Mydealz Script

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

Versione datata 11/03/2016. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
}

})();