Enstyler

MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect

目前为 2017-11-05 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Enstyler
  3. // @namespace Enstyler
  4. // @description MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect
  5. // @author dealz.rrr.de
  6. // @include https://nl.pepper.com/*
  7. // @include https://www.preisjaeger.at/*
  8. // @include https://www.mydealz.de/*
  9. // @include https://www.hotukdeals.com/*
  10. // @include https://userstyles.org/styles/128262/*
  11. // @include https://www.amazon.*/gp/aw/*
  12. // @version 3.11.052
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_xmlhttpRequest
  16. // //@require http://code.jquery.com/jquery-3.1.1.min.js
  17. // //@require http://openuserjs.org/src/libs/sizzle/GM_config.js
  18. // @require https://cdn.rawgit.com/gnadelwartz/zepto-modules/468559e1b3dc6463a0eada49ff71d7b5407a8a26/zepto-noajax-min.js
  19. // @require https://cdn.rawgit.com/gnadelwartz/GM_config/0e4b1e4c0dd6b08499082c679850ebc0f56e6ca4/GM_config-min.js
  20. // @require https://cdn.rawgit.com/gnadelwartz/Enstyler/61faddbaa201013e340dabf154410e962f1655f2/translations.js
  21. // @require https://cdn.rawgit.com/bitwiseshiftleft/sjcl/4fc74ff92fd6b836cc596cc0ee940ef6cc8db7c6/sjcl.js
  22. // @require https://cdn.rawgit.com/pieroxy/lz-string/c58a22021000ac2d99377cc0bf9ac193a12563c5/libs/lz-string.min.js
  23. // @run-at document-start
  24. // ==/UserScript==
  25. // @ the original development source with comments can be found here: https://greasyfork.org/de/scripts/24244-enstylerjs-develop
  26. // @ if you don't trust this minimized script use the development source.
  27. function EnstylerInit() {
  28. (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr(enHREF), enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1"), GM_setValue("enConfSyncUser", enUserName)) : enUserName = GM_getValue("enConfSyncUser"),
  29. enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
  30. }
  31.  
  32. function EnstylerDealActions() {
  33. if (enTransTags = 5, myDealAction) {
  34. $("footer ul").length && (enDealFooter = "%0D%0A%0D%0A-- %0D%0A" + $("footer ul li p").first().html().replace(/<br>/g, "%0D%0A").replace(/<.*?>/g, ""));
  35. var e = enLocParser.pathname, n = 0;
  36. switch ("" != enUserName && (e = e.replace(enUserName + "/", "")), $(".ico--type-grid-subNavActive, .thread-list--type-card ").length && (n = 1), enDealAdd = enDealAction[0] + enDealAction[1 + n] + enDealAction[3],
  37. !0) {
  38. case e.endsWith("profile/saved-deals"):
  39. enDealAdd += enDealAction[4] + enDealAction[5 + n] + enDealAction[7], enDealUnbook = !0;
  40. break;
  41.  
  42. case e.endsWith("profile/diskussion"):
  43. case enUserLogin && e.endsWith(enUserName):
  44. enDealAdd += enDealAction[8] + enDealAction[9 + n] + enDealAction[11];
  45. }
  46. enDealAdd = enLangLocalize(enDealAdd + enDealAction[12] + enDealAction[13 + n] + enDealAction[15], enDealLang, enLANG), enSocialAdd = enLangLocalize(enDealAction[16] + enDealAction[17] + enDealAction[19], enDealLang, enLANG);
  47. }
  48. EnstylerDealActionsDo();
  49. }
  50.  
  51. function EnstylerDealActionsDo() {
  52. var e, n, t, a, o, i, s, l, c, r;
  53. enMyCSSID = genUserKey(MyCSS), (myDealAction || myTouch || myFixHtml || myVotebar || myPrice) && $("article").not(".enClassActionDone, ." + enClassHidden).each(function() {
  54. $(this).addClass("enClassActionDone"), $(this).hasClass("threadWidget--type-card--item") || (r = "c" != $(this).attr("id")[0], myFixHtml && $(this).find(".userHtml").each(function() {
  55. $(this).html($(this).html().replace(/[^ -~Ä-Ÿ✘►○●✰€]+|(&nbsp;)+|(\n\r)+|<\/p>|<div>/g, " ").replace(/<\/div>/g, "<br>").replace(/<p>|<br>( *<br>)+/g, "<br><br>").replace(/(<li>)(<br>)+|<br>*(<br><\/li>)/g, "$1"));
  56. }), myPrice && r && (t = $(this).find(".thread-price.text--b")).length && ((o = $(this).find(".cept-dealBtn")).hasClass("ico--type-redirect-white") ? o.html(t.html()) : o.html(t.html() + '<span class="ico ico--type-redirect-white size--all-xl space--l-1"></span>'),
  57. $(this).find(".cept-tb").html(t.html())), n = $(this).find(".userHtml"), e = $(".cept-comment-link", $(this)), t = $(".thread-title a", $(this)), c = t.length, r && !n.length && (myCompact && ($(".threadGrid-image, .threadGrid-body", $(this)).remove(),
  58. $(".threadGrid-dealBtn", $(this)).css("grid-column", "3")), $(".threadGrid-image", $(this)).css("width", "50%")), myDealAction && r && (c || (t = $(".thread-title", $(this)), enTransTags = 20), enTranslateText(t),
  59. (i = $(".vote-temp", $(this))).length && (i = parseInt(i.text()), myVotebar && (l = $(".vote-temp", $(this)).attr("class").replace(/.*charcoal|.*vote-temp--/i, ""), (s = i / (myVotescale / 70) + 10) < 0 && (s *= -3),
  60. $(this).prepend('<div class="votebar vote-progress voteBar--' + l + '" style="width: ' + s + '%;"></div>')), $(this).hasClass("thread--type-card") && (i = 0), i > myVotescale / 2.51 ? myVotebar ? ($(this).prepend(enDealFlame),
  61. $(this).find(".threadGrid").css("padding-top", "0")) : $(this).find(".vote-box").after(enDealFlame) : i < -myVotescale / 10.1 && (myVotebar ? ($(this).prepend(enDealIce), $(this).find("threadGrid").css("padding-top", "0")) : $(this).find(".vote-box").after(enDealIce))),
  62. c ? ($("button.meta-ribbon-btn.hide--fromW3", $(this)).remove(), $("span.meta-ribbon.hide--toW3", $(this)).removeClass("hide--toW3"), $(".threadGrid-title .thread-title.lineClamp--2", $(this)).removeClass("lineClamp--2"),
  63. a = t[0].outerHTML.replace(/\n|\r/, "").replace(/^.*href="/, "").replace(/".*/, ""), o = enDealComposeMail($(this), t.text(), a, enDealAdd), e.append(o)) : (enCSSDealz && $(this).find("a.btn--twitter").length && (o = $(this).find("a.btn--twitter")[0].outerHTML.replace(/&amp;text=/g, "?ID=" + enMyCSSID + "&amp;text="),
  64. $(this).find("a.btn--twitter").replaceWith(o), o = $(this).find("a.btn--facebook")[0].outerHTML.replace(/&amp;title=/g, "?ID=" + enMyCSSID + "&amp;title="), $(this).find("a.btn--facebook").replaceWith(o),
  65. o = $(this).find("a.btn--whatsapp")[0].outerHTML.replace(/" rel="no/, "?ID=" + enMyCSSID + '" rel="no'), $(this).find("a.btn--whatsapp").replaceWith(o)), o = enDealComposeMail($(this), t.text(), "" + enLocParser, enSocialAdd),
  66. $(this).find("a.btn--twitter").parent().append(o))), n.length && enTranslateText(n), r && (o = $(this).find(".threadGrid-image, .threadCardLayout--row--image")).length && o.html(o.html().replace(/ img--dummy.*" data-lazy-img="{&quot;src&quot;:&quot;/, '" src="').replace(/&quot;,&quot;finishClass&quot;:.*">/, '">')),
  67. myTouch && r && $(this).find("button .avatar").each(function() {
  68. $(this).prop("outerHTML", $(this).prop("outerHTML").replace(/thread-avatar/, "avatar--type-m"));
  69. }));
  70. });
  71. }
  72.  
  73. function enDealComposeMail(e, n, t, a) {
  74. (n = encodeURIComponent(("Gnadelwartz" == enUserName ? "KayDealz" : enInternationalName) + ": " + n.replace(/\r|\n|\t/g, " ").replace(/ */g, " "))).length < 100 && e.find("span.thread-price").length && (n += encodeURIComponent(" -> " + e.find("span.thread-price").text().replace(/ |\t/g, "")));
  75. var o = t;
  76. return enCSSDealz && (o = t.replace(/^https:\/\/.*?\//, "https://dealz.rrr.de/" + enInternationalName + "/") + "?ID=" + enMyCSSID), a.replace(enPATTERN[enHREF], "\n\r" + t).replace(enPATTERN[enTEXT], truncStringWord(n, 160, "%20") + "&body=" + n + "%0D%0A%0D%0A" + o + enDealFooter);
  77. }
  78.  
  79. function EnstylerPagePickerCreate() {
  80. if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker") || enNoScript) {
  81. var e, n, t, a = 1, o = 1;
  82. if ($(selectList).empty(), $("div.text--color-charcoalTint").length) {
  83. var i = $("nav > div.text--color-charcoalTint").html().replace(/\r?\n|\r/g);
  84. isNaN(a = parseInt(i.replace(/.*currentPage=/, ""))) && (a = 1), isNaN(o = parseInt(i.replace(/.*lastPage=/, ""))) && (o = a);
  85. }
  86. for (x = 1; x <= o; ) (t = document.createElement("option")).text = x, selectList.add(t), n = x, e = Math.abs(x - a), x < 10 || e < 5 ? x++ : x < 1e3 && e > 600 ? x += Math.floor(e / 100) : x += Math.floor(e / 2);
  87. a > o && (o = a), n < o && ((t = document.createElement("option")).text = o, selectList.add(t)), selectList.value = a;
  88. var s = [ ".js-navDropDown-messages", EnstylerPageEnum + " js-navDropDown-messages vAlign--all-m" ];
  89. $(".test-loginButton").length && (s[0] = ".test-loginButton"), $(".voteBar").length && (s = [ ".voteBar--sticky-off--hide.hAlign--all-r", EnstylerPageEnum + " subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
  90. selectList.setAttribute("class", s[1]), $(s[0]).before(selectList);
  91. }
  92. }
  93.  
  94. function EnstylerPagePickerDo() {
  95. location.search.match(/^page=/) ? selectList.value = parseint(location.search.replace(/^page=/, "")) : $(".js-sticky .text--color-charcoalTint").length && (selectList.value = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">' + EnstylerSiteConfig("page"))[1]));
  96. }
  97.  
  98. function EnstylerPageAction() {
  99. var e = "page=" + $(this).val(), n = ("" + enLocParser).replace(/page=.*|#.*/, "");
  100. n.endsWith("?") || n.endsWith("&") ? n += e : n += "?" + e, "/deals/" == enSection && (n += "#thread-comments"), window.location = n;
  101. }
  102.  
  103. function EnstylerPagePickerRemove() {
  104. $("." + EnstylerPageEnum).remove();
  105. }
  106.  
  107. function EnstylerBlacklist() {
  108. enUserLogin && !GM_config.get("enConfWhitelist").includes(enUserName) && (GM_config.set("enConfWhitelist", "@" + enUserName + "," + GM_config.get("enConfWhitelist")), GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist")));
  109. var e = GM_config.get("enConfBlacklist").replace(unwantedRegex[0], "");
  110. enBlack = RegExp(e.replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), (enBlackTrue = !" ".match(enBlack)) || "" == e || alert(confLang("regexfailed")), enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
  111. enWhiteTrue = !" ".match(enWhite), enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
  112. }
  113.  
  114. function EnstylerBlacklistDo() {
  115. if (!(!GM_config.get("enConfBlackEnable") || !enBlackTrue && enBlackTemp < -900)) {
  116. var e;
  117. $("article").not("." + enClassBlackDone + ", .threadWidget-item").each(function() {
  118. $(this).addClass(enClassBlackDone), e = "c" != $(this).attr("id")[0] ? $("a.thread-category", $(this)).text() + " " + $(".thread-title a", $(this)).text() + " @" + $("a.user", $(this)).text() : $(".userHtml", $(this)).text() + " @" + $(".vwo-user-link", $(this)).text(),
  119. e = e.replace(unwantedRegex[1], " "), enWhiteTrue && e.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && e.match(enBlack)) && ($(this).addClass(enClassHidden),
  120. enBlacklisted++, EnstylerLastSeenSkip("#" + $(this).attr(enID)));
  121. }), EnstylerBlacklistShow();
  122. }
  123. }
  124.  
  125. function EnstylerBlacklistShow() {
  126. enConfDefs.default.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[enTEXT], enBlacklisted);
  127. }
  128.  
  129. function EnstylerBlacklistRemove() {
  130. EnstylerBlacklistUnhide(), $("." + enClassBlackDone).removeClass(enClassBlackDone);
  131. }
  132.  
  133. function EnstylerBlacklistUnhide() {
  134. enBlacklisted = 0, EnstylerBlacklistShow(), $("." + enClassHidden).removeClass(enClassHidden);
  135. }
  136.  
  137. function EnstylerFixedNav() {
  138. if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
  139. var e = $("header").html();
  140. $("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
  141. var n = myFixedCSS.every;
  142. enSection == EnstylerSiteConfig("discussion") && (n += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (n += myFixedCSS.subnav), addStyleString(n = n.replace(enPATTERN[enTEXT], enMainHeigth));
  143. }
  144. }
  145.  
  146. function EnstylerDealTime() {
  147. TodayStart.setHours(0, 0, 0, 0), today = enLangLocalize('<span class="hide--toW2"><EN-LANG:today>&nbsp;</span>', enTimeLang, enLANG), oclock = enLangLocalize('<span class="hide--toW2">&nbsp;<EN-LANG:oclock></span>', enTimeLang, enLANG),
  148. yesterday = enLangLocalize("<EN-LANG:yesterday> ", enTimeLang, enLANG), EnstylerDealTimeDo();
  149. }
  150.  
  151. function EnstylerDealTimeDo() {
  152. if (GM_config.get("enConfDealTime")) {
  153. var e, n, t, a = Date.now();
  154. $(".meta-ribbon, time, .metaRibbon").not("." + EnstylerTimeSeen).each(function() {
  155. if ($(this).addClass(EnstylerTimeSeen), !(e = $(this).text()).includes(" am ")) {
  156. switch (DealDate.setTime(a - (60 * parseInt(e.replace(/.* ([0-9].*) [hu].*|.*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*|.*/, "$1"))) * enTime2Min), e = $(this).html(), n = (a - DealDate) / enTime2Min,
  157. t = ("" + DealDate).slice(16, 21), !0) {
  158. case t.length < 5 || n < 60:
  159. return;
  160.  
  161. case n > 1440:
  162. e += "&nbsp;(" + t + oclock + ")";
  163. break;
  164.  
  165. case DealDate < TodayStart:
  166. e = yesterday + t + oclock;
  167. break;
  168.  
  169. default:
  170. e += "&nbsp;(" + today + t + oclock + ")";
  171. }
  172. $(this).html(e);
  173. }
  174. });
  175. }
  176. }
  177.  
  178. function EnstylerLastSeen() {
  179. LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) ? (enSeenArticle = GM_getValue(enSec, ""), SyncLastSeen(), EnstylerLastSeenDo(), "" == enLocParser.search && $("article").not(".threadWidget-item").each(function() {
  180. if ($(this).length) return GM_setValue(enSec, $(this).attr(enID)), GM_setValue(enSec + "Last", enSeenArticle), SaveLastSeen(), !1;
  181. })) : EnstylerLastSeenLast());
  182. }
  183.  
  184. function EnstylerLastSeenDo() {
  185. "" != enSec && (GM_setValue("enLastCheck" + enSec, Date.now() / enMs2Min), "" !== enSeenArticle || "" !== enLoadedArticle ? (GM_setValue(enSec + "Last", enSeenArticle), $("#" + enSeenArticle).addClass("enClassMarkArticle"),
  186. $("#" + enLoadedArticle).addClass("enClassMarkArticleLoad")) : GM_setValue(enSec, "thread_1"));
  187. }
  188.  
  189. function EnstylerLastSeenLast() {
  190. var e = GM_getValue(enNewestBase + "LastSec", "");
  191. GM_setValue(e, GM_getValue(e + "Last", ""));
  192. }
  193.  
  194. function EnstylerLastSeenSkip(e) {
  195. e == "#" + GM_getValue(enSec, "") && (GM_setValue(enSec, enSeenArticle), enSeenArticle = $(e).next().attr(enID), EnstylerLastSeenDo());
  196. }
  197.  
  198. function enCheckUpdates() {
  199. if (GM_config.get("enConfInjectCSS")) {
  200. var e = Date.now() / enMs2Min - GM_getValue("enLastUpdateCheck", "0");
  201. (e > enUpdateInterval || e < 0) && enUpdateCSS();
  202. }
  203. }
  204.  
  205. function enUpdateCSS() {
  206. var e = parseInt(Date.now() / enMs2Min), n = enComposeUpdateOpt();
  207. enCacheExternalResource(enUpdateUrl + n, MyCSS), GM_setValue("enLastUpdateCheck", e), enSaveMyCSS();
  208. }
  209.  
  210. function enComposeUpdateOpt() {
  211. var e = GM_getValue(enCssOpt, "");
  212. if ("" == e || !e.startsWith("#")) return "";
  213. var n = (e = e.replace(/\n/g, "")).split(";");
  214. e = "";
  215. for (var t = 0; t < n.length; t++) if ("" != n[t]) {
  216. var a = n[t].split(":");
  217. a.length < 2 || (e += "&" + a[1].slice(0, -1) + "=" + a[1]);
  218. }
  219. return e = "?" + e.slice(1);
  220. }
  221.  
  222. function EnstylerMenuActions() {
  223. if (EnstylerNavRemove(), enMenuButton.setAttribute("style", "background-position: -.00071em -176.85em; width: .85786em; display: inline-block; height: 1.42929em; background-image: url(https://assets.mydealz.de/assets/img/icons_5a065.svg); background-repeat: no-repeat; background-size: 5.50071em 590.57214em; cursor: pointer;"),
  224. $("#tour-filter .subNavMenu-layer").after(enMenuButton), enNoScript) return $(".nav-link.navMenu-trigger").hide(), $("#tour-expired").hide(), $("#tour-expired").after(enNavGrid), $(".thread-list-sidebar").hide(),
  225. void $(".carousel").hide();
  226. enInternational || EnstylerAddNav("Main", "<EN-LANG:discussion>", EnstylerSiteConfig("discussion"), "enMainDiscussion"), EnstylerAddNav("Main", "<EN-LANG:enstyler>", '<EN-LANG:enhref>" target="_blank', "enMainHomepage", "home"),
  227. EnstylerAddNav("Main", "Enstyler Discussion", "https://www.mydealz.de/diskussion/enstyler-856062", "enMainHomepage", "page"), EnstylerAddNav("MainButton", "<EN-LANG:settings>", showEnstylerConfig, EnstylerButton, "gear-grey");
  228. }
  229.  
  230. function EnstylerAddNav(e, n, t, a, o) {
  231. void 0 !== o && "" != o || (o = enNavIconPat);
  232. var i = !1, s = enMenuItemCode[e].replace(enPATTERN[enID], a).replace(enPATTERN[enTEXT], n);
  233. 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)),
  234. enAddMain += s, i && (enAddMainFunc[enAddMainCount++] = {
  235. ID: a,
  236. target: t
  237. }));
  238. }
  239.  
  240. function EnstylerMainDo() {
  241. $(".popover-content nav .navMenu-div").first().before(enLangLocalize(enAddMain, enMenuLang, enLANG));
  242. var e = $(".popover--mainNav"), n = 35 * (enAddMain.split(enNavEntry).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  243. e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + n + "px"));
  244. for (var t = 0; t < enAddMainCount; t++) $("section #" + enAddMainFunc[t].ID).click(enAddMainFunc[t].target);
  245. }
  246.  
  247. function EnstylerNavRemove() {
  248. enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, $(".navMenu-page").unbind("click"), $("." + enNavEntry).remove();
  249. }
  250.  
  251. function confLang(e) {
  252. return enLangLocalize("<EN-LANG:" + e + ">", enConfigLang, enLANG);
  253. }
  254.  
  255. function confMess(e) {
  256. return enLangLocalize("<EN-LANG:" + e + ">", enMessageLang, enLANG);
  257. }
  258.  
  259. function showEnstylerConfig() {
  260. enGMConfigOpen ? GM_config.close() : (GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
  261. }
  262.  
  263. function confLangOpen() {
  264. GM_config.set("enConfLang", GM_getValue("enLang", "")), $('.GM_config button[id$="_saveBtn"]').html(confLang("save")), $('.GM_config button[id$="_saveBtn"]').prop("title", confMess("save")), $('.GM_config button[id$="_closeBtn"]').html(confLang("close")),
  265. $('.GM_config button[id$="_closeBtn"]').prop("title", confMess("close")), $("#GM_config_resetLink").html(confMess("reset"));
  266. }
  267.  
  268. function SyncSettings() {
  269. EnGetValue(enCssOpt, enSetValue), EnGetValue(enSettings, enSetSettings);
  270. }
  271.  
  272. function SaveSettings() {
  273. GM_config.get("enConfInjectCSS") && (EnSaveValue(enCssOpt, GM_getValue(enCssOpt)), enSaveMyCSS());
  274. for (var e = "", n = 0; n < enSaveSettings.length; n++) e += enSaveSettings[n] + "=" + GM_config.get(enSaveSettings[n]) + "&";
  275. EnSaveValue(enSettings, e);
  276. }
  277.  
  278. function SaveLastSeen() {
  279. if (enAutoSync) {
  280. GM_config.get("enConfSyncTime");
  281. Date.now() / enMs2Min - GM_getValue("enLastCheck" + enSec, "0") > 5 && (delay = 500), sleepAsync(function() {
  282. EnSaveValue(enSec, GM_getValue(enSec, ""));
  283. }, GM_config.get("enConfSyncTime", 10) * enMs2Min / 2);
  284. }
  285. }
  286.  
  287. function SyncLastSeen() {
  288. if (enAutoSync) {
  289. var e = Date.now() / enMs2Min, n = e - GM_getValue("enLastCheck" + enSec, "0");
  290. (n > enSyncInterval || n < 0) && (GM_setValue("enLastCheck" + enSec, e), EnGetValue(enSec, enSetLastSeen));
  291. }
  292. }
  293.  
  294. function enSetLastSeen(e, n) {
  295. enLoadedArticle = n, EnstylerLastSeenDo(), enLoadedArticle.replace(/thread_/i, "") > enSeenArticle.replace(/thread_/i, "") && enSetValue(e + "Last", n);
  296. }
  297.  
  298. function enSaveMyCSS() {
  299. earlyCSS(), EnSaveValue(MyCSS, extraCSS + GM_getValue(MyCSS).replace(/^.*?{/, "").replace(/} *@-moz-document.*/, ""), !1);
  300. }
  301.  
  302. function checkSyncSettings() {
  303. var e = GM_config.fields.enSyncKeyInput.toValue();
  304. null === e && (e = $("#undefined_field_enSyncKeyInput").val());
  305. GM_config.get("enConfSyncKey");
  306. e.length < 6 && (checkSyncReset(), e = enSyncOff), enSyncKey = e, GM_config.fields.enConfSyncKey.node.value = e, GM_config.set("enConfSyncKey", e), GM_config.fields.enSyncKeyInput.value = e, GM_config.fields.enSyncKeyInput.reload();
  307. }
  308.  
  309. function checkSyncReset() {
  310. GM_config.fields.enSyncKeyInput.value = enSyncOff, GM_config.fields.enSyncKeyInput.reload(), $("#undefined_field_enSyncKeyInput").val(enSyncOff), syncCheckBug > 0 && ($("#undefined_field_enSyncKeyInput").on("change", function() {
  311. checkSyncSettings();
  312. }), syncCheckBug--);
  313. }
  314.  
  315. function enSetSettings(e, n) {
  316. for (var t = n.split("&"), a = 0; a < t.length; a++) {
  317. GM_config.set("enConfSyncKey", enSyncOff);
  318. var o = t[a].split("=");
  319. o.length < 2 || (GM_config.fields[o[0]].value = o[1], GM_config.fields[o[0]].reload());
  320. }
  321. }
  322.  
  323. function enSaveCSS() {
  324. enSendCSS(), enSetHome(), enUpdateCSS(), EnstylerHomeButton();
  325. }
  326.  
  327. function enAmazonMobileRedirect() {
  328. var e = "" + enLocParser;
  329. return !e.startsWith("https://www.amazon") || (GM_config.get("enConfAmazonRedirect") && (e.includes("/gp/aw/d/") ? window.location.replace(e.replace("/gp/aw/d/", "/dp/")) : e.includes("/gp/aw/ol/") ? window.location.replace(e.replace("/gp/aw/ol/", "/gp/offer-listing/")) : (enDebugLog("AMAZON redirect failed ... redirect to main page"),
  330. window.location = enLocParser.protocol + enLocParser.host)), !1);
  331. }
  332.  
  333. function EnstylerStart() {
  334. EnstylerFixedNav(), EnstylerLastSeen(), EnstylerDealTime(), EnstylerBlacklist(), EnstylerDealActions();
  335. }
  336.  
  337. function EnstylerRedo() {
  338. EnstylerLastSeenDo(), EnstylerPagePickerDo(), EnstylerDealTimeDo(), EnstylerBlacklistDo(), EnstylerDealActionsDo();
  339. }
  340.  
  341. function EnstylerDelayedInit() {
  342. var e = $(".nav").css("background-color"), n = shadeRGBColor($(".btn--mode-special").first().css("background-color"), .1), t = shadeRGBColor(e, .7);
  343. addStyleString(" .GM_config {background-color: " + e + " !important; color: " + t + "; top: " + enMainHeigth + "px !important;} .GM_config .section_header {background-color: " + shadeRGBColor(e, -.25) + " !important; color: " + t + " !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover { background-color: " + shadeRGBColor(e, .1) + " !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, .2) + " !important; border-color: " + shadeRGBColor(n, .2) + " !important;}"),
  344. EnstylerMenuActions(), EnstylerPagePickerCreate(), $("#main").bind("DOMSubtreeModified", debounce(100, function() {
  345. EnstylerRedo();
  346. }));
  347. }
  348.  
  349. function WaitForBody() {
  350. if (enAmazonMobileRedirect(), $("section, footer").length) {
  351. if (earlyCSS(), enLocParser.pathname.match(enDisableScript)) return enDebugLog("disable Enstyler for path: " + enLocParser.pathname), void enDebugLog("regex: " + enDisableScript);
  352. WaitForDOM();
  353. } else setTimeout(WaitForBody, 10);
  354. }
  355.  
  356. function WaitForDOM() {
  357. var e = $(".nav, #navigation").css("background-color").replace(/[^\(]*/, "");
  358. $(".vwo-deal-button, #footer").length && "" != e ? MAIN() : setTimeout(WaitForDOM, 100);
  359. }
  360.  
  361. function earlyCSS() {
  362. extraCSS = enCSS, "userstyles.org" != enLocParser.hostname && (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS", ""), 'domain("' + enLocParser.hostname), enCSSDealz = GM_config.get("enConfCSSDealz"),
  363. myDealAction = GM_config.get("enConfDealAction"), myTouch = GM_config.get("enConfTouch"), myCompact = GM_config.get("enConfCompact"), myPrice = GM_config.get("enConfPrice"), myFixHtml = GM_config.get("enConfFixHtml"),
  364. myVotebar = GM_config.get("enConfDealVotebar"), myVotescale = GM_config.get("enConfDealVotescale"), myPrice && (extraCSS += ".threadGrid-title .flex {display: none;}"), myCompact && (extraCSS += ".threadGrid {padding: .3em !important;} .threadGrid-headerMeta, .threadGrid-title {height: 2.8em;}.thread-title {white-space: nowrap;} .threadGrid-headerMeta {height: 2.3em;}.space--mt-2, .space--mv-2 {margin-top: .25em;} .vote-box {height: 2.1em} .votebar {top: 0;} .threadTempBadge-icon {font-size: 1.3em !important;}",
  365. myPrice && (extraCSS += ".threadGrid-headerMeta, .threadGrid-title {height: 2em !important;}")), myTouch && (extraCSS += "article .threadGrid-footerMeta .ico:before, article .threadItem-footerMeta .ico:before, article .threadCardLayout--row--small .ico:before, .thread-userOptionLink.ico::before {-webkit-transform: scale(1.7); transform: scale(1.7); width: 1.5em; left: .4em;}.ico--reduce3 {left: .4em;} #emergency {transform: scale(1.5); margin-left: .7em;}article a.btn--circle {-webkit-transform: scale(1.5); transform: scale(1.5); left: -1em; margin-left: 3em; width: 4em;}.vote-down, .vote-up {padding-top: 0.25em; padding-bottom: 0.25em}")),
  366. addStyleString(extraCSS);
  367. }
  368.  
  369. function MAIN() {
  370. var e = Date.now();
  371. EnstylerInit(), enCheckUpdates(), document.body.appendChild(enGMFrame), "userstyles.org" != enInternationalSite ? (addStyleString(".bg--off {background-color: " + shadeRGBColor($(".bg--main").css("background-color"), -.08) + "!important;}"),
  372. enMainHeigth = getOuterHeight("header"), EnstylerStart(), EnstylerStartupDelay = Date.now() - e, EnstylerDelayedInit()) : (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS", ""), "url(https://userstyles.org"),
  373. EnstylerHomeButton(), setUserClick(), enSetHome(), GM_config.get("enConfInjectCSS") && addStyleString("#buttons {visibility: hidden;} #ownedButtons {visibility: visible; border: 1px solid red;}"), "#style-info" == enLocParser.hash && showNotSaved());
  374. }
  375.  
  376. function showEnstylerCSS() {
  377. enGetHome(), GM_config.open();
  378. }
  379.  
  380. function EnstylerHomeButton() {
  381. $("#advancedsettings_area").attr("class", "advancedsettings_shown"), $(".advanced_button").remove(), $("select, input").unbind(), input.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), $("#button_middle").after(input),
  382. window.scrollTo(0, 600);
  383. }
  384.  
  385. function setUserClick() {
  386. $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);
  387. }
  388.  
  389. function enGetHome() {
  390. var e, n, t, a = "";
  391. $("#style-settings select").each(function() {
  392. e = $(this).attr(enID), n = $(this).val(), t = $("option[value=" + n + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  393. }), $("#style-settings input[type=text]").each(function() {
  394. e = $(this).attr(enID), n = $(this).val(), a += "#" + e + ":" + n + ":" + (t = "RGB-Clolor") + ";\n";
  395. }), $("#style-settings input:checked").each(function() {
  396. e = $(this).attr(enID), n = $(this).val(), t = $("label[for=" + e + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  397. }), GM_config.set("saveOpt", a), GM_setValue(enCssOpt, a), EnSaveValue(enCssOpt, a);
  398. }
  399.  
  400. function enSetHome() {
  401. input.value = confLang("options");
  402. var e = GM_getValue(enCssOpt, ""), n = (e = e.replace(/\n/g, "")).split(";");
  403. if ("" != e && e.startsWith("#")) {
  404. for (var t = 0; t < n.length; t++) {
  405. var a = n[t].split(":");
  406. a[0].startsWith("#setting") ? ($(a[0]).val(""), $(a[0]).val(a[1])) : a[0].startsWith("#option") ? $(a[0]).prop("checked", !0) : "" != a[0] && enDebugLog('ignoring unkown option: "' + a + '"');
  407. }
  408. GM_config.get("enConfInjectCSS") && addStyleString("#button { display: none; }"), HideShowLogoSelect(), HideShowEnstyler();
  409. }
  410. }
  411.  
  412. function showNotSaved() {
  413. input.value = confLang("optnotsave"), EnstylerHomeButton();
  414. }
  415.  
  416. function ShowHideItem(e, n, t, a) {
  417. $("#style-settings " + t).each(function() {
  418. -1 != $(this).text().indexOf(a) && ($(e).val() == n ? $(this).parent().addClass(enClassHidden) : $(this).parent().removeClass(enClassHidden));
  419. });
  420. }
  421.  
  422. function HideShowLogoSelect() {
  423. ShowHideItem("#setting-455195", "ik-logo1", "label", "MyDealz Logo");
  424. }
  425.  
  426. function HideShowEnstyler() {
  427. ShowHideItem("#setting-451668", "ik-compact1", "label", "... ");
  428. }
  429.  
  430. function enSendCSS() {
  431. isFirefox && "#style-info" == enLocParser.hash && "string" == typeof GM_info.scriptHandler && GM_info.scriptHandler.match(/usi/i) && window.open(document.referrer + "/1/" + enComposeCSS());
  432. }
  433.  
  434. function enCatchCSS() {
  435. var e = enLocParser.search.replace(/\?/, "#").replace(/=/g, ":").replace(/\&|$/g, ":notext;\n#");
  436. GM_setValue(enCssOpt, e), GM_setValue("enLastUpdateCheck", 0), window.close();
  437. }
  438.  
  439. function enComposeCSS() {
  440. var e = GM_getValue(enCssOpt, "");
  441. if ("" == e || !e.startsWith("#")) return "";
  442. var n = (e = e.replace(/\n/g, "")).split(";");
  443. e = "";
  444. for (var t = 0; t < n.length; t++) if ("" != n[t]) {
  445. var a = n[t].split(":");
  446. a.length < 2 || (e += "&" + a[0] + "=" + a[1]);
  447. }
  448. return e = "?" + e.slice(1).replace(/#/g, ""), enDebugLog(e), e;
  449. }
  450.  
  451. function mobileLog(e) {
  452. GM_setValue(saveLog, GM_getValue(saveLog) + e + "\n");
  453. }
  454.  
  455. function mobileShowLog() {
  456. alert(GM_getValue(saveLog));
  457. }
  458.  
  459. function mobileClearLog() {
  460. GM_setValue(saveLog, "Enstyler Log\n");
  461. }
  462.  
  463. function EnstylerSiteConfig(e) {
  464. return enGetSiteConfig(enInternationalName, e);
  465. }
  466.  
  467. function enGetSiteConfig(e, n) {
  468. return enSiteConfig.hasOwnProperty(e) && enSiteConfig[e].hasOwnProperty(n) ? enSiteConfig[e][n] : "";
  469. }
  470.  
  471. function enLangLocalize(e, n, t) {
  472. return enDealLang.hasOwnProperty(t) && void 0 !== n[t] || (t = "en"), (e = e.replace(enLangPat, function(e, a) {
  473. return n.hasOwnProperty(t) && n[t].hasOwnProperty(a) ? n[t][a] : a;
  474. })).match(enLangPat) ? enLangLocalize(e, n, t) : e;
  475. }
  476.  
  477. function addStyleString(e, n) {
  478. // check if style contains @-moz-document rules
  479. if (void 0 === n && (n = ""), e.match(enUserScript.detect)) {
  480. "" == n && (n = enLocParser.hostname);
  481. var t = e.split(n);
  482. e = "";
  483. for (var a = 1; a < t.length; a++) -1 != t[a].indexOf("{") && (e += t[a].replace(enUserScript.split, "").replace(enUserScript.next, ""));
  484. }
  485. for (var o, i = 0, s = enCSSmax; e.length > s && (o = e.substring(s).indexOf("}.")) > 0; ) addStyleString(e.slice(i, s += o + 1)), i = s, s += enCSSmax;
  486. var l = document.createElement("style");
  487. l.innerHTML = e.slice(i), document.body.appendChild(l);
  488. }
  489.  
  490. function capitalizeFirstLetter(e) {
  491. return e[0].toUpperCase() + e.slice(1);
  492. }
  493.  
  494. function truncStringWord(e, n, t) {
  495. return void 0 === t && (t = " "), e.length > n ? (e = e.substr(0, n - 1)).substr(0, e.lastIndexOf(t)) + "..." : e;
  496. }
  497.  
  498. function sleepAsync(e, n) {
  499. setTimeout(e, n);
  500. }
  501.  
  502. function shadeRGBColor(e, n) {
  503. if (void 0 === n && (n = .1), void 0 === e) return "rgba(0,0,0,0)";
  504. var t = e.split(","), a = n < 0 ? 0 : 255, o = n < 0 ? -1 * n : n, i = parseInt(t[0].slice(4)), s = parseInt(t[1]), l = parseInt(t[2]);
  505. return "rgb(" + (Math.round((a - i) * o) + i) + "," + (Math.round((a - s) * o) + s) + "," + (Math.round((a - l) * o) + l) + ")";
  506. }
  507.  
  508. function debounce(e, n) {
  509. var t = null;
  510. return function() {
  511. clearTimeout(t), t = setTimeout(function() {
  512. n.call(this);
  513. }, e);
  514. };
  515. }
  516.  
  517. /* curreently we assume its a CSS or JS File, so we strip comments and @namespace @moz-document... */
  518. function enCacheExternalResource(e, n) {
  519. GM_xmlhttpRequest({
  520. method: "GET",
  521. url: e,
  522. onload: function(e) {
  523. var t = e.responseText.replace(/\r\n/g, " ").replace(/\/\*.*?\*\/| *|\t/g, "").replace(/([:;]) /g, "$1").replace(/1111.11%/g, "100%");
  524. GM_setValue(n, t), addStyleString(t);
  525. },
  526. onerror: function(e) {
  527. alert(confLang("cssfailed"));
  528. }
  529. });
  530. }
  531.  
  532. function getOuterHeight(e) {
  533. e = "string" == typeof e ? document.querySelector(e) : e;
  534. var n = window.getComputedStyle(e), t = parseFloat(n.marginTop) + parseFloat(n.marginBottom);
  535. return Math.ceil(e.offsetHeight + t);
  536. }
  537.  
  538. function enTranslateText(thisObj) {
  539. if (enLANG != enSiteLANG && thisObj.length) {
  540. var text = thisObj.html().replace(/[#\(\)]|\n|\r|\t/g, ""), html = "", transTags = [], count, match, buff = "", last = 0, regex = /<.*?>/gi;
  541. for (count = 0; match = regex.exec(text); count++) {
  542. if (enTransTags < count || buff.length + (match.index - last) > enMaxTrans) {
  543. var space = text.lastIndexOf(" ", last + (enMaxTrans - buff.length));
  544. buff += text.slice(last, last + space), html = text.slice(last + space);
  545. break;
  546. }
  547. transTags[count] = match[0], buff += text.slice(last, match.index) + '<a href="' + count + '">', last = regex.lastIndex;
  548. }
  549. if (buff.length || !((buff = text).length > enMaxTrans)) var query = enTranslateGoogle.replace(/<ENSTYLER-LANG-HERE>/, enLANG).replace(/<ENSTYLER-HTML-HERE>/, encodeURI(buff)), ret = GM_xmlhttpRequest({
  550. method: "GET",
  551. url: query,
  552. onload: function(res) {
  553. text = eval("(" + res.responseText + ")")[0][0][0];
  554. try {
  555. for (x = 1; x < 5; x++) text += eval("(" + res.responseText + ")")[0][x][0];
  556. } catch (e) {}
  557. for (count--; count >= 0; count--) text = text.replace(RegExp('< *a href *= *"' + count + '" *>'), transTags[count]);
  558. thisObj.html(text + " " + html);
  559. }
  560. });
  561. }
  562. }
  563.  
  564. function EnSaveValue(e, n, t) {
  565. if ("" != enUserName && enSyncKey != enSyncOff) {
  566. if (void 0 === t && (t = !0), e + n == enSaveUrlLast) return;
  567. enSaveUrlLast = e + n;
  568. var a = t ? enEncrypt(n) : LZString.compressToEncodedURIComponent(n), o = enSaveURL + "ID=" + genUserKey(e) + "&value=" + a;
  569. GM_xmlhttpRequest({
  570. method: "GET",
  571. url: o
  572. });
  573. }
  574. }
  575.  
  576. function genUserKey(e) {
  577. return sha256_hex(enUserName + ":" + enSyncKey + "&key=" + e);
  578. }
  579.  
  580. function EnGetValue(e, n, t) {
  581. if ("" == enUserName && (enUserName = GM_getValue("enConfSyncUser")), "" != enUserName && enSyncKey != enSyncOff) {
  582. void 0 === t && (t = !0);
  583. var a = "https://dealz.rrr.de/enstyler/load.php?ID=" + genUserKey(e);
  584. GM_xmlhttpRequest({
  585. method: "GET",
  586. url: a,
  587. onload: function(a) {
  588. 200 === a.status && a.responseText.length > 30 && n(e, t ? enDecrypt(a.responseText) : LZString.decompressFromEncodedURIComponent(a.responseText));
  589. }
  590. });
  591. }
  592. }
  593.  
  594. function enSetValue(e, n) {
  595. GM_setValue(e + "", n + "");
  596. }
  597.  
  598. function enEncrypt(e) {
  599. return btoa(sjcl.encrypt(sha256_hex(enUserName + ":" + enSyncKey), e));
  600. }
  601.  
  602. function enDecrypt(e) {
  603. return sjcl.decrypt(sha256_hex(enUserName + ":" + enSyncKey), atob(e));
  604. }
  605.  
  606. function sha256_hex(e) {
  607. return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(e));
  608. }
  609.  
  610. var DEBUG = !1, DEBUGXX = !0, DEBUGXXX = !1, DEBUGINT = !1, enLocParser = location, enInternationalSite = enLocParser.hostname.replace("www.", ""), enInternationalName = capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")), enInternational = "Mydealz" != enInternationalName, enUpdateInterval = 1440, enMs2Min = 6e4, enTime2Min = enMs2Min, enUserLogin = !1, enUserName = "", enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1"), enSyncOff = "off", enSyncKey = enSyncOff, enAutoSync = !1, enSyncInterval = 5, isFirefox = "undefined" != typeof InstallTrigger, isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  611.  
  612. /Linux/i.test(navigator.userAgent) && void 0 !== GM_info.scriptHandler && GM_info.scriptHandler.startsWith("USI") && (isMobile = !0);
  613.  
  614. var saveLog = "enMobileLog", enDebugLog = console.error;
  615.  
  616. mobileClearLog();
  617.  
  618. var enInitTime, enDisableScript = /settings$/, enLangPat = /<EN-LANG:(.*?)>/g, enLANG, enSiteLANG = void 0 === enSiteConfig[enInternationalName] ? "en" : enSiteConfig[enInternationalName].lang;
  619.  
  620. "" == (enLANG = GM_getValue("enLang", "")) && (GM_setValue("enLANG", ""), enLANG = enSiteLANG);
  621.  
  622. var enHostpath = enLocParser.protocol + "//" + enLocParser.host + enLocParser.pathname, enDealAction = [ '<a title="<EN-LANG:post>" class="link ico ico--pos-l ico--type-comment-blue linkPlain space--h-3"href="<ENSTYLER-HREF-HERE>#comment-form" data-handler="track" data-track="{&quot;action&quot;:&quot;scroll_to_comment_add_form&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3"><EN-LANG:post></span><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--h-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--h-3"href="<ENSTYLER-HREF-HERE>/edit" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_Update startededit_form&quot;,&quot;beacon&quot;:true}">', '<span class="hide--toW3"><EN-LANG:edit></span><span class="hide--fromW3 hide--toW2"><EN-LANG:ed></span>', "", "<span></a>", '<a title="<EN-LANG:mail>" class="link text--color-blue ico ico--type-mail-blue linkPlain ico--pos-l space--h-3"href="mailto:?subject=<ENSTYLER-TEXT-HERE>" <span class="hide--toW3">', '<span class="hide--toW3"><EN-LANG:mail></span><span class="hide--fromW3 hide--toW2"><EN-LANG:ma></span>', "", "<span></a>", '<a title="<EN-LANG:mail>" class="btn btn--whatsapp btn--circle size--all-xs space--ml-2" style="background-color: #69be28;"', 'href="mailto:?subject=<ENSTYLER-TEXT-HERE>"><span class="ico ico--type-mail-white ico--reduce size--all-xxl">', "</span></a>", "</span></a>" ], enDealFlame = '<span class="vote-tempIco ico ico--type-flame2-red threadTempBadge-icon" style="position: unset; margin-left: .5em; font-size: 2em;"></span>', enDealIce = '<span class="vote-tempIco ico ico--type-snowflake-blueTint threadTempBadge-icon" style="position: unset; margin-left: .5em;"></span>', enDealMarker = "#thread_", enDealAdd = "", enSocialAdd, enDealUnbook = !1, enDealFooter = "", enCSSDealz, enMyCSSID, myDealAction, myTouch, myFixHtml, myVotebar, myVotescale, myCompact, myPrice, EnstylerPageEnum = "enPageEnum", selectList = document.createElement("select");
  623.  
  624. selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;
  625.  
  626. var enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone", enBlacklisted = 0, unwantedRegex = [ /[\[\]\(\)\{\}\?\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ], enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp, myFixedCSS = {
  627. every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .profileHeader, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px}",
  628. subnav: ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px}",
  629. discus: ".tGrid.page2-center.height--all-full {margin-top: calc(<ENSTYLER-TEXT-HERE>px + 10px);} #footer .page-content { padding-top: calc(<ENSTYLER-TEXT-HERE>px + 10px);}"
  630. }, DealDate = new Date(), TodayStart = new Date(), EnstylerTimeSeen = "enTimeSeen", today = "", oclock = "", yesterday, enNewestBase = "enNewest" + enInternationalSite, enSec = enNewestBase + "-" + enSection.replace(/\//, ""), LastSeenOnce = !0, enSeenArticle = "", enLoadedArticle = "", enUpdateUrl = "https://userstyles.org/styles/128262/enstyler2-style-your-mydealz.css", MyCSS = "Enstyler2_CSS", enCssOpt = "EnstylerCssOpt", enMainSectionMatch = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, enHREF = "href", enID = "id", enTEXT = "text", enPATTERN = {
  631. href: /<ENSTYLER-HREF-HERE>/g,
  632. id: /<ENSTYLER-THREADID-HERE>/g,
  633. text: /<ENSTYLER-TEXT-HERE>/g
  634. }, enNavEntry = "enNavEntry", enMenuItemCode = {
  635. 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>',
  636. 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>',
  637. MainButton: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-HERE>"><span class="navMenu-link-ico ico ico--type-discussion"></span><ENSTYLER-TEXT-HERE></a>'
  638. }, enNavGrid = '<div class="config_var subNavMenu subNavMenu--menu subNav-item" style="margin-left: 4em; margin-top: 1em; border: 0;"><a title="Grid Layout" class="ico ico--type-grid-subNavLayerActive size--all-xxxl vAlign--all-m space--h-1" href="' + enHostpath + '?layout=grid"></a><a title="List Layout" class="ico ico--type-list-subNavLayerActive size--all-xxxl vAlign--all-m space--h-1" href="' + enHostpath + '?layout=horizontal"></a><a title="Text Layout" class="ico ico--type-rows-subNavLayerActive size--all-xxxl vAlign--all-m space--h-1" href="' + enHostpath + '?layout=text"></a></div>', enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton", enMenuButton = document.createElement("input");
  639.  
  640. enMenuButton.type = "button", enMenuButton.setAttribute(enID, "emergency"), enMenuButton.onclick = showEnstylerConfig, enMenuButton.value = " ";
  641.  
  642. var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, enJSAutoUpdate = GM_info.scriptWillUpdate, enUpdateWindow, enUnblackText = enLangLocalize("<EN-LANG:unblack> <ENSTYLER-TEXT-HERE> Dealz", enConfigLang, enLANG), enConfDefs = [];
  643.  
  644. enConfDefs.default = {
  645. enstylerCSS: {
  646. section: [ confLang("features"), "" ],
  647. label: confLang("configcss"),
  648. title: confMess("configcss"),
  649. type: "button",
  650. click: function() {
  651. enUpdateWindow = window.open("https://userstyles.org/styles/128262", "UserCSS", "left=0,top=0"), GM_setValue("enLastUpdateCheck", 0);
  652. }
  653. },
  654. enstylerJS: {
  655. label: confLang("userscript"),
  656. title: confMess("userscript"),
  657. type: "button",
  658. click: function() {
  659. sleepAsync((enUpdateWindow = window.open("https://greasyfork.org/scripts/24243-enstylerjs/code/EnstylerJS.user.js", "UserScript", "width=210,height=210,left=0,top=0")).close, 5e3);
  660. }
  661. },
  662. enConfInjectCSS: {
  663. label: confLang("injectcss"),
  664. title: confMess("injectcss"),
  665. type: "checkbox",
  666. default: !0
  667. },
  668. enConfMax: {
  669. label: confLang("max"),
  670. title: confMess("max"),
  671. type: "select",
  672. options: enSiteConfig.max,
  673. default: "1280"
  674. },
  675. Section: {
  676. section: [ confLang("config"), "" ],
  677. type: "hidden"
  678. },
  679. enConfNavFixed: {
  680. label: confLang("navfixed"),
  681. title: confMess("navfixed"),
  682. type: "checkbox",
  683. default: !0
  684. },
  685. enConfDealAction: {
  686. label: confLang("dealaction"),
  687. title: confMess("dealaction"),
  688. type: "checkbox",
  689. default: !0
  690. },
  691. enConfDealVotebar: {
  692. label: confLang("dealvotebar"),
  693. title: confMess("dealvotebar"),
  694. type: "checkbox",
  695. default: !0
  696. },
  697. enConfDealVotescale: {
  698. label: confLang("dealvotescale"),
  699. title: confMess("dealvotescale"),
  700. type: "select",
  701. options: enSiteConfig.votescale,
  702. default: "500"
  703. },
  704. enConfTouch: {
  705. label: confLang("touch"),
  706. title: confMess("touch"),
  707. type: "checkbox",
  708. default: !0
  709. },
  710. enConfWidth: {
  711. label: confLang("width"),
  712. title: confMess("width"),
  713. type: "select",
  714. options: enSiteConfig.width,
  715. default: "off"
  716. },
  717. enConfPrice: {
  718. label: confLang("price"),
  719. title: confMess("price"),
  720. type: "checkbox",
  721. default: !1
  722. },
  723. enConfCompact: {
  724. label: confLang("compact"),
  725. title: confMess("compact"),
  726. type: "checkbox",
  727. default: !1
  728. },
  729. enConfCSSDealz: {
  730. label: confLang("cssdealz"),
  731. title: confMess("cssdealz"),
  732. type: "checkbox",
  733. default: !0
  734. },
  735. enConfAmazonRedirect: {
  736. label: confLang("amazon"),
  737. title: confMess("amazon"),
  738. type: "checkbox",
  739. default: !0
  740. },
  741. enConfPagePicker: {
  742. label: confLang("picker"),
  743. title: confMess("picker"),
  744. type: "checkbox",
  745. default: !0
  746. },
  747. enConfDealTime: {
  748. label: confLang("dealtime"),
  749. title: confMess("dealtime"),
  750. type: "checkbox",
  751. default: !0
  752. },
  753. enConfFixHtml: {
  754. label: confLang("fixhtml"),
  755. title: confMess("fixhtml"),
  756. type: "checkbox",
  757. default: !0
  758. },
  759. enConfBlackEnable: {
  760. label: confLang("blacklist"),
  761. title: confMess("blacklist"),
  762. type: "checkbox",
  763. default: !0
  764. },
  765. enConfHideColder: {
  766. label: confLang("blackcold"),
  767. title: confMess("blackcold"),
  768. type: "select",
  769. options: enSiteConfig.blackcold,
  770. default: "-20"
  771. },
  772. enConfBlacklist: {
  773. label: confLang("black"),
  774. title: confMess("black"),
  775. type: "text",
  776. size: 70,
  777. default: ""
  778. },
  779. enConfWhitelist: {
  780. label: confLang("white"),
  781. title: confMess("white"),
  782. type: "text",
  783. size: 70,
  784. default: ""
  785. },
  786. enConfUnblacklist: {
  787. label: confLang("unblack"),
  788. title: confMess("unblack"),
  789. type: "button",
  790. click: function() {
  791. EnstylerBlacklistUnhide();
  792. }
  793. },
  794. enConfLang: {
  795. label: confLang("lang"),
  796. title: confMess("lang"),
  797. type: "select",
  798. options: enSiteConfig.languages,
  799. default: ""
  800. }
  801. }, enConfDefs.sync = {
  802. syncsection: {
  803. section: [ confLang("syncconf"), "" ],
  804. type: "hidden"
  805. },
  806. enConfAutoSync: {
  807. label: confLang("autosync"),
  808. title: confMess("autosync"),
  809. type: "checkbox",
  810. default: !0
  811. },
  812. enConfSyncTime: {
  813. label: confLang("synctime"),
  814. title: confMess("synctime"),
  815. type: "select",
  816. options: enSiteConfig.synctimes,
  817. default: "5"
  818. },
  819. enSyncKeyInput: {
  820. label: confLang("synckey"),
  821. title: confMess("synckey"),
  822. type: "text",
  823. size: 16,
  824. save: !1,
  825. default: "off"
  826. },
  827. enConfSyncKey: {
  828. type: "hidden",
  829. default: enSyncOff
  830. },
  831. enConfSync: {
  832. label: confLang("sync"),
  833. title: confMess("sync"),
  834. type: "button",
  835. click: function() {
  836. SyncSettings();
  837. }
  838. }
  839. }, isFirefox && (enConfDefs.firefox = {
  840. debugsection: {
  841. section: [ "Firefox", "" ],
  842. type: "hidden"
  843. },
  844. enConfNoScript: {
  845. label: confLang("noscript"),
  846. title: confMess("noscript"),
  847. type: "checkbox",
  848. default: !1
  849. }
  850. });
  851.  
  852. var enSaveSettings = [ "enConfNavFixed", "enConfDealAction", "enConfDealVotebar", "enConfTouch", "enConfAmazonRedirect", "enConfPagePicker", "enConfFixHtml", "enConfDealTime", "enConfBlackEnable", "enConfHideColder", "enConfDealVotescale", "enConfBlacklist", "enConfWhitelist", "enConfAutoSync", "enConfCompact" ], enHomefieldDefs = {
  853. saveOpt: {
  854. section: [ confLang("savecss"), "" ],
  855. label: confLang("howtocss"),
  856. type: "textarea",
  857. size: 70
  858. },
  859. enConfInjectCSS: {
  860. label: confLang("injectcss"),
  861. type: "checkbox",
  862. default: !0
  863. },
  864. enConfLang: {
  865. type: "hidden",
  866. options: enSiteConfig.languages,
  867. default: ""
  868. }
  869. }, enGMFrame = document.createElement("div");
  870.  
  871. enGMFrame.setAttribute("class", "GM_config");
  872.  
  873. var enGMConfigOpen = !1, enRemoveConfig = [ {
  874. check: !1,
  875. switch: "enConfBlackEnable",
  876. remove: "enConfWhitelist"
  877. }, {
  878. check: !1,
  879. switch: "enConfBlackEnable",
  880. remove: "enConfBlacklist"
  881. }, {
  882. check: !1,
  883. switch: "enConfBlackEnable",
  884. remove: "enConfHideColder"
  885. }, {
  886. check: !1,
  887. switch: "enConfBlackEnable",
  888. remove: "enConfUnblacklist"
  889. } ], enSettings = "enSettings", syncCheckBug = 1;
  890.  
  891. if (window.location.hostname.endsWith("userstyles.org")) GM_config.init({
  892. id: "GM_config",
  893. title: confLang("headline") + " CSS",
  894. fields: enHomefieldDefs,
  895. events: {
  896. open: function() {
  897. confLangOpen();
  898. },
  899. save: function() {
  900. enSaveCSS(), GM_config.close(), sleepAsync(window.close, 1e3);
  901. },
  902. close: function() {
  903. enGMConfigOpen = !1;
  904. }
  905. },
  906. frame: enGMFrame
  907. }); else {
  908. var enFixedNavLast = !1;
  909. GM_config.init({
  910. id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
  911. title: confLang("headline"),
  912. fields: $.extend(enConfDefs.default, enConfDefs.firefox, enConfDefs.sync, enConfDefs.debug),
  913. events: {
  914. init: function() {
  915. GM_config.fields.enSyncKeyInput.value = GM_config.fields.enConfSyncKey.value;
  916. },
  917. open: function(e) {
  918. syncCheckBug = 1, GM_config.get("enConfSyncKey").length < 6 && (GM_config.set("enConfSyncKey", enSyncOff), checkSyncReset()), $("#GM_config_field_enSyncKeyInput").on("change", function() {
  919. checkSyncSettings();
  920. }), enFixedNavLast = GM_config.get("enConfNavFixed"), confLangOpen(), $("#GM_config_enstylerJS_var").after(enNavGrid), $(enRemoveConfig).each(function() {
  921. GM_config.get(this.switch) == this.check && GM_config.fields[this.remove].remove();
  922. }), enJSAutoUpdate && GM_config.fields.enstylerJS.remove(), isMobile || GM_config.fields.enConfWidth.remove();
  923. },
  924. save: function() {
  925. "auto" == GM_config.get("enConfLang") ? GM_setValue("enLang", "") : GM_setValue("enLang", GM_config.get("enConfLang")), SaveSettings(), GM_setValue("enNoScript", GM_config.get("enConfNoScript")), GM_setValue("enWidth", GM_config.get("enConfWidth")),
  926. GM_setValue("enMax", GM_config.get("enConfMax")), window.location.reload();
  927. },
  928. close: function() {
  929. enGMConfigOpen = !1, enCheckUpdates();
  930. }
  931. },
  932. frame: enGMFrame
  933. }), enSyncKey = GM_config.get("enConfSyncKey"), enAutoSync = GM_config.get("enConfAutoSync"), enSyncInterval = GM_config.get("enConfSyncTime", enSyncInterval);
  934. }
  935.  
  936. var enMainHeigth, 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; } .GM_config { border: none !important; box-shadow: 1px 6px 9px -1px rgba(0, 0, 0, 0.3); left: 8% !important; height: auto !important; min-width: 21em; max-width: 37em !important; } .GM_config .config_header {font-size: 14pt !important; border: none !important; padding-top: 0.5em; color: #69be28; font-weight: bold; text-align: center;} .GM_config .section_header { border: none !important; background-color:#005293 !important; color: #8eaacd !important; text-align: center; margin-top: 1em;} .GM_config .field_label:hover {color: white;} .GM_config a:hover {text-decoration: underline; color: darkgray;} .GM_config .config_var {display: inline-block;} .GM_config .field_label {display: inline-block; min-width: 14em; margin-left: 2em; } .GM_config button, .GM_config input[type=button] { font-weight: bold; text-align: center; color: #fff; background-color: #58a618 !important; } .GM_config button:hover {background-color: #a5d867 !important; border-color: #a5d867 !important;} .enClassHidden, #EnPopup_closeBtn, .voteBar-- { display: none !important; } .votebar {display: inline-block; position: relative; top: .3em; height: .5em; margin-left: 2%; max-width: 80% } .voteBar--warm { background-color: #ffb612 } .voteBar--hot { background-color: #e00034 } .voteBar--burn { background-color: #e00034 } .voteBar--cold, .voteBar--colder { background-color:: #00a9e0 } .voteBar--cold, .voteBar--colder { background-color: #5bc6e8 } .threadTempBadge { display: none; } .flex--justify-space-between { justify-content: unset !important; }", ".page2-center, .thread-list--type-list--sideAds, .thread-list--type-list { max-width: " + GM_getValue("enMax") + "px !important;}" ].join(" "), extraCSS, input = document.createElement("input");
  937.  
  938. input.type = "button", input.setAttribute(enID, EnstylerButton), input.onclick = showEnstylerCSS, input.value = confLang("options"), !enLocParser.hostname.endsWith("usertyle.org") && enLocParser.search.match(/ik-maxwidth/i) && enCatchCSS();
  939.  
  940. //var isIE = /*@cc_on!@*/false || !!document.documentMode;
  941. var enNoScript = GM_getValue("enNoScript", !1);
  942.  
  943. isFirefox && enNoScript && "userstyles.org" != enInternationalSite && window.addEventListener("beforescriptexecute", function(e) {
  944. e.stopPropagation(), e.preventDefault();
  945. }, !0);
  946.  
  947. var enWidth = GM_getValue("enWidth");
  948.  
  949. isMobile && "off" != enWidth && $("meta[name=viewport]").attr("content", "width=" + enWidth + "px, initial-scale=1");
  950.  
  951. var enUserScript = {
  952. detect: /.*?@-moz-document .*?\{\s*/,
  953. split: /^.*?\{/,
  954. next: /}\s*@-moz-document.*/
  955. }, enCSSmax = 16100, enTranslateGoogle = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=<ENSTYLER-LANG-HERE>&dt=t&q=<ENSTYLER-HTML-HERE>", enMaxTrans = 300, enTransTags = 5, enSaveURL = "https://dealz.rrr.de/enstyler/save.php?", enSaveUrlLast = "";
  956.  
  957. WaitForBody();