Created
June 13, 2014 06:00
-
-
Save riverspirit/fd0efae9ac732f8ddd1a to your computer and use it in GitHub Desktop.
Load javascript file dynamically and call a function from it
This file contains hidden or 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
(function (d, f, a) { | |
// Your settings here | |
var o = { | |
maxLinks: 4, | |
searchElements: ['div', 'h'], | |
linkClass: 'link-to-mdn', | |
extraLinks: { | |
'keywordx': 'http://example.com' | |
} | |
}; | |
var s = d.createElement("script"); | |
s.type = "text/javascript"; | |
if (s.f) { | |
s.a = function () { | |
if (s.f == "loaded" || s.f == "complete") { | |
s.a = null; | |
PromoteMDN(o) | |
} | |
} | |
} else { | |
s.onload = function () { | |
PromoteMDN(o) | |
} | |
} | |
s.src = "promote-mdn.js"; | |
d.getElementsByTagName("head")[0].appendChild(s) | |
})(document, 'readyState', 'onreadystatechange'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment