EnstylerJS

MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect

目前為 2017-10-11 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name EnstylerJS
  3. // @namespace Enstyler
  4. // @description MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect
  5. // @include https://nl.pepper.com/*
  6. // @include https://www.preisjaeger.at/*
  7. // @include https://www.mydealz.de/*
  8. // @include https://www.hotukdeals.com/*
  9. // @include https://userstyles.org/styles/128262/*
  10. // @include https://www.amazon.*/gp/aw/*
  11. // @version 3.10.115-hotfix
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_xmlhttpRequest
  15. // // gnadelwartz hosted includes
  16. // @require https://cdn.rawgit.com/gnadelwartz/zepto-modules/468559e1b3dc6463a0eada49ff71d7b5407a8a26/zepto-noajax-min.js
  17. // @require https://cdn.rawgit.com/gnadelwartz/GM_config/0e4b1e4c0dd6b08499082c679850ebc0f56e6ca4/GM_config-min.js
  18. // @require https://cdn.rawgit.com/gnadelwartz/Enstyler/7b3521a80e49bf3f8938cd0ccde291b0cf3f379e/translations.js
  19. // @require https://cdn.rawgit.com/bitwiseshiftleft/sjcl/4fc74ff92fd6b836cc596cc0ee940ef6cc8db7c6/sjcl.js
  20. // @require https://cdn.rawgit.com/pieroxy/lz-string/c58a22021000ac2d99377cc0bf9ac193a12563c5/libs/lz-string.min.js
  21. // @run-at document-start
  22. // ==/UserScript==
  23. // commented source: https://greasyfork.org/de/scripts/24244-enstylerjs-develop?version=221793
  24. // diff to last release: https://greasyfork.org/de/scripts/24244-enstylerjs-develop/diff?v1=221793&v2=220747&context=3&w=1
  25.  
  26. function EnstylerInit() {
  27. (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr(enHREF), enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1"), GM_setValue("enConfSyncUser", enUserName)) : enUserName = GM_getValue("enConfSyncUser"),
  28. enDebugLog("User: " + enUserName), enDebugLog("SyncKey: " + enSyncKey), enDebugLog("AotoSync: " + enAutoSync), enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1"), enDebugLog("Section: " + enSection);
  29. }
  30.  
  31. function EnstylerDealActions() {
  32. if (enCSSDealz = GM_config.get("enConfCSSDealz"), myDealAction = GM_config.get("enConfDealAction"), myTouch = GM_config.get("enConfTouch"), myFixHtml = GM_config.get("enConfFixHtml"), myDealAction) {
  33. $("footer ul").length && (enDealFooter = "%0D%0A%0D%0A-- %0D%0A" + $("footer ul li p").first().html().replace(/<br>/g, "%0D%0A").replace(/<.*?>/g, ""));
  34. var e = enLocParser.pathname, n = 0;
  35. 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],
  36. !0) {
  37. case e.endsWith("profile/saved-deals"):
  38. enDealAdd += enDealAction[4] + enDealAction[5 + n], +enDealAction[7], enDealUnbook = !0;
  39. break;
  40.  
  41. case e.endsWith("profile/diskussion"):
  42. case enUserLogin && e.endsWith(enUserName):
  43. enDealAdd += enDealAction[8] + enDealAction[9 + n] + enDealAction[11];
  44. }
  45. enDealAdd = enLangLocalize(enDealAdd + enDealAction[12] + enDealAction[13 + n] + enDealAction[15], enDealLang, enLANG), enSocialAdd = enLangLocalize(enDealAction[16] + enDealAction[17] + enDealAction[19], enDealLang, enLANG);
  46. var t = enHideFlame;
  47. GM_config.get("enConfTouch") && (t += "article span.overflow--wrap-off.text--b .ico:before, article div.js-options.text--b .ico:before, article p.text--b button.ico:before{-webkit-transform: scale(1.5); transform: scale(1.5); width: 1.5em; left: 5px;}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}"),
  48. addStyleString(t);
  49. }
  50. EnstylerDealActionsDo();
  51. }
  52.  
  53. function EnstylerDealActionsDo() {
  54. var e, n, t, a;
  55. enMyCSSID = genUserKey(MyCSS), (myDealAction || myTouch || myFixHtml) && $("article").not(".enClassActionDone, .enClassHidden").each(function() {
  56. var o = "c" != $(this).attr("id")[0];
  57. if (myDealAction && o) {
  58. e = $(".cept-comment-link", $(this)), n = $(".thread-title a", $(this)), n.length || (n = $(".thread-title", $(this)));
  59. var i = $(this).find(".userHtml");
  60. if (i.length && enTranslateText(i), enTranslateText(n), $("threadWidget-item", $(this)).length) return;
  61. e.length ? (parseInt($(".vote-temp", $(this)).text()) > 199 && $(this).find(".vote-box").after(enDealFlame), t = n[0].outerHTML.replace(/\n|\r/, "").replace(/^.*href="/, "").replace(/".*/, ""), a = enDealComposeMail($(this), n.text(), t, enDealAdd),
  62. e.append(a)) : (enCSSDealz && $(this).find("a.btn--twitter").length && (a = $(this).find("a.btn--twitter")[0].outerHTML.replace(/&amp;text=/g, "?ID=" + enMyCSSID + "&amp;text="), $(this).find("a.btn--twitter").replaceWith(a),
  63. a = $(this).find("a.btn--facebook")[0].outerHTML.replace(/&amp;title=/g, "?ID=" + enMyCSSID + "&amp;title="), $(this).find("a.btn--facebook").replaceWith(a), a = $(this).find("a.btn--whatsapp")[0].outerHTML.replace(/" rel="no/, "?ID=" + enMyCSSID + '" rel="no'),
  64. $(this).find("a.btn--whatsapp").replaceWith(a)), a = enDealComposeMail($(this), n.text(), "" + enLocParser, enSocialAdd), $(this).find("a.btn--twitter").parent().append(a));
  65. }
  66. myTouch && o && (a = $(this).find("div.aGrid, p.imgFrame--noBorder"), a.length && a.html(a.html().replace(/(<a .*?)href=/, "$1noklick=").replace(/ img--dummy.*" data-lazy-img="{&quot;src&quot;:&quot;/, '" src="').replace(/&quot;,&quot;finishClass&quot;:.* alt="/, '" alt="'))),
  67. myFixHtml && $(this).find("div.userHtml").each(function() {
  68. $(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"));
  69. }), myTouch && o && $(this).find("button .avatar").each(function() {
  70. $(this).prop("outerHTML", $(this).prop("outerHTML").replace(/thread-avatar/, "avatar--type-m"));
  71. }), $(this).addClass("enClassActionDone");
  72. });
  73. }
  74.  
  75. function enDealComposeMail(e, n, t, a) {
  76. return void 0 === t && (t = "", enDebugLog("enDealComposeMail href missing!")), n = encodeURIComponent(("Gnadelwartz" == enUserName ? "KayDealz" : enInternationalName) + ": " + n.replace(/\r|\n|\t/g, " ").replace(/ */g, " ")),
  77. n.length < 100 && e.find("span.thread-price").length && (n += encodeURIComponent(" -> " + e.find("span.thread-price").text().replace(/ |\t/g, ""))), enCSSDealz && (t = t.replace(/^https:\/\/.*?\//, "https://dealz.rrr.de/" + enInternationalName + "/") + "?ID=" + enMyCSSID),
  78. a.replace(enPATTERN[enHREF], t).replace(enPATTERN[enTEXT], truncStringWord(n, 160, "%20") + "&body=" + n + "%0D%0A%0D%0A" + t + enDealFooter);
  79. }
  80.  
  81. function EnstylerPagePickerCreate() {
  82. if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
  83. var e, n, t, a = 1, o = 1;
  84. if ($(selectList).empty(), $("div.text--color-charcoalTint").length) {
  85. var i = $("nav > div.text--color-charcoalTint").html().replace(/\r?\n|\r/g);
  86. isNaN(a = parseInt(i.replace(/.*currentPage=/, ""))) && (a = 1), isNaN(o = parseInt(i.replace(/.*lastPage=/, ""))) && (o = a);
  87. }
  88. for (x = 1; x <= o; ) t = document.createElement("option"), t.text = x, selectList.add(t), n = x, e = Math.abs(x - a), x < 10 || 5 > e ? x++ : x < 1e3 && e > 600 ? x += Math.floor(e / 100) : x += Math.floor(e / 2);
  89. a > o && (o = a), o > n && (t = document.createElement("option"), t.text = o, selectList.add(t)), selectList.value = a;
  90. var l = [ ".js-navDropDown-messages", "enPageEnum js-navDropDown-messages vAlign--all-m" ];
  91. $(".test-loginButton").length && (l[0] = ".test-loginButton"), $(".voteBar").length && (l = [ ".voteBar--sticky-off--hide.hAlign--all-r", "enPageEnum subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
  92. selectList.setAttribute("class", l[1]), $(l[0]).before(selectList);
  93. }
  94. }
  95.  
  96. function EnstylerPagePickerDo() {
  97. location.search.match(/^page=/) ? (enDebugLog("Picker from URL: " + location.search), selectList.value = parseint(location.search.replace(/^page=/, ""))) : $(".js-sticky .text--color-charcoalTint").length && (enDebugLog("Picker from pagenav: " + $(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">Seite')[1]),
  98. selectList.value = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">' + EnstylerSiteConfig("page"))[1]));
  99. }
  100.  
  101. function EnstylerPageAction() {
  102. var e = "page=" + $(this).val(), n = ("" + enLocParser).replace(/page=.*|#.*/, "");
  103. n += n.endsWith("?") || n.endsWith("&") ? e : "?" + e, "/deals/" == enSection && (n += "#thread-comments"), window.location = n;
  104. }
  105.  
  106. function EnstylerPagePickerRemove() {
  107. $(".enPageEnum").remove();
  108. }
  109.  
  110. function EnstylerBlacklist() {
  111. enUserLogin && !GM_config.get("enConfWhitelist").includes(enUserName) && (GM_config.set("enConfWhitelist", "@" + enUserName + "," + GM_config.get("enConfWhitelist")), GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist")));
  112. var e = GM_config.get("enConfBlacklist").replace(unwantedRegex[0], "");
  113. enBlack = RegExp(e.replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), enBlackTrue = !" ".match(enBlack), enBlackTrue || "" == e || alert(confLang("regexfailed")), enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
  114. enWhiteTrue = !" ".match(enWhite), enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
  115. }
  116.  
  117. function EnstylerBlacklistDo() {
  118. if (GM_config.get("enConfBlackEnable") && (enBlackTrue || enBlackTemp >= -900)) {
  119. var e;
  120. $("article").not(".enClassBlackDone, .threadWidget-item").each(function() {
  121. $(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(),
  122. e = e.replace(unwantedRegex[1], " "), enWhiteTrue && e.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && e.match(enBlack)) && ($(this).addClass(enClassHidden),
  123. enBlacklisted++, EnstylerLastSeenSkip("#" + $(this).attr(enID)));
  124. }), EnstylerBlacklistShow();
  125. }
  126. }
  127.  
  128. function EnstylerBlacklistShow() {
  129. enJSfieldDefs.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[enTEXT], enBlacklisted);
  130. }
  131.  
  132. function EnstylerBlacklistRemove() {
  133. EnstylerBlacklistUnhide(), $(".enClassBlackDone").removeClass(enClassBlackDone);
  134. }
  135.  
  136. function EnstylerBlacklistUnhide() {
  137. enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden);
  138. }
  139.  
  140. function EnstylerFixedNav() {
  141. if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
  142. var e = $("header").html();
  143. $("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
  144. var n = myFixedCSS.every;
  145. enSection == EnstylerSiteConfig("discussion") && (enDebugLog("FixedNav DICUSSION detected"), n += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (n += myFixedCSS.subnav),
  146. n = n.replace(enPATTERN[enTEXT], enMainHeigth), addStyleString(n);
  147. }
  148. }
  149.  
  150. function EnstylerDealTime() {
  151. TodayStart.setHours(0, 0, 0, 0), $("section.thread-list--type-card").length || (today = enLangLocalize('<span class="hide--toW2"><EN-LANG:today> </span>', enTimeLang, enLANG), oclock = enLangLocalize('<span class="hide--toW2"> <EN-LANG:oclock></span>', enTimeLang, enLANG)),
  152. yesterday = enLangLocalize("<EN-LANG:yesterday> ", enTimeLang, enLANG), EnstylerDealTimeDo();
  153. }
  154.  
  155. function EnstylerDealTimeDo() {
  156. if (GM_config.get("enConfDealTime")) {
  157. var e, n, t = Date.now();
  158. $("time").not("." + EnstylerTimeSeen).each(function() {
  159. if ($(this).addClass(EnstylerTimeSeen), e = $(this).attr("datetime"), void 0 !== e) DealDate.setTime(1e3 * e); else {
  160. if (e = $(this).text(), e.length < 8 || "Preisjaeger" == enInternationalName || e.match(/ 20[012][0-9]$/)) return;
  161. DealDate.setTime(t - (60 * parseInt(e.replace(/.* ([0-9].*) [hu].*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*/, "$1"))) * enMs2Min);
  162. }
  163. switch (e = $(this).html(), n = (t - DealDate) / enMs2Min, enDebugLog("DealTimeDo: myTimeText: " + e), !0) {
  164. case 1 > n || n > 7200:
  165. return;
  166.  
  167. case n > 1440:
  168. e += " (" + ("" + DealDate).slice(16, 21) + oclock + ")";
  169. break;
  170.  
  171. case TodayStart > DealDate:
  172. e = yesterday + ("" + DealDate).slice(16, 21) + oclock;
  173. break;
  174.  
  175. default:
  176. e += " (" + today + ("" + DealDate).slice(16, 21) + oclock + ")";
  177. }
  178. $(this).html(e);
  179. });
  180. }
  181. }
  182.  
  183. function EnstylerLastSeen() {
  184. LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) ? (enSeenArticle = GM_getValue(enSec, ""), SyncLastSeen(), EnstylerLastSeenDo(), "" == enLocParser.search && $("article").not(".threadWidget-item").each(function() {
  185. return $(this).length ? (GM_setValue(enSec, $(this).attr(enID)), GM_setValue(enSec + "Last", enSeenArticle), SaveLastSeen(), !1) : void 0;
  186. })) : EnstylerLastSeenLast());
  187. }
  188.  
  189. function EnstylerLastSeenDo() {
  190. enDebugLog("Enter LastSeenDo: " + enSec), "" != enSec && (enDebugLog("LastSeenDo Execution: " + enSec + " " + enSeenArticle), GM_setValue("enLastCheck" + enSec, Date.now() / enMs2Min), "" !== enSeenArticle || "" !== enLoadedArticle ? (GM_setValue(enSec + "Last", enSeenArticle),
  191. $("#" + enSeenArticle).addClass("enClassMarkArticle"), $("#" + enLoadedArticle).addClass("enClassMarkArticleLoad")) : GM_setValue(enSec, "thread_1"));
  192. }
  193.  
  194. function EnstylerLastSeenLast() {
  195. var e = GM_getValue(enNewestBase + "LastSec", "");
  196. GM_setValue(e, GM_getValue(e + "Last", ""));
  197. }
  198.  
  199. function EnstylerLastSeenSkip(e) {
  200. e == "#" + GM_getValue(enSec, "") && (GM_setValue(enSec, enSeenArticle) = $(e).next().attr(enID), EnstylerLastSeenDo());
  201. }
  202.  
  203. function enCheckUpdates() {
  204. if (GM_config.get("enConfInjectCSS")) {
  205. var e = Date.now() / enMs2Min - GM_getValue("enLastUpdateCheck", "0");
  206. enDebugLog("Update requested, intervall " + enUpdateInterval + " minutes , actual diff " + parseInt(e)), (e > enUpdateInterval || 0 > e) && (enDebugLog("Update started"), enUpdateCSS());
  207. }
  208. }
  209.  
  210. function enUpdateCSS() {
  211. var e = parseInt(Date.now() / enMs2Min), n = enComposeUpdateOpt();
  212. enCacheExternalResource(enUpdateUrl + n, MyCSS), GM_setValue("enLastUpdateCheck", e), enSaveMyCSS();
  213. }
  214.  
  215. function enComposeUpdateOpt() {
  216. var e = GM_getValue(enCssOpt, "");
  217. if ("" == e || !e.startsWith("#")) return "";
  218. e = e.replace(/\n/g, "");
  219. var n = e.split(";");
  220. e = "";
  221. for (var t = 0; t < n.length; t++) if ("" != n[t]) {
  222. var a = n[t].split(":");
  223. a.length < 2 || (e += "&" + a[1].slice(0, -1) + "=" + a[1]);
  224. }
  225. return e = "?" + e.slice(1), enDebugLog(e), e;
  226. }
  227.  
  228. function EnstylerMenuActions() {
  229. EnstylerNavRemove(), enInternational || EnstylerAddNav("Main", "<EN-LANG:discussion>", EnstylerSiteConfig("discussion"), "enMainDiscussion"), EnstylerAddNav("Main", "<EN-LANG:enstyler>", '<EN-LANG:enhref>" target="_blank', "enMainHomepage", "building"),
  230. EnstylerAddNav("MainButton", "<EN-LANG:settings>", showEnstylerConfig, EnstylerButton, "filter-subNavBg");
  231. }
  232.  
  233. function EnstylerAddNav(e, n, t, a, o) {
  234. (void 0 === o || "" == o) && (o = enNavIconPat);
  235. var i = !1, l = enMenuItemCode[e].replace(enPATTERN[enID], a).replace(enPATTERN[enTEXT], n);
  236. o != enNavIconPat && (l = l.split(enNavIconPat).join("--type-" + o)), "function" == typeof t ? i = !0 : l = l.replace(enPATTERN[enHREF], t), "M" == e[0] && ("" == enAddMain && $(".nav-link.navMenu-trigger").click(debounce(300, EnstylerMainDo)),
  237. enAddMain += l, i && (enAddMainFunc[enAddMainCount++] = {
  238. ID: a,
  239. target: t
  240. }));
  241. }
  242.  
  243. function EnstylerMainDo() {
  244. $(".popover-content nav .navMenu-div").first().before(enLangLocalize(enAddMain, enMenuLang, enLANG));
  245. var e = $(".popover--mainNav"), n = 35 * (enAddMain.split(enNavEntry).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  246. e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + n + "px"));
  247. for (var t = 0; enAddMainCount > t; t++) $("section #" + enAddMainFunc[t].ID).click(enAddMainFunc[t].target);
  248. }
  249.  
  250. function EnstylerNavRemove() {
  251. enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, $(".navMenu-page").unbind("click"), $(".enNavEntry").remove();
  252. }
  253.  
  254. function confLang(e) {
  255. return enLangLocalize("<EN-LANG:" + e + ">", enConfigLang, enLANG);
  256. }
  257.  
  258. function showEnstylerConfig() {
  259. enGMConfigOpen ? GM_config.close() : (GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
  260. }
  261.  
  262. function confLangOpen() {
  263. GM_config.set("enConfLang", GM_getValue("enLang", "")), $('.GM_config button[id$="_saveBtn"]').html(enConfigLang[enLANG].save), $('.GM_config button[id$="_closeBtn"]').html(enConfigLang[enLANG].close);
  264. }
  265.  
  266. function SyncSettings() {
  267. EnGetValue(enCssOpt, enSetValue), EnGetValue(enSettings, enSetSettings);
  268. }
  269.  
  270. function SaveSettings() {
  271. GM_config.get("enConfInjectCSS") && (EnSaveValue(enCssOpt, GM_getValue(enCssOpt)), enSaveMyCSS());
  272. for (var e = "", n = 0; n < enSaveSettings.length; n++) e += enSaveSettings[n] + "=" + GM_config.get(enSaveSettings[n]) + "&";
  273. enDebugLog("SaveSettings: " + e), EnSaveValue(enSettings, e);
  274. }
  275.  
  276. function SaveLastSeen() {
  277. if (enAutoSync) {
  278. var e = GM_config.get("enConfSyncTime") * enMs2Min / 2, n = Date.now() / enMs2Min, t = n - GM_getValue("enLastCheck" + enSec, "0");
  279. t > 5 && (delay = 500), enDebugLog("SaveLastSeen enLastCheck" + enSec + " dealy: " + e + "ms"), sleepAsync(function() {
  280. enDebugLog("LastSeen SAVE started"), EnSaveValue(enSec, GM_getValue(enSec, ""));
  281. }, GM_config.get("enConfSyncTime", 10) * enMs2Min / 2);
  282. }
  283. }
  284.  
  285. function SyncLastSeen() {
  286. if (enAutoSync) {
  287. var e = Date.now() / enMs2Min, n = e - GM_getValue("enLastCheck" + enSec, "0");
  288. enDebugLog("LastSeen " + enSec + " requested, intervall " + enSyncInterval + " minutes , actual diff " + parseInt(n)), (n > enSyncInterval || 0 > n) && (enDebugLog("LastSeeen Update started"), GM_setValue("enLastCheck" + enSec, e),
  289. EnGetValue(enSec, enSetLastSeen));
  290. }
  291. }
  292.  
  293. function enSetLastSeen(e, n) {
  294. enLoadedArticle = n, EnstylerLastSeenDo(), enLoadedArticle.replace(/thread_/i, "") > enSeenArticle.replace(/thread_/i, "") && enSetValue(e + "Last", n);
  295. }
  296.  
  297. function enSaveMyCSS() {
  298. EnSaveValue(MyCSS, GM_getValue(MyCSS).replace(/^.*?{/, "").replace(/} *@-moz-document.*/, ""), !1);
  299. }
  300.  
  301. function checkSyncSettings() {
  302. var e = GM_config.fields.enSyncKeyInput.toValue();
  303. null === e && (e = $("#undefined_field_enSyncKeyInput").val());
  304. GM_config.get("enConfSyncKey");
  305. 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();
  306. }
  307.  
  308. function checkSyncReset() {
  309. enDebugLog("checkSyncReset!!"), GM_config.fields.enSyncKeyInput.value = enSyncOff, GM_config.fields.enSyncKeyInput.reload(), $("#undefined_field_enSyncKeyInput").val(enSyncOff), syncCheckBug > 0 && ($("#undefined_field_enSyncKeyInput").on("change", function() {
  310. checkSyncSettings();
  311. }), syncCheckBug--);
  312. }
  313.  
  314. function enSetSettings(e, n) {
  315. enDebugLog("enSetSettings: " + 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(), enDebugLog(o[0] + "=" + o[1]));
  320. }
  321. }
  322.  
  323. function enAmazonMobileRedirect() {
  324. var e = "" + enLocParser;
  325. return e.startsWith("https://www.amazon") ? (enDebugLog("On AMAZON ..."), GM_config.get("enConfAmazonRedirect") && (enDebugLog("AMAZON redirect enabled ..."), 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"),
  326. window.location = enLocParser.protocol + enLocParser.host)), !1) : !0;
  327. }
  328.  
  329. function EnstylerStart() {
  330. EnstylerFixedNav();
  331. var e, n = Date.now();
  332. EnstylerLastSeen(), e = Date.now(), enDebugLog("Call lastseen took ms : " + (e - n)), n = Date.now(), EnstylerDealTime(), e = Date.now(), enDebugLog("Call dealtime took ms : " + (e - n)), n = Date.now(),
  333. EnstylerBlacklist(), e = Date.now(), enDebugLog("Call blacklist took ms : " + (e - n)), n = Date.now(), EnstylerDealActions(), e = Date.now(), enDebugLog("Call dealaction took ms: " + (e - n));
  334. }
  335.  
  336. function EnstylerDelayedInit() {
  337. var e = $(".nav").css("background-color"), n = shadeRGBColor($(".btn--mode-special").first().css("background-color"), .1), t = shadeRGBColor(e, .7);
  338. 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;}"),
  339. EnstylerMenuActions(), EnstylerPagePickerCreate(), $(".js-pagi-bottom").bind("DOMSubtreeModified", debounce(100, function() {
  340. var e, n = Date.now(), t = Date.now();
  341. EnstylerLastSeenDo(), EnstylerPagePickerDo(), e = Date.now(), enDebugLog("Call lastseen took ms : " + (e - t)), t = Date.now(), EnstylerDealTimeDo(), e = Date.now(), enDebugLog("Call dealtime took ms : " + (e - t)),
  342. t = Date.now(), EnstylerBlacklistDo(), e = Date.now(), enDebugLog("Call blacklist took ms : " + (e - t)), t = Date.now(), EnstylerDealActionsDo(), e = Date.now(), enDebugLog("Call dealaction took ms: " + (e - t)),
  343. enDebugLog("DOMSubtreeModified took ms: " + (e - n));
  344. }));
  345. }
  346.  
  347. function WaitForBody() {
  348. if (enAmazonMobileRedirect(), $("section, footer").length) {
  349. if (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS", ""), 'domain("' + enLocParser.hostname), enLocParser.pathname.match(enDisableScript)) return enDebugLog("disable Enstyler for path: " + enLocParser.pathname),
  350. void enDebugLog("regex: /settings$/");
  351. WaitForDOM();
  352. } else setTimeout(WaitForBody, 10);
  353. }
  354.  
  355. function WaitForDOM() {
  356. myColor = $(".nav, #navigation").css("background-color").replace(/rgba.*/, ""), $(".vwo-deal-button, #footer").length && "" == !myColor ? MAIN() : (enDebugLog(myColor), setTimeout(WaitForDOM, 100));
  357. }
  358.  
  359. function MAIN() {
  360. enInitTime = performance.now() - enInitTime, enDebugLog("Inittime: " + enInitTime + " ms");
  361. const e = Date.now();
  362. if (enDebugLog("Start Init"), EnstylerInit(), enDebugLog("Start CheckUpdate"), enCheckUpdates(), addStyleString(enCSS), document.body.appendChild(enGMFrame), "userstyles.org" != enInternationalSite) {
  363. var n = shadeRGBColor($(".bg--main").css("background-color"), -.08);
  364. addStyleString(".bg--off {background-color: " + n + "!important;}"), enMainHeigth = getOuterHeight("header"), EnstylerStart(), EnstylerStartupDelay = Date.now() - e, enDebugLog("Startup in ms: " + EnstylerStartupDelay),
  365. EnstylerDelayedInit();
  366. } else enDebugLog("On Userstyle ..."), GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS", ""), "url(https://userstyles.org"), EnstylerHomeButton(), setUserClick(), enSetHome(),
  367. GM_config.get("enConfInjectCSS") && addStyleString(".install-status { display: none; }"), "#style-info" == enLocParser.hash && showNotSaved();
  368. }
  369.  
  370. function showEnstylerCSS() {
  371. enGetHome(), GM_config.open();
  372. }
  373.  
  374. function EnstylerHomeButton() {
  375. $("#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),
  376. window.scrollTo(0, 600);
  377. }
  378.  
  379. function setUserClick() {
  380. $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);
  381. }
  382.  
  383. function enGetHome() {
  384. var e, n, t, a = "";
  385. $("#style-settings select").each(function() {
  386. e = $(this).attr(enID), n = $(this).val(), t = $("option[value=" + n + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  387. }), $("#style-settings input[type=text]").each(function() {
  388. e = $(this).attr(enID), n = $(this).val(), t = "RGB-Clolor", a += "#" + e + ":" + n + ":" + t + ";\n";
  389. }), $("#style-settings input:checked").each(function() {
  390. e = $(this).attr(enID), n = $(this).val(), t = $("label[for=" + e + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  391. }), GM_config.set("saveOpt", a), GM_setValue(enCssOpt, a), EnSaveValue(enCssOpt, a);
  392. }
  393.  
  394. function enSetHome() {
  395. input.value = confLang("options");
  396. var e = GM_getValue(enCssOpt, "");
  397. e = e.replace(/\n/g, "");
  398. var n = e.split(";");
  399. if ("" != e && e.startsWith("#")) {
  400. for (var t = 0; t < n.length; t++) {
  401. var a = n[t].split(":");
  402. 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 + '"');
  403. }
  404. addStyleString(GM_config.get("enConfInjectCSS") ? ".install-status { display: none; }" : ".install-status { display: inline; }"), HideShowLogoSelect(), HideShowEnstyler();
  405. }
  406. }
  407.  
  408. function closeOnClick() {
  409. sleepAsync(windows.close, 1e4);
  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. isMozilla && "#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. e = e.replace(/\n/g, "");
  443. var n = e.split(";");
  444. e = "";
  445. for (var t = 0; t < n.length; t++) if ("" != n[t]) {
  446. var a = n[t].split(":");
  447. a.length < 2 || (e += "&" + a[0] + "=" + a[1]);
  448. }
  449. return e = "?" + e.slice(1).replace(/#/g, ""), enDebugLog(e), e;
  450. }
  451.  
  452. function mobileLog(e) {
  453. GM_setValue(saveLog, GM_getValue(saveLog) + e + "\n");
  454. }
  455.  
  456. function mobileShowLog() {
  457. alert(GM_getValue(saveLog));
  458. }
  459.  
  460. function mobileClearLog() {
  461. GM_setValue(saveLog, "Enstyler Log\n");
  462. }
  463.  
  464. function EnstylerSiteConfig(e) {
  465. return enGetSiteConfig(enInternationalName, e);
  466. }
  467.  
  468. function enGetSiteConfig(e, n) {
  469. return enSiteConfig.hasOwnProperty(e) && enSiteConfig[e].hasOwnProperty(n) ? enSiteConfig[e][n] : "";
  470. }
  471.  
  472. function enLangLocalize(e, n, t) {
  473. return enDealLang.hasOwnProperty(t) || (t = "de"), e = e.replace(enLangPat, function(e, a) {
  474. return n.hasOwnProperty(t) && n[t].hasOwnProperty(a) ? n[t][a] : a;
  475. }), e.match(enLangPat) ? enLangLocalize(e, n, t) : e;
  476. }
  477.  
  478. function addStyleString(e, n) {
  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, l = enCSSmax; e.length > l && (o = e.substring(l).indexOf("}.")) > 0; ) addStyleString(e.slice(i, l += o + 1)), i = l, l += enCSSmax;
  486. enDebugLog("applyed style length: " + (e.length - i));
  487. var s = document.createElement("style");
  488. s.innerHTML = e.slice(i), document.body.appendChild(s);
  489. }
  490.  
  491. function capitalizeFirstLetter(e) {
  492. return e[0].toUpperCase() + e.slice(1);
  493. }
  494.  
  495. function truncStringWord(e, n, t) {
  496. return void 0 === t && (t = " "), e.length > n ? (e = e.substr(0, n - 1), e.substr(0, e.lastIndexOf(t)) + "...") : e;
  497. }
  498.  
  499. function sleepAsync(e, n) {
  500. setTimeout(e, n);
  501. }
  502.  
  503. function shadeRGBColor(e, n) {
  504. if (void 0 === n && (n = .1), void 0 === e) return "rgba(0,0,0,0)";
  505. var t = e.split(","), a = 0 > n ? 0 : 255, o = 0 > n ? -1 * n : n, i = parseInt(t[0].slice(4)), l = parseInt(t[1]), s = parseInt(t[2]);
  506. return "rgb(" + (Math.round((a - i) * o) + i) + "," + (Math.round((a - l) * o) + l) + "," + (Math.round((a - s) * o) + s) + ")";
  507. }
  508.  
  509. function debounce(e, n) {
  510. var t = null;
  511. return function() {
  512. clearTimeout(t), t = setTimeout(function() {
  513. n.call(this);
  514. }, e);
  515. };
  516. }
  517.  
  518. function enCacheExternalResource(e, n) {
  519. GM_xmlhttpRequest({
  520. method: "GET",
  521. url: e,
  522. onload: function(t) {
  523. var a = t.responseText.replace(/\r\n/g, " ").replace(enStripComments, "").replace(enFixCSS, "100%");
  524. enDebugLog([ t.status, t.statusText, t.readyState, t.finalUrl, e, GM_getValue(enCssOpt, ""), t.responseHeaders ].join("\n") + "\n" + a.replace(/.*?(btn--mode-special[^}]*).*/, "$1}")), GM_setValue(n, a),
  525. addStyleString(a);
  526. },
  527. onerror: function(e) {
  528. alert(confLang("cssfailed"));
  529. }
  530. });
  531. }
  532.  
  533. function getOuterHeight(e) {
  534. e = "string" == typeof e ? document.querySelector(e) : e;
  535. var n = window.getComputedStyle(e), t = parseFloat(n.marginTop) + parseFloat(n.marginBottom);
  536. return Math.ceil(e.offsetHeight + t);
  537. }
  538.  
  539. function enTranslateText(thisObj) {
  540. if (enLANG != enSiteLANG && thisObj.length) {
  541. var text = thisObj.html().replace(/\n|\r|\t/g, ""), html = text.replace(/.*?(<[ai].*)/, "$1");
  542. html === text && (html = "");
  543. var text = text.replace(/<(a|i).*$/, "");
  544. if ("" === text && (text = html, html = ""), text.length > enMaxTrans) return void enDebugLog("translation to long:" + text);
  545. var query = enTranslateQuery.replace(/<ENSTYLER-LANG-HERE>/, enLANG).replace(/<ENSTYLER-HTML-HERE>/, encodeURI(text)), ret = GM_xmlhttpRequest({
  546. method: "GET",
  547. url: query,
  548. onload: function(res) {
  549. var trans = eval("(" + res.responseText + ")")[0][0][0];
  550. try {
  551. for (x = 1; x < 5; x++) trans += eval("(" + res.responseText + ")")[0][x][0];
  552. } catch (e) {}
  553. thisObj.html(trans + " " + html), enDebugLog("Translate from: " + text), enDebugLog("===> " + trans + " " + html);
  554. }
  555. });
  556. }
  557. }
  558.  
  559. function EnSaveValue(e, n, t) {
  560. if ("" != enUserName && enSyncKey != enSyncOff) {
  561. if (void 0 === t && (t = !0), enDebugLog("EnSaveValue crypt: " + t), e + n == enSaveUrlLast) return;
  562. enSaveUrlLast = e + n;
  563. var a = t ? enEncrypt(n) : LZString.compressToEncodedURIComponent(n), o = enSaveURL + "ID=" + genUserKey(e) + "&value=" + a;
  564. enDebugLog("EnSaveValue URL: " + o), enDebugLog("EnSaveValue Key: " + e + " Value: " + n), GM_xmlhttpRequest({
  565. method: "GET",
  566. url: o
  567. });
  568. }
  569. }
  570.  
  571. function genUserKey(e) {
  572. return sha256_hex(enUserName + ":" + enSyncKey + "&key=" + e);
  573. }
  574.  
  575. function EnGetValue(e, n, t) {
  576. if ("" == enUserName && (enUserName = GM_getValue("enConfSyncUser")), enDebugLog("enGetValue user: " + enUserName + " SyncID: " + enSyncKey + " key: " + e), "" != enUserName && enSyncKey != enSyncOff) {
  577. void 0 === t && (t = !0);
  578. var a = "https://dealz.rrr.de/enstyler/load.php?ID=" + genUserKey(e);
  579. enDebugLog("EnGetValue: " + a), GM_xmlhttpRequest({
  580. method: "GET",
  581. url: a,
  582. onload: function(a) {
  583. enDebugLog("EnCallback Key: " + e + " status=" + a.status), 200 === a.status && a.responseText.length > 5 ? (enDebugLog(enDecrypt(a.responseText)), n(e, t ? enDecrypt(a.responseText) : LZString.decompressFromEncodedURIComponent(a.responseText))) : enDebugLog("EnCallback Value: No stored value for " + e + a.responseText);
  584. }
  585. });
  586. }
  587. }
  588.  
  589. function enSetValue(e, n) {
  590. enDebugLog("enSetValue " + e + " old: " + GM_getValue(e) + " new: " + n), GM_setValue(e + "", n + "");
  591. }
  592.  
  593. function enEncrypt(e) {
  594. return btoa(sjcl.encrypt(sha256_hex(enUserName + ":" + enSyncKey), e));
  595. }
  596.  
  597. function enDecrypt(e) {
  598. return sjcl.decrypt(sha256_hex(enUserName + ":" + enSyncKey), atob(e));
  599. }
  600.  
  601. function sha256_hex(e) {
  602. return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(e));
  603. }
  604.  
  605. const DEBUG = !0, DEBUGXX = !0, DEBUGXXX = !1, enLocParser = location, enInternationalSite = enLocParser.hostname.replace("www.", ""), enInternationalName = capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")), enInternational = "Mydealz" != enInternationalName;
  606.  
  607. var enUpdateInterval = 1440, enMs2Min = 6e4, enUserLogin = !1, enUserName = "", enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
  608.  
  609. const enSyncOff = "off";
  610.  
  611. var enSyncKey = enSyncOff, enAutoSync = !1, enSyncInterval = 5, isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  612.  
  613. /Linux/i.test(navigator.userAgent) && void 0 !== GM_info.scriptHandler && GM_info.scriptHandler.startsWith("USI") && (isMobile = !0);
  614.  
  615. const saveLog = "enMobileLog";
  616.  
  617. var enDebugLog = console.error;
  618.  
  619. isMobile && (enDebugLog = mobileLog);
  620.  
  621. var enInitTime = performance.now();
  622.  
  623. enDebugLog("DEBUG activated"), enDebugLog("International Site: " + enInternationalSite), enDebugLog("International Name: " + enInternationalName), enMs2Min = 1e4;
  624.  
  625. const enDisableScript = /settings$/, enLangPat = /<EN-LANG:(.*?)>/g;
  626.  
  627. var enLANG;
  628.  
  629. const enSiteLANG = void 0 === enSiteConfig[enInternationalName] ? "en" : enSiteConfig[enInternationalName].lang;
  630.  
  631. "" == (enLANG = GM_getValue("enLang", "")) && (GM_setValue("enLANG", ""), enLANG = enSiteLANG), enDebugLog("Site Lang: " + enSiteLANG), enDebugLog("Selected Lang: " + enLANG), enDebugLog("URL : " + enLocParser),
  632. enDebugLog("hostname : " + enLocParser.hostname), enDebugLog("pathname : " + enLocParser.pathname), enDebugLog(" search : " + enLocParser.search), enDebugLog(" hash : " + enLocParser.hash);
  633.  
  634. const 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;"></span>', enHideFlame = ".threadTempBadge { display: none; } .flex--justify-space-between { justify-content: unset !important; }", enDealMarker = "#thread_";
  635.  
  636. var enDealAdd = "", enSocialAdd, enDealUnbook = !1, enDealFooter = "", enCSSDealz, enMyCSSID, myDealAction, myTouch, myFixHtml;
  637.  
  638. const EnstylerPageEnum = "enPageEnum", selectList = document.createElement("select");
  639.  
  640. selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;
  641.  
  642. const enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone";
  643.  
  644. var enBlacklisted = 0;
  645.  
  646. const unwantedRegex = [ /[\[\]\(\)\{\}\?\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ];
  647.  
  648. var enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp;
  649.  
  650. const myFixedCSS = {
  651. every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .profileHeader, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px}",
  652. subnav: ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px}",
  653. 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);}"
  654. };
  655.  
  656. var DealDate = new Date(), TodayStart = new Date(), EnstylerTimeSeen = "enTimeSeen", today = "", oclock = "", yesterday;
  657.  
  658. const enNewestBase = "enNewest" + enInternationalSite, enSec = enNewestBase + "-" + enSection.replace(/\//, "");
  659.  
  660. var LastSeenOnce = !0, enSeenArticle = "", enLoadedArticle = "";
  661.  
  662. const 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 = {
  663. href: /<ENSTYLER-HREF-HERE>/g,
  664. id: /<ENSTYLER-THREADID-HERE>/g,
  665. text: /<ENSTYLER-TEXT-HERE>/g
  666. }, enNavEntry = "enNavEntry", enMenuItemCode = {
  667. 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>',
  668. 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>',
  669. MainButton: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-HERE>"><span class="navMenu-link-ico ico ico--type-discussion"></span><ENSTYLER-TEXT-HERE></a>',
  670. SubButton: '<li class="enNavEntry subNavMenu-item--separator test-tablink-discussed"><a class="subNavMenu-item subNavMenu-link space--h-4 vAlign--all-m" id="<ENSTYLER-THREADID-HERE>"><span class="box--all-i size--all-xl vAlign--all-m"><ENSTYLER-TEXT-HERE></span></a></li>'
  671. }, enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton";
  672.  
  673. var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;
  674.  
  675. const enJSAutoUpdate = GM_info.scriptWillUpdate;
  676.  
  677. var enUpdateWindow;
  678.  
  679. const enUnblackText = enLangLocalize("<EN-LANG:unblack> <ENSTYLER-TEXT-HERE> Dealz", enConfigLang, enLANG), enJSfieldDefs = {
  680. enstylerCSS: {
  681. section: [ confLang("features"), "" ],
  682. label: confLang("configcss"),
  683. type: "button",
  684. click: function() {
  685. enUpdateWindow = window.open("https://userstyles.org/styles/128262", "UserCSS", "left=0,top=0"), GM_setValue("enLastUpdateCheck", 0);
  686. }
  687. },
  688. enstylerJS: {
  689. label: confLang("userscript"),
  690. type: "button",
  691. click: function() {
  692. enUpdateWindow = window.open(" https://greasyfork.org/scripts/24244-enstylerjs-develop/code/EnstylerJS Develop.user.js", "UserScript", "width=110,height=110,left=0,top=0"), sleepAsync(enUpdateWindow.close, 5e3);
  693. }
  694. },
  695. dontCookies: {
  696. label: confLang("cookies"),
  697. type: "button",
  698. click: function() {
  699. window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
  700. }
  701. },
  702. mobileDebugClear: {
  703. label: "Clear Debuglog",
  704. type: "button",
  705. click: function() {
  706. mobileClearLog();
  707. }
  708. },
  709. mobileDebugShow: {
  710. label: "Show Debuglog on mobile",
  711. type: "button",
  712. click: function() {
  713. mobileShowLog();
  714. }
  715. },
  716. enConfInjectCSS: {
  717. label: confLang("injectcss"),
  718. type: "checkbox",
  719. default: !0
  720. },
  721. Section: {
  722. section: [ confLang("config"), "" ],
  723. type: "hidden"
  724. },
  725. enConfNavFixed: {
  726. label: confLang("navfixed"),
  727. type: "checkbox",
  728. default: !0
  729. },
  730. enConfDealAction: {
  731. label: confLang("dealaction"),
  732. type: "checkbox",
  733. default: !0
  734. },
  735. enConfTouch: {
  736. label: confLang("touch"),
  737. type: "checkbox",
  738. default: !1
  739. },
  740. enConfCSSDealz: {
  741. label: confLang("cssdealz"),
  742. type: "checkbox",
  743. default: !0
  744. },
  745. enConfAmazonRedirect: {
  746. label: confLang("amazon"),
  747. type: "checkbox",
  748. default: !0
  749. },
  750. enConfPagePicker: {
  751. label: confLang("picker"),
  752. type: "checkbox",
  753. default: !0
  754. },
  755. enConfDealTime: {
  756. label: confLang("dealtime"),
  757. type: "checkbox",
  758. default: !0
  759. },
  760. enConfFixHtml: {
  761. label: confLang("fixhtml"),
  762. type: "checkbox",
  763. default: !0
  764. },
  765. enConfBlackEnable: {
  766. label: confLang("blacklist"),
  767. type: "checkbox",
  768. default: !0
  769. },
  770. enConfHideColder: {
  771. label: confLang("blackcold"),
  772. type: "select",
  773. options: enSiteConfig.blackcold,
  774. default: "-20"
  775. },
  776. enConfBlacklist: {
  777. label: confLang("black"),
  778. type: "text",
  779. size: 70,
  780. default: confLang("examples")
  781. },
  782. enConfWhitelist: {
  783. label: confLang("white"),
  784. type: "text",
  785. size: 70,
  786. default: ""
  787. },
  788. enConfUnblacklist: {
  789. label: confLang("unblack"),
  790. type: "button",
  791. click: function() {
  792. EnstylerBlacklistUnhide();
  793. }
  794. },
  795. enConfLang: {
  796. label: confLang("lang"),
  797. type: "select",
  798. options: enSiteConfig.languages,
  799. default: ""
  800. },
  801. syncsection: {
  802. section: [ confLang("syncconf"), "" ],
  803. type: "hidden"
  804. },
  805. enConfAutoSync: {
  806. label: confLang("autosync"),
  807. type: "checkbox",
  808. default: !0
  809. },
  810. enConfSyncTime: {
  811. label: confLang("synctime"),
  812. type: "select",
  813. options: enSiteConfig.synctimes,
  814. default: "10"
  815. },
  816. enSyncKeyInput: {
  817. label: confLang("synckey"),
  818. type: "text",
  819. size: 16,
  820. save: !1,
  821. default: "off"
  822. },
  823. enConfSyncKey: {
  824. type: "hidden",
  825. default: enSyncOff
  826. },
  827. enConfSync: {
  828. label: confLang("sync"),
  829. type: "button",
  830. click: function() {
  831. SyncSettings();
  832. }
  833. }
  834. }, enSaveSettings = [ "enConfNavFixed", "enConfDealAction", "enConfTouch", "enConfAmazonRedirect", "enConfPagePicker", "enConfFixHtml", "enConfDealTime", "enConfBlackEnable", "enConfHideColder", "enConfBlacklist", "enConfWhitelist", "enConfLang", "enConfAutoSync" ], enHomefieldDefs = {
  835. saveOpt: {
  836. section: [ confLang("savecss"), "" ],
  837. label: confLang("howtocss"),
  838. type: "textarea",
  839. size: 70
  840. },
  841. enConfInjectCSS: {
  842. label: confLang("injectcss"),
  843. type: "checkbox",
  844. default: !0
  845. },
  846. enConfLang: {
  847. type: "hidden",
  848. options: enSiteConfig.languages,
  849. default: ""
  850. }
  851. }, enGMFrame = document.createElement("div");
  852.  
  853. enGMFrame.setAttribute("class", "GM_config");
  854.  
  855. var enGMConfigOpen = !1;
  856.  
  857. const enRemoveConfig = [ {
  858. check: !1,
  859. switch: "enConfBlackEnable",
  860. remove: "enConfWhitelist"
  861. }, {
  862. check: !1,
  863. switch: "enConfBlackEnable",
  864. remove: "enConfBlacklist"
  865. }, {
  866. check: !1,
  867. switch: "enConfBlackEnable",
  868. remove: "enConfHideColder"
  869. }, {
  870. check: !1,
  871. switch: "enConfBlackEnable",
  872. remove: "enConfUnblacklist"
  873. } ], enSettings = "enSettings";
  874.  
  875. var syncCheckBug = 1;
  876.  
  877. if (window.location.hostname.endsWith("userstyles.org")) GM_config.init({
  878. id: "GM_config",
  879. title: confLang("headline") + " >> Debug <<",
  880. fields: enHomefieldDefs,
  881. events: {
  882. open: function() {
  883. confLangOpen();
  884. },
  885. save: function() {
  886. enSendCSS(), enSetHome(), enUpdateCSS(), EnstylerHomeButton(), GM_config.close();
  887. },
  888. close: function() {
  889. enGMConfigOpen = !1;
  890. }
  891. },
  892. frame: enGMFrame
  893. }); else {
  894. var enFixedNavLast = !1;
  895. GM_config.init({
  896. id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
  897. title: confLang("headline") + " >> Debug <<",
  898. fields: enJSfieldDefs,
  899. events: {
  900. init: function() {
  901. GM_config.fields.enSyncKeyInput.value = GM_config.fields.enConfSyncKey.value;
  902. },
  903. open: function(e) {
  904. syncCheckBug = 1, GM_config.get("enConfSyncKey").length < 6 && (enDebugLog("GM_confit.init enConfSyncKey: " + GM_config.get("enConfSyncKey")), GM_config.set("enConfSyncKey", enSyncOff), checkSyncReset()),
  905. $("#GM_config_field_enSyncKeyInput").on("change", function() {
  906. checkSyncSettings();
  907. }), enFixedNavLast = GM_config.get("enConfNavFixed"), confLangOpen(), $(enRemoveConfig).each(function() {
  908. GM_config.get(this["switch"]) == this.check && GM_config.fields[this.remove].remove();
  909. }), enJSAutoUpdate && GM_config.fields.enstylerJS.remove(), isMozilla || GM_config.fields.dontCookies.remove(), isMobile ? enDebugLog("Debug on mobile device detected ...") : (GM_config.fields.mobileDebugShow.remove(),
  910. GM_config.fields.mobileDebugClear.remove());
  911. },
  912. save: function() {
  913. "auto" == GM_config.get("enConfLang") ? GM_setValue("enLang", "") : GM_setValue("enLang", GM_config.get("enConfLang")), SaveSettings(), GM_config.get("enConfNavFixed") || GM_config.get("enConfNavFixed") == enFixedNavLast || window.location.reload(!1),
  914. GM_config.close(), enCheckUpdates(), EnstylerStart(), EnstylerMenuActions(), EnstylerPagePickerCreate();
  915. },
  916. close: function() {
  917. enGMConfigOpen = !1;
  918. }
  919. },
  920. frame: enGMFrame
  921. }), enSyncKey = GM_config.get("enConfSyncKey"), enAutoSync = GM_config.get("enConfAutoSync"), enSyncInterval = GM_config.get("enConfSyncTime", enSyncInterval);
  922. }
  923.  
  924. var enCSS = ".threadWidget-footer::after {display: none !important}; .GM_config {left: 5% !iportant; top: 8% !important; height: auto !important; max-width: 35em !important; background-color: white;} .GM_config input, .GM_config button, .GM_config textarea { border: 1px solid; margin: 0.5em 0em 0.2em 1em; padding: 0.1em;} .GM_config .reset { font-size: 9pt; padding-right: 1em; } .enClassHidden, #EnPopup_closeBtn {display: none;}", enMainHeigth, input = document.createElement("input");
  925.  
  926. 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();
  927.  
  928. const isMozilla = void 0 === GM_info.scriptHandler || !GM_info.scriptHandler.startsWith("Tamp"), enUserScript = {
  929. detect: /.*?@-moz-document .*?\{\s*/,
  930. split: /^.*?\{/,
  931. next: /}\s*@-moz-document.*/
  932. }, enCSSmax = 16100, enStripComments = /\/\*.*?\*\/| *|\t/g, enFixCSS = /1111.11%/g, enTranslateQuery = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=<ENSTYLER-LANG-HERE>&dt=t&q=<ENSTYLER-HTML-HERE>", enMaxTrans = 300, enSaveURL = "https://dealz.rrr.de/enstyler/save.php?";
  933.  
  934. var enSaveUrlLast = "";
  935.  
  936. WaitForBody();