// ==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 2.12.224-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
// ==/UserScript==
// mobile minimized Version, see last version 2.12.222 for commented Source
function EnstylerInit() {
addStyleString(".threadWidget-footer::after {display: none !important};"), (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr("href"),
enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1")) : $(document).on("click", ".test-loginButton", EnstylerLastSeenLast), enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
}
function EnstylerDealActions() {
var e, n;
if (enUserLogin && GM_config.get("enConfMoreDeal")) {
switch (enDealActionMailFooter = "%0D%0A%0D%0A-- %0D%0A" + enInternationalName + ":%0D%0A" + $("footer ul li:first p").html().replace(/.*<br>/g, ""),
e = enLocParser.pathname, n = 0, "" != 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 += enDealAction[12] + enDealAction[13 + n] + enDealAction[15], enDealAdd = enDealActionOuterHtml[0] + enDealAdd + enDealActionOuterHtml[1],
EnstylerDealActionsDo();
}
}
function EnstylerDealActionsDo() {
enUserLogin && GM_config.get("enConfMoreDeal") && ($("article:not(.enClassHidden)").each(function() {
var e, n, t, a, o = $(".thread-infoRow", $(this));
o.length && !$(enDealNoAction, $(this)).length && (e = $(".thread-title a", $(this)), n = e.attr("href"), t = encodeURIComponent(enInternationalName + ": " + e.text()),
a = enDealAdd.replace(enPATTERN[0], n).replace(enPATTERN[2], truncStringWord(t, 160, "%20") + "&body=" + t + "%0D%0A%0D%0A" + n + enDealActionMailFooter),
enDealUnbook && (a = a.replace(enPATTERN[1], ("#" + $(this).attr("id")).replace(enDealMarker, ""))), o.append(a), o.removeClass("thread-infoRow"));
}), $(".thread--type-detail .userHtml").each(function() {
var e = $(this).html(), n = e.replace(/<\/p>|<\/div>/gi, "").replace(/<div>|<p>/gi, "<br><br>").replace(/<br>(<br>)*<br>/gi, "<br><br>");
$(this).html(n);
}));
}
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 = GM_config.get("enConfAvatar");
$(".thread-footer-cell a.user.linkPlain, .user.linkPlain.thread-user").each(function() {
var n, t, a;
$(this).hasClass(enClassAvatarDone) || $(this).hasClass(enClassBlackDone) || ($(this).addClass(enClassAvatarDone), n = $(this).html(), t = $(this).attr("href"),
a = n.replace(/<span.*/, "").replace(/avatar--type-s/, "avatar--type-m"), e && (a = a.replace(/thread-avatar/, "avatar--type-m")), $(this).html(enPopupUser[0] + t + enPopupUser[1] + a + enPopupUser[2] + '<a href="' + t + '">' + n.replace(/.*<span class=".* space--mr-1">/, '<span class=" space--mr-1 user link-plain">') + "</a>"));
});
}
}
function EnstylerPagePickerCreate() {
var e, n, t, a, o, i, s, l;
if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
for (e = 1, n = 1, $(selectList).empty(), $(".text--color-charcoalTint").length && (t = $(".text--color-charcoalTint").html().replace(/\r?\n|\r/g), isNaN(e = parseInt(t.replace(/.*>Seite /i, ""))) && (e = 1),
isNaN(n = parseInt(t.replace(/.*page=/, ""))) && (n = e)), a = 1; n >= a; ) o = document.createElement("option"), o.text = a, selectList.add(o), i = a,
s = Math.abs(a - e), 10 > a || 5 > s ? a++ : a += 1e3 > a && s > 600 ? Math.floor(s / 100) : Math.floor(s / 2);
e > n && (n = e), n > i && (o = document.createElement("option"), o.text = n, selectList.add(o)), selectList.value = e, l = [ ".js-navDropDown-messages", "enPageEnum js-navDropDown-messages vAlign--all-m" ],
$(".test-loginButton").length && (l[0] = ".test-loginButton"), $(".voteBar").length && (l = [ ".voteBar--sticky-off--hide:last", "enPageEnum subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
selectList.setAttribute("class", l[1]), $(l[0]).before(selectList);
}
}
function EnstylerPagePickerDo() {
if ($(".js-sticky .text--color-charcoalTint").length) {
var e = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">Seite ')[1]);
selectList.value = e;
}
}
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) ? !1 : !0, enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
enWhiteTrue = "".match(enWhite) ? !1 : !0, enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
}
function EnstylerBlacklistDo() {
!GM_config.get("enConfBlackEnable") || !enBlackTrue && -900 > enBlackTemp || ($("article:not(.enClassBlackDone, .threadWidget-item)").each(function() {
$(this).addClass(enClassBlackDone);
var 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("id")));
}), EnstylerBlacklistShow());
}
function EnstylerBlacklistShow() {
enJSfieldDefs.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[2], enBlacklisted);
}
function EnstylerBlacklistRemove() {
enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden), $(".enClassBlackDone").removeClass(enClassBlackDone);
}
function EnstylerBlacklistUnhide() {
enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden);
}
function EnstylerFixedNav() {
var e, n;
GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection && (e = $("header").html(), $("header").replaceWith('<header class="enFixedNav">' + e + "</header>"),
n = myFixedCSS[0], "/diskussion/" == enSection && (n += myFixedCSS[2]), ($(".nav-subheadline").length || "/profile/" == enSection) && (n += myFixedCSS[1]),
n = n.replace(enPATTERN[2], enMainHeigth), addStyleString(n));
}
function EnstylerDealTime() {
enNow = new Date(), enNow.setTime(EnstylerStartTime), DealDate = new Date(), TodayStart = new Date(enNow.getFullYear(), enNow.getMonth(), enNow.getDate()),
ShowTime = 3600 * GM_config.get("enConfDealMinTime") * 1e3, EnstylerDealTimeDo();
}
function EnstylerDealTimeDo() {
GM_config.get("enConfDealTime") && (enNow.setTime(Date.now()), $("time:not(." + EnstylerTimeSeen + ")").each(function() {
var e, n = $(this).text();
if (!(n.length < 9) && n.startsWith("v")) {
if (e = 6e4 * (60 * parseInt(n.replace(/.* ([0-9].*) h.*/, "$1")) + parseInt(n.replace(/.* ([0-9].*) m.*/, "$1"))), DealDate.setTime(enNow.getTime() - e),
TodayStart > DealDate) $(this).text("gestern " + ("" + DealDate).slice(16, 21) + " Uhr"); else {
if (!(e > ShowTime)) return;
$(this).html(n + ' (<span class="hide--toW2">heute </span>' + ("" + DealDate).slice(16, 21) + " Uhr)");
}
$(this).addClass(EnstylerTimeSeen);
}
}));
}
function EnstylerLastSeen() {
LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) && "" == enLocParser.search ? (enSec = enNewestBase + enSection.replace(/\//, ""),
GM_setValue(enNewestBase + "LastSec", enSec), enSeenArticle = GM_getValue(enSec), void 0 === enSeenArticle && (enSeenArticle = ""), EnstylerLastSeenDo(),
$("article:not(.threadWidget-item)").each(function() {
return $(this).length ? (GM_setValue(enSec, $(this).attr("id")), 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("id"), EnstylerLastSeenDo());
}
function EnstylerMenuActions() {
EnstylerNavRemove(), enInternational || EnstylerAddNav(enMenuMain, "Alle Diskussionen", "https://www.mydealz.de/diskussion", "enMainDiscussion"), EnstylerAddNav(enMenuMain, "Enstyler Homepage", 'https://www.mydealz.de/diskussion/enstyler-856062" target="_blank', "enMainHomepage", "building"),
EnstylerAddNav(enMenuMainButton, "Enstyler Einstellungen", showEnstylerConfig, EnstylerButton, "page");
}
function EnstylerAddNav(e, n, t, a, o) {
var i, s;
if (!(e >= enMenuItemLength)) switch ((void 0 === o || "" == o) && (o = enNavIconPat), i = !1, s = enMenuItemCode[e].replace(enPATTERN[1], a).replace(enPATTERN[2], n),
o != enNavIconPat && (s = s.split(enNavIconPat).join("--type-" + o)), "function" == typeof t ? i = !0 : s = s.replace(enPATTERN[0], t), e) {
case enMenuMain:
case enMenuMainButton:
"" == enAddMain && $(".nav-link.navMenu-trigger").click(debounce(300, EnstylerMainDo)), enAddMain += s, i && (enAddMainFunc[enAddMainCount++] = {
ID: a,
target: t
});
}
}
function EnstylerMainDo() {
var e, n, t;
for ($(enAddMain).insertBefore(".popover-content nav .navMenu-div:first"), 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")), 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 showEnstylerConfig() {
enGMConfigOpen ? GM_config.close() : (enGetHome(), GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
}
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 enGetHome() {}
function EnstylerStart() {
EnstylerFixedNav(), EnstylerDealTime(), EnstylerLastSeen(), EnstylerBlacklist(), EnstylerAvatarPopup(), EnstylerDealActions();
}
function EnstylerDelayedInit() {
EnstylerMenuActions(), EnstylerPagePickerCreate(), $(".js-pagi-bottom").bind("DOMSubtreeModified", debounce(100, function() {
EnstylerLastSeenDo(), EnstylerPagePickerDo(), EnstylerDealTimeDo(), EnstylerBlacklistDo(), EnstylerAvatarPopupDo(), EnstylerDealActionsDo();
}));
}
function EnstylerHomeButton() {
$("#EnstylerButton").remove(), input.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), $("#style-settings").after(input);
}
function enGetHome() {
var e = "";
$("#style-settings select").each(function() {
var n = $(this).attr("id"), t = $(this).val(), a = $("option[value=" + t + "]").text();
e += "#" + n + ":" + t + ":" + a + ";\n";
}), $("#style-settings input:checked").each(function() {
var n = $(this).attr("id"), t = $(this).val(), a = $("label[for=" + n + "]").text();
e += "#" + n + ":" + t + ":" + a + ";\n";
}), GM_config.set("saveOpt", e);
}
function enSetHome() {
var e, n, t, a;
if (input.value = "Save Options", e = GM_config.get("saveOpt"), e = e.replace(/\n/g, ""), n = e.split(";"), "" != e && e.startsWith("#")) {
for (t = 0; t < n.length; t++) 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 + '"');
HideShowLogoSelect(), HideShowEnstyler();
}
}
function closeOnClick() {
sleepAsync(1e4).then(function() {
window.close();
});
}
function showNotSaved() {
input.value = "Options not saved!", EnstylerHomeButton();
}
function ShowHideItem(e, n, t) {
$(e).val() == n ? $("#style-settings " + t).parent().addClass(enClassHidden) : $("#style-settings " + t).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 n = document.createElement("style");
n.innerHTML = e, document.body.appendChild(n);
}
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);
};
}
var DEBUG, enDealAdd, enDealUnbook, enDealActionMailFooter, enBlacklisted, enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp, enNow, DealDate, TodayStart, ShowTime, EnstylerTimeSeen, enSec, enSeenArticle, LastSeenOnce, enNavIconPat, enAddMain, enAddMainFunc, enAddMainCount, enUpdateWindow, enMainHeigth, myBgColor, enGmCss, enGMConfigOpen, EnstylerStartupDelay, enFixedNavLast, input, enUserLogin = !1, enUserName = "", enSection = "";
const EnstylerStartTime = Date.now(), enLocParser = location;
DEBUG = !1;
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="{"action":"scroll_to_comment_add_form","label":"engagement"}">', '<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="{"endpoint":"https://www.mydealz.de/threads/<ENSTYLER-THREADID-HERE>/remove","method":"post"}" data-track="{"action":"save_thread","label":"engagement"}">', '<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="{"action":"goto_thread_edit_form","beacon":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";
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="{"action":"show_short_user_profile","label":"engagement"}" data-popover="{"endpoint":"', '/short","target":"#template-popoverLoader","layout":[{"preset":"e","y":"50%","left":{"offset":0},"width":300,"maxWidth":"100%"}]}">', "</button>" ], enClassAvatarDone = "enClassAvatarDone", EnstylerPageEnum = "enPageEnum", selectList = document.createElement("select");
selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;
const enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone";
enBlacklisted = 0;
const unwantedRegex = [ /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ], enUnblackText = "unBlacklist <ENSTYLER-TEXT-HERE> Dealz", myFixedCSS = [ ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .userProfile, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px;}", ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px;}", ".tGrid.page2-center.height--all-full {margin-top: calc(<ENSTYLER-TEXT-HERE>px + 10px);}" ];
EnstylerTimeSeen = "enTimeSeen", enSec = "", enSeenArticle = "";
const enNewestBase = "enNewest" + enLocParser.hostname.replace("www", "");
LastSeenOnce = !0;
const enMainSectionMatch = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, enPATTERN = [ /<ENSTYLER-HREF-HERE>/g, /<ENSTYLER-THREADID-HERE>/g, /<ENSTYLER-TEXT-HERE>/g ], enNavEntry = "enNavEntry", enMenuItemCode = [ '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-HERE>" href="<ENSTYLER-HREF-HERE>" data-handler="track" data-track="{"action":"goto_main_target","beacon":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>', '<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="{"action":"goto_menu_target sort","label":"diskutiert","beacon":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="{"count":null}"></span></a></li>', '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-HERE>"><span class="navMenu-link-ico ico ico--type-discussion-navMenuLayerText"></span><ENSTYLER-TEXT-HERE></a>', '<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>' ], enMenuMain = 0, enMenuMainButton = 2, enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton";
enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;
const enJSAutoUpdate = GM_info.scriptWillUpdate, enInternationalSite = enLocParser.hostname.replace("www", ""), enInternationalName = capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")), enInternational = "Mydealz" != enInternationalName, isMozilla = void 0 === GM_info.scriptHandler || !GM_info.scriptHandler.startsWith("Tamp"), enJSfieldDefs = {
enstyler: {
section: [ "additonal features for Enstyler", "" ],
label: "Update 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: "Update UserScript",
type: "button",
click: function() {
enUpdateWindow = window.open(DEBUG ? " https://greasyfork.org/scripts/24244-enstylerjs-develop/code/EnstylerJS Develop.user.js" : "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: "Mozilla no cookies",
type: "button",
click: function() {
window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
}
},
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
},
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"), document.body.appendChild(enGMFrame);
const enCSS = ".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;}";
$(".nav").length && (myBgColor = $(".nav").css("background-color"), enGmCss = " .GM_config {background-color: " + shadeRGBColor(myBgColor, -.3) + " !important; color: " + shadeRGBColor(myBgColor, .5),
enMainHeigth = parseInt($("header").outerHeight()), enGmCss += "; top: " + enMainHeigth + "px !important;}", enGmCss += " .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover { background-color: " + shadeRGBColor(myBgColor, .11) + " !important;}"),
addStyleString(enCSS + enGmCss), enGMConfigOpen = !1, window.location.hostname.endsWith("userstyles.org") ? (DEBUG && console.error("On Userstyle ..."),
input = document.createElement("input"), input.type = "button", input.setAttribute("id", EnstylerButton), input.onclick = showEnstylerConfig, input.value = "Save Options",
$(".install").click(closeOnClick), $("#style-settings").click(showNotSaved), $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler),
GM_config.init({
id: "GM_config",
title: "Enstyler2 - Settings",
fields: enHomefieldDefs,
events: {
save: function() {
enSetHome(), EnstylerHomeButton(), GM_config.close();
},
close: function() {
enGMConfigOpen = !1;
}
},
frame: enGMFrame
}), EnstylerHomeButton(), enSetHome()) : (enFixedNavLast = !1, GM_config.init({
id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
title: DEBUG ? " EnstylerJS - >> Debug <<" : "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();
},
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
}), enAmazonMobileRedirect() && (EnstylerInit(), EnstylerStart(), EnstylerStartupDelay = Date.now() - EnstylerStartTime, "loading" == document.readyState || "interactive" == document.readyState ? $(window).bind("load", function() {
EnstylerDelayedInit();
}) : sleepAsync(EnstylerStartupDelay).then(function() {
EnstylerDelayedInit();
})));