Greasy Fork is available in English.

EnstylerJS

MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect

Mint 2017.01.11.. Lásd a legutóbbi verzió

// ==UserScript==
// @name        EnstylerJS
// @namespace   Enstyler
// @description MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect
// @include     https://www.preisjaeger.at/*
// @include     https://www.mydealz.de/*
// @include     https://userstyles.org/styles/128262/*
// @include     https://www.amazon.*/gp/aw/*
// @version     3.01.112-min
// @grant       GM_getValue
// @grant       GM_setValue
// @require     http://code.jquery.com/jquery-3.1.1.min.js
// @require     http://openuserjs.org/src/libs/sizzle/GM_config.js
// @run-at      document-start
// ==/UserScript==
// mobile minimized Version, see develop version for commented Source:
// https://greasyfork.org/de/scripts/24244-enstylerjs-develop/code?version=168651
// https://greasyfork.org/de/scripts/24244-enstylerjs-develop/diff?v1=168651&v2=166127
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 (enUserLogin && GM_config.get("enConfMoreDeal")) {
    enDealActionMailFooter = "%0D%0A%0D%0A-- %0D%0A" + enInternationalName + ":%0D%0A" + $("footer ul li:first p").html().replace(/.*<br>/g, "");
    var e = enLocParser.pathname, t = 0;
    switch ("" != enUserName && (e = e.replace(enUserName + "/", "")), $(".ico--type-grid-subNavActive").length && (t = 1), enDealAdd = enDealAction[0] + enDealAction[1 + t] + enDealAction[3], !0) {
     case e.endsWith("profile/saved-deals"):
      enDealAdd += enDealAction[4] + enDealAction[5 + t], +enDealAction[7], enDealUnbook = !0;
      break;

     case e.endsWith("profile/diskussion"):
     case e.endsWith(enUserName):
      enDealAdd += enDealAction[8] + enDealAction[9 + t] + enDealAction[11];
    }
    enDealAdd += enDealAction[12] + enDealAction[13 + t] + enDealAction[15], enDealAdd = enDealActionOuterHtml[0] + enDealAdd + enDealActionOuterHtml[1], EnstylerDealActionsDo();
  }
}

function EnstylerDealActionsDo() {
  if (enUserLogin && GM_config.get("enConfMoreDeal")) {
    var e, t, n, a, o;
    $("article:not(.enClassHidden)").each(function() {
      e = $(".thread-infoRow", $(this)), e.length && !$(enDealNoAction, $(this)).length && (t = $(".thread-title a", $(this)), n = t.attr(enHREF), a = encodeURIComponent(enInternationalName + ": " + t.text()), 
      a.length < 100 && (a += encodeURIComponent($(".thread-price", $(this)).text().replace(/\t/g, "").replace(/^(.)/g, " -> $1"))), o = enDealAdd.replace(enPATTERN[enHREF], n).replace(enPATTERN[enTEXT], truncStringWord(a, 160, "%20") + "&body=" + a + "%0D%0A%0D%0A" + n + enDealActionMailFooter), 
      enDealUnbook && (o = o.replace(enPATTERN[enID], ("#" + $(this).attr(enID)).replace(enDealMarker, ""))), e.append(o), e.removeClass("thread-infoRow"));
    }), $(".thread--type-detail .userHtml").each(function() {
      $(this).html($(this).html().replace(/<\/p>|<\/div>/gi, "").replace(/<div>|<p>/gi, "<br><br>").replace(/<br>(<br>)*<br>/gi, "<br><br>"));
    });
  }
}

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

function EnstylerAvatarPopupDo() {
  if (enUserLogin && GM_config.get("enConfUser")) {
    var e, t, n, a = GM_config.get("enConfAvatar");
    $(".thread-footer-cell a.user.linkPlain, .user.linkPlain.thread-user").each(function() {
      $(this).hasClass(enClassAvatarDone) || $(this).hasClass(enClassBlackDone) || ($(this).addClass(enClassAvatarDone), e = $(this).html(), t = $(this).attr(enHREF), n = e.replace(/<span.*/, "").replace(/avatar--type-s/, "avatar--type-m"), 
      a && (n = n.replace(/thread-avatar/, "avatar--type-m")), $(this).html(enPopupUser[0] + t + enPopupUser[1] + n + enPopupUser[2] + '<a href="' + t + '">' + e.replace(/.*<span class=".* space--mr-1">/, '<span class=" space--mr-1 user link-plain">') + "</a>"));
    });
  }
}

function EnstylerPagePickerCreate() {
  if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
    var e, t, n, a, o;
    if ($(selectList).empty(), $(".text--color-charcoalTint").length) {
      var i = $(".text--color-charcoalTint").html().replace(/\r?\n|\r/g);
      isNaN(e = parseInt(i.replace(/.*>Seite /i, ""))) && (e = 1), isNaN(t = parseInt(i.replace(/.*page=/, ""))) && (t = e);
    }
    for (x = 1; x <= t; ) {
      o = document.createElement("option"), o.text = x, selectList.add(o), a = x, n = Math.abs(x - e), x < 10 || 5 > n ? x++ : x < 1e3 && n > 600 ? x += Math.floor(n / 100) : x += Math.floor(n / 2);
    }
    e > t && (t = e), t > a && (o = document.createElement("option"), o.text = t, selectList.add(o)), selectList.value = e;
    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:last", "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(), t = ("" + enLocParser).replace(/page=.*|#.*/, "");
  t += t.endsWith("?") || t.endsWith("&") ? e : "?" + e, "/deals/" == enSection && (t += "#thread-comments"), window.location = t;
}

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;
    $("article:not(.enClassBlackDone, .threadWidget-item)").each(function() {
      $(this).addClass(enClassBlackDone), e = ($(".thread-category", $(this)).text() + " " + $(".thread-title a", $(this)).text() + " @" + $(".user", $(this)).text()).replace(unwantedRegex[1], " "), enWhiteTrue && e.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && e.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 t = myFixedCSS.every;
    "/diskussion/" == enSection && (t += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (t += myFixedCSS.subnav), t = t.replace(enPATTERN[enTEXT], enMainHeigth), addStyleString(t);
  }
}

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

function EnstylerDealTimeDo() {
  if (GM_config.get("enConfDealTime")) {
    var e, t = Date.now();
    $("time:not(." + EnstylerTimeSeen + ")").each(function() {
      if (e = $(this).text(), e.length >= 9 && e.startsWith("v")) {
        var n = 6e4 * (60 * parseInt(e.replace(/.* ([0-9].*) h.*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*/, "$1")));
        if (DealDate.setTime(t - n), TodayStart > DealDate) {
          $(this).text("gestern " + ("" + DealDate).slice(16, 21) + " Uhr");
        } else {
          if (ShowTime >= n) {
            return;
          }
          $(this).html(e + ' (<span class="hide--toW2">heute </span>' + ("" + DealDate).slice(16, 21) + " Uhr)");
        }
        $(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("enConfCheckEnUpdate")) {
    var e = (Date.now() / 6e4 | 0) - GM_getValue("enLastUpdateCheck");
    (isNaN(e) || e > enUpdateInterval) && enUpdateCSS();
  }
}

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

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

function EnstylerMenuActions() {
  EnstylerNavRemove(), enInternational || EnstylerAddNav("Main", "Alle Diskussionen", "https://www.mydealz.de/diskussion", "enMainDiscussion"), EnstylerAddNav("Main", "Enstyler Homepage", 'https://www.mydealz.de/diskussion/enstyler-856062" target="_blank', "enMainHomepage", "building"), 
  EnstylerAddNav("MainButton", "Enstyler Einstellungen", showEnstylerConfig, EnstylerButton, "page");
}

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

function EnstylerMainDo() {
  $(enAddMain).insertBefore(".popover-content nav .navMenu-div:first");
  var e = $(".popover--mainNav"), t = 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: " + t + "px"));
  for (var n = 0; enAddMainCount > n; n++) {
    $("section #" + enAddMainFunc[n].ID).click(enAddMainFunc[n].target);
  }
}

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

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

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

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(), EnstylerAvatarPopup(), EnstylerDealActions();
}

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

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

function MAIN() {
  document.body.appendChild(enGMFrame), isMozilla && GM_config.get("enConfCheckEnUpdate") && addStyleString(GM_getValue("Enstyler2_CSS"));
  const e = Date.now();
  if ($(".nav").length) {
    enCheckUpdates();
    var t = $(".nav").css("background-color");
    enMainHeigth = parseInt($("header").outerHeight()), enCSS += " .GM_config {background-color: " + shadeRGBColor(t, -.3) + " !important; color: " + shadeRGBColor(t, .5) + "; top: " + enMainHeigth + "px !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover  { background-color: " + shadeRGBColor(t, .11) + " !important;}";
  }
  addStyleString(enCSS), window.location.hostname.endsWith("userstyles.org") ? (EnstylerHomeButton(), enSetHome(), isMozilla && GM_config.get("enConfCheckEnUpdate") && addStyleString(".install-status { display: none; }")) : enAmazonMobileRedirect() && (EnstylerInit(), 
  EnstylerStart(), EnstylerStartupDelay = Date.now() - e, "loading" == document.readyState || "interactive" == document.readyState ? $(window).bind("load", function() {
    EnstylerDelayedInit();
  }) : sleepAsync(EnstylerStartupDelay).then(function() {
    EnstylerDelayedInit();
  }));
}

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

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

function enSetHome() {
  input.value = "Save Options";
  var e = GM_config.get("saveOpt");
  GM_setValue("Enstyler2Opt", e), e = e.replace(/\n/g, "");
  var t = e.split(";");
  if ("" != e && e.startsWith("#")) {
    for (var n = 0; n < t.length; n++) {
      var a = t[n].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("enConfCheckEnUpdate") ? ".install-status { display: none; }" : ".install-status { display: inline; }"), HideShowLogoSelect(), HideShowEnstyler();
  }
}

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

function showNotSaved() {
  input.value = "Klick to save Options!", EnstylerHomeButton();
}

function ShowHideItem(e, t, n) {
  $(e).val() == t ? $("#style-settings " + n).parent().addClass(enClassHidden) : $("#style-settings " + n).parent().removeClass(enClassHidden);
}

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

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

function addStyleString(e) {
  var t = document.createElement("style");
  t.innerHTML = e, document.body.appendChild(t);
}

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

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

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

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

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

function GM_saveExternalCors(e, t) {
  var n = window.XMLHttpRequest, a = !1;
  try {
    a = n && "withCredentials" in new n();
  } catch (o) {}
  if (!a) {
    return void console.error("CORS not supported");
  }
  var i = new n();
  i.open("GET", e), i.onload = function() {
    if (i.onload = i.onerror = null, i.status < 200 || i.status >= 300) {
      console.error("style failed to load: " + e);
    } else {
      var n = i.responseText.replace(/\r\n/g, " ").replace(enStripComments, "");
      GM_setValue(t, n), addStyleString(n);
    }
    i.onerror = function() {
      i.onload = i.onerror = null, console.error("XHR CORS CSS fail:" + styleURI);
    };
  }, i.send();
}

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

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="Sag was dazu" class="link ico ico--pos-l ico--type-comment-blue 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">Sag was dazu</span><span class="hide--fromW3 hide--toW2">Sag</span>', "", "</a>", '<a title="Von Liste entfernen" class="link text--color-blue ico ico--type-bookmark-blue 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">Von Liste entfernen</span><span class="hide--fromW3 hide--toW2">Enft</span>', "", "</a>", '<a title="Bearbeiten" class="link text--color-blue ico ico--type-pencil-blue 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">Bearbeiten</span><span class="hide--fromW3 hide--toW2">Bearb</span>', "", "<span></a>", '<a title="Als Mail versenden" class="link text--color-blue ico ico--type-code-blue ico--pos-l space--mr-3"href="mailto:?subject=<ENSTYLER-TEXT-HERE>" <span class="hide--toW3">', '<span class="hide--toW3">Mail versenden</span><span class="hide--fromW3 hide--toW2">Mail</span>', "", "<span></a>" ], enDealMarker = "#thread_", enDealNoAction = ".ico--type-clock-grey, .vote-temp--colder";

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

const enDealActionOuterHtml = [ '<span class="js-options bg--em bRad--a space--h-3 space--v-3 space--mt-3 text--b">', "</span>" ], 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 enUnblackText = "unBlacklist <ENSTYLER-TEXT-HERE> Dealz", 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", 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";

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

const enJSAutoUpdate = GM_info.scriptWillUpdate;

var enUpdateWindow;

const enJSfieldDefs = {
  enstyler: {
    section: [ "additonal features for Enstyler", "" ],
    label: "Config CSS",
    type: "button",
    click: function() {
      enUpdateWindow = window.open("https://userstyles.org/styles/128262#style-info", "UserCSS", "width=600,height=950,left=0,top=0");
    }
  },
  enstylerJS: {
    label: "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: "No Cookies",
    type: "button",
    click: function() {
      window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
    }
  },
  enConfCheckEnUpdate: {
    label: "Inject CSS without Stylish",
    type: "checkbox",
    default: !0
  },
  Section: {
    section: [ "Configuration", "" ],
    type: "hidden"
  },
  enConfNavFixed: {
    label: "Display FIXED MainNav",
    type: "checkbox",
    default: !0
  },
  enConfUser: {
    label: "Show Popuop Userinfo",
    type: "checkbox",
    default: !0
  },
  enConfAvatar: {
    label: "bigger Avatar for Popuop",
    type: "checkbox",
    default: !0
  },
  enConfAmazonRedirect: {
    label: "Amazon mobile redirect",
    type: "checkbox",
    default: !0
  },
  enConfMoreDeal: {
    label: "additional Deal actions",
    type: "checkbox",
    default: !0
  },
  enConfPagePicker: {
    label: "Enable Page Picker",
    type: "checkbox",
    default: !0
  },
  enConfDealTime: {
    label: "Show real Deal Time",
    type: "checkbox",
    default: !0
  },
  enConfDealMinTime: {
    label: "if older than Hours",
    type: "int",
    min: 1,
    max: 24,
    size: 4,
    default: 6
  },
  enConfBlackEnable: {
    label: "Enable Black- / Whitelist",
    type: "checkbox",
    default: !0
  },
  enConfHideColder: {
    label: "Blacklist if colder then",
    type: "int",
    min: -9999,
    max: -9,
    size: 4,
    default: -999
  },
  enConfBlacklist: {
    label: "Blacklist - deals, categories, @users",
    type: "text",
    size: 70,
    default: "Nutella, Bangood, @Admin"
  },
  enConfWhitelist: {
    label: "Whitelist",
    type: "text",
    size: 70,
    default: ""
  },
  enConfUnblacklist: {
    label: "UnBlacklist",
    type: "button",
    click: function() {
      EnstylerBlacklistUnhide();
    }
  },
  saveOpt: {
    type: "hidden"
  }
}, enHomefieldDefs = {
  saveOpt: {
    section: [ "save your CSS options for next visit", "" ],
    label: 'Select your CSS on main page then come back and klick "Save"  ',
    type: "textarea",
    size: 70
  },
  enConfCheckEnUpdate: {
    label: "Inject CSS without Stylish",
    type: "checkbox",
    default: !0
  },
  copy: {
    section: [ "", '(c) Gnadelwartz - <a target="blank" href="https://www.mydealz.de/diskussion/enstyler2-style-your-mydealz-incl-pepper-sites-736219">Enstyler2 - Style your MyDealz</a>' ],
    type: "hidden",
    value: "Some hidden value"
  }
}, enGMFrame = document.createElement("div");

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

var enGMConfigOpen = !1;

if (window.location.hostname.endsWith("userstyles.org")) {
  GM_config.init({
    id: "GM_config",
    title: "Enstyler2 - Settings",
    fields: enHomefieldDefs,
    events: {
      open: function() {
        isMozilla || GM_config.fields.enConfCheckEnUpdate.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: "EnstylerJS - Settings",
    fields: enJSfieldDefs,
    events: {
      open: function() {
        var e = [ {
          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"
        } ];
        enFixedNavLast = GM_config.get("enConfNavFixed"), $(e).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.enConfCheckEnUpdate.remove());
      },
      save: function() {
        GM_config.get("enConfNavFixed") || GM_config.get("enConfNavFixed") == enFixedNavLast || window.location.reload(!1), GM_config.close(), 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 = "Save Options", $(".install").click(closeOnClick), $("#style-settings").click(showNotSaved), 
$("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);

const enStripComments = /\/\*.*?\*\/|   *|\t/g;