Enstyler

MyDealz Enstyler enhanced features

目前為 2017-12-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Enstyler
// @namespace   dealz.rrr.de
// @description MyDealz Enstyler enhanced features
// @author      gnadelwartz
// @license     LGPL-3.0; http://www.gnu.org/licenses/lgpl-3.0.txt
// @include     https://nl.pepper.com/*
// @include     https://www.preisjaeger.at/*
// @include     https://www.mydealz.de/*
// @include     https://www.hotukdeals.com/*
// @include     https://userstyles.org/styles/128262/*
// @include     https://www.amazon.*/gp/aw/*
// @version     4.00.115
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_xmlhttpRequest
// @require     https://unpkg.com/umbrellajs
// @require     https://cdn.rawgit.com/gnadelwartz/GM_config/3bfccb1cb4238694566ec491ee83d8df94da18d5/GM_config-min.js
// @require     https://cdn.rawgit.com/gnadelwartz/Enstyler/0f9712b759d8312b93e864a09e71d93fb89ba75e/translations.js
// @require     https://cdn.rawgit.com/pieroxy/lz-string/c58a22021000ac2d99377cc0bf9ac193a12563c5/libs/lz-string.min.js
// @require     https://cdn.rawgit.com/gnadelwartz/sjcl/20de886688dcabda2da1a42cd89790aacc987b09/sjcl.js
// @run-at      document-start
// @noframes
// ==/UserScript==
// @ the original development source with comments can be found here: https://greasyfork.org/de/scripts/24244-enstylerjs-develop
// @ if you don't trust this minimized script use the development source.
function e() {
  var e, n, a, i, o, r, l, c, s, d;
  ce = B(Je), (se || ue || de || pe || he) && u("article").not(".enClassActionDone, ." + Ae).each(function(p) {
    u(p).addClass("enClassActionDone"), u(p).hasClass("threadWidget--type-card--item") || (null !== u(p).attr("id") ? (d = "c" != u(p).attr("id")[0], de && u(p).find(".userHtml").each(function(e) {
      u(e).html(u(e).html().replace(/[^ -~Ä-Ÿ✘►○●✰€]+|(&nbsp;)+|(\n\r)+|<\/p>|<div>/g, " ").replace(/<\/div>/g, "<br>").replace(/<p>|<br>( *<br>)+/g, "<br><br>").replace(/(<li>)(<br>)+|<br>*(<br><\/li>)/g, "$1"));
    }), he && d && (a = u(p).find(".thread-price.text--b")).length && ((o = u(p).find(".cept-dealBtn")).hasClass("ico--type-redirect-white") ? o.html(a.html()) : o.html(a.html() + '<span class="ico ico--type-redirect-white size--all-xl space--l-1"></span>'),
    u(p).find(".cept-tb").html(a.html())), n = u(p).find(".userHtml").first(), e = u(p).find(".cept-comment-link"), a = u(p).find(".thread-title a"), s = a.length, d && !n.length && ge && u(p).find(".threadGrid-image, .threadGrid-body").remove(),
    se && d && (s || (a = u(p).find(".thread-title"), St = 20), (r = u(p).find(".vote-temp")).length && (r = parseInt(r.text()), pe && (c = u(p).find(".vote-temp").attr("class").replace(/.*charcoal|.*vote-temp--/i, ""),
    (l = r / (fe / 70) + 5) < 0 && (l *= -3), u(p).prepend('<div class="votebar vote-progress voteBar--' + c + '" style="width: ' + l + '%;"></div>'), u(p).hasClass("thread--type-card") && (r = 0), r > fe / 2.51 ? u(p).prepend(Ee) : r < -fe / 10.1 && u(p).prepend(Ge))),
    s ? (u(p).find("button.meta-ribbon-btn.hide--fromW3").remove(), u(p).find("span.meta-ribbon.hide--toW3").removeClass("hide--toW3"), u(p).find(".threadGrid-title .thread-title.lineClamp--2").removeClass("lineClamp--2"),
    i = a.first().outerHTML.replace(/\n|\r|\t/g, "").replace(/^.*href="/, "").replace(/".*/, ""), o = t(u(this), a.text(), i, ke), e.append(o)) : (le && u(p).find("a.btn--twitter").length && (o = u(p).find("a.btn--twitter").first().outerHTML.replace(/&amp;text=/g, "?ID=" + ce + "&amp;text="),
    u(p).find("a.btn--twitter").replace(o), o = u(p).find("a.btn--facebook").first().outerHTML.replace(/&amp;title=/g, "?ID=" + ce + "&amp;title="), u(p).find("a.btn--facebook").replace(o), o = u(p).find("a.btn--whatsapp").first().outerHTML.replace(/" rel="no/, "?ID=" + ce + '" rel="no'),
    u(p).find("a.btn--whatsapp").replace(o)), o = t(u(this), a.text(), $.toString(), re), u(p).find("a.btn--twitter").parent().append(o))), d && (o = u(p).find(".threadGrid-image, .threadCardLayout--row--image")).length && o.html(o.html().replace(/ img--dummy.*" data-lazy-img="{&quot;src&quot;:&quot;/, '" src="').replace(/&quot;,&quot;finishClass&quot;:.*">/, '">'))) : u(p).remove());
  });
}

function t(e, t, n, a) {
  (t = encodeURIComponent(("Gnadelwartz" == J ? "KayDealz" : O) + ": " + t.replace(/\r|\n|\t/g, " ").replace(/  */g, " "))).length < 100 && e.find("span.thread-price").length && (t += encodeURIComponent(" -> " + e.find("span.thread-price").text().replace(/ |\t/g, "")));
  var i = n;
  return le && (i = n.replace(/^https:\/\/.*?\//, "https://dealz.rrr.de/" + O + "/") + "?ID=" + ce), a.replace(at[et], "\n\r" + n).replace(at[nt], function(e, t, n) {
    void 0 === n && (n = " ");
    if (e.length > t) return (e = e.substr(0, t - 1)).substr(0, e.lastIndexOf(n)) + "...";
    return e;
  }(t, 160, "%20") + "&body=" + t + "%0D%0A%0D%0A" + i + xe);
}

function n() {
  K && !GM_config.get("enConfWhitelist").includes(J) && (GM_config.set("enConfWhitelist", "@" + J + "," + GM_config.get("enConfWhitelist")), GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist")));
  var e = GM_config.get("enConfBlacklist").replace(Ie[0], "");
  Le = RegExp(e.replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), (Se = !" ".match(Le)) || "" == e || alert(g("regexfailed")), Ne = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
  De = !" ".match(Ne), Re = GM_config.get("enCBlackC"), Se = Se && Re != Q, o(), u("." + He).removeClass(He), a();
}

function a() {
  if (Re != Q) {
    var e, t, n;
    u("article").not("." + He + ", .threadWidget-item").each(function(a) {
      u(a).addClass(He), (t = u(a).attr("id")) ? t.startsWith("thread_details") || ("c" != t ? (e = (u(a).find(".thread-title a").text() + " @" + u(a).find("a.user").text()).replace(/\n|\r|\t+/g, " "), n = null !== (n = u(a).find(".vote-temp")).text() ? parseInt(n.text()) : 0) : (e = (u(a).find(".userHtml").text() + " @" + u(this).find("a.user").text()).replace(/\n|\r|\t+/g, ""),
      n = 0), e = e.replace(Ie[1], " "), De && e.match(Ne) || (n <= Re || Se && e.match(Le)) && (u(a).addClass(Ae), Be++, function(e) {
        e == "#" + GM_getValue(Ye, "") && (GM_setValue(Ye, Ue), Ue = u(e).first().nextElementSibling.getAttribute(tt), c());
      }("#" + u(a).attr(tt)))) : u(a).remove();
    }), i();
  }
}

function i() {
  mt.default.enCUnblackL.label = ht.replace(at[nt], Be);
}

function o() {
  Be = 0, i(), u("." + Ae).removeClass(Ae);
}

function r() {
  if (GM_config.get("enCDealT")) {
    var e, t, n, a = Date.now();
    u(".meta-ribbon, time, .metaRibbon").not("." + Pe).each(function(i) {
      if (u(i).addClass(Pe), !(e = u(i).html()).includes(" am ")) {
        switch (Ve.setTime(a - (60 * parseInt(e.replace(/.* ([0-9].*) [hu].*|.*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*|.*/, "$1"))) * X), t = (a - Ve) / X, n = Ve.toString().slice(16, 21), !0) {
         case n.length < 5 || t < 60:
          return;

         case t > 1440:
          e += "&nbsp;(" + n + je + ")";
          break;

         case Ve < ze:
          e = qe + n + je;
          break;

         default:
          e += "&nbsp;(" + $e + n + je + ")";
        }
        u(i).html(e);
      }
    });
  }
}

function l() {
  if (Fe) if (Fe = !1, Z.match(Qe)) {
    if (Ue = GM_getValue(Ye, ""), function() {
      if (te) {
        var e = Date.now() / U, t = e - GM_getValue("enLastCheck" + Ye, "0");
        0, (t > ne || t < 0) && (GM_setValue("enLastCheck" + Ye, e), I(Ye, y));
      }
    }(), c(), "" == $.search) {
      var e = !0;
      u("article").not(".threadWidget-item").each(function(t) {
        if (e && 0 == u(t).find(".cept-pinned-flag").length) return GM_setValue(Ye, u(t).attr(tt)), GM_setValue(Ye + "Last", Ue), function() {
          if (te) {
            GM_config.get("enCSyncT");
            var e = Date.now() / U, t = e - GM_getValue("enLastCheck" + Ye, "0");
            t > 5 && (delay = 500), setTimeout(function() {
              H(Ye, GM_getValue(Ye, ""));
            }, GM_config.get("enCSyncT", 10) * U / 2);
          }
        }(), e = !1;
      });
    }
  } else !function() {
    var e = GM_getValue(Oe + "LastSec", "");
    GM_setValue(e, GM_getValue(e + "Last", ""));
  }();
}

function c() {
  "" != Ye && (GM_setValue("enLastCheck" + Ye, Date.now() / U), Ue ? (GM_setValue(Ye + "Last", Ue), u("#" + Ue).addClass("enClassMarkArticle"), Xe.startsWith("thread_") && u("#" + Xe).addClass("enClassMarkArticleLoad")) : GM_setValue(Ye, "thread_1"));
}

function s() {
  var e = Date.now() / U - GM_getValue("enLastUpdateCheck", "0");
  (e > F || e < 0) && function() {
    var e = parseInt(Date.now() / U), t = function() {
      var e = GM_getValue(Ze, "");
      if ("" == e || !e.startsWith("#")) return "";
      var t = (e = e.replace(/\n/g, "")).split(";");
      e = "";
      for (var n = 0; n < t.length; n++) if ("" != t[n]) {
        var a = t[n].split(":");
        a.length < 2 || (e += "&" + a[1].slice(0, -1) + "=" + a[1]);
      }
      e = "?" + e.slice(1), 0;
      return e;
    }();
    (/* curreently we assume its a CSS or JS File, so we strip comments and @namespace @moz-document... */
    function(e, t) {
      0;
      GM_xmlhttpRequest({
        method: "GET",
        url: e,
        onload: function(e) {
          var n = e.responseText.replace(/\r\n/g, " ").replace(/\/\*.*?\*\/|   *|\t/g, "").replace(/([:;]) /g, "$1").replace(/1111.11%/g, "100%");
          GM_setValue(t, n), R(n);
        },
        onerror: function() {
          alert(g("cssfailed"));
        }
      });
    })(Ke + t, Je), GM_setValue("enLastUpdateCheck", e), M();
  }();
}

function d() {
  pt = "", ft = [], gt = 0, u(".navMenu-page").off("click"), u("." + it).remove(), st.setAttribute("style", "background-position: -.00071em -176.85em; width: .85786em; display: inline-block; height: 1.42929em; background-image: url(https://assets.mydealz.de/assets/img/icons_5a065.svg); background-repeat: no-repeat; background-size: 5.50071em 590.57214em; cursor: pointer;");
  var e = u(".subNavMenu .subNavMenu-layer").first();
  e && e.after(st), Y || p("Main", "<EN-LANG:discussion>", N("discussion"), "enMainDiscussion"), p("Main", "<EN-LANG:enstyler>", '<EN-LANG:enhref>" target="_blank', "enMainHomepage", "home"), p("Main", "Enstyler Discussion", "https://www.mydealz.de/diskussion/enstyler-856062", "enMainHomepage", "page"),
  p("MainButton", "<EN-LANG:settings>", m, ct, "gear-grey");
}

function p(e, t, n, a, i) {
  void 0 !== i && "" != i || (i = dt);
  var o = !1;
  var r = ot[e].replace(at[tt], a).replace(at[nt], t);
  i != dt && (r = r.split(dt).join("--type-" + i)), "function" == typeof n ? o = !0 : r = r.replace(at[et], n), "M" == e[0] && ("" == pt && u(".nav-link.navMenu-trigger").on("click", function() {
    setTimeout(f, 200);
  }), pt += r, o && (ft[gt++] = {
    ID: a,
    target: n
  }));
}

function f() {
  u(".popover-content nav .navMenu-div").first().insertAdjacentHTML("beforebegin", D(pt, enMenuLang, ye));
  var e = u(".popover--mainNav"), t = 35 * (pt.split(it).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + t + "px"));
  for (var n = 0; n < gt; n++) u("section #" + ft[n].ID).on("click", ft[n].target);
}

function g(e) {
  return D("<EN-LANG:" + e + ">", enConfigLang, ye);
}

function h(e) {
  return D("<EN-LANG:" + e + ">", enMessageLang, ye);
}

function m() {
  u("body").prepend('<div id="enOverDim"></div>'), GM_config.open(), document.getElementById("main").click(), yt = !0;
}

function b() {
  u("#enOverDim").remove(), yt = !1;
}

function v() {
  u('.GM_config button[id$="_saveBtn"]').html(g("save")), u('.GM_config button[id$="_closeBtn"]').html(g("close")), u("#GM_config_resetLink").html(h("reset"));
}

function y(e, t) {
  Xe = t, c(), Xe.replace(/thread_/i, "") > Ue.replace(/thread_/i, "") && W(e + "Last", t);
}

function M() {
  H(Je, _t + GM_getValue(Je).replace(/^.*?{/, "").replace(/} *@-moz-document.*/, ""), !1);
}

function C(e, t) {
  for (var n = t.split("&"), a = 0; a < n.length; a++) {
    var i = n[a].split("=");
    i.length < 2 || !bt.includes(i[0]) || ("false" == i[1] ? GM_config.fields[i[0]].value = !1 : GM_config.fields[i[0]].value = i[1], GM_config.fields[i[0]].reload());
  }
}

function E() {
  !function() {
    if (GM_config.get("enCNavF") && "/deals/" != Z && "/gutscheine/" != Z) {
      var e = u("header").html();
      u("header").replace('<header class="enFixedNav">' + e + "</header>");
      var t = We.every;
      Z == N("discussion") && (t += We.discus), (u(".nav-subheadline").length || "/profile/" == Z) && (t += We.subnav), R(t = t.replace(at[nt], kt));
    }
  }(), l(), ze.setHours(0, 0, 0, 0), $e = D('<span class="hide--toW2"><EN-LANG:today>&nbsp;</span>', enTimeLang, ye), je = D('<span class="hide--toW2">&nbsp;<EN-LANG:oclock></span>', enTimeLang, ye), qe = D("<EN-LANG:yesterday> ", enTimeLang, ye),
  r(), n(), function() {
    if (St = 5, se) {
      u("footer ul").length && (xe = "%0D%0A%0D%0A-- %0D%0A" + u("footer ul li p").first().innerHTML.replace(/<br>/g, "%0D%0A").replace(/<.*?>/g, ""));
      var t = $.pathname, n = 0;
      switch ("" != J && (t = t.replace(J + "/", "")), u(".ico--type-grid-subNavActive, .thread-list--type-card ").length && (n = 1), ke = Ce[0] + Ce[1 + n] + Ce[3], !0) {
       case t.endsWith("profile/saved-deals"):
        ke += Ce[4] + Ce[5 + n] + Ce[7], _e = !0;
        break;

       case t.endsWith("profile/diskussion"):
       case K && t.endsWith(J):
        ke += Ce[8] + Ce[9 + n] + Ce[11];
      }
      ke = D(ke + Ce[12] + Ce[13 + n] + Ce[15], enDealLang, ye), re = D(Ce[16] + Ce[17] + Ce[19], enDealLang, ye);
    }
    e();
  }();
}

function G() {
  c(), location.search.match(/^page=/) ? Te.value = parseint(location.search.replace(/^page=/, "")) : u(".js-sticky .text--color-charcoalTint").length && (Te.value = parseInt(u(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">' + N("page"))[1])),
  r(), a(), e();
}

function k() {
  var e = q(P(u(".nav").first(), "background-color"), .1), t = q(P(u(".btn--mode-special").first(), "background-color"), .1), n = q(e, .7), a = function(e) {
    var t = e.split(","), n = parseInt(t[0].slice(4)), a = parseInt(t[1]), i = parseInt(t[2]);
    return Math.round((n + a + i) / 3);
  }(P(u("#main").first(), "background-color")) > 100 ? "" : "body, .user, .thread-title, .subNavMenu-link {color: #aaa !important} article, section {border: 1px #666 solid}";
  R(" .GM_config {background-color: " + e + " !important; color: " + n + ";} .GM_config .section_header, .GM_config .config_header {background-color: " + q(e, -.25) + " !important; color: " + n + " !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover  { background-color: " + q(e, .1) + " !important;} .GM_config input[type=button] { background-color: " + t + " !important; border-color: " + t + " !important; min-width: 10em;} .GM_config input[type=button]:hover, .btn--mode-special:hover { background-color: " + q(t, .2) + " !important; border-color: " + q(t, .2) + " !important;}" + a),
  d(), function() {
    if (GM_config.get("enCPageP")) {
      var e, t, n, a = 1, i = 1;
      if (u(Te).empty(), u("div.text--color-charcoalTint").length) {
        var o = u("nav > div.text--color-charcoalTint").html().replace(/\r?\n|\r/g);
        isNaN(a = parseInt(o.replace(/.*currentPage=/, ""))) && (a = 1), isNaN(i = parseInt(o.replace(/.*lastPage=/, ""))) && (i = a);
      }
      for (x = 1; x <= i; ) (n = document.createElement("option")).text = x, Te.add(n), t = x, e = Math.abs(a - x), x < 10 || e < 5 ? x++ : x < 1e3 && e > 600 ? x += e / 3.5 : x += Math.floor(e / 2), e > 9 && x > 9 && (e < 50 || x < 50 ? x = 2 * Math.floor(x / 2) : x = 5 * Math.floor(x / 5));
      a > i && (i = a), t < i && ((n = document.createElement("option")).text = i, Te.add(n)), Te.value = a;
      var r = [ ".js-navDropDown-messages", we + " js-navDropDown-messages vAlign--all-m" ];
      u(".test-loginButton").length && (r[0] = ".test-loginButton"), u(".voteBar").length && (r = [ ".voteBar--sticky-off--hide.hAlign--all-r", we + " subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
      Te.setAttribute("class", r[1]), u(r[0]).before(Te);
    }
  }(), ae ? u("#main").on("DOMSubtreeModified", A(300, function() {
    G();
  })) : u(".js-pagi-bottom").on("DOMSubtreeModified", A(200, function() {
    G();
  }));
}

function _() {
  if (!function() {
    var e = $.href;
    return !!e.startsWith("https://www.amazon") && (GM_config.get("enCRedirect") && (e.includes("/gp/aw/d/") ? window.location.replace(e.replace("/gp/aw/d/", "/dp/")) : e.includes("/gp/aw/ol/") ? window.location.replace(e.replace("/gp/aw/ol/", "/gp/offer-listing/")) : (oe("AMAZON redirect failed ... redirect to main page"),
    window.location = $.protocol + $.host)), !0);
  }()) if (u("#messages-list").length || u("#footer").length) {
    if (function() {
      R(GM_getValue("Enstyler2_CSS", ""), 'domain("' + $.hostname), le = GM_config.get("enCCMail"), se = GM_config.get("enCDealA"), ue = GM_config.get("enCTouch"), ge = GM_config.get("enCCompact"), he = GM_config.get("enCPrice"),
      de = GM_config.get("enCFixHtml"), fe = GM_config.get("enCDealVbar"), pe = fe != Q, he && (_t += ".threadGrid-title .flex, .threadGrid-title .overflow--fade {display: none;}");
      ge && (_t += ".threadGrid {padding: .3em !important;} .threadGrid-headerMeta, .threadGrid-title {height: 2.8em;}.thread-title {white-space: nowrap;} .threadGrid-headerMeta {height: 2.3em;}.space--mt-2, .space--mv-2 {margin-top: .25em;} .vote-box {height: 2.1em} .votebar {top: 0;} .threadTempBadge-icon {font-size: 1.3em !important;}",
      he && (_t += ".threadGrid-headerMeta, .threadGrid-title {height: 2em !important;}"));
      ue && (_t += "article .footerMeta-commentsSlot .ico::before, article .threadItem-footerMeta .ico::before, article .threadCardLayout--row--small .ico::before, .thread-userOptionLink.ico:before {-webkit-transform: scale(1.7); transform: scale(1.7); width: 1.5em; left: .4em;}.ico--reduce3 {left: .5em;} #emergency {transform: scale(1.5); margin-left: .7em;}article a.btn--circle {-webkit-transform: scale(1.5); transform: scale(1.5); left: -1em; margin-left: 3em; width: 4em;}.vote-down, .vote-up {padding-top: 0.25em; padding-bottom: 0.25em} .thread-avatar { width: 2.3em; height: 2.3em;}");
      pe || (_t += ".threadTempBadge { display: unset; }");
      R(_t + lt);
    }(), $.pathname.match(me)) return void 0;
    w();
  } else window.requestAnimationFrame(_);
}

function w() {
  var e = P(u(".nav, #navigation").first(), "background-color").replace(/[^\(]*/, "");
  u(".vwo-deal-button, #footer").length && "" != e ? function() {
    0;
    0;
    var e = Date.now();
    0;
    (K = u(".avatar--type-nav").length) ? (J = (J = u(".navDropDown a").attr(et)).replace(/.*\/profile\/([^\/]+).*/, "$1"), GM_setValue("enCSyncUser", J)) : J = GM_getValue("enCSyncUser"), Z = $.pathname.replace(/\/([^\/]+\/*).*/, "/$1"),
    0;
    s(), document.body.appendChild(vt);
    R(".bg--off {background-color: " + q(P(u(".bg--main").first(), "background-color"), -.08) + "!important;}"), kt = function(e) {
      e = "string" == typeof e ? document.querySelector(e) : e;
      var t = window.getComputedStyle(e), n = parseFloat(t.marginTop) + parseFloat(t.marginBottom);
      return Math.ceil(e.offsetHeight + n);
    }("header"), E(), EnstylerStartupDelay = Date.now() - e, 0;
    setTimeout(k, 300);
  }() : window.requestAnimationFrame(function() {
    setTimeout(w, 80);
  });
}

function T() {
  u("#advancedsettings_area").attr("class", "advancedsettings_shown"), u(".advanced_button").remove(), xt.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), u("#button_middle").first().after(xt),
  window.scrollTo(0, 600), L();
}

function L() {
  xt.value = g("options");
  var e = GM_getValue(Ze, ""), t = (e = e.replace(/\n/g, "")).split(";");
  if ("" != e && e.startsWith("#")) {
    for (var n = 0; n < t.length; n++) {
      0;
      var a = t[n].split(":");
      a[0].startsWith("#setting") ? (u(a[0]).first().selectedIndex = "-1", u(a[0]).first().value = a[1]) : a[0].startsWith("#option") ? u(a[0]).first().checked = !0 : "" != a[0] && oe('ignoring unkown option: "' + a + '"');
    }
    R("#button { display: none; }");
  }
}

function S() {
  GM_setValue(ie, "Enstyler Log\n");
}

function N(e) {
  return function(e, t) {
    return enSiteConfig.hasOwnProperty(e) && enSiteConfig[e].hasOwnProperty(t) ? enSiteConfig[e][t] : "";
  }(O, e);
}

function D(e, t, n) {
  return enDealLang.hasOwnProperty(n) && void 0 !== t[n] || (n = "en"), (e = e.replace(be, function(e, a) {
    return t.hasOwnProperty(n) && t[n].hasOwnProperty(a) ? t[n][a] : a;
  })).match(be) ? D(e, t, n) : e;
}

function R(e, t) {
  // check if style contains @-moz-document rules
  if (void 0 === t && (t = ""), e.match(Tt.detect)) {
    "" == t && (t = $.hostname);
    var n = e.split(t);
    e = "";
    for (var a = 1; a < n.length; a++) -1 != n[a].indexOf("{") && (e += n[a].replace(Tt.split, "").replace(Tt.next, ""));
  }
  for (var i, o = 0, r = Lt; e.length > r && (i = e.substring(r).indexOf("}.")) > 0; ) R(e.slice(o, r += i + 1)), o = r, r += Lt;
  var l = document.createElement("style");
  l.innerHTML = e.slice(o), document.body.appendChild(l);
}

function q(e, t) {
  if (void 0 === t && (t = .1), void 0 === e) return "rgba(0,0,0,0)";
  var n = e.split(","), a = t < 0 ? 0 : 255, i = t < 0 ? -1 * t : t, o = parseInt(n[0].slice(4)), r = parseInt(n[1]), l = parseInt(n[2]);
  return "rgb(" + (Math.round((a - o) * i) + o) + "," + (Math.round((a - r) * i) + r) + "," + (Math.round((a - l) * i) + l) + ")";
}

function A(e, t) {
  var n = null;
  return function() {
    clearTimeout(n), n = setTimeout(function() {
      t.call(this);
    }, e);
  };
}

function H(e, t, n) {
  if ("" != J && ee != Q) {
    if (void 0 === n && (n = !0), e + t == Dt) return;
    Dt = e + t;
    var a = n ? function(e) {
      return btoa(sjcl.encrypt(z(J + ":" + ee), e));
    }(t) : LZString.compressToEncodedURIComponent(t), i = Nt + "ID=" + B(e) + "&value=" + a;
    0, GM_xmlhttpRequest({
      method: "GET",
      url: i
    });
  }
}

function B(e) {
  return z(J + ":" + ee + "&key=" + e);
}

function I(e, t, n) {
  if ("" == J && (J = GM_getValue("enCSyncUser")), "" != J && ee != Q) {
    void 0 === n && (n = !0);
    var a = "https://dealz.rrr.de/enstyler/load.php?ID=" + B(e);
    0, GM_xmlhttpRequest({
      method: "GET",
      url: a,
      onload: function(a) {
        200 === a.status && a.responseText.length > 30 && t(e, n ? V(a.responseText) : LZString.decompressFromEncodedURIComponent(a.responseText));
      }
    });
  }
}

function W(e, t) {
  GM_setValue(String(e), String(t));
}

function V(e) {
  return sjcl.decrypt(z(J + ":" + ee), atob(e));
}

function z(e) {
  return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(e));
}

function P(e, t) {
  if (window.getComputedStyle) try {
    return getComputedStyle(e).getPropertyValue(t);
  } catch (e) {} else if (e.currentStyle) try {
    return e.currentStyle[t];
  } catch (e) {}
  return "";
}

var $ = location, j = $.hostname.replace("www.", ""), O = function(e) {
  return e[0].toUpperCase() + e.slice(1);
}(j.replace(/^\.|\..*/g, "")), Y = "Mydealz" != O, F = 1440, U = 6e4, X = U, K = !1, J = "", Z = $.pathname.replace(/\/([^\/]+\/*).*/, "/$1"), Q = "off", ee = Q, te = !1, ne = 5, ae = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

/Linux/i.test(navigator.userAgent) && void 0 !== GM_info.scriptHandler && GM_info.scriptHandler.startsWith("USI") && (ae = !0);

var ie = "enMobileLog", oe = console.error;

S();

var re, le, ce, se, ue, de, pe, fe, ge, he, me = /settings$/, be = /<EN-LANG:(.*?)>/g, ve = void 0 === enSiteConfig[O] ? "en" : enSiteConfig[O].lang, ye = ve, Me = $.protocol + "//" + $.host + $.pathname, Ce = [ '<a title="<EN-LANG:post>" class="link ico ico--pos-l ico--type-comment-blue linkPlain space--h-3"href="<ENSTYLER-HREF-HERE>#comment-form" data-handler="track" data-track="{&quot;action&quot;:&quot;scroll_to_comment_add_form&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3"><EN-LANG:post></span>', "", "</a>", '<a title="<EN-LANG:remove>" class="link text--color-blue ico ico--type-bookmark-blue linkPlain ico--pos-l space--h-3"data-handler="track replace" data-replace="{&quot;endpoint&quot;:&quot;https://www.mydealz.de/threads/<ENSTYLER-ID-HERE>/remove&quot;,&quot;method&quot;:&quot;post&quot;}" data-track="{&quot;action&quot;:&quot;save_thread&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3"><EN-LANG:remove></span>', "", "</a>", '<a title="<EN-LANG:edit>" class="link text--color-blue ico ico--type-pencil-blue linkPlain ico--pos-l space--h-3"href="<ENSTYLER-HREF-HERE>/edit" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_Update startededit_form&quot;,&quot;beacon&quot;:true}">', '<span class="hide--toW3"><EN-LANG:edit></span>', "", "<span></a>", '<a title="<EN-LANG:mail>" class="link text--color-blue ico ico--type-mail-blue linkPlain ico--pos-l space--h-3"href="mailto:?subject=<ENSTYLER-TEXT-HERE>" <span class="hide--toW3">', '<span class="hide--toW3"><EN-LANG:mail></span>', "", "<span></a>", '<a title="<EN-LANG:mail>" class="btn btn--whatsapp btn--circle size--all-xs space--ml-2" style="background-color: #69be28;"', 'href="mailto:?subject=<ENSTYLER-TEXT-HERE>"><span class="ico ico--type-mail-white ico--reduce size--all-xxl">', "</span></a>", "</span></a>" ], Ee = '<span class="vote-tempIco ico ico--type-flame2-red threadTempBadge-icon" style="position: absolute; display: block; margin-left: .3em; font-size: 2em;"></span>', Ge = '<span class="vote-tempIco ico ico--type-snowflake-blueTint threadTempBadge-icon" style="position: absolute; display: block; margin-left: .3em; font-size: 2em;"></span>', ke = "", _e = !1, xe = "", we = "enPageEnum", Te = document.createElement("select");

Te.id = we, Te.setAttribute("class", we), Te.onchange = function() {
  var e = document.getElementById(we), t = "page=" + e.options[e.selectedIndex].value, n = $.toString().replace(/page=.*|#.*/, "");
  n.endsWith("?") || n.endsWith("&") ? n += t : n += "?" + t, "/deals/" == Z && (n += "#thread-comments"), window.location = n;
};

var Le, Se, Ne, De, Re, qe, Ae = "enClassHidden", He = "enClassBlackDone", Be = 0, Ie = [ /[\[\]\(\)\{\}\?\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ], We = {
  every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .profileHeader, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px}",
  subnav: ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px}",
  discus: ".tGrid.page2-center.height--all-full {margin-top: calc(<ENSTYLER-TEXT-HERE>px + 10px);} #footer .page-content { padding-top: calc(<ENSTYLER-TEXT-HERE>px + 10px);}"
}, Ve = new Date(), ze = new Date(), Pe = "enTimeSeen", $e = "", je = "", Oe = "enNewest" + j, Ye = Oe + "-" + Z.replace(/\//, ""), Fe = !0, Ue = "", Xe = "", Ke = "https://userstyles.org/styles/128262/enstyler2-style-your-mydealz.css", Je = "Enstyler2_CSS", Ze = "EnstylerCssOpt", Qe = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, et = "href", tt = "id", nt = "text", at = {
  href: /<ENSTYLER-HREF-HERE>/g,
  id: /<ENSTYLER-ID-HERE>/g,
  text: /<ENSTYLER-TEXT-HERE>/g
}, it = "enNavEntry", ot = {
  Main: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-ID-HERE>" href="<ENSTYLER-HREF-HERE>" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_main_target&quot;,&quot;beacon&quot;:true}"><span class="navMenu-link-ico ico ico--type-discussion-navMenuLayerItem navMenu-ico--selected--type-discussion navMenu-ico--hover--type-discussion"></span><ENSTYLER-TEXT-HERE></a>',
  Sub: '<li class="enNavEntry subNavMenu-item--separator test-tablink-discussed"><a  href="<ENSTYLER-HREF-HERE>" class="subNavMenu-item subNavMenu-link space--h-4 vAlign--all-m" id="<ENSTYLER-ID-HERE>" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_menu_target sort&quot;,&quot;label&quot;:&quot;diskutiert&quot;,&quot;beacon&quot;:true}"><span class="box--all-i size--all-xl vAlign--all-m"><ENSTYLER-TEXT-HERE></span><span class="js-vue-container--threadcount" data-handler="vue" data-vue="{&quot;count&quot;:null}"></span></a></li>',
  MainButton: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-ID-HERE>"><span class="navMenu-link-ico ico  ico--type-discussion"></span><ENSTYLER-TEXT-HERE></a>'
}, rt = '<div id="enButt"><a title="Grid Layout" id="enGrid" href="' + Me + '?layout=grid"><img src="https://dealz.rrr.de/enstyler/grid.png"></a><a title="List Layout" id="enList" href="' + Me + '?layout=horizontal"><img src="https://dealz.rrr.de/enstyler/list.png"></a><a title="Text Layout" id="enText" href="' + Me + '?layout=text"><img src="https://dealz.rrr.de/enstyler/text.png"></a></div>', lt = "#enGrid, #enList, #enText { padding: 0.5em; } #enButt {left: 3em; top: 1em; padding-left: 4em; display: inline-block;}", ct = (ot.length,
"EnstylerButton"), st = document.createElement("input");

st.type = "button", st.setAttribute(tt, "emergency"), st.onclick = m, st.value = " ";

var ut, dt = "--type-discussion", pt = "", ft = [], gt = 0, ht = (GM_info.scriptWillUpdate, D("<EN-LANG:unblack> <ENSTYLER-TEXT-HERE> Dealz", enConfigLang, ye)), mt = [];

mt.default = {
  enCSS: {
    label: g("configcss"),
    title: h("configcss"),
    type: "button",
    click: function() {
      ut = window.open("https://userstyles.org/styles/128262", "UserCSS", "left=0,top=0"), GM_setValue("enLastUpdateCheck", 0);
    }
  },
  enJS: {
    label: g("userscript"),
    title: h("userscript"),
    type: "button",
    click: function() {
      ut = window.open("https://greasyfork.org/scripts/24243-enstylerjs/code/EnstylerJS.user.js", "UserScript", "width=210,height=210,left=0,top=0"), setTimeout(ut.close, 5e3);
    }
  },
  enCNavF: {
    label: g("navfixed"),
    title: h("navfixed"),
    type: "checkbox",
    default: !0,
    section: [ g("config"), "" ]
  },
  enCMax: {
    label: g("max"),
    title: h("max"),
    type: "select",
    options: enSiteConfig.width,
    default: "1280"
  },
  enCDealA: {
    label: g("dealaction"),
    title: h("dealaction"),
    type: "checkbox",
    default: !0
  },
  enCDealVbar: {
    label: g("dealvotebar"),
    title: h("dealvotebar"),
    type: "select",
    options: enSiteConfig.votescale,
    default: "500"
  },
  enCTouch: {
    label: g("touch"),
    title: h("touch"),
    type: "checkbox",
    default: !0
  },
  enCWidth: {
    label: g("width"),
    title: h("width"),
    type: "select",
    options: enSiteConfig.width,
    default: Q
  },
  enCPrice: {
    label: g("price"),
    title: h("price"),
    type: "checkbox",
    default: !1
  },
  enCCompact: {
    label: g("compact"),
    title: h("compact"),
    type: "checkbox",
    default: !1
  },
  enCCMail: {
    label: g("cssdealz"),
    title: h("cssdealz"),
    type: "checkbox",
    default: !0
  },
  enCRedirect: {
    label: g("redir"),
    title: h("redir"),
    type: "checkbox",
    default: !0
  },
  enCPageP: {
    label: g("picker"),
    title: h("picker"),
    type: "checkbox",
    default: !0
  },
  enCDealT: {
    label: g("dealtime"),
    title: h("dealtime"),
    type: "checkbox",
    default: !0
  },
  enCFixHtml: {
    label: g("fixhtml"),
    title: h("fixhtml"),
    type: "checkbox",
    default: !0
  },
  enCBlackC: {
    label: g("blacklist"),
    title: h("blacklist"),
    type: "select",
    options: enSiteConfig.blackcold,
    default: "-20"
  },
  enConfBlacklist: {
    label: g("black"),
    title: h("black"),
    type: "text",
    size: 70,
    default: ""
  },
  enConfWhitelist: {
    label: g("white"),
    title: h("white"),
    type: "text",
    size: 70,
    default: ""
  },
  enCUnblackL: {
    label: g("unblack"),
    title: h("unblack"),
    type: "button",
    click: function() {
      o();
    }
  },
  enCLang: {
    label: g("lang"),
    title: h("lang"),
    type: "select",
    options: enSiteConfig.languages,
    default: ""
  }
}, mt.sync = {
  enCAutoS: {
    label: g("autosync"),
    title: h("autosync"),
    type: "checkbox",
    section: [ g("syncconf"), "" ],
    default: !0
  },
  enCSyncT: {
    label: g("synctime"),
    title: h("synctime"),
    type: "select",
    options: enSiteConfig.synctimes,
    default: "5"
  },
  enCSyncKey: {
    label: g("synckey"),
    title: h("synckey"),
    type: "text",
    size: 16,
    default: Q
  },
  enCSync: {
    label: g("sync"),
    title: h("sync"),
    type: "button",
    click: function() {
      I(Ze, W), I(Ct, C);
    }
  }
};

var bt = [ "enCNavF", "enCDealA", "enCDealVbar", "enCTouch", "enCRedirect", "enCPageP", "enCFixHtml", "enCDealT", "enCBlackC", "enConfBlacklist", "enConfWhitelist", "enCAutoS" ], vt = document.createElement("div");

vt.setAttribute("class", "GM_config");

var yt = !1, Mt = [ {
  val: Q,
  field: "enCBlackC",
  rem: "enConfWhitelist"
}, {
  val: Q,
  field: "enCBlackC",
  rem: "enConfBlacklist"
}, {
  val: Q,
  field: "enCBlackC",
  rem: "enCUnblackL"
}, {
  val: Q,
  field: "enCSyncKey",
  rem: "enCSync"
}, {
  val: Q,
  field: "enCSyncKey",
  rem: "enCAutoS"
}, {
  val: Q,
  field: "enCSyncKey",
  rem: "enCSyncT"
} ], Ct = "enSettings", Et = !1;

if (window.location.hostname.endsWith("userstyles.org")) GM_config.init({
  id: "GM_config",
  title: g("headline") + " CSS",
  fields: {
    saveOpt: {
      section: [ g("savecss"), "" ],
      label: g("howtocss"),
      type: "textarea",
      size: 70
    }
  },
  events: {
    open: function() {
      v();
    },
    save: function() {
      L(), setTimeout(window.close, 1e3);
    },
    close: function() {
      b();
    }
  },
  frame: vt
}), window.onload = function() {
  document.body.appendChild(vt), R(_t + "#buttons {visibility: hidden;} #ownedButtons {visibility: visible; border: 1px solid red;}"), R(GM_getValue("Enstyler2_CSS", ""), "url(https://userstyles.org"),
  setTimeout(T, 500);
}; else {
  var Gt = !1;
  GM_config.init({
    id: Y ? "GM_config" + j : "GM_config",
    title: g("headline"),
    fields: Object.assign(mt.default, mt.sync, mt.debug),
    events: {
      open: function() {
        Gt = GM_config.get("enCNavF"), v(), u("#GM_config_enJS_var").after(rt);
        for (var e = 0; e < Mt.length; e++) GM_config.get(Mt[e].field) == Mt[e].val && GM_config.fields[Mt[e].rem].remove();
        ae || GM_config.fields.enCWidth.remove();
      },
      save: function() {
        !function() {
          H(Ze, GM_getValue(Ze)), M();
          for (var e = "", t = 0; t < bt.length; t++) e += bt[t] + "=" + GM_config.get(bt[t]) + "&";
          H(Ct, e);
        }(), GM_setValue("enWidth", GM_config.get("enCWidth")), GM_setValue("enMax", GM_config.get("enCMax")), GM_config.close(), m(), Et = !0;
      },
      close: function() {
        b(), Et && window.location.reload(), s();
      }
    },
    frame: vt
  }), ee = GM_config.get("enCSyncKey"), te = GM_config.get("enCAutoS"), ne = GM_config.get("enCSyncT", ne);
}

var kt, _t = [ ".threadWidget-footer::after {display: none !important}", ".GM_config {color: white !important; opacity: 0.92 !important; left: 5% !important; height: auto !important; top: 1.4em !important;", "box-shadow: 10px 10px 20px black; min-width: 21em; max-width: 40em !important; border-radius: 10px}", "#enOverDim {background-color: black; z-index: 999; position: fixed; top: 0; right: 0; bottom: 0; left: 0; opacity: 0.5}", ".GM_config input, .GM_config button, .GM_config textarea { border: 1px solid; margin: 0.5em 0em 0.2em 1em; padding: 0.1em;}", ".GM_config .reset { font-size: 9pt; padding-right: 1em; }", ".GM_config .config_header {font-size: 14pt !important; border: none !important; padding: 0.2em; font-weight: bold; text-align: center;}", ".GM_config .section_header { border: none !important; background-color:#005293 !important; !important; text-align: center; margin-top: 1em;}", ".GM_config .field_label:hover {color: gray;} .GM_config a:hover {text-decoration: underline; color: darkgray;}", ".GM_config .config_var {display: inline-block;} .GM_config .field_label {display: inline-block; min-width: 14em;  margin-left: 2em; }", ".GM_config button, .GM_config input[type=button] { font-weight: bold; text-align: center; color: #fff; background-color:  #58a618 !important; }", ".GM_config button:hover {background-color: #a5d867 !important; border-color: #a5d867 !important;}", ".enClassHidden, #EnPopup_closeBtn, .voteBar-- { display: none !important; }", ".votebar {display: inline-block; position: relative; top: .3em; height: .5em; margin-left: 2.5em; max-width: 80% }", ".voteBar--warm { background-color:  #ffb612 } .voteBar--hot  { background-color:  #e00034 } .voteBar--burn { background-color:  #e00034 }", ".voteBar--cold, .voteBar--colder { background-color:: #00a9e0 } .voteBar--cold, .voteBar--colder { background-color: #5bc6e8 }", ".threadTempBadge { display: none; } .flex--justify-space-between { justify-content: unset !important; }", ".page2-center, .thread-list--type-list--sideAds, .thread-list--type-list { max-width: " + GM_getValue("enMax") + "px !important;}" ].join(" "), xt = document.createElement("input");

xt.type = "button", xt.setAttribute(tt, ct), xt.onclick = function() {
  !function() {
    var e, t, n, a = "";
    u("#style-settings select").each(function(i) {
      e = u(i).attr(tt), t = i.value, n = u("option[value=" + t + "]").text(), a += "#" + e + ":" + t + ":" + n + ";\n";
    }), u("#style-settings input[type=text]").each(function(i) {
      e = u(i).attr(tt), t = i.value, a += "#" + e + ":" + t + ":" + (n = "RGB-Clolor") + ";\n";
    }), u("#style-settings input:checked").each(function(i) {
      e = u(i).attr(tt), t = i.value, n = u("label[for=" + e + "]").text(), a += "#" + e + ":" + t + ":" + n + ";\n";
    }), GM_config.set("saveOpt", a), GM_setValue(Ze, a);
  }(), m();
}, xt.value = g("options");

//var isIE = /*@cc_on!@*/false || !!document.documentMode;
var wt = GM_getValue("enWidth");

ae && wt != Q && u("meta[name=viewport]").attr("content", "width=" + wt + "px, initial-scale=1");

var Tt = {
  detect: /.*?@-moz-document .*?\{\s*/,
  split: /^.*?\{/,
  next: /}\s*@-moz-document.*/
}, Lt = 16100, St = 5, Nt = "https://dealz.rrr.de/enstyler/save.php?", Dt = "";

"auto" != GM_config.get("enCLang") && (ye = GM_config.get("enCLang")), window.eval("window['ga-disable-UA-2467049-1'] = true;"), _();