Facebook
From Bistre Meerkat, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 128
  1. // ==UserScript==
  2. // @name         Maddonz - Test 4.6
  3. // @version      4.6
  4. // @description  Zbiór dodatków do Margonem
  5. // @author       Barlag
  6. // @match        http*://*.margonem.pl/
  7. // @match        http*://*.margonem.com/
  8. // @exclude      http*://margonem.*/*
  9. // @exclude      http*://www.margonem.*/*
  10. // @exclude      http*://new.margonem.*/*
  11. // @exclude      http*://forum.margonem.*/*
  12. // @exclude      http*://commons.margonem.*/*
  13. // @exclude      http*://dev-commons.margonem.*/*
  14. // @grant        GM_setValue
  15. // @grant        GM_getValue
  16. // @grant        GM_xmlhttpRequest
  17. // @connect      margonem.pl
  18. // @connect      margonem.com
  19. // @run-at       document-body
  20. // ==/UserScript==
  21.  
  22. (function() {
  23.     const GLOBAL = true;
  24.  
  25.     const style = document.createElement('link');
  26.     style.rel = 'stylesheet';
  27.     style.type = 'text/css';
  28.  
  29.     const script = document.createElement('script');
  30.     script.type = 'module';
  31.  
  32.     const maddonz = {};
  33.     document.maddonz = maddonz;
  34.  
  35.     if (GLOBAL && typeof GM_setValue !== 'undefined') {
  36.         maddonz.GM_getValue = GM_getValue;
  37.         maddonz.GM_setValue = GM_setValue;
  38.     } else {
  39.         maddonz.GM_getValue = function(key) {
  40.             return JSON.parse(localStorage.getItem(key));
  41.         };
  42.         maddonz.GM_setValue = function(key, value) {
  43.             localStorage.setItem(key, JSON.stringify(value));
  44.         };
  45.     }
  46.  
  47.     maddonz.GM_xmlhttpRequest = GM_xmlhttpRequest;
  48.     maddonz.GM_info = GM_info;
  49.  
  50.     let cacheToken = maddonz.GM_getValue('mz_cache_token');
  51.     if (!cacheToken) {
  52.         cacheToken = Math.random()
  53.             .toString(36)
  54.             .substring(2);
  55.         maddonz.GM_setValue('mz_cache_token', cacheToken);
  56.     }
  57.  
  58.     function getResourceUrl(resource) {
  59.         return `https://test.barlag.pl/${resource}?c=${cacheToken}`;
  60.     }
  61.  
  62.     script.src = getResourceUrl('maddonz.js');
  63.     document.head.appendChild(script);
  64.     style.href = getResourceUrl('maddonz.css');
  65.     document.head.appendChild(style);
  66. })();
  67.