Created
April 10, 2017 15:36
-
-
Save vshmoylov/ccbcefe236bfd7dad973c39e8f2c4e5f to your computer and use it in GitHub Desktop.
Replaces EveryTimeZone predefined timezones with custom ones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name EveryTimeZone Enhancer | |
// @version 0.1-alpha-poc | |
// @description Replaces EveryTimeZone predefined timezones with custom ones | |
// @author Victor Shmoylov | |
// @match http://everytimezone.com/* | |
// @grant none | |
// @run-at document-start | |
// @require https://code.jquery.com/jquery-3.1.0.min.js | |
// @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js | |
// ==/UserScript== | |
var changed = 0; // script need to be edited with | |
window.addEventListener('beforescriptexecute', function(e) { | |
///for external script: | |
src = e.target.src; | |
console.log(src.search(/data\.js/)); | |
if (src.search(/data\.js/) != -1) { | |
changed++; | |
e.preventDefault(); | |
e.stopPropagation(); | |
var parent = e.target.parentNode; | |
parent.appendChild(document.createElement('script')) | |
.innerHTML = NewScript1; | |
console.log("replacing"); | |
} | |
///when done, remove the listener: | |
if(changed == 2) window.removeEventListener(e.type, arguments.callee, true); | |
}, true); | |
//////////////////////////////////////////////// | |
var NewScript1='var data = [[-4.0,"Boston","EDT UTC-4",true],[0.0,"UTC","",true],[2.0,"Gdańsk","CEST UTC+2",true],[6.0,"Bishkek","UTC+6.0",true],[7.0,"Tomsk","+07 UTC+7",true]];'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment