From 9ae86d18a0cf1b8e25a46de8ede280ce9d0453d9 Mon Sep 17 00:00:00 2001 From: James Shiffer Date: Sat, 27 Jun 2020 00:22:35 -0700 Subject: [PATCH] attempt to make click sound IE-compatible --- default_text.htm | 2 + index.html | 341 +++++++++++++++++++++++++++++++++++++++++++++++ js/click.js | 44 ++++-- 3 files changed, 374 insertions(+), 13 deletions(-) create mode 100644 default_text.htm create mode 100644 index.html diff --git a/default_text.htm b/default_text.htm new file mode 100644 index 0000000..e915e56 --- /dev/null +++ b/default_text.htm @@ -0,0 +1,2 @@ + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..8c2d819 --- /dev/null +++ b/index.html @@ -0,0 +1,341 @@ + + + Welcome to Microsoft's Homepage + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Microsoft Home + + +   +   + All Products  +   + | +   +   + Support  +   + | +   +   + Search  +   + | +   +   + microsoft.com Home  +   + +
+ +   +   + Home  +   + | +   +   + Events/Training  +   + | +   +   + Subscribe  +   + | +   +   + About Microsoft  +   + | +   +   + US/Worldwide  +   + | +   +   + Downloads  +   + | +   +   + Contact Us  +   + | +   +   + MSN.com  +   + | +
+
+ + + + + + + + + +
+ +
+ Search
+ + +   +
+
+ + Product Family Sites
+ + Windows
+ + Office
+ + Servers
+ + Developer Tools
+
+ Web Services
+ + Office eServices
+ + Windows Update
+ + MSN
+ + bCentral
+
+ Customer Sites
+ + Home & Personal
+ + Business
+ + IT Professional
+ + Developer
+ + Partner/Reseller
+ + Education
+
+ Resources
+ + Order Microsoft Products
+ + Microsoft Press Books
+ + Media Information
+ + Newsletters
+ + Microsoft Jobs
+ + Privacy Statement
+ + Freedom to Innovate
+ + Support
+
+
+
+ + + +
+ + +
+ Celebrate Clippy's demise at an Office XP launch event
+ + +
+
+
+
+
+ + + + + + +
+ + Today's News + +
+
+ + + + + + + + + + + + + + + + + + + + +
  + Pre-order Office XP
+ for launch day and get free shipping. U.S. only. +
+
  + Be among the first
+ to get Microsoft Visual Studio.NET Beta 2 by attending Tech·Ed. +
+
  + Windows XP at home:
+ See how you'll get a lot more from your PC. +
+
  +
+ More News +
+
+
+
+
+
+ + + + + + +
+ + New Downloads + +
+
+ + + + + + + + + + + + + + + +
  + Internet Explorer 6 Preview Edition
+ offers new integrated messaging and privacy features. +
+
  + Windows 2000 SP1
+ has the latest in compatibility, setup, reliability, and security updates. +
+
  +
+ More Downloads +
+
+
+
+
+

+ +  Last Updated: Monday, April 30, 2001 - 4:42 p.m. Pacific Time
+  ©2001 Microsoft Corporation. All rights reserved. Terms of Use
+   + Text-only Home Page + | + Disability/accessibility + | + Contact Us + | + Privacy Statement
+
+ +
+
+ + + + + + + + + + + + + + diff --git a/js/click.js b/js/click.js index 904685a..0cb3ef1 100644 --- a/js/click.js +++ b/js/click.js @@ -1,13 +1,31 @@ -var links = document.querySelectorAll("a"); -links.forEach(function (link) { - link.addEventListener("click", function () { - var audio = document.createElement("audio"); - audio.style.display = "none"; - audio.src = "assets/click.wav"; - audio.autoplay = true; - audio.onended = function() { - audio.remove(); - }; - document.body.appendChild(audio); - }); -}); +function playAudio(e) { + if (e.preventDefault) { + e.preventDefault(); + } + var audio = document.createElement("audio"); + audio.style.display = "none"; + audio.src = "assets/click.wav"; + audio.autoplay = true; + audio.onended = function () { + audio.remove(); + if (e.target) { + window.location.href = e.target.href; + } + }; + document.body.appendChild(audio); +} + +function on(el, event, cb) { + if (el.addEventListener) { + el.addEventListener(event, cb, true); + } else if (el.attachEvent) { + el.attachEvent("on" + event, cb); + } else { + el["on" + event] = cb; + } +} + +for (var i = 0; i < document.links.length; i++) { + var link = document.links[i]; + on(link, "click", playAudio); +}