Greasy Fork is available in English.

Discussies » Scriptaanvragen

Change Facebook Notification Sound - (Convert Chrome extension to userscript)

q1k
§
Geplaatst: 19-10-2015
Bijgewerkt: 20-10-2015

Change Facebook Notification Sound - (Convert Chrome extension to userscript)

So there is this Chrome extension. And of course it won't work on Firefox, or any other browser for that matter.

What I'm asking here is someone to make it into a userscript that will play a sound from a location on our PC or from a web-url. For Example

§
Geplaatst: 25-10-2015

I've looked through and rewritten it without jQuery so it's faster. But I'm still dissatisfied with setInterval 1000 (checking each second) so I changed it to 5 seconds.

You can change parts you wish on your PC it's quite easy code... https://greasyfork.org/uk/scripts/13346-change-facebook-notification-sound/code

§
Geplaatst: 25-10-2015

I don't see a need in interface there are two possible variables in line 18 and 19, url and interval.

§
Geplaatst: 25-10-2015

Don't use interval lower than 2 your browser could lag with it.

q1k
§
Geplaatst: 25-10-2015
Bijgewerkt: 25-10-2015

Thanks,
but is there any way to add a button in the chat settings menu, which then opens a popup and lets us choose a sound, be it URL or local location on disk. Also a reset feature would be nice too.

And I have lowered the interval to one second, 5 seconds is just too much..

§
Geplaatst: 25-10-2015

As I said, it would be easier to change url in line 18, edit script and you'll see. It's just copy/paste.

§
Geplaatst: 25-10-2015

If you'll have problems with changing it, I'll make interface especially for you.

q1k
§
Geplaatst: 25-10-2015
Bijgewerkt: 25-10-2015

Well for some reason if I change anything it doesn't work.

So I was thinking of, adding a button in the fb chat settings that would open an interface to choose file be it from url or locally.
Something like this:


And maybe also add an option to change the interval too?

§
Geplaatst: 25-10-2015
Bijgewerkt: 25-10-2015

I've added interface but it's without local option. I'm sorry but GM_config (that I used) does not have 'file' type field. And it would take more time to write it down.

If you wish you could make another request about local option, but I can't help you there...

You can find settings window in Greasemonkey's "User Script Commands" http://wiki.greasespot.net/GreasemonkeyManual:MonkeyMenu

q1k
§
Geplaatst: 26-10-2015

ok.

But where is the button to open the UI?
I can't find it..

wOxxOmMod
§
Geplaatst: 26-10-2015

You can probably just store base64-encoded file contents (atob() and btoa()) with GMsetValue/GMgetValue. However there's a possibility of hitting some userscript data size limit.

q1k
§
Geplaatst: 26-10-2015

And another problem is when we click on the chat window that has a new message, it plays the sound again, as if another message was received. And I've also checked the chrome extension and this doesn't happen there.

§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

http://take.ms/CHypE Here is a small screencast, also I'll check about chat window problem.

§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

I've added screenshots to a userscript page

q1k
§
Geplaatst: 26-10-2015

Alright, looking forward to your update.

§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

I showed current version.

§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

I pushed version update, also here is another message sound I used https://instaud.io/_/dEa.mp3

No double sounds and I've cleaned intervals now.

q1k
§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

Just noticed there is still double sound, when reloading/opening a page.

§
Geplaatst: 26-10-2015
Bijgewerkt: 26-10-2015

Ok I'll check it on Seamonkey, also I cold have fixed one thing abd broken another, this stuff often needs debugging sorry about that I was just writing down small script ))), also could you check maybe you have two versions of script in script list? (if yes telodar thee older one)

q1k
§
Geplaatst: 27-10-2015

1000% sure I have only 1 version of it installed.

q1k
§
Geplaatst: 31-10-2015

Also another problem is that when we have more then 1 tab open we can hear the sound multiple times, once from each tab.

§
Geplaatst: 31-10-2015

Khm, ok I'll look into it, *(about multiple sound in multiple tabs, I haven't checked it)

§
Geplaatst: 31-10-2015

I'm not sure I've fixed everything, please check new version on multiple windows...

q1k
§
Geplaatst: 31-10-2015
Bijgewerkt: 31-10-2015

Now when we click on the chat windows in the newly opened tab the sound plays again (even multiple times..).

Also if the message has been received a while ago and later when we click on the window with new message(s) the sound plays again. This might be causing the other thing to happen.

And if a message was received while offline, once we open fb the sound plays, even though the message might have been sent hours ago, maybe days.

§
Geplaatst: 31-10-2015

Now sound would only be played on increase in messages ) (I've changed a lot of code and now I hope it would work good cross tabs) I'm also not sure if it would play multiple times, please check now...

§
Geplaatst: 01-11-2015

I'm not using facebook much so I'm bad at testing it. Also I think it's almost done, I'm sorry it took so long to fix it...

q1k
§
Geplaatst: 01-11-2015
Bijgewerkt: 02-11-2015

WTF. Now it keeps playing the sound over and over as many times as there are tabs open.


EDIT:
The previous version (0.2.2) seems to be better in that regard,
but one small problem there too.
If a facebook tab is in focus (the one that we are curently looking at), the sound doesn't play.
I enabled fb chat sounds, and the original sound does play.


EDIT 2:
v0.2.2 - On the first message received sound doesn't play, but after that the sound does play.
Not a big deal, but I wanted to point it out.

§
Geplaatst: 03-11-2015

Oh, so I've broken it once more, ok, I'll make it work but on this weekend, the first message I'll fix it... )

§
Geplaatst: 09-11-2015

Please try v0.2.4 it might not fix initial sound but I recovered it to version 0.2.2 and added changes I hipe might fix it on initial launch. I can't replicate them though. In the end you can use my skype dirrectly and test it with me online. *(skype login: dexmaster)

q1k
§
Geplaatst: 09-11-2015
Bijgewerkt: 09-11-2015

OK, will test it now
Seems to be working fine, but the initial sound still doesn't play

q1k
§
Geplaatst: 29-04-2016
Bijgewerkt: 29-04-2016

Ok, I have just one more requirement.

Is it possible that when I disable the sound through the greesemonkey script commands, to disble the sounds instantly without the need to reload the page.?

Because what's the point of the enable/disable option if I have to reload the page...
I could just as easily just disable the whole script and reload the page (heck, it's even faster).

But the point is to not have to reload the page at all.


And another thing, is it possible to get the initial sound to play? (it still doesn't work)

Reactie plaatsen

Log in om antwoord te geven.