Mydealz Script

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Mydealz Script
// @description Versteckt abgelaufene Dealz, verbreitert die Seitenansicht, entfernt den Newsletterhinweis und entfernt einige Referrerlinks
// @namespace   cuzi
// @oujs:author cuzi
// @version     6
// @license     GPL-3.0
// @include     /^https?:\/\/www\.mydealz\.de\/.*/
// @grant       none
// ==/UserScript==


if(document.querySelector('.page-canvas>.page-content'))  {



// Old page




(function main() {
'use strict';


function decodeHtml(html) {
  var txt = document.createElement("textarea");
  txt.innerHTML = html;
  txt.innerHTML = txt.value;
  txt.innerHTML = txt.value;
  txt.innerHTML = txt.value;
  return txt.value;
}

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

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

function restoreLinks() {

  var patterns = [
    {
      pattern: /^http:\/\/www\.mydealz\.de\/visit\?.*&d=(.+)/,
      test: (a, pattern) => pattern.test(a.href), 
      decode: (a, pattern) => decodeHtml(decodeURIComponent(pattern.exec(a.href)[1])) 
    },
    {
      pattern: /&amp;redir=(http.+)"/,
      test: (a, pattern) => "track" in a.dataset && pattern.test(a.dataset.track), 
      decode: (a, pattern) => decodeHtml(decodeURIComponent(pattern.exec(a.dataset.track)[1])) 
    },
    {
      pattern: /"label":"(http.+)"/,
      test: (a, pattern) => "track" in a.dataset && pattern.test(a.dataset.track), 
      decode: (a, pattern) => decodeHtml(JSON.parse(a.dataset.track).label)
    }
  ];
  
  var a = document.querySelectorAll("a[target]");
  for(let i = 0; i < a.length; i++) {
    for(let j = 0, o = patterns[0]; j < patterns.length; o = patterns[++j]) {
      if(o.test(a[i], o.pattern)) {
        a[i].href = o.decode(a[i], o.pattern);
      }
    }
  }
}


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

// Restore links
restoreLinks();

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

// Semi-hide expired dealz
var exclude = [
  /^https?:\/\/www\.mydealz\.de\/(deals)|(freebies)|(gutscheine)\/.+-\d+/, 
  /^https?:\/\/www\.mydealz\.de\/profile\/.*/, 
  /^https?:\/\/www\.mydealz\.de\/search.*/];
if(!exclude.some((pattern) => document.location.href.match(pattern))) {
  putDealzToSleep();
}

// Change search form to https
var form = document.querySelectorAll("form.search");
for(let i = 0; i < form.length; i++) {
  form[i].setAttribute("action", form[i].getAttribute("action").replace(/^http:/,"https:"));
}

})();










} else {
  
  
  
   // New page
  
  
  

   
   (function main() {
'use strict';


function decodeHtml(html) {
  var txt = document.createElement("textarea");
  txt.innerHTML = html;
  txt.innerHTML = txt.value;
  txt.innerHTML = txt.value;
  txt.innerHTML = txt.value;
  return txt.value;
}

function putDealzToSleep() {
  var lis = document.querySelectorAll('.ico--type-clock-grey'); 
  for(let i = 0; i < lis.length; i++) {
    let li = lis[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
    let s = li.style;
    s.maxHeight = '10em';   
    s.overflow = 'auto';
    s.opacity = 0.5;
    li.addEventListener('click',reviveDeal);
  }
}

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

function restoreLinks() {

  var patterns = [
    {
      pattern: /^http:\/\/www\.mydealz\.de\/visit\?.*&d=(.+)/,
      test: (a, pattern) => pattern.test(a.href), 
      decode: (a, pattern) => decodeHtml(decodeURIComponent(pattern.exec(a.href)[1])) 
    },
    {
      pattern: /&amp;redir=(http.+)"/,
      test: (a, pattern) => "track" in a.dataset && pattern.test(a.dataset.track), 
      decode: (a, pattern) => decodeHtml(decodeURIComponent(pattern.exec(a.dataset.track)[1])) 
    },
    {
      pattern: /"label":"(http.+)"/,
      test: (a, pattern) => "track" in a.dataset && pattern.test(a.dataset.track), 
      decode: (a, pattern) => decodeHtml(JSON.parse(a.dataset.track).label)
    }
  ];
  
  var a = document.querySelectorAll("a[target]");
  for(let i = 0; i < a.length; i++) {
    for(let j = 0, o = patterns[0]; j < patterns.length; o = patterns[++j]) {
      if(o.test(a[i], o.pattern)) {
        a[i].href = o.decode(a[i], o.pattern);
      }
    }
  }
}


// Restore links
restoreLinks();

// Remove newsletter info
try {
  let n = document.querySelector('.vwo-newsletterWidget-close1');
  n.parentNode.removeChild(n); 
} catch(e) {}

// Semi-hide expired dealz
var exclude = [
  /^https?:\/\/www\.mydealz\.de\/(deals)|(freebies)|(gutscheine)\/.+-\d+/, 
  /^https?:\/\/www\.mydealz\.de\/profile\/.*/, 
  /^https?:\/\/www\.mydealz\.de\/search.*/];
if(!exclude.some((pattern) => document.location.href.match(pattern))) {
  putDealzToSleep();
}

})();
   
  




  
   
}