Skip to content

Instantly share code, notes, and snippets.

@fisknils
Created October 12, 2018 14:44
Show Gist options
  • Save fisknils/692f2536f2715d7635d4d13c50002e51 to your computer and use it in GitHub Desktop.
Save fisknils/692f2536f2715d7635d4d13c50002e51 to your computer and use it in GitHub Desktop.
// ==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