how to make a sound notification, trigured by a certain URL

in Ideas and script requests
Subscribe to how to make a sound notification, trigured by a certain URL 9 posts, 3 voices



AMAZINGN00B User
FirefoxWindows

hi, im not very user-script-smart.

i was wondering if anyone knows where i can find a script that plays a sound (windows logon ect...) when another script takes me to a certain URL.

eg, when i voyage to "www.google.com" a sound will play.

thanks

(please note, i am a massive N00B when it somes to scripts lol.
please explain any script jargon like you are talking to a grandma lol)

 
AMAZINGN00B User
FirefoxWindows

anyone?

 
znerp Scriptwright
FirefoxWindows

Try searching the forums. Similar requests have been made and solved before.

 
ekbworldwide Scriptwright
FirefoxWindows

Here:

document.body.innerHTML += '<div style="display:none;"><audio src="http://www.skierpage.com/moz_bugs/Albanian_numbers.ogg" controls="true" autoplay></audio></div>';

______________________________________________
Important - I usually do things in a stupid way. This works - but if people say "There's a better way to..." - do it their way.

______________________________________________
Google or check w3schools.com - or similar site for whatever you want to learn about: inline css, visilibity, etc.

example

CSS visibility property
http://www.w3schools.com/CSS/pr_class_visibilit...
______________________________________________

A div is created. Inline css is used to hide it. If you remove style="display:none;" and look at the bottom of the page you can see the player.

The audio tag goes into the div. Autoplay is set to true.

The += sticks the div stuff at the end of the body innerHTML. It's the sme as:

document.body.innerHTML = document.body.innerHTML + '<div style="display:none;"><audio src="http://www.skierpage.com/moz_bugs/Albanian_numbers.ogg" controls="true" autoplay></audio></div>';

The audio is a guy counting in Albanian. I didn't feel like looking around for something better. I assume that only .ogg files can be used.

I assume there's some way to set the volume. Maybe as simple as volume="40".

 
znerp Scriptwright
FirefoxWindows
ekbworldwide wrote:
Here:
document.body.innerHTML += '<div style="display:none;"><audio src="http://www.skierpage.com/moz_bugs/Albanian_numbers.ogg" controls="true" autoplay></audio></div>';

Well it would be much better to create the div and then append it to the body. Your way would break any eventlisteners, etc.

newDiv = document.createElement("div");
newDiv.innerHTML = "<audio src=\"http://www.skierpage.com/moz_bugs/Albanian_numbers.ogg\" controls=\"true\" autoplay></audio>";
newDiv.style.display = "none";
document.body.appendChild(newDiv);
 
AMAZINGN00B User
FirefoxWindows

im quite confused, i dont mean to duplicate posts either however i cannot literally make sense of anything anyone makes.
i apreciate your help guys, but without step by step explanations, i cant make any sense out of what youve made.

 
ekbworldwide Scriptwright
FirefoxWindows

______________________________
@znerp
Thanks. Boy, I've got some bad habits.

______________________________
@AMAZINGN00B

>> without step by step explanations

I could give you even more detailed step by step instructsions on my code, but there's a problem. My code is flawed. What znerp posted is far better, but much harder to explain.

Your first step is go to google and use sites like like w3schools.com

Go to such a site and go through - page by page - their html tutorial. And their css tutorial. And their javascript tutorial.

Most code isn't going to be one line. Or four.

There's an alternative...

You could post a thread with a different theme. "Could somebody make a script that ..."

znerp's code does what you want. You don't have to understand it to use it.

 
znerp Scriptwright
SafariMacintosh

@AMAZINGN00B: To create your script, look at this Dive into Greasemonkey page.

 
AMAZINGN00B User
FirefoxWindows

Thanks everyone for trying to help.
seriously, none of the tutorials help me do anything.
whether they, or me, suck i dont know.
however i asked somewhere else and found what i was looking for

document.title = "Google ";
document.location = 'http://www.skierpage.com/moz_bugs/Albanian_numb...;

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel