EnstylerJS

MyDealz and Pepper enhanced features incl. Amazon mobile redirect

اعتبارا من 01-03-2017. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        EnstylerJS
// @namespace   Enstyler
// @description MyDealz and Pepper enhanced features incl. Amazon mobile redirect
// @include     https://nl.pepper.com/*
// @include     https://www.preisjaeger.at/*
// @include     https://www.mydealz.de/*
// @include     https://userstyles.org/styles/128262/*
// @include     https://www.amazon.*/gp/aw/*
// @version     3.02.289-min
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_xmlhttpRequest
// @require     https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js
// @require     http://openuserjs.org/src/libs/sizzle/GM_config.js
// @run-at      document-start
// ==/UserScript==
// commented source: https://greasyfork.org/de/scripts/24244-enstylerjs-develop?version=178032
// diff to last version: https://greasyfork.org/de/scripts/24244-enstylerjs-develop/diff?v1=178032&v2=177204&context=3&w=1
function EnstylerInit() {
  (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr(enHREF), enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1")) : $(document).on("click", ".test-loginButton", EnstylerLastSeenLast), 
  enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
}

function EnstylerDealActions() {
  if (GM_config.get("enConfMoreDeal")) {
    $("footer ul").length && (enDealFooter = "%0D%0A%0D%0A-- %0D%0A" + $("footer ul li p").first().html().replace(/<br>/g, "%0D%0A").replace(/<.*?>/g, ""));
    var e = enLocParser.pathname, n = 0;
    switch ("" != enUserName && (e = e.replace(enUserName + "/", "")), $(".ico--type-grid-subNavActive").length && (n = 1), enDealAdd = enDealAction[0] + enDealAction[1 + n] + enDealAction[3], 
    !0) {
     case e.endsWith("profile/saved-deals"):
      enDealAdd += enDealAction[4] + enDealAction[5 + n], +enDealAction[7], enDealUnbook = !0;
      break;

     case e.endsWith("profile/diskussion"):
     case e.endsWith(enUserName):
      enDealAdd += enDealAction[8] + enDealAction[9 + n] + enDealAction[11];
    }
    enDealAdd = enLangLocalize(enDealActionPreHtml + enDealAdd + enDealAction[12] + enDealAction[13 + n] + enDealAction[15] + "</span>", enDealLang, enLANG);
  }
  EnstylerAvatarPopup(), EnstylerDealActionsDo();
}

function EnstylerDealActionsDo() {
  var e, n, t, a, o, i = GM_config.get("enConfMoreDeal"), s = GM_config.get("enConfTouch"), l = enUserLogin && GM_config.get("enConfPopup");
  $("article").not(".enClassActionDone, .enClassHidden").each(function() {
    if (e = $(".thread-infoRow", $(this)), i && e.length && (n = $(".thread-title a", $(this)), t = n.attr(enHREF), a = encodeURIComponent(enInternationalName + ": " + n.text()), 
    a.length < 100 && $(this).find(".thread-price").length && (a += encodeURIComponent(" -> " + $(this).find(".thread-price").text().replace(/ |\t/g, ""))), o = enDealAdd.replace(enPATTERN[enHREF], t).replace(enPATTERN[enTEXT], truncStringWord(a, 160, "%20") + "&body=" + a + "%0D%0A%0D%0A" + t + enDealFooter), 
    enDealUnbook && (o = o.replace(enPATTERN[enID], ("#" + $(this).attr(enID)).replace(enDealMarker, ""))), e.append(o), e.removeClass("thread-infoRow")), s && (o = $(this).find(".imgFrame").parent(), 
    o.html(o.html().replace(/(<a .*?") href=/, "$1 noklick=").replace(/ img--dummy.*" data-lazy-img="{&quot;src&quot;:&quot;/, '" src="').replace(/&quot;,&quot;finishClass&quot;:.* alt="/, '" alt="'))), 
    $(this).find(".userHtml").each(function() {
      $(this).html($(this).html().replace(/[^ -~Ä-ü]+|(&nbsp;)+|(\n\r)+|<\/p>|<\/div>/g, " ").replace(/<div>|<p>|(<br> *<br>)( |<br>)*/g, "<br><br>").replace(/(<li>)(<br>)+|<br>*(<br><\/li>)/g, "$1"));
    }), l) {
      var c = /avatar--type-s/;
      s && (c = /avatar--type-s|thread-avatar/g), $(this).find("a.user").each(function() {
        o = $(this).html(), a = $(this).attr(enHREF), n = o.replace(/<span.*/, "").replace(c, "avatar--type-m"), $(this).html(enPopupUser[0] + a + enPopupUser[1] + n + enPopupUser[2] + '<a href="' + a + '">' + o.replace(/.*<span class=".* space--mr-1">/, '<span class=" space--mr-1 user link-plain">') + "</a>");
      });
    }
    $(this).addClass("enClassActionDone");
  });
}

function EnstylerAvatarPopup() {
  enUserLogin && GM_config.get("enConfPopup") && addStyleString(".thread-footer-cell a img.avatar.vAlign--all-m.space--mr-1.thread-avatar {display: none;}");
}

function EnstylerPagePickerCreate() {
  if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
    var e, n, t, a = 1, o = 1;
    if ($(selectList).empty(), $("div.text--color-charcoalTint").length) {
      var i = $("div.text--color-charcoalTint").html().replace(/\r?\n|\r/g);
      isNaN(a = parseInt(i.replace(/.*>Seite /i, ""))) && (a = 1), isNaN(o = parseInt(i.replace(/.*page=/, ""))) && (o = a);
    }
    for (x = 1; x <= o; ) t = document.createElement("option"), t.text = x, selectList.add(t), n = x, e = Math.abs(x - a), x < 10 || 5 > e ? x++ : x < 1e3 && e > 600 ? x += Math.floor(e / 100) : x += Math.floor(e / 2);
    a > o && (o = a), o > n && (t = document.createElement("option"), t.text = o, selectList.add(t)), selectList.value = a;
    var s = [ ".js-navDropDown-messages", "enPageEnum js-navDropDown-messages vAlign--all-m" ];
    $(".test-loginButton").length && (s[0] = ".test-loginButton"), $(".voteBar").length && (s = [ ".voteBar--sticky-off--hide.hAlign--all-r", "enPageEnum subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]), 
    selectList.setAttribute("class", s[1]), $(s[0]).before(selectList);
  }
}

function EnstylerPagePickerDo() {
  $(".js-sticky .text--color-charcoalTint").length && (selectList.value = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">Seite ')[1]));
}

function EnstylerPageAction() {
  var e = "page=" + $(this).val(), n = ("" + enLocParser).replace(/page=.*|#.*/, "");
  n += n.endsWith("?") || n.endsWith("&") ? e : "?" + e, "/deals/" == enSection && (n += "#thread-comments"), window.location = n;
}

function EnstylerPagePickerRemove() {
  $(".enPageEnum").remove();
}

function EnstylerBlacklist() {
  enUserLogin && !GM_config.get("enConfWhitelist").includes(enUserName) && (GM_config.set("enConfWhitelist", "@" + enUserName + "," + GM_config.get("enConfWhitelist")), 
  GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist"))), enBlack = RegExp(GM_config.get("enConfBlacklist").replace(unwantedRegex[0], "").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), 
  enBlackTrue = !"".match(enBlack), enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), enWhiteTrue = !"".match(enWhite), 
  enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
}

function EnstylerBlacklistDo() {
  if (GM_config.get("enConfBlackEnable") && (enBlackTrue || enBlackTemp >= -900)) {
    var e = !1;
    $(".comments-list").length && (e = !0);
    var n;
    $("article").not(".enClassBlackDone, .threadWidget-item").each(function() {
      $(this).addClass(enClassBlackDone), n = $(".thread-category", $(this)).text() + " " + $(".thread-title a", $(this)).text() + " @" + $(".user", $(this)).text(), 
      e && (n += " " + $(".comments-item .userHtml", $(this)).text() + " @" + $(".vwo-user-link", $(this)).text()), n = n.replace(unwantedRegex[1], " "), enWhiteTrue && n.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && n.match(enBlack)) && ($(this).addClass(enClassHidden), 
      enBlacklisted++, EnstylerLastSeenSkip("#" + $(this).attr(enID)));
    }), EnstylerBlacklistShow();
  }
}

function EnstylerBlacklistShow() {
  enJSfieldDefs.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[enTEXT], enBlacklisted);
}

function EnstylerBlacklistRemove() {
  enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden), $(".enClassBlackDone").removeClass(enClassBlackDone);
}

function EnstylerBlacklistUnhide() {
  enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden);
}

function EnstylerFixedNav() {
  if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
    var e = $("header").html();
    $("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
    var n = myFixedCSS.every;
    "/diskussion/" == enSection && (n += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (n += myFixedCSS.subnav), n = n.replace(enPATTERN[enTEXT], enMainHeigth), 
    addStyleString(n);
  }
}

function EnstylerDealTime() {
  TodayStart = new Date(enNow.getFullYear(), enNow.getMonth(), enNow.getDate()), ShowTime = 3600 * GM_config.get("enConfDealMinTime") * 1e3, EnstylerDealTimeDo();
}

function EnstylerDealTimeDo() {
  if (enSection.match(enMainSectionMatch) && GM_config.get("enConfDealTime")) {
    var e, n, t = Date.now();
    $("time").not("." + EnstylerTimeSeen).each(function() {
      if (e = $(this).text(), e.length >= 8 && !e.endsWith("e") && (n = 6e4 * (60 * parseInt(e.replace(/.* ([0-9].*) [hu].*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*/, "$1"))), 
      !isNaN(n))) {
        if (DealDate.setTime(t - n), TodayStart > DealDate) e = "<EN-LANG:yesterday> " + ("" + DealDate).slice(16, 21) + " <EN-LANG:oclock>"; else {
          if (ShowTime >= n) return;
          e += ' (<span class="hide--toW2"><EN-LANG:today> </span>' + ("" + DealDate).slice(16, 21) + " <EN-LANG:oclock>)";
        }
        $(this).html(enLangLocalize(e, enTimeLang, enLANG)), $(this).addClass(EnstylerTimeSeen);
      }
    });
  }
}

function EnstylerLastSeen() {
  LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) ? (enSec = enNewestBase + enSection.replace(/\//, ""), GM_setValue(enNewestBase + "LastSec", enSec), 
  enSeenArticle = GM_getValue(enSec), void 0 === enSeenArticle && (enSeenArticle = ""), EnstylerLastSeenDo(), "" == enLocParser.search && $("article").not(".threadWidget-item").each(function() {
    return $(this).length ? (GM_setValue(enSec, $(this).attr(enID)), GM_setValue(enSec + "Last", enSeenArticle), !1) : void 0;
  })) : EnstylerLastSeenLast());
}

function EnstylerLastSeenDo() {
  "" != enSec && ("" != enSeenArticle ? (GM_setValue(enSec + "Last", enSeenArticle), $("#" + enSeenArticle).addClass("enClassMarkArticle")) : GM_setValue(enSec, "thread_1"));
}

function EnstylerLastSeenLast() {
  enSec = GM_getValue(enNewestBase + "LastSec"), GM_setValue(enSec, GM_getValue(enSec + "Last"));
}

function EnstylerLastSeenSkip(e) {
  e == "#" + enSeenArticle && (enSeenArticle = $(e).next().attr(enID), EnstylerLastSeenDo());
}

function enCheckUpdates() {
  if (isMozilla && GM_config.get("enConfInjectCSS")) {
    var e = (Date.now() / 6e4 | 0) - GM_getValue("enLastUpdateCheck");
    (isNaN(e) || e > enUpdateInterval) && enUpdateCSS();
  }
}

function enUpdateCSS() {
  var e = Date.now() / 6e4 | 0;
  enCacheExternalResource(enUpdateUrl + enComposeUpdateOpt(), "Enstyler2_CSS"), GM_setValue("enLastUpdateCheck", e);
}

function enComposeUpdateOpt() {
  var e = GM_getValue("EnstylerCssOpt");
  if (void 0 === e) return "";
  e = e.replace(/\n/g, "");
  var n = e.split(";");
  if ("" == e || !e.startsWith("#")) return "";
  e = "";
  for (var t = 0; t < n.length; t++) if ("" != n[t]) {
    var a = n[t].split(":");
    e += "&" + a[1].slice(0, -1) + "=" + a[1];
  }
  return e = "?" + e.slice(1);
}

function EnstylerMenuActions() {
  EnstylerNavRemove(), enInternational || EnstylerAddNav("Main", "<EN-LANG:discussion>", "/diskussion", "enMainDiscussion"), EnstylerAddNav("Main", "<EN-LANG:enstyler>", '<EN-LANG:enhref>" target="_blank', "enMainHomepage", "building"), 
  EnstylerAddNav("MainButton", "<EN-LANG:settings>", showEnstylerConfig, EnstylerButton, "page");
}

function EnstylerAddNav(e, n, t, a, o) {
  (void 0 === o || "" == o) && (o = enNavIconPat);
  var i = !1, s = enMenuItemCode[e].replace(enPATTERN[enID], a).replace(enPATTERN[enTEXT], n);
  o != enNavIconPat && (s = s.split(enNavIconPat).join("--type-" + o)), "function" == typeof t ? i = !0 : s = s.replace(enPATTERN[enHREF], t), "M" == e[0] && ("" == enAddMain && $(".nav-link.navMenu-trigger").click(debounce(300, EnstylerMainDo)), 
  enAddMain += s, i && (enAddMainFunc[enAddMainCount++] = {
    ID: a,
    target: t
  }));
}

function EnstylerMainDo() {
  $(".popover-content nav .navMenu-div").first().before(enLangLocalize(enAddMain, enMenuLang, enLANG));
  var e = $(".popover--mainNav"), n = 35 * (enAddMain.split(enNavEntry).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + n + "px"));
  for (var t = 0; enAddMainCount > t; t++) $("section #" + enAddMainFunc[t].ID).click(enAddMainFunc[t].target);
}

function EnstylerNavRemove() {
  enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, $(".navMenu-page").unbind("click"), $(".enNavEntry").remove();
}

function confLang(e) {
  return enLangLocalize("<EN-LANG:" + e + ">", enConfigLang, enLANG);
}

function getLanguages() {
  return [ "auto", "de", "en", "nl" ];
}

function showEnstylerConfig() {
  enGMConfigOpen ? GM_config.close() : (GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
}

function showEnstylerCSS() {
  enGetHome(), GM_config.open();
}

function confLangOpen() {
  GM_config.set("enConfLang", GM_getValue("enLang")), $('.GM_config button[id$="_saveBtn"]').html(enConfigLang[enLANG].save), $('.GM_config button[id$="_closeBtn"]').html(enConfigLang[enLANG].close);
}

function enAmazonMobileRedirect() {
  var e = "" + enLocParser;
  return e.startsWith("https://www.amazon") ? (GM_config.get("enConfAmazonRedirect") && (e.includes("/gp/aw/d/") ? window.location.assign(e.replace("/gp/aw/d/", "/dp/")) : window.location.assign(e.replace("/gp/aw/ol/", "/gp/offer-listing/"))), 
  !1) : !0;
}

function EnstylerStart() {
  EnstylerFixedNav();
  EnstylerLastSeen(), EnstylerDealTime(), EnstylerBlacklist(), EnstylerDealActions();
}

function EnstylerDelayedInit() {
  EnstylerMenuActions(), EnstylerPagePickerCreate(), $(".js-pagi-bottom").bind("DOMSubtreeModified", debounce(100, function() {
    EnstylerLastSeenDo(), EnstylerPagePickerDo(), EnstylerDealTimeDo(), EnstylerBlacklistDo(), EnstylerDealActionsDo();
  }));
}

function WaitForBody() {
  $("footer").length ? MAIN() : setTimeout(WaitForBody, 200);
}

function MAIN() {
  document.body.appendChild(enGMFrame);
  const e = Date.now();
  $(".nav").length && (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS"), 'domain("' + enLocParser.hostname), enCheckUpdates(), enMainHeigth = getOuterHeight("header"), 
  sleepAsync(1e3).then(function() {
    var e = $(".nav").css("background-color"), n = $(".btn--mode-special").first().css("background-color");
    addStyleString(" .GM_config {background-color: " + shadeRGBColor(e, -.3) + " !important; color: " + shadeRGBColor(e, .5) + "; top: " + enMainHeigth + "px !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover  { background-color: " + shadeRGBColor(e, .11) + " !important;} .GM_config input[type=button] { background-color: " + n + " !important; border-color: " + n + " !important; min-width: 10em;} .GM_config input[type=button]:hover, .btn--mode-special:hover { background-color: " + shadeRGBColor(n, .3) + " !important; border-color: " + shadeRGBColor(n, .3) + " !important;}");
  })), addStyleString(enCSS), "userstyles.org" != enInternationalSite ? enAmazonMobileRedirect() && (EnstylerInit(), EnstylerStart(), EnstylerStartupDelay = Date.now() - e, 
  "loading" == document.readyState || "interactive" == document.readyState ? $(window).bind("load", function() {
    EnstylerDelayedInit();
  }) : sleepAsync(EnstylerStartupDelay).then(function() {
    EnstylerDelayedInit();
  })) : (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS"), "url(https://userstyles.org"), EnstylerHomeButton(), enSetHome(), isMozilla && GM_config.get("enConfInjectCSS") && addStyleString(".install-status { display: none; }"));
}

function EnstylerHomeButton() {
  $("#EnstylerButton").remove(), input.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), $("#style-settings").after(input);
}

function enGetHome() {
  var e, n, t, a = "";
  $("#style-settings select").each(function() {
    e = $(this).attr(enID), n = $(this).val(), t = $("option[value=" + n + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  }), $("#style-settings input:checked").each(function() {
    e = $(this).attr(enID), n = $(this).val(), t = $("label[for=" + e + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  }), GM_config.set("saveOpt", a);
}

function enSetHome() {
  input.value = confLang("options");
  var e = GM_config.get("saveOpt");
  GM_setValue("EnstylerCssOpt", e), e = e.replace(/\n/g, "");
  var n = e.split(";");
  if ("" != e && e.startsWith("#")) {
    for (var t = 0; t < n.length; t++) {
      var a = n[t].split(":");
      a[0].match(/^#setting/i) ? ($(a[0]).val(""), $(a[0]).val(a[1])) : a[0].startsWith("#option") ? $(a[0]).prop("checked", !0) : "" != a[0] && alert('unkown option: "' + a + '"');
    }
    addStyleString(isMozilla && GM_config.get("enConfInjectCSS") ? ".install-status { display: none; }" : ".install-status { display: inline; }"), HideShowLogoSelect(), 
    HideShowEnstyler();
  }
}

function closeOnClick() {
  sleepAsync(1e4).then(function() {
    window.close();
  });
}

function showNotSaved() {
  input.value = confLang(optnotsave), EnstylerHomeButton();
}

function ShowHideItem(e, n, t, a) {
  $("#style-settings " + t).each(function() {
    -1 != $(this).text().indexOf(a) && ($(e).val() == n ? $(this).parent().addClass(enClassHidden) : $(this).parent().removeClass(enClassHidden));
  });
}

function HideShowLogoSelect() {
  ShowHideItem("#setting-455195", "ik-logo1", "label", "MyDealz Logo");
}

function HideShowEnstyler() {
  ShowHideItem("#setting-451668", "ik-compact1", "label", "|---");
}

function enLangLocalize(e, n, t) {
  return e = e.replace(enLangPat, function(e, a) {
    return n.hasOwnProperty(t) && n[t].hasOwnProperty(a) ? n[t][a] : a;
  }), e.match(enLangPat) ? enLangLocalize(e, n, t) : e;
}

function addStyleString(e, n) {
  if (void 0 === n && (n = ""), e.match(enUserScript.detect)) {
    "" == n && (n = enLocParser.hostname);
    var t = e.split(n);
    e = "";
    for (var a = 1; a < t.length; a++) t[a].includes("{") && (e += t[a].replace(enUserScript.split, "").replace(enUserScript.next, ""));
  }
  var o = document.createElement("style");
  o.innerHTML = e, document.body.appendChild(o);
}

function capitalizeFirstLetter(e) {
  return e[0].toUpperCase() + e.slice(1);
}

function truncStringWord(e, n, t) {
  return void 0 === t && (t = " "), e.length > n ? (e = e.substr(0, n - 1), e.substr(0, e.lastIndexOf(t)) + "...") : e;
}

function sleepAsync(e) {
  return new Promise(resolve => setTimeout(resolve, e));
}

function shadeRGBColor(e, n) {
  var t = e.split(","), a = 0 > n ? 0 : 255, o = 0 > n ? -1 * n : n, i = parseInt(t[0].slice(4)), s = parseInt(t[1]), l = parseInt(t[2]);
  return "rgb(" + (Math.round((a - i) * o) + i) + "," + (Math.round((a - s) * o) + s) + "," + (Math.round((a - l) * o) + l) + ")";
}

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

function enCacheExternalResource(e, n) {
  GM_xmlhttpRequest({
    method: "GET",
    url: e,
    onload: function(e) {
      var t = e.responseText.replace(/\r\n/g, " ").replace(enStripComments, "").replace(enFixCSS, "100%");
      GM_setValue(n, ""), sleepAsync(500).then(GM_setValue(n, t)), addStyleString(t);
    }
  });
}

function getOuterHeight(e) {
  e = "string" == typeof e ? document.querySelector(e) : e;
  var n = window.getComputedStyle(e), t = parseFloat(n.marginTop) + parseFloat(n.marginBottom);
  return Math.ceil(e.offsetHeight + t);
}

const enLocParser = location, enInternationalSite = enLocParser.hostname.replace("www.", ""), enInternationalName = -1 == enInternationalSite.indexOf("pepper") ? capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")) : enInternationalSite, enInternational = "Mydealz" != enInternationalName;

var enLANG = enInternationalName.match(/mydealz|preisjaeger|userstyle/i) ? "de" : "en";

const enLangPat = /<EN-LANG:(.*?)>/g, myLang = GM_getValue("enLang");

"" == myLang || void 0 === myLang ? GM_setValue("enLANG", "") : enLANG = myLang;

var isMozilla = void 0 === GM_info.scriptHandler || !GM_info.scriptHandler.startsWith("Tamp"), enUserLogin = !1, enUserName = "", enSection = "";

const DEBUG = !1;

var enInitTime;

const enDealAction = [ '<a title="<EN-LANG:post>" class="link ico ico--pos-l ico--type-comment-blue linkPlain space--mr-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><span class="hide--fromW3 hide--toW2"><EN-LANG:po></span>', "", "</a>", '<a title="<EN-LANG:remove>" class="link text--color-blue ico ico--type-bookmark-blue linkPlain ico--pos-l space--mr-3"data-handler="track replace" data-replace="{&quot;endpoint&quot;:&quot;https://www.mydealz.de/threads/<ENSTYLER-THREADID-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><span class="hide--fromW3 hide--toW2"><EN-LANG:rem></span>', "", "</a>", '<a title="<EN-LANG:edit>" class="link text--color-blue ico ico--type-pencil-blue linkPlain ico--pos-l space--mr-3"href="<ENSTYLER-HREF-HERE>/edit" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_thread_edit_form&quot;,&quot;beacon&quot;:true}">', '<span class="hide--toW3"><EN-LANG:edit></span><span class="hide--fromW3 hide--toW2"><EN-LANG:ed></span>', "", "<span></a>", '<a title="<EN-LANG:mail>" class="link text--color-blue ico ico--type-code-blue linkPlain ico--pos-l space--mr-3"href="mailto:?subject=<ENSTYLER-TEXT-HERE>" <span class="hide--toW3">', '<span class="hide--toW3"><EN-LANG:mail></span><span class="hide--fromW3 hide--toW2"><EN-LANG:ma></span>', "", "<span></a>" ], enDealLang = {
  de: {
    post: "Sag was dazu",
    remove: "Von Liste entfernen",
    edit: "Bearbeiten",
    mail: "Mail versenden",
    po: "Sag",
    rem: "Entf",
    ed: "Bearb",
    ma: "Mail"
  },
  en: {
    post: "post a comment",
    remove: "remove from list",
    edit: "edit",
    mail: "send as mail",
    po: "post",
    rem: "remove",
    ed: "edit",
    ma: "mail"
  }
}, enDealMarker = "#thread_";

var enDealAdd = "", enDealUnbook = !1, enDealFooter = "";

const enDealActionPreHtml = '<span class="js-options bg--em bRad--a space--h-3 space--v-3 space--mt-3 text--b">', enPopupUser = [ '<button data-handler="track popover" data-track="{&quot;action&quot;:&quot;show_short_user_profile&quot;,&quot;label&quot;:&quot;engagement&quot;}" data-popover="{&quot;endpoint&quot;:&quot;', '/short&quot;,&quot;target&quot;:&quot;#template-popoverLoader&quot;,&quot;layout&quot;:[{&quot;preset&quot;:&quot;e&quot;,&quot;y&quot;:&quot;50%&quot;,&quot;left&quot;:{&quot;offset&quot;:0},&quot;width&quot;:300,&quot;maxWidth&quot;:&quot;100%&quot;}]}">', "</button>" ], enClassAvatarDone = "enClassAvatarDone", EnstylerPageEnum = "enPageEnum", selectList = document.createElement("select");

selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;

const enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone";

var enBlacklisted = 0;

const unwantedRegex = [ /[\[\]\(\)\{\}\?\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ];

var enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp;

const myFixedCSS = {
  every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .userProfile, .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)}"
};

var enNow = new Date(), DealDate = new Date(), TodayStart, ShowTime, EnstylerTimeSeen = "enTimeSeen";

const enTimeLang = {
  de: {
    yesterday: "Gestern",
    today: "heute",
    oclock: "Uhr"
  },
  en: {
    oclock: "o&acute;clock"
  }
};

var enSec = "", enSeenArticle = "";

const enNewestBase = "enNewest" + enInternationalSite;

var LastSeenOnce = !0;

const enUpdateUrl = "https://userstyles.org/styles/128262/enstyler2-style-your-mydealz.css";

var enUpdateInterval = 1440;

const enMainSectionMatch = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, enHREF = "href", enID = "id", enTEXT = "text", enPATTERN = {
  href: /<ENSTYLER-HREF-HERE>/g,
  id: /<ENSTYLER-THREADID-HERE>/g,
  text: /<ENSTYLER-TEXT-HERE>/g
}, enNavEntry = "enNavEntry", enMenuItemCode = {
  Main: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-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-THREADID-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-THREADID-HERE>"><span class="navMenu-link-ico ico  ico--type-discussion-navMenuLayerText"></span><ENSTYLER-TEXT-HERE></a>',
  SubButton: '<li class="enNavEntry subNavMenu-item--separator test-tablink-discussed"><a  class="subNavMenu-item subNavMenu-link space--h-4 vAlign--all-m" id="<ENSTYLER-THREADID-HERE>"><span class="box--all-i size--all-xl vAlign--all-m"><ENSTYLER-TEXT-HERE></span></a></li>'
}, enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton", enMenuLang = {
  de: {
    discussion: "Alle Diskussionen",
    enstyler: "Enstyler Homepage",
    enhref: "https://www.mydealz.de/diskussion/enstyler-856062",
    settings: "Enstyler Einstellungen"
  },
  en: {
    discussion: "All discussions",
    enstyler: "Enstyler Homepage",
    enhref: "https://greasyfork.org/de/scripts/24243-enstylerjs",
    settings: "Enstyler Settings"
  }
}, enDiscussionURL = {
  Mydealz: {
    url: "/diskussion"
  },
  Preisjaeger: {
    url: "/diskussion"
  },
  Nl: {
    url: "/discussies"
  }
};

var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;

const enJSAutoUpdate = GM_info.scriptWillUpdate;

var enUpdateWindow;

const enConfigLang = {
  de: {
    headline: "Enstyler - Einstellungen",
    features: "Erweiterte Funktionen f&uuml;r Enstyler",
    configcss: "CSS Optionen",
    userscript: "Update Enstyler",
    cookies: "No Cookies",
    injectcss: "CSS ohne Stylish laden",
    config: "Konfiguration",
    navfixed: "feste Haupnavigation",
    userpopup: "Popuop f&uuml;r Userinfo",
    touch: "Touch Support aktivieren",
    amazon: "Amazon mobile redirect",
    dealaction: "zus&auml;tzliche Deal Aktionen",
    picker: "Zeige Page Picker",
    dealtime: "Zeige echte Deal Zeit",
    mintime: "wenn &auml;lter als x Stunden",
    blacklist: "Aktiviere Black- / Whitelist",
    blackcold: "Blacklist wenn k&auml;lter als",
    black: "Blacklist - Dealz, Kategorie, @Benutzer, Kommentare",
    white: "Whitelist",
    unblack: "Entferne von Blacklist:",
    lang: "Enstyler Sprache w&auml;hlen",
    save: "Speichern",
    close: "Schlie&szlig;en",
    savecss: "Deine ausgewählten CSS Optionen",
    howtocss: 'Zum Beibehalten der CSS Optionen "<EN-LANG:save>" klicken ',
    options: "Optionen speichern",
    optnotsave: "Klicken zum Speichern der Optionen!"
  },
  en: {
    headline: "Enstyler - Settings",
    features: "additonal features for Enstyler",
    configcss: "CSS Options",
    userscript: "Update Enstyler",
    cookies: "No Cookies",
    injectcss: "Inject CSS without Stylish",
    config: "Configuration",
    navfixed: "Display FIXED MainNav",
    userpopup: "Show Popuop Userinfo",
    touch: "Enable Touch Support",
    amazon: "Amazon mobile redirect",
    dealaction: "additional Deal actions",
    picker: "Enable Page Picker",
    dealtime: "Show real Deal Time",
    mintime: "if older than Hours",
    blacklist: "Enable Black- / Whitelist",
    blackcold: "Blacklist if colder then",
    black: "Blacklist - dealz, categories, @users, comments",
    white: "Whitelist",
    unblack: "Remove from blacklist:",
    lang: "Select Enstyler Language",
    save: "Save",
    close: "Close",
    savecss: "Your selected CSS options",
    howtocss: 'To store your CSS options klick "<EN-LANG:save>" ',
    options: "Save options",
    optnotsave: "Klick to save Options!"
  }
}, enUnblackText = confLang("unblack") + " <ENSTYLER-TEXT-HERE> Dealz", enJSfieldDefs = {
  enstylerCSS: {
    section: [ confLang("features"), "" ],
    label: confLang("configcss"),
    type: "button",
    click: function() {
      enUpdateWindow = window.open("https://userstyles.org/styles/128262#style-info", "UserCSS", "width=600,height=950,left=0,top=0"), GM_setValue("enLastUpdateCheck", 0);
    }
  },
  enstylerJS: {
    label: confLang("userscript"),
    type: "button",
    click: function() {
      enUpdateWindow = window.open("https://greasyfork.org/scripts/24243-enstylerjs/code/EnstylerJS.user.js", "UserScript", "width=110,height=110,left=0,top=0"), sleepAsync(5e3).then(function() {
        enUpdateWindow.close();
      });
    }
  },
  dontCookies: {
    label: confLang("cookies"),
    type: "button",
    click: function() {
      window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
    }
  },
  enConfInjectCSS: {
    label: confLang("injectcss"),
    type: "checkbox",
    default: !0
  },
  Section: {
    section: [ confLang("config"), "" ],
    type: "hidden"
  },
  enConfNavFixed: {
    label: confLang("navfixed"),
    type: "checkbox",
    default: !0
  },
  enConfMoreDeal: {
    label: confLang("dealaction"),
    type: "checkbox",
    default: !0
  },
  enConfPopup: {
    label: confLang("userpopup"),
    type: "checkbox",
    default: !0
  },
  enConfTouch: {
    label: confLang("touch"),
    type: "checkbox",
    default: !1
  },
  enConfAmazonRedirect: {
    label: confLang("amazon"),
    type: "checkbox",
    default: !0
  },
  enConfPagePicker: {
    label: confLang("picker"),
    type: "checkbox",
    default: !0
  },
  enConfDealTime: {
    label: confLang("dealtime"),
    type: "checkbox",
    default: !0
  },
  enConfDealMinTime: {
    label: confLang("mintime"),
    type: "int",
    min: 1,
    max: 24,
    size: 4,
    default: 6
  },
  enConfBlackEnable: {
    label: confLang("blacklist"),
    type: "checkbox",
    default: !0
  },
  enConfHideColder: {
    label: confLang("blackcold"),
    type: "int",
    min: -9999,
    max: -9,
    size: 4,
    default: -999
  },
  enConfBlacklist: {
    label: confLang("black"),
    type: "text",
    size: 70,
    default: "G.steklo, Bangood, @Admin"
  },
  enConfWhitelist: {
    label: confLang("white"),
    type: "text",
    size: 70,
    default: ""
  },
  enConfUnblacklist: {
    label: confLang("unblack"),
    type: "button",
    click: function() {
      EnstylerBlacklistUnhide();
    }
  },
  enConfLang: {
    label: confLang("lang"),
    type: "select",
    options: getLanguages(),
    default: ""
  },
  saveOpt: {
    type: "hidden"
  }
}, enHomefieldDefs = {
  saveOpt: {
    section: [ confLang("savecss"), "" ],
    label: confLang("howtocss"),
    type: "textarea",
    size: 70
  },
  enConfInjectCSS: {
    label: confLang("injectcss"),
    type: "checkbox",
    default: !0
  },
  enConfLang: {
    type: "hidden",
    options: getLanguages(),
    default: ""
  }
}, enGMFrame = document.createElement("div");

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

var enGMConfigOpen = !1;

const enRemoveConfig = [ {
  check: !1,
  switch: "enConfDealTime",
  remove: "enConfDealMinTime"
}, {
  check: !1,
  switch: "enConfBlackEnable",
  remove: "enConfWhitelist"
}, {
  check: !1,
  switch: "enConfBlackEnable",
  remove: "enConfBlacklist"
}, {
  check: !1,
  switch: "enConfBlackEnable",
  remove: "enConfHideColder"
}, {
  check: !1,
  switch: "enConfBlackEnable",
  remove: "enConfUnblacklist"
} ];

if (window.location.hostname.endsWith("userstyles.org")) GM_config.init({
  id: "GM_config",
  title: confLang("headline") + " CSS",
  fields: enHomefieldDefs,
  events: {
    open: function() {
      confLangOpen(), isMozilla || GM_config.fields.enConfInjectCSS.remove();
    },
    save: function() {
      enSetHome(), enUpdateCSS(), EnstylerHomeButton(), GM_config.close();
    },
    close: function() {
      enGMConfigOpen = !1;
    }
  },
  frame: enGMFrame
}); else {
  var enFixedNavLast = !1;
  GM_config.init({
    id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
    title: confLang("headline"),
    fields: enJSfieldDefs,
    events: {
      open: function() {
        enFixedNavLast = GM_config.get("enConfNavFixed"), confLangOpen(), $(enRemoveConfig).each(function() {
          GM_config.get(this["switch"]) == this.check && GM_config.fields[this.remove].remove();
        }), enJSAutoUpdate && GM_config.fields.enstylerJS.remove(), isMozilla || (GM_config.fields.dontCookies.remove(), GM_config.fields.enConfInjectCSS.remove());
      },
      save: function() {
        "auto" == GM_config.get("enConfLang") ? GM_setValue("enLang", "") : GM_setValue("enLang", GM_config.get("enConfLang")), GM_config.get("enConfNavFixed") || GM_config.get("enConfNavFixed") == enFixedNavLast || window.location.reload(!1), 
        GM_config.close(), enCheckUpdates(), EnstylerStart(), EnstylerMenuActions(), EnstylerPagePickerCreate(), GM_config.open();
      },
      close: function() {
        enGMConfigOpen = !1;
      }
    },
    frame: enGMFrame
  });
}

var enCSS = ".threadWidget-footer::after {display: none !important}; .GM_config {left: 5% !iportant; top: 8% !important; height: auto !important; max-width: 35em !important; background-color: white;} .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; } .enClassHidden, #EnPopup_closeBtn {display: none;}", enMainHeigth;

WaitForBody();

var input = document.createElement("input");

input.type = "button", input.setAttribute(enID, EnstylerButton), input.onclick = showEnstylerCSS, input.value = confLang("options"), $(".install").click(closeOnClick), 
$("#style-settings").click(showNotSaved), $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);

const enUserScript = {
  detect: /.*?@-moz-document .*?\{\s*/,
  split: /^.*?\{/,
  next: /}\s*@-moz-document.*/
}, enStripComments = /\/\*.*?\*\/|   *|\t/g, enFixCSS = /1111.11%/g;