Greasy Fork 还支持 简体中文。

EnstylerJS

MyDealz and Pepper enhanced features incl. Amazon mobile redirect

目前為 2017-03-01 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name EnstylerJS
  3. // @namespace Enstyler
  4. // @description MyDealz and Pepper 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://userstyles.org/styles/128262/*
  9. // @include https://www.amazon.*/gp/aw/*
  10. // @version 3.02.288-min
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // @grant GM_xmlhttpRequest
  14. // @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js
  15. // @require http://openuserjs.org/src/libs/sizzle/GM_config.js
  16. // @run-at document-start
  17. // ==/UserScript==
  18. // commented source: https://greasyfork.org/de/scripts/24244-enstylerjs-develop?version=178032
  19. // diff to last version: https://greasyfork.org/de/scripts/24244-enstylerjs-develop/diff?v1=178032&v2=177204&context=3&w=1
  20. function EnstylerInit() {
  21. (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr(enHREF), enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1")) : $(document).on("click", ".test-loginButton", EnstylerLastSeenLast),
  22. enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
  23. }
  24.  
  25. function EnstylerDealActions() {
  26. if (GM_config.get("enConfMoreDeal")) {
  27. $("footer ul").length && (enDealFooter = "%0D%0A%0D%0A-- %0D%0A" + $("footer ul li p").first().html().replace(/<br>/g, "%0D%0A").replace(/<.*?>/g, ""));
  28. var e = enLocParser.pathname, n = 0;
  29. switch ("" != enUserName && (e = e.replace(enUserName + "/", "")), $(".ico--type-grid-subNavActive").length && (n = 1), enDealAdd = enDealAction[0] + enDealAction[1 + n] + enDealAction[3],
  30. !0) {
  31. case e.endsWith("profile/saved-deals"):
  32. enDealAdd += enDealAction[4] + enDealAction[5 + n], +enDealAction[7], enDealUnbook = !0;
  33. break;
  34.  
  35. case e.endsWith("profile/diskussion"):
  36. case e.endsWith(enUserName):
  37. enDealAdd += enDealAction[8] + enDealAction[9 + n] + enDealAction[11];
  38. }
  39. enDealAdd = enLangLocalize(enDealActionPreHtml + enDealAdd + enDealAction[12] + enDealAction[13 + n] + enDealAction[15] + "</span>", enDealLang, enLANG);
  40. }
  41. EnstylerAvatarPopup(), EnstylerDealActionsDo();
  42. }
  43.  
  44. function EnstylerDealActionsDo() {
  45. var e, n, t, a, o, i = GM_config.get("enConfMoreDeal"), s = GM_config.get("enConfTouch"), l = enUserLogin && GM_config.get("enConfPopup");
  46. $("article").not(".enClassActionDone, .enClassHidden").each(function() {
  47. if (e = $(".thread-infoRow", $(this)), i && e.length && (n = $(".thread-title a", $(this)), t = n.attr(enHREF), a = encodeURIComponent(enInternationalName + ": " + n.text()),
  48. a.length < 100 && $(this).find(".thread-price").length && (a += encodeURIComponent(" -> " + $(this).find(".thread-price").text().replace(/ |\t/g, ""))), o = enDealAdd.replace(enPATTERN[enHREF], t).replace(enPATTERN[enTEXT], truncStringWord(a, 160, "%20") + "&body=" + a + "%0D%0A%0D%0A" + t + enDealFooter),
  49. enDealUnbook && (o = o.replace(enPATTERN[enID], ("#" + $(this).attr(enID)).replace(enDealMarker, ""))), e.append(o), e.removeClass("thread-infoRow")), s && (o = $(this).find(".imgFrame").parent(),
  50. o.html(o.html().replace(/(<a .*?") href=/, "$1 noklick=").replace(/ img--dummy.*" data-lazy-img="{&quot;src&quot;:&quot;/, '" src="').replace(/&quot;,&quot;finishClass&quot;:.* alt="/, '" alt="'))),
  51. $(this).find(".userHtml").each(function() {
  52. $(this).html($(this).html().replace(/[^ -~Ä-ü]+|(&nbsp;)+|(\n\r)+|<\/p>|<\/div>/g, " ").replace(/<div>|<p>|(<br> *<br>)( |<br>)*/g, "<br><br>").replace(/(<li>)(<br>)+|<br>*(<br><\/li>)/g, "$1"));
  53. }), l) {
  54. var c = /avatar--type-s/;
  55. s && (c = /avatar--type-s|thread-avatar/g), $(this).find("a.user").each(function() {
  56. o = $(this).html(), a = $(this).attr(enHREF), n = o.replace(/<span.*/, "").replace(c, "avatar--type-m"), $(this).html(enPopupUser[0] + a + enPopupUser[1] + n + enPopupUser[2] + '<a href="' + a + '">' + o.replace(/.*<span class=".* space--mr-1">/, '<span class=" space--mr-1 user link-plain">') + "</a>");
  57. });
  58. }
  59. $(this).addClass("enClassActionDone");
  60. });
  61. }
  62.  
  63. function EnstylerAvatarPopup() {
  64. enUserLogin && GM_config.get("enConfPopup") && addStyleString(".thread-footer-cell a img.avatar.vAlign--all-m.space--mr-1.thread-avatar {display: none;}");
  65. }
  66.  
  67. function EnstylerPagePickerCreate() {
  68. if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
  69. var e, n, t, a = 1, o = 1;
  70. if ($(selectList).empty(), $("div.text--color-charcoalTint").length) {
  71. var i = $("div.text--color-charcoalTint").html().replace(/\r?\n|\r/g);
  72. isNaN(a = parseInt(i.replace(/.*>Seite /i, ""))) && (a = 1), isNaN(o = parseInt(i.replace(/.*page=/, ""))) && (o = a);
  73. }
  74. 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);
  75. a > o && (o = a), o > n && (t = document.createElement("option"), t.text = o, selectList.add(t)), selectList.value = a;
  76. var s = [ ".js-navDropDown-messages", "enPageEnum js-navDropDown-messages vAlign--all-m" ];
  77. $(".test-loginButton").length && (s[0] = ".test-loginButton"), $(".voteBar").length && (s = [ ".voteBar--sticky-off--hide.hAlign--all-r", "enPageEnum subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
  78. selectList.setAttribute("class", s[1]), $(s[0]).before(selectList);
  79. }
  80. }
  81.  
  82. function EnstylerPagePickerDo() {
  83. $(".js-sticky .text--color-charcoalTint").length && (selectList.value = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">Seite ')[1]));
  84. }
  85.  
  86. function EnstylerPageAction() {
  87. var e = "page=" + $(this).val(), n = ("" + enLocParser).replace(/page=.*|#.*/, "");
  88. n += n.endsWith("?") || n.endsWith("&") ? e : "?" + e, "/deals/" == enSection && (n += "#thread-comments"), window.location = n;
  89. }
  90.  
  91. function EnstylerPagePickerRemove() {
  92. $(".enPageEnum").remove();
  93. }
  94.  
  95. function EnstylerBlacklist() {
  96. enUserLogin && !GM_config.get("enConfWhitelist").includes(enUserName) && (GM_config.set("enConfWhitelist", "@" + enUserName + "," + GM_config.get("enConfWhitelist")),
  97. GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist"))), enBlack = RegExp(GM_config.get("enConfBlacklist").replace(unwantedRegex[0], "").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
  98. enBlackTrue = !"".match(enBlack), enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), enWhiteTrue = !"".match(enWhite),
  99. enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
  100. }
  101.  
  102. function EnstylerBlacklistDo() {
  103. if (GM_config.get("enConfBlackEnable") && (enBlackTrue || enBlackTemp >= -900)) {
  104. var e = !1;
  105. $(".comments-list").length && (e = !0);
  106. var n;
  107. $("article").not(".enClassBlackDone, .threadWidget-item").each(function() {
  108. $(this).addClass(enClassBlackDone), n = $(".thread-category", $(this)).text() + " " + $(".thread-title a", $(this)).text() + " @" + $(".user", $(this)).text(),
  109. e && (n += " " + $(".comments-item .userHtml", $(this)).text() + " @" + $(".vwo-user-link", $(this)).text()), n = n.replace(unwantedRegex[1], " "), enWhiteTrue && n.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && n.match(enBlack)) && ($(this).addClass(enClassHidden),
  110. enBlacklisted++, EnstylerLastSeenSkip("#" + $(this).attr(enID)));
  111. }), EnstylerBlacklistShow();
  112. }
  113. }
  114.  
  115. function EnstylerBlacklistShow() {
  116. enJSfieldDefs.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[enTEXT], enBlacklisted);
  117. }
  118.  
  119. function EnstylerBlacklistRemove() {
  120. enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden), $(".enClassBlackDone").removeClass(enClassBlackDone);
  121. }
  122.  
  123. function EnstylerBlacklistUnhide() {
  124. enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden);
  125. }
  126.  
  127. function EnstylerFixedNav() {
  128. if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
  129. var e = $("header").html();
  130. $("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
  131. var n = myFixedCSS.every;
  132. "/diskussion/" == enSection && (n += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (n += myFixedCSS.subnav), n = n.replace(enPATTERN[enTEXT], enMainHeigth),
  133. addStyleString(n);
  134. }
  135. }
  136.  
  137. function EnstylerDealTime() {
  138. TodayStart = new Date(enNow.getFullYear(), enNow.getMonth(), enNow.getDate()), ShowTime = 3600 * GM_config.get("enConfDealMinTime") * 1e3, EnstylerDealTimeDo();
  139. }
  140.  
  141. function EnstylerDealTimeDo() {
  142. if (enSection.match(enMainSectionMatch) && GM_config.get("enConfDealTime")) {
  143. var e, n, t = Date.now();
  144. $("time").not("." + EnstylerTimeSeen).each(function() {
  145. if (e = $(this).text(), e.length >= 8 && !e.endsWith("e") && (n = 6e4 * (60 * parseInt(e.replace(/.* ([0-9].*) [hu].*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*/, "$1"))),
  146. !isNaN(n))) {
  147. if (DealDate.setTime(t - n), TodayStart > DealDate) e = "<EN-LANG:yesterday> " + ("" + DealDate).slice(16, 21) + " <EN-LANG:oclock>"; else {
  148. if (ShowTime >= n) return;
  149. e += ' (<span class="hide--toW2"><EN-LANG:today> </span>' + ("" + DealDate).slice(16, 21) + " <EN-LANG:oclock>)";
  150. }
  151. $(this).html(enLangLocalize(e, enTimeLang, enLANG)), $(this).addClass(EnstylerTimeSeen);
  152. }
  153. });
  154. }
  155. }
  156.  
  157. function EnstylerLastSeen() {
  158. LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) ? (enSec = enNewestBase + enSection.replace(/\//, ""), GM_setValue(enNewestBase + "LastSec", enSec),
  159. enSeenArticle = GM_getValue(enSec), void 0 === enSeenArticle && (enSeenArticle = ""), EnstylerLastSeenDo(), "" == enLocParser.search && $("article").not(".threadWidget-item").each(function() {
  160. return $(this).length ? (GM_setValue(enSec, $(this).attr(enID)), GM_setValue(enSec + "Last", enSeenArticle), !1) : void 0;
  161. })) : EnstylerLastSeenLast());
  162. }
  163.  
  164. function EnstylerLastSeenDo() {
  165. "" != enSec && ("" != enSeenArticle ? (GM_setValue(enSec + "Last", enSeenArticle), $("#" + enSeenArticle).addClass("enClassMarkArticle")) : GM_setValue(enSec, "thread_1"));
  166. }
  167.  
  168. function EnstylerLastSeenLast() {
  169. enSec = GM_getValue(enNewestBase + "LastSec"), GM_setValue(enSec, GM_getValue(enSec + "Last"));
  170. }
  171.  
  172. function EnstylerLastSeenSkip(e) {
  173. e == "#" + enSeenArticle && (enSeenArticle = $(e).next().attr(enID), EnstylerLastSeenDo());
  174. }
  175.  
  176. function enCheckUpdates() {
  177. if (isMozilla && GM_config.get("enConfInjectCSS")) {
  178. var e = (Date.now() / 6e4 | 0) - GM_getValue("enLastUpdateCheck");
  179. (isNaN(e) || e > enUpdateInterval) && enUpdateCSS();
  180. }
  181. }
  182.  
  183. function enUpdateCSS() {
  184. var e = Date.now() / 6e4 | 0;
  185. enCacheExternalResource(enUpdateUrl + enComposeUpdateOpt(), "Enstyler2_CSS"), GM_setValue("enLastUpdateCheck", e);
  186. }
  187.  
  188. function enComposeUpdateOpt() {
  189. var e = GM_getValue("EnstylerCssOpt");
  190. if (void 0 === e) return "";
  191. e = e.replace(/\n/g, "");
  192. var n = e.split(";");
  193. if ("" == e || !e.startsWith("#")) return "";
  194. e = "";
  195. for (var t = 0; t < n.length; t++) if ("" != n[t]) {
  196. var a = n[t].split(":");
  197. e += "&" + a[1].slice(0, -1) + "=" + a[1];
  198. }
  199. return e = "?" + e.slice(1);
  200. }
  201.  
  202. function EnstylerMenuActions() {
  203. EnstylerNavRemove(), enInternational || EnstylerAddNav("Main", "<EN-LANG:discussion>", "/diskussion", "enMainDiscussion"), EnstylerAddNav("Main", "<EN-LANG:enstyler>", '<EN-LANG:enhref>" target="_blank', "enMainHomepage", "building"),
  204. EnstylerAddNav("MainButton", "<EN-LANG:settings>", showEnstylerConfig, EnstylerButton, "page");
  205. }
  206.  
  207. function EnstylerAddNav(e, n, t, a, o) {
  208. (void 0 === o || "" == o) && (o = enNavIconPat);
  209. var i = !1, s = enMenuItemCode[e].replace(enPATTERN[enID], a).replace(enPATTERN[enTEXT], n);
  210. 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)),
  211. enAddMain += s, i && (enAddMainFunc[enAddMainCount++] = {
  212. ID: a,
  213. target: t
  214. }));
  215. }
  216.  
  217. function EnstylerMainDo() {
  218. $(".popover-content nav .navMenu-div").first().before(enLangLocalize(enAddMain, enMenuLang, enLANG));
  219. var e = $(".popover--mainNav"), n = 35 * (enAddMain.split(enNavEntry).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  220. e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + n + "px"));
  221. for (var t = 0; enAddMainCount > t; t++) $("section #" + enAddMainFunc[t].ID).click(enAddMainFunc[t].target);
  222. }
  223.  
  224. function EnstylerNavRemove() {
  225. enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, $(".navMenu-page").unbind("click"), $(".enNavEntry").remove();
  226. }
  227.  
  228. function confLang(e) {
  229. return enLangLocalize("<EN-LANG:" + e + ">", enConfigLang, enLANG);
  230. }
  231.  
  232. function getLanguages() {
  233. return [ "auto", "de", "en", "nl" ];
  234. }
  235.  
  236. function showEnstylerConfig() {
  237. enGMConfigOpen ? GM_config.close() : (GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
  238. }
  239.  
  240. function showEnstylerCSS() {
  241. enGetHome(), GM_config.open();
  242. }
  243.  
  244. function confLangOpen() {
  245. 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);
  246. }
  247.  
  248. function enAmazonMobileRedirect() {
  249. var e = "" + enLocParser;
  250. return e.startsWith("https://www.amazon") ? (GM_config.get("enConfAmazonRedirect") && (e.includes("/gp/aw/d/") ? window.location.assign(e.replace("/gp/aw/d/", "/dp/")) : window.location.assign(e.replace("/gp/aw/ol/", "/gp/offer-listing/"))),
  251. !1) : !0;
  252. }
  253.  
  254. function EnstylerStart() {
  255. EnstylerFixedNav();
  256. EnstylerLastSeen(), EnstylerDealTime(), EnstylerBlacklist(), EnstylerDealActions();
  257. }
  258.  
  259. function EnstylerDelayedInit() {
  260. EnstylerMenuActions(), EnstylerPagePickerCreate(), $(".js-pagi-bottom").bind("DOMSubtreeModified", debounce(100, function() {
  261. EnstylerLastSeenDo(), EnstylerPagePickerDo(), EnstylerDealTimeDo(), EnstylerBlacklistDo(), EnstylerDealActionsDo();
  262. }));
  263. }
  264.  
  265. function WaitForBody() {
  266. $("footer").length ? MAIN() : setTimeout(WaitForBody, 200);
  267. }
  268.  
  269. function MAIN() {
  270. document.body.appendChild(enGMFrame);
  271. const e = Date.now();
  272. $(".nav").length && (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS"), 'domain("' + enLocParser.hostname), enCheckUpdates(), enMainHeigth = getOuterHeight("header"),
  273. sleepAsync(1e3).then(function() {
  274. var e = $(".nav").css("background-color"), n = $(".btn--mode-special").first().css("background-color");
  275. addStyleString(" .GM_config {background-color: " + shadeRGBColor(e, -.3) + " !important; color: " + shadeRGBColor(e, .5) + "; top: " + enMainHeigth + "px !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover { background-color: " + shadeRGBColor(e, .11) + " !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, .3) + " !important; border-color: " + shadeRGBColor(n, .3) + " !important;}");
  276. })), addStyleString(enCSS), "userstyles.org" != enInternationalSite ? enAmazonMobileRedirect() && (EnstylerInit(), EnstylerStart(), EnstylerStartupDelay = Date.now() - e,
  277. "loading" == document.readyState || "interactive" == document.readyState ? $(window).bind("load", function() {
  278. EnstylerDelayedInit();
  279. }) : sleepAsync(EnstylerStartupDelay).then(function() {
  280. EnstylerDelayedInit();
  281. })) : (GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS"), "url(https://userstyles.org"), EnstylerHomeButton(), enSetHome(), isMozilla && GM_config.get("enConfInjectCSS") && addStyleString(".install-status { display: none; }"));
  282. }
  283.  
  284. function EnstylerHomeButton() {
  285. $("#EnstylerButton").remove(), input.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), $("#style-settings").after(input);
  286. }
  287.  
  288. function enGetHome() {
  289. var e, n, t, a = "";
  290. $("#style-settings select").each(function() {
  291. e = $(this).attr(enID), n = $(this).val(), t = $("option[value=" + n + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  292. }), $("#style-settings input:checked").each(function() {
  293. e = $(this).attr(enID), n = $(this).val(), t = $("label[for=" + e + "]").text(), a += "#" + e + ":" + n + ":" + t + ";\n";
  294. }), GM_config.set("saveOpt", a);
  295. }
  296.  
  297. function enSetHome() {
  298. input.value = confLang("options");
  299. var e = GM_config.get("saveOpt");
  300. GM_setValue("EnstylerCssOpt", e), e = e.replace(/\n/g, "");
  301. var n = e.split(";");
  302. if ("" != e && e.startsWith("#")) {
  303. for (var t = 0; t < n.length; t++) {
  304. var a = n[t].split(":");
  305. a[0].match(/^#setting/i) ? ($(a[0]).val(""), $(a[0]).val(a[1])) : a[0].startsWith("#option") ? $(a[0]).prop("checked", !0) : "" != a[0] && alert('unkown option: "' + a + '"');
  306. }
  307. addStyleString(isMozilla && GM_config.get("enConfInjectCSS") ? ".install-status { display: none; }" : ".install-status { display: inline; }"), HideShowLogoSelect(),
  308. HideShowEnstyler();
  309. }
  310. }
  311.  
  312. function closeOnClick() {
  313. sleepAsync(1e4).then(function() {
  314. window.close();
  315. });
  316. }
  317.  
  318. function showNotSaved() {
  319. input.value = confLang(optnotsave), EnstylerHomeButton();
  320. }
  321.  
  322. function ShowHideItem(e, n, t, a) {
  323. $("#style-settings " + t).each(function() {
  324. -1 != $(this).text().indexOf(a) && ($(e).val() == n ? $(this).parent().addClass(enClassHidden) : $(this).parent().removeClass(enClassHidden));
  325. });
  326. }
  327.  
  328. function HideShowLogoSelect() {
  329. ShowHideItem("#setting-455195", "ik-logo1", "label", "MyDealz Logo");
  330. }
  331.  
  332. function HideShowEnstyler() {
  333. ShowHideItem("#setting-451668", "ik-compact1", "label", "|---");
  334. }
  335.  
  336. function enLangLocalize(e, n, t) {
  337. return e = e.replace(enLangPat, function(e, a) {
  338. return n.hasOwnProperty(t) && n[t].hasOwnProperty(a) ? n[t][a] : a;
  339. }), e.match(enLangPat) ? enLangLocalize(e, n, t) : e;
  340. }
  341.  
  342. function addStyleString(e, n) {
  343. if (void 0 === n && (n = ""), e.match(enUserScript.detect)) {
  344. "" == n && (n = enLocParser.hostname);
  345. var t = e.split(n);
  346. e = "";
  347. for (var a = 1; a < t.length; a++) t[a].includes("{") && (e += t[a].replace(enUserScript.split, "").replace(enUserScript.next, ""));
  348. }
  349. var o = document.createElement("style");
  350. o.innerHTML = e, document.body.appendChild(o);
  351. }
  352.  
  353. function capitalizeFirstLetter(e) {
  354. return e[0].toUpperCase() + e.slice(1);
  355. }
  356.  
  357. function truncStringWord(e, n, t) {
  358. return void 0 === t && (t = " "), e.length > n ? (e = e.substr(0, n - 1), e.substr(0, e.lastIndexOf(t)) + "...") : e;
  359. }
  360.  
  361. function sleepAsync(e) {
  362. return new Promise(resolve = setTimeout(resolve, e));
  363. }
  364.  
  365. function shadeRGBColor(e, n) {
  366. var t = e.split(","), a = 0 > n ? 0 : 255, o = 0 > n ? -1 * n : n, i = parseInt(t[0].slice(4)), s = parseInt(t[1]), l = parseInt(t[2]);
  367. return "rgb(" + (Math.round((a - i) * o) + i) + "," + (Math.round((a - s) * o) + s) + "," + (Math.round((a - l) * o) + l) + ")";
  368. }
  369.  
  370. function debounce(e, n) {
  371. var t = null;
  372. return function() {
  373. clearTimeout(t), t => setTimeout(function() {
  374. n.call(this);
  375. }, e);
  376. };
  377. }
  378.  
  379. function enCacheExternalResource(e, n) {
  380. GM_xmlhttpRequest({
  381. method: "GET",
  382. url: e,
  383. onload: function(e) {
  384. var t = e.responseText.replace(/\r\n/g, " ").replace(enStripComments, "").replace(enFixCSS, "100%");
  385. GM_setValue(n, ""), sleepAsync(500).then(GM_setValue(n, t)), addStyleString(t);
  386. }
  387. });
  388. }
  389.  
  390. function getOuterHeight(e) {
  391. e = "string" == typeof e ? document.querySelector(e) : e;
  392. var n = window.getComputedStyle(e), t = parseFloat(n.marginTop) + parseFloat(n.marginBottom);
  393. return Math.ceil(e.offsetHeight + t);
  394. }
  395.  
  396. const enLocParser = location, enInternationalSite = enLocParser.hostname.replace("www.", ""), enInternationalName = -1 == enInternationalSite.indexOf("pepper") ? capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")) : enInternationalSite, enInternational = "Mydealz" != enInternationalName;
  397.  
  398. var enLANG = enInternationalName.match(/mydealz|preisjaeger|userstyle/i) ? "de" : "en";
  399.  
  400. const enLangPat = /<EN-LANG:(.*?)>/g, myLang = GM_getValue("enLang");
  401.  
  402. "" == myLang || void 0 === myLang ? GM_setValue("enLANG", "") : enLANG = myLang;
  403.  
  404. var isMozilla = void 0 === GM_info.scriptHandler || !GM_info.scriptHandler.startsWith("Tamp"), enUserLogin = !1, enUserName = "", enSection = "";
  405.  
  406. const DEBUG = !1;
  407.  
  408. var enInitTime;
  409.  
  410. const enDealAction = [ '<a title="<EN-LANG:post>" class="link ico ico--pos-l ico--type-comment-blue linkPlain space--mr-3"href="<ENSTYLER-HREF-HERE>#comment-form" data-handler="track" data-track="{&quot;action&quot;:&quot;scroll_to_comment_add_form&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3"><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--mr-3"data-handler="track replace" data-replace="{&quot;endpoint&quot;:&quot;https://www.mydealz.de/threads/<ENSTYLER-THREADID-HERE>/remove&quot;,&quot;method&quot;:&quot;post&quot;}" data-track="{&quot;action&quot;:&quot;save_thread&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3"><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--mr-3"href="<ENSTYLER-HREF-HERE>/edit" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_thread_edit_form&quot;,&quot;beacon&quot;:true}">', '<span class="hide--toW3"><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-code-blue linkPlain ico--pos-l space--mr-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>" ], enDealLang = {
  411. de: {
  412. post: "Sag was dazu",
  413. remove: "Von Liste entfernen",
  414. edit: "Bearbeiten",
  415. mail: "Mail versenden",
  416. po: "Sag",
  417. rem: "Entf",
  418. ed: "Bearb",
  419. ma: "Mail"
  420. },
  421. en: {
  422. post: "post a comment",
  423. remove: "remove from list",
  424. edit: "edit",
  425. mail: "send as mail",
  426. po: "post",
  427. rem: "remove",
  428. ed: "edit",
  429. ma: "mail"
  430. }
  431. }, enDealMarker = "#thread_";
  432.  
  433. var enDealAdd = "", enDealUnbook = !1, enDealFooter = "";
  434.  
  435. const enDealActionPreHtml = '<span class="js-options bg--em bRad--a space--h-3 space--v-3 space--mt-3 text--b">', enPopupUser = [ '<button data-handler="track popover" data-track="{&quot;action&quot;:&quot;show_short_user_profile&quot;,&quot;label&quot;:&quot;engagement&quot;}" data-popover="{&quot;endpoint&quot;:&quot;', '/short&quot;,&quot;target&quot;:&quot;#template-popoverLoader&quot;,&quot;layout&quot;:[{&quot;preset&quot;:&quot;e&quot;,&quot;y&quot;:&quot;50%&quot;,&quot;left&quot;:{&quot;offset&quot;:0},&quot;width&quot;:300,&quot;maxWidth&quot;:&quot;100%&quot;}]}">', "</button>" ], enClassAvatarDone = "enClassAvatarDone", EnstylerPageEnum = "enPageEnum", selectList = document.createElement("select");
  436.  
  437. selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;
  438.  
  439. const enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone";
  440.  
  441. var enBlacklisted = 0;
  442.  
  443. const unwantedRegex = [ /[\[\]\(\)\{\}\?\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ];
  444.  
  445. var enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp;
  446.  
  447. const myFixedCSS = {
  448. every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .userProfile, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px}",
  449. subnav: ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px}",
  450. discus: ".tGrid.page2-center.height--all-full {margin-top: calc(<ENSTYLER-TEXT-HERE>px + 10px)}"
  451. };
  452.  
  453. var enNow = new Date(), DealDate = new Date(), TodayStart, ShowTime, EnstylerTimeSeen = "enTimeSeen";
  454.  
  455. const enTimeLang = {
  456. de: {
  457. yesterday: "Gestern",
  458. today: "heute",
  459. oclock: "Uhr"
  460. },
  461. en: {
  462. oclock: "o&acute;clock"
  463. }
  464. };
  465.  
  466. var enSec = "", enSeenArticle = "";
  467.  
  468. const enNewestBase = "enNewest" + enInternationalSite;
  469.  
  470. var LastSeenOnce = !0;
  471.  
  472. const enUpdateUrl = "https://userstyles.org/styles/128262/enstyler2-style-your-mydealz.css";
  473.  
  474. var enUpdateInterval = 1440;
  475.  
  476. const enMainSectionMatch = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, enHREF = "href", enID = "id", enTEXT = "text", enPATTERN = {
  477. href: /<ENSTYLER-HREF-HERE>/g,
  478. id: /<ENSTYLER-THREADID-HERE>/g,
  479. text: /<ENSTYLER-TEXT-HERE>/g
  480. }, enNavEntry = "enNavEntry", enMenuItemCode = {
  481. 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>',
  482. 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>',
  483. MainButton: '<a class="enNavEntry navMenu-link" id="<ENSTYLER-THREADID-HERE>"><span class="navMenu-link-ico ico ico--type-discussion-navMenuLayerText"></span><ENSTYLER-TEXT-HERE></a>',
  484. 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>'
  485. }, enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton", enMenuLang = {
  486. de: {
  487. discussion: "Alle Diskussionen",
  488. enstyler: "Enstyler Homepage",
  489. enhref: "https://www.mydealz.de/diskussion/enstyler-856062",
  490. settings: "Enstyler Einstellungen"
  491. },
  492. en: {
  493. discussion: "All discussions",
  494. enstyler: "Enstyler Homepage",
  495. enhref: "https://greasyfork.org/de/scripts/24243-enstylerjs",
  496. settings: "Enstyler Settings"
  497. }
  498. }, enDiscussionURL = {
  499. Mydealz: {
  500. url: "/diskussion"
  501. },
  502. Preisjaeger: {
  503. url: "/diskussion"
  504. },
  505. Nl: {
  506. url: "/discussies"
  507. }
  508. };
  509.  
  510. var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;
  511.  
  512. const enJSAutoUpdate = GM_info.scriptWillUpdate;
  513.  
  514. var enUpdateWindow;
  515.  
  516. const enConfigLang = {
  517. de: {
  518. headline: "Enstyler - Einstellungen",
  519. features: "Erweiterte Funktionen f&uuml;r Enstyler",
  520. configcss: "CSS Optionen",
  521. userscript: "Update Enstyler",
  522. cookies: "No Cookies",
  523. injectcss: "CSS ohne Stylish laden",
  524. config: "Konfiguration",
  525. navfixed: "feste Haupnavigation",
  526. userpopup: "Popuop f&uuml;r Userinfo",
  527. touch: "Touch Support aktivieren",
  528. amazon: "Amazon mobile redirect",
  529. dealaction: "zus&auml;tzliche Deal Aktionen",
  530. picker: "Zeige Page Picker",
  531. dealtime: "Zeige echte Deal Zeit",
  532. mintime: "wenn &auml;lter als x Stunden",
  533. blacklist: "Aktiviere Black- / Whitelist",
  534. blackcold: "Blacklist wenn k&auml;lter als",
  535. black: "Blacklist - Dealz, Kategorie, @Benutzer, Kommentare",
  536. white: "Whitelist",
  537. unblack: "Entferne von Blacklist:",
  538. lang: "Enstyler Sprache w&auml;hlen",
  539. save: "Speichern",
  540. close: "Schlie&szlig;en",
  541. savecss: "Deine ausgewählten CSS Optionen",
  542. howtocss: 'Zum Beibehalten der CSS Optionen "<EN-LANG:save>" klicken ',
  543. options: "Optionen speichern",
  544. optnotsave: "Klicken zum Speichern der Optionen!"
  545. },
  546. en: {
  547. headline: "Enstyler - Settings",
  548. features: "additonal features for Enstyler",
  549. configcss: "CSS Options",
  550. userscript: "Update Enstyler",
  551. cookies: "No Cookies",
  552. injectcss: "Inject CSS without Stylish",
  553. config: "Configuration",
  554. navfixed: "Display FIXED MainNav",
  555. userpopup: "Show Popuop Userinfo",
  556. touch: "Enable Touch Support",
  557. amazon: "Amazon mobile redirect",
  558. dealaction: "additional Deal actions",
  559. picker: "Enable Page Picker",
  560. dealtime: "Show real Deal Time",
  561. mintime: "if older than Hours",
  562. blacklist: "Enable Black- / Whitelist",
  563. blackcold: "Blacklist if colder then",
  564. black: "Blacklist - dealz, categories, @users, comments",
  565. white: "Whitelist",
  566. unblack: "Remove from blacklist:",
  567. lang: "Select Enstyler Language",
  568. save: "Save",
  569. close: "Close",
  570. savecss: "Your selected CSS options",
  571. howtocss: 'To store your CSS options klick "<EN-LANG:save>" ',
  572. options: "Save options",
  573. optnotsave: "Klick to save Options!"
  574. }
  575. }, enUnblackText = confLang("unblack") + " <ENSTYLER-TEXT-HERE> Dealz", enJSfieldDefs = {
  576. enstylerCSS: {
  577. section: [ confLang("features"), "" ],
  578. label: confLang("configcss"),
  579. type: "button",
  580. click: function() {
  581. enUpdateWindow = window.open("https://userstyles.org/styles/128262#style-info", "UserCSS", "width=600,height=950,left=0,top=0"), GM_setValue("enLastUpdateCheck", 0);
  582. }
  583. },
  584. enstylerJS: {
  585. label: confLang("userscript"),
  586. type: "button",
  587. click: function() {
  588. enUpdateWindow = window.open("https://greasyfork.org/scripts/24243-enstylerjs/code/EnstylerJS.user.js", "UserScript", "width=110,height=110,left=0,top=0"), sleepAsync(5e3).then(function() {
  589. enUpdateWindow.close();
  590. });
  591. }
  592. },
  593. dontCookies: {
  594. label: confLang("cookies"),
  595. type: "button",
  596. click: function() {
  597. window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
  598. }
  599. },
  600. enConfInjectCSS: {
  601. label: confLang("injectcss"),
  602. type: "checkbox",
  603. default: !0
  604. },
  605. Section: {
  606. section: [ confLang("config"), "" ],
  607. type: "hidden"
  608. },
  609. enConfNavFixed: {
  610. label: confLang("navfixed"),
  611. type: "checkbox",
  612. default: !0
  613. },
  614. enConfMoreDeal: {
  615. label: confLang("dealaction"),
  616. type: "checkbox",
  617. default: !0
  618. },
  619. enConfPopup: {
  620. label: confLang("userpopup"),
  621. type: "checkbox",
  622. default: !0
  623. },
  624. enConfTouch: {
  625. label: confLang("touch"),
  626. type: "checkbox",
  627. default: !1
  628. },
  629. enConfAmazonRedirect: {
  630. label: confLang("amazon"),
  631. type: "checkbox",
  632. default: !0
  633. },
  634. enConfPagePicker: {
  635. label: confLang("picker"),
  636. type: "checkbox",
  637. default: !0
  638. },
  639. enConfDealTime: {
  640. label: confLang("dealtime"),
  641. type: "checkbox",
  642. default: !0
  643. },
  644. enConfDealMinTime: {
  645. label: confLang("mintime"),
  646. type: "int",
  647. min: 1,
  648. max: 24,
  649. size: 4,
  650. default: 6
  651. },
  652. enConfBlackEnable: {
  653. label: confLang("blacklist"),
  654. type: "checkbox",
  655. default: !0
  656. },
  657. enConfHideColder: {
  658. label: confLang("blackcold"),
  659. type: "int",
  660. min: -9999,
  661. max: -9,
  662. size: 4,
  663. default: -999
  664. },
  665. enConfBlacklist: {
  666. label: confLang("black"),
  667. type: "text",
  668. size: 70,
  669. default: "G.steklo, Bangood, @Admin"
  670. },
  671. enConfWhitelist: {
  672. label: confLang("white"),
  673. type: "text",
  674. size: 70,
  675. default: ""
  676. },
  677. enConfUnblacklist: {
  678. label: confLang("unblack"),
  679. type: "button",
  680. click: function() {
  681. EnstylerBlacklistUnhide();
  682. }
  683. },
  684. enConfLang: {
  685. label: confLang("lang"),
  686. type: "select",
  687. options: getLanguages(),
  688. default: ""
  689. },
  690. saveOpt: {
  691. type: "hidden"
  692. }
  693. }, enHomefieldDefs = {
  694. saveOpt: {
  695. section: [ confLang("savecss"), "" ],
  696. label: confLang("howtocss"),
  697. type: "textarea",
  698. size: 70
  699. },
  700. enConfInjectCSS: {
  701. label: confLang("injectcss"),
  702. type: "checkbox",
  703. default: !0
  704. },
  705. enConfLang: {
  706. type: "hidden",
  707. options: getLanguages(),
  708. default: ""
  709. }
  710. }, enGMFrame = document.createElement("div");
  711.  
  712. enGMFrame.setAttribute("class", "GM_config");
  713.  
  714. var enGMConfigOpen = !1;
  715.  
  716. const enRemoveConfig = [ {
  717. check: !1,
  718. switch: "enConfDealTime",
  719. remove: "enConfDealMinTime"
  720. }, {
  721. check: !1,
  722. switch: "enConfBlackEnable",
  723. remove: "enConfWhitelist"
  724. }, {
  725. check: !1,
  726. switch: "enConfBlackEnable",
  727. remove: "enConfBlacklist"
  728. }, {
  729. check: !1,
  730. switch: "enConfBlackEnable",
  731. remove: "enConfHideColder"
  732. }, {
  733. check: !1,
  734. switch: "enConfBlackEnable",
  735. remove: "enConfUnblacklist"
  736. } ];
  737.  
  738. if (window.location.hostname.endsWith("userstyles.org")) GM_config.init({
  739. id: "GM_config",
  740. title: confLang("headline") + " CSS",
  741. fields: enHomefieldDefs,
  742. events: {
  743. open: function() {
  744. confLangOpen(), isMozilla || GM_config.fields.enConfInjectCSS.remove();
  745. },
  746. save: function() {
  747. enSetHome(), enUpdateCSS(), EnstylerHomeButton(), GM_config.close();
  748. },
  749. close: function() {
  750. enGMConfigOpen = !1;
  751. }
  752. },
  753. frame: enGMFrame
  754. }); else {
  755. var enFixedNavLast = !1;
  756. GM_config.init({
  757. id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
  758. title: confLang("headline"),
  759. fields: enJSfieldDefs,
  760. events: {
  761. open: function() {
  762. enFixedNavLast = GM_config.get("enConfNavFixed"), confLangOpen(), $(enRemoveConfig).each(function() {
  763. GM_config.get(this["switch"]) == this.check && GM_config.fields[this.remove].remove();
  764. }), enJSAutoUpdate && GM_config.fields.enstylerJS.remove(), isMozilla || (GM_config.fields.dontCookies.remove(), GM_config.fields.enConfInjectCSS.remove());
  765. },
  766. save: function() {
  767. "auto" == GM_config.get("enConfLang") ? GM_setValue("enLang", "") : GM_setValue("enLang", GM_config.get("enConfLang")), GM_config.get("enConfNavFixed") || GM_config.get("enConfNavFixed") == enFixedNavLast || window.location.reload(!1),
  768. GM_config.close(), enCheckUpdates(), EnstylerStart(), EnstylerMenuActions(), EnstylerPagePickerCreate(), GM_config.open();
  769. },
  770. close: function() {
  771. enGMConfigOpen = !1;
  772. }
  773. },
  774. frame: enGMFrame
  775. });
  776. }
  777.  
  778. 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;
  779.  
  780. WaitForBody();
  781.  
  782. var input = document.createElement("input");
  783.  
  784. input.type = "button", input.setAttribute(enID, EnstylerButton), input.onclick = showEnstylerCSS, input.value = confLang("options"), $(".install").click(closeOnClick),
  785. $("#style-settings").click(showNotSaved), $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);
  786.  
  787. const enUserScript = {
  788. detect: /.*?@-moz-document .*?\{\s*/,
  789. split: /^.*?\{/,
  790. next: /}\s*@-moz-document.*/
  791. }, enStripComments = /\/\*.*?\*\/| *|\t/g, enFixCSS = /1111.11%/g;