NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name homestuck color button // @description change background color in pesterlog // @include http://www.mspaintadventures* // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // ==/UserScript== var flag = GM_getValue('fflag', false); var zNode = document.createElement ('div'); zNode.innerHTML = '<img \ src="http://vignette1.wikia.nocookie.net/mspaintadventures/images/2/22/Homestuck_Act_1.gif/revision/latest/scale-to-width-down/32"\ alt="Color" id="myButton">'; zNode.setAttribute ('id', 'myContainer'); document.body.appendChild (zNode); document.getElementById ("myButton").addEventListener ("click", ChangeColor, false); SetColor(); function SetColor() { flag ? SetDark() : SetBright(); } function ChangeColor(zEvent) { flag ? SetBright() : SetDark(); flag = !flag; GM_setValue('fflag', flag); } function SetBright() { GM_addStyle (multilineStr ( function () {/*! .spoiler { background-color: whitesmoke; }*/})); } function SetDark() { GM_addStyle (multilineStr ( function () {/*! .spoiler { background-color: #101010; }*/})); } GM_addStyle ( multilineStr ( function () {/*! #myContainer { position: fixed; right: 0; bottom: 0; } */} ) ); function multilineStr (dummyFunc) { var str = dummyFunc.toString (); str = str.replace (/^[^\/]+\/\*!?/, '') .replace (/\s*\*\/\s*\}\s*$/, '') .replace (/\/\/.+$/gm, '') ; return str; }