Skip to content

Instantly share code, notes, and snippets.

@GTHBNLK
Last active July 22, 2019 12:51
Show Gist options
  • Select an option

  • Save GTHBNLK/62c21ffde45f202782766fb7eb39ff1a to your computer and use it in GitHub Desktop.

Select an option

Save GTHBNLK/62c21ffde45f202782766fb7eb39ff1a to your computer and use it in GitHub Desktop.
Actions: Notify Page Load
// ==UserScript==
// @name Actions: Notify Page Load
// @description Notify when a page is loaded
// @version 0.1.7
// @author GHNalk2016
// @include *
// @updateURL https://gist.githubusercontent.com/GHNalk2016/62c21ffde45f202782766fb7eb39ff1a/raw/actions-notify-page-load.meta.js
// @downloadURL https://gist.githubusercontent.com/GHNalk2016/62c21ffde45f202782766fb7eb39ff1a/raw/actions-notify-page-load.user.js
// @grant none
// @noframes
// ==/UserScript==
// ==UserScript==
// @name Actions: Notify Page Load
// @description Notify when a page is loaded
// @version 0.1.7
// @author GHNalk2016
// @include *
// @updateURL https://gist.githubusercontent.com/GHNalk2016/62c21ffde45f202782766fb7eb39ff1a/raw/actions-notify-page-load.meta.js
// @downloadURL https://gist.githubusercontent.com/GHNalk2016/62c21ffde45f202782766fb7eb39ff1a/raw/actions-notify-page-load.user.js
// @grant none
// @noframes
// ==/UserScript==
// Links: https://stackoverflow.com/questions/27862073/how-can-i-play-a-sound-within-a-greasemonkey-script/27862190#27862190
//window.addEventListener("load", function(e) { scroll(0, document.body.scrollHeight); }, false);
//window.removeEventListener("load", function(e) { scroll(0, document.body.scrollHeight); }, false);
//scroll(0, document.body.scrollHeight);
unsafeWindow.console.clear();
unsafeWindow.console.time('ScriptRun');
unsafeWindow.console.log("Script start." );
unsafeWindow.console.timeEnd('ScriptRun');
function loadSound(event) {
var player1 = document.createElement('audio');
var player2 = document.createElement('audio');
if (window.top != window.self) {
//frames or iframes
//player1.src = 'http://stephane.brechet.free.fr/Sons/MP3/COINDRP1.mp3';
player1.src = 'https://www.soundjay.com/mechanical/camera-shutter-click-02.mp3';
player2.src = 'https://www.soundjay.com/misc/sounds/briefcase-lock-10.mp3';
} else {
//player1.src = 'https://www.soundjay.com/misc/coins-to-table-2.mp3';
player1.src = 'https://www.soundjay.com/misc/spinning-coin-3.mp3';
player2.src = 'https://www.soundjay.com/misc/sounds/briefcase-lock-5.mp3';
//player2.src = 'https://www.soundjay.com/misc/sounds/briefcase-lock-10.mp3';
//player2.src = 'https://www.soundjay.com/misc/handbag-lock-5.mp3';
//player2.src = 'https://www.soundjay.com/misc/handbag-lock-6.mp3';
//player2.src = 'https://www.soundjay.com/mechanical/camera-shutter-click-02.mp3';
//player2.src = 'https://www.soundjay.com/misc/magic-chime-01.mp3';
}
player1.preload = 'auto';
player2.preload = 'auto';
player1.volume = 0.35;
player2.volume = 0.65;
player1.play();
// code before the pause
setTimeout(function() {
player2.play();
}, 2000);
}
window.addEventListener("load", loadSound, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment