// ==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.254-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() {
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("href"), a = encodeURIComponent(enInternationalName + ": " + t.text()),
a.length < 100 && (a += encodeURIComponent($(".thread-price", $(this)).text().replace(/\t/g, "").replace(/^(.)/g, " -> $1"))), o = enDealAdd.replace(enPATTERN[0], n).replace(enPATTERN[2], truncStringWord(a, 160, "%20") + "&body=" + a + "%0D%0A%0D%0A" + n + enDealActionMailFooter),
enDealUnbook && (o = o.replace(enPATTERN[1], ("#" + $(this).attr("id")).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("href"),
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("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() {
if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
var e = $("header").html();
$("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
var t = myFixedCSS[0];
"/diskussion/" == enSection && (t += myFixedCSS[2]), ($(".nav-subheadline").length || "/profile/" == enSection) && (t += myFixedCSS[1]), t = t.replace(enPATTERN[2], 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) && "" == 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, t, n, a, o) {
if (enMenuItemLength > e) {
(void 0 === o || "" == o) && (o = enNavIconPat);
var i = !1, s = enMenuItemCode[e].replace(enPATTERN[1], a).replace(enPATTERN[2], t);
switch (o != enNavIconPat && (s = s.split(enNavIconPat).join("--type-" + o)), "function" == typeof n ? i = !0 : s = s.replace(enPATTERN[0], n), e) {
case enMenuMain:
case enMenuMainButton:
"" == 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() : (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();
EnstylerLastSeen(), EnstylerDealTime(), 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, t, n, a = "";
$("#style-settings select").each(function() {
e = $(this).attr("id"), t = $(this).val(), n = $("option[value=" + t + "]").text(), a += "#" + e + ":" + t + ":" + n + ";\n";
}), $("#style-settings input:checked").each(function() {
e = $(this).attr("id"), 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");
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 + '"');
}
HideShowLogoSelect(), HideShowEnstyler();
}
}
function closeOnClick() {
sleepAsync(1e4).then(function() {
window.close();
});
}
function showNotSaved() {
input.value = "Options not saved!", 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, time));
}
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);
};
}
var enUserLogin = !1, enUserName = "", enSection = "";
const EnstylerStartTime = Date.now(), enLocParser = location, DEBUG = !1, 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";
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="{"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";
var enBlacklisted = 0;
const unwantedRegex = [ /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ];
var enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp;
const 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);}" ];
var enNow = new Date(), DealDate = new Date(), TodayStart, ShowTime, EnstylerTimeSeen = "enTimeSeen", enSec = "", enSeenArticle = "";
const enNewestBase = "enNewest" + enLocParser.hostname.replace("www", "");
var 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";
var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;
const enJSAutoUpdate = GM_info.scriptWillUpdate;
var enUpdateWindow;
const 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("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;}";
var enMainHeigth;
if ($(".nav").length) {
var 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);
var enGMConfigOpen = !1, EnstylerStartupDelay;
if (window.location.hostname.endsWith("userstyles.org")) {
var 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();
} 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();
},
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();
}));
}