Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Der Leistungsschutzrecht-Warner
- // @namespace LeistungsschutzrechtWarner
- // @description Warnt auf Seiten mit einem roten Balken, falls diese das Leistungsschutzrecht unterstützt. Nutzt die Blacklist von http://leistungsschutzrecht-stoppen.d-64.org/.
- // @include *
- // @version 1
- // @grant GM_xmlhttpRequest
- // @grant GM_getValue
- // @grant GM_setValue
- // ==/UserScript==
- /* Frage das Datum der letzten Aktualisierung ab */
- var LastRefresh = GM_getValue("LastRefresh");
- if(LastRefresh == undefined) {
- LastRefresh = 0;
- }
- /* Frage das heutige Datum ab */
- var HeuteRaw = new Date();
- var Heute = (HeuteRaw.getFullYear() * 10000) + ((HeuteRaw.getMonth() + 1) * 100) + (HeuteRaw.getDate());
- /* Falls noch nicht heute abgerufen, rufe Blacklist ab */
- if(LastRefresh != Heute) {
- GM_xmlhttpRequest({
- method: "GET",
- url: "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt",
- onload: function(response) {
- GM_setValue("Blacklist", response.responseText);
- }
- });
- GM_setValue("LastRefresh", Heute);
- }
- /* Rufe gespeicherte Blacklist ab */
- var Blacklist = GM_getValue("Blacklist");
- if(Blacklist == undefined) {
- Blacklist = "";
- }
- /* Wandle Blacklist in Array um */
- var BlacklistA = Blacklist.split(",");
- /* Stelle fest, ob Seite in Blacklist ist */
- var IsInBlacklist = false;
- for each(BlacklistE in BlacklistA) {
- if(window.location.host.indexOf(BlacklistE) > -1) {
- IsInBlacklist = true;
- }
- }
- /* Falls Seite in Blacklist */
- if(IsInBlacklist) {
- /* Füge (LSR) dem Titel hinzu */
- document.title = "(LSR) " + document.title;
- var WarnElement = document.createElement("div");
- WarnElement.innerHTML = "Leistungsschutzrechtsunterstützer";
- WarnElement.style.position = "fixed";
- WarnElement.style.top = "0px";
- WarnElement.style.left = "0px";
- WarnElement.style.zIndex = "999999";
- WarnElement.style.fontFamily = "\"Trebuchet MS\", sans-serif";
- WarnElement.style.fontSize = "7pt";
- WarnElement.style.color = "black";
- WarnElement.style.backgroundColor = "red";
- WarnElement.style.opacity = "0.8";
- WarnElement.style.padding = "2px";
- document.getElementsByTagName("body")[0].appendChild(WarnElement);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement