Created
October 12, 2018 14:44
-
-
Save fisknils/692f2536f2715d7635d4d13c50002e51 to your computer and use it in GitHub Desktop.
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 [DEBUG MODE] | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Library for calling a callback if debug cookie has been set | |
// @author You | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
(function( fn , args ) { | |
'use strict'; | |
let if_debug_mode; | |
const func_observer = (function(mutations){ | |
console.log(mutations); | |
}); | |
if_debug_mode = (function( fn, args = [] ){ | |
let pat = new RegExp('[^\w]debug=true[$|;]'); | |
if(pat.test(document.cookie)) | |
{ | |
try { | |
callback.apply( null , args ) | |
} catch(e){console.error(e);} | |
} | |
})(); | |
})( fn , args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment