Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get(selector, ctx) {
- return (ctx || document).querySelectorAll(selector);
- }
- var getScriptNode = function () {
- var re = /http:\/\/js.smi2.ru\/data\/js\/(\d+)\.js\b/;
- var scripts = get('script', document.body);
- var cmp, id = null, script = [].filter.call(scripts, function (el) {
- if (id !== null) {
- return false;
- }
- cmp = el.src.match(re);
- if (cmp) {
- id = cmp[1];
- return true;
- }
- })[0];
- return script;
- };
- unsafeWindow.document.addEventListener('load', function() { unsafeWindow.alert('123'); }, false);
- unsafeWindow.document.addEventListener('DOMContentLoaded',
- function() {
- // console.log('UserScript', getScriptNode());
- unsafeWindow.alert('UserScript');
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment