Advertisement
Guest User

Der Leistungsschutzrecht-Warner

a guest
Mar 1st, 2013
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Der Leistungsschutzrecht-Warner
  3. // @namespace   LeistungsschutzrechtWarner
  4. // @description Warnt auf Seiten mit einem roten Balken, falls diese das Leistungsschutzrecht unterstützt. Nutzt die Blacklist von http://leistungsschutzrecht-stoppen.d-64.org/.
  5. // @include     *
  6. // @version     1
  7. // @grant       GM_xmlhttpRequest
  8. // @grant       GM_getValue
  9. // @grant       GM_setValue
  10. // ==/UserScript==
  11.  
  12. /* Frage das Datum der letzten Aktualisierung ab */
  13. var LastRefresh = GM_getValue("LastRefresh");
  14. if(LastRefresh == undefined) {
  15.   LastRefresh = 0;
  16. }
  17.  
  18. /* Frage das heutige Datum ab */
  19. var HeuteRaw = new Date();
  20. var Heute = (HeuteRaw.getFullYear() * 10000) + ((HeuteRaw.getMonth() + 1) * 100) + (HeuteRaw.getDate());
  21.  
  22. /* Falls noch nicht heute abgerufen, rufe Blacklist ab */
  23. if(LastRefresh != Heute) {
  24.   GM_xmlhttpRequest({
  25.     method: "GET",
  26.     url: "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt",
  27.     onload: function(response) {
  28.       GM_setValue("Blacklist", response.responseText);
  29.     }
  30.   });
  31.   GM_setValue("LastRefresh", Heute);
  32. }
  33.  
  34. /* Rufe gespeicherte Blacklist ab */
  35. var Blacklist = GM_getValue("Blacklist");
  36. if(Blacklist == undefined) {
  37.   Blacklist = "";
  38. }
  39.  
  40. /* Wandle Blacklist in Array um */
  41. var BlacklistA = Blacklist.split(",");
  42.  
  43. /* Stelle fest, ob Seite in Blacklist ist */
  44. var IsInBlacklist = false;
  45. for each(BlacklistE in BlacklistA) {
  46.   if(window.location.host.indexOf(BlacklistE) > -1) {
  47.     IsInBlacklist = true;
  48.   }
  49. }
  50.  
  51. /* Falls Seite in Blacklist */
  52. if(IsInBlacklist) {
  53.   /* Füge (LSR) dem Titel hinzu */
  54.   document.title = "(LSR) " + document.title;
  55.   var WarnElement = document.createElement("div");
  56.   WarnElement.innerHTML = "Leistungsschutzrechtsunterstützer";
  57.   WarnElement.style.position = "fixed";
  58.   WarnElement.style.top = "0px";
  59.   WarnElement.style.left = "0px";
  60.   WarnElement.style.zIndex = "999999";
  61.   WarnElement.style.fontFamily = "\"Trebuchet MS\", sans-serif";
  62.   WarnElement.style.fontSize = "7pt";
  63.   WarnElement.style.color = "black";
  64.   WarnElement.style.backgroundColor = "red";
  65.   WarnElement.style.opacity = "0.8";
  66.   WarnElement.style.padding = "2px";
  67.   document.getElementsByTagName("body")[0].appendChild(WarnElement);
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement