Mydealz Script

Versteckt abgelaufene Dealz, verbreitert die Seitenansicht, entfernt den Newsletterhinweis und entfernt einige Referrerlinks

Verze ze dne 11. 03. 2016. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Mydealz Script
// @description Versteckt abgelaufene Dealz, verbreitert die Seitenansicht, entfernt den Newsletterhinweis und entfernt einige Referrerlinks
// @namespace   cuzi
// @oujs:author cuzi
// @version     1
// @license     GNUGPL
// @include     /^https?:\/\/www\.mydealz\.de\/.*/
// @exclude     /^https?:\/\/www\.mydealz\.de\/profile\/.*/
// @exclude     /^https?:\/\/www\.mydealz\.de\/search.*/
// @grant       none
// ==/UserScript==

function reviveDeal() {
  this.removeEventListener('click',reviveDeal);
  this.style.maxHeight = "";
  this.style.opacity = 1.0;
}

function restoreLinks() {
  var a = document.querySelectorAll("a[target]");
  var pattern0 = /^http:\/\/www\.mydealz\.de\/visit\?.*&d=(.+)/;
  var pattern1 = /&redir=(http.+)"/;
  var pattern2 = /"label":"(http.+)"/;

  for(let i = 0; i < a.length; i++) {
    if(pattern0.test(a[i].href)) {
      a[i].href = decodeURIComponent(pattern0.exec(a[i].href)[1]);
    } else if("track" in a[i].dataset && pattern1.test(a[i].dataset.track)) {
      a[i].href = decodeURIComponent(pattern1.exec(a[i].dataset.track)[1]);    
    } else if("track" in a[i].dataset && pattern2.test(a[i].dataset.track)) {
      a[i].href = decodeURIComponent(pattern2.exec(a[i].dataset.track)[1]);    
    } 
  }
}

(function main() {

// Widen page content
document.querySelector('.page-canvas>.page-content').style.maxWidth = '120em';

// Restore links
restoreLinks();

// Remove newsletter info
try {
  var n = document.querySelector('li.inline-newsletter');
  n.parentNode.removeChild(n); 
} catch(e) {}

// Put expired dealz to sleep
var lis = document.querySelectorAll('.thread--expired .thread-title'); 
for(let i = 0; i < lis.length; i++) {
  var li = lis[i].parentNode.parentNode.parentNode.parentNode;
  var s = li.style;
  s.maxHeight = '10em';   
  s.overflow = 'auto';
  s.opacity = 0.5;
  li.addEventListener('click',reviveDeal);
}

})();