EnstylerJS

MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect

目前为 2017-01-14 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name EnstylerJS
  3. // @namespace Enstyler
  4. // @description MyDealz Enstyler enhanced features incl. Amazon Mobile Redirect
  5. // @include https://www.preisjaeger.at/*
  6. // @include https://www.mydealz.de/*
  7. // @include https://userstyles.org/styles/128262/*
  8. // @include https://www.amazon.*/gp/aw/*
  9. // @version 3.01.133-min
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @require http://code.jquery.com/jquery-3.1.1.min.js
  13. // @require http://openuserjs.org/src/libs/sizzle/GM_config.js
  14. // @run-at document-start
  15. // ==/UserScript==
  16. // mobile minimized Version, see develop version for commented Source:
  17. // https://greasyfork.org/de/scripts/24244-enstylerjs-develop?version=169098
  18. // hhttps://greasyfork.org/de/scripts/24244-enstylerjs-develop/diff?v1=169098&v2=168651
  19. function EnstylerInit() {
  20. (enUserLogin = $(".avatar--type-nav").length) ? (enUserName = $(".navDropDown a").attr(enHREF), enUserName = enUserName.replace(/.*\/profile\/([^\/]+).*/, "$1")) : $(document).on("click", ".test-loginButton", EnstylerLastSeenLast),
  21. enSection = enLocParser.pathname.replace(/\/([^\/]+\/*).*/, "/$1");
  22. }
  23.  
  24. function EnstylerDealActions() {
  25. if (enUserLogin && GM_config.get("enConfMoreDeal")) {
  26. enDealActionMailFooter = "%0D%0A%0D%0A-- %0D%0A" + enInternationalName + ":%0D%0A" + $("footer ul li:first p").html().replace(/.*<br>/g, "");
  27. var e = enLocParser.pathname, t = 0;
  28. switch ("" != enUserName && (e = e.replace(enUserName + "/", "")), $(".ico--type-grid-subNavActive").length && (t = 1), enDealAdd = enDealAction[0] + enDealAction[1 + t] + enDealAction[3], !0) {
  29. case e.endsWith("profile/saved-deals"):
  30. enDealAdd += enDealAction[4] + enDealAction[5 + t], +enDealAction[7], enDealUnbook = !0;
  31. break;
  32.  
  33. case e.endsWith("profile/diskussion"):
  34. case e.endsWith(enUserName):
  35. enDealAdd += enDealAction[8] + enDealAction[9 + t] + enDealAction[11];
  36. }
  37. enDealAdd += enDealAction[12] + enDealAction[13 + t] + enDealAction[15], enDealAdd = enDealActionOuterHtml[0] + enDealAdd + enDealActionOuterHtml[1], EnstylerDealActionsDo();
  38. }
  39. }
  40.  
  41. function EnstylerDealActionsDo() {
  42. if (enUserLogin && GM_config.get("enConfMoreDeal")) {
  43. var e, t, n, a, o;
  44. $("article:not(.enClassHidden)").each(function() {
  45. e = $(".thread-infoRow", $(this)), e.length && !$(enDealNoAction, $(this)).length && (t = $(".thread-title a", $(this)), n = t.attr(enHREF), a = encodeURIComponent(enInternationalName + ": " + t.text()),
  46. a.length < 100 && (a += encodeURIComponent($(".thread-price", $(this)).text().replace(/\t/g, "").replace(/^(.)/g, " -> $1"))), o = enDealAdd.replace(enPATTERN[enHREF], n).replace(enPATTERN[enTEXT], truncStringWord(a, 160, "%20") + "&body=" + a + "%0D%0A%0D%0A" + n + enDealActionMailFooter),
  47. enDealUnbook && (o = o.replace(enPATTERN[enID], ("#" + $(this).attr(enID)).replace(enDealMarker, ""))), e.append(o), e.removeClass("thread-infoRow"));
  48. }), $(".thread--type-detail .userHtml").each(function() {
  49. $(this).html($(this).html().replace(/<\/p>|<\/div>/gi, "").replace(/<div>|<p>/gi, "<br><br>").replace(/<br>(<br>)*<br>/gi, "<br><br>"));
  50. });
  51. }
  52. }
  53.  
  54. function EnstylerAvatarPopup() {
  55. enUserLogin && GM_config.get("enConfUser") && (addStyleString(".thread-footer-cell a img.avatar.vAlign--all-m.space--mr-1.thread-avatar {display: none;}"), EnstylerAvatarPopupDo());
  56. }
  57.  
  58. function EnstylerAvatarPopupDo() {
  59. if (enUserLogin && GM_config.get("enConfUser")) {
  60. var e, t, n, a = GM_config.get("enConfAvatar");
  61. $(".thread-footer-cell a.user.linkPlain, .user.linkPlain.thread-user").each(function() {
  62. $(this).hasClass(enClassAvatarDone) || $(this).hasClass(enClassBlackDone) || ($(this).addClass(enClassAvatarDone), e = $(this).html(), t = $(this).attr(enHREF), n = e.replace(/<span.*/, "").replace(/avatar--type-s/, "avatar--type-m"),
  63. a && (n = n.replace(/thread-avatar/, "avatar--type-m")), $(this).html(enPopupUser[0] + t + enPopupUser[1] + n + enPopupUser[2] + '<a href="' + t + '">' + e.replace(/.*<span class=".* space--mr-1">/, '<span class=" space--mr-1 user link-plain">') + "</a>"));
  64. });
  65. }
  66. }
  67.  
  68. function EnstylerPagePickerCreate() {
  69. if (EnstylerPagePickerRemove(), GM_config.get("enConfPagePicker")) {
  70. var e, t, n, a, o;
  71. if ($(selectList).empty(), $(".text--color-charcoalTint").length) {
  72. var i = $(".text--color-charcoalTint").html().replace(/\r?\n|\r/g);
  73. isNaN(e = parseInt(i.replace(/.*>Seite /i, ""))) && (e = 1), isNaN(t = parseInt(i.replace(/.*page=/, ""))) && (t = e);
  74. }
  75. for (x = 1; x <= t; ) {
  76. o = document.createElement("option"), o.text = x, selectList.add(o), a = x, n = Math.abs(x - e), x < 10 || 5 > n ? x++ : x < 1e3 && n > 600 ? x += Math.floor(n / 100) : x += Math.floor(n / 2);
  77. }
  78. e > t && (t = e), t > a && (o = document.createElement("option"), o.text = t, selectList.add(o)), selectList.value = e;
  79. var s = [ ".js-navDropDown-messages", "enPageEnum js-navDropDown-messages vAlign--all-m" ];
  80. $(".test-loginButton").length && (s[0] = ".test-loginButton"), $(".voteBar").length && (s = [ ".voteBar--sticky-off--hide:last", "enPageEnum subNavMenu-link subNavMenu-btn voteBar--sticky-off--hide" ]),
  81. selectList.setAttribute("class", s[1]), $(s[0]).before(selectList);
  82. }
  83. }
  84.  
  85. function EnstylerPagePickerDo() {
  86. $(".js-sticky .text--color-charcoalTint").length && (selectList.value = parseInt($(".js-sticky .text--color-charcoalTint").html().replace(/\r?\n|\r/g).split('--toW2">Seite ')[1]));
  87. }
  88.  
  89. function EnstylerPageAction() {
  90. var e = "page=" + $(this).val(), t = ("" + enLocParser).replace(/page=.*|#.*/, "");
  91. t += t.endsWith("?") || t.endsWith("&") ? e : "?" + e, "/deals/" == enSection && (t += "#thread-comments"), window.location = t;
  92. }
  93.  
  94. function EnstylerPagePickerRemove() {
  95. $(".enPageEnum").remove();
  96. }
  97.  
  98. function EnstylerBlacklist() {
  99. enUserLogin && !GM_config.get("enConfWhitelist").includes(enUserName) && (GM_config.set("enConfWhitelist", "@" + enUserName + "," + GM_config.get("enConfWhitelist")), GM_config.setValue("enConfWhitelist", GM_config.get("enConfWhitelist"))),
  100. enBlack = RegExp(GM_config.get("enConfBlacklist").replace(unwantedRegex[0], "").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"), enBlackTrue = !"".match(enBlack), enWhite = RegExp(GM_config.get("enConfWhitelist").replace(/^,|,$/g, "").replace(/(.),(.)/g, "$1|$2"), "i"),
  101. enWhiteTrue = !"".match(enWhite), enBlackTemp = GM_config.get("enConfHideColder"), EnstylerBlacklistRemove(), EnstylerBlacklistDo();
  102. }
  103.  
  104. function EnstylerBlacklistDo() {
  105. if (GM_config.get("enConfBlackEnable") && (enBlackTrue || enBlackTemp >= -900)) {
  106. var e;
  107. $("article:not(.enClassBlackDone, .threadWidget-item)").each(function() {
  108. $(this).addClass(enClassBlackDone), e = ($(".thread-category", $(this)).text() + " " + $(".thread-title a", $(this)).text() + " @" + $(".user", $(this)).text()).replace(unwantedRegex[1], " "), enWhiteTrue && e.match(enWhite) || (parseInt($(".vote-temp", $(this)).text()) <= enBlackTemp || enBlackTrue && e.match(enBlack)) && ($(this).addClass(enClassHidden),
  109. enBlacklisted++, EnstylerLastSeenSkip("#" + $(this).attr(enID)));
  110. }), EnstylerBlacklistShow();
  111. }
  112. }
  113.  
  114. function EnstylerBlacklistShow() {
  115. enJSfieldDefs.enConfUnblacklist.label = enUnblackText.replace(enPATTERN[enTEXT], enBlacklisted);
  116. }
  117.  
  118. function EnstylerBlacklistRemove() {
  119. enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden), $(".enClassBlackDone").removeClass(enClassBlackDone);
  120. }
  121.  
  122. function EnstylerBlacklistUnhide() {
  123. enBlacklisted = 0, EnstylerBlacklistShow(), $(".enClassHidden").removeClass(enClassHidden);
  124. }
  125.  
  126. function EnstylerFixedNav() {
  127. if (GM_config.get("enConfNavFixed") && "/deals/" != enSection && "/gutscheine/" != enSection) {
  128. var e = $("header").html();
  129. $("header").replaceWith('<header class="enFixedNav">' + e + "</header>");
  130. var t = myFixedCSS.every;
  131. "/diskussion/" == enSection && (t += myFixedCSS.discus), ($(".nav-subheadline").length || "/profile/" == enSection) && (t += myFixedCSS.subnav), t = t.replace(enPATTERN[enTEXT], enMainHeigth), addStyleString(t);
  132. }
  133. }
  134.  
  135. function EnstylerDealTime() {
  136. TodayStart = new Date(enNow.getFullYear(), enNow.getMonth(), enNow.getDate()), ShowTime = 3600 * GM_config.get("enConfDealMinTime") * 1e3, EnstylerDealTimeDo();
  137. }
  138.  
  139. function EnstylerDealTimeDo() {
  140. if (GM_config.get("enConfDealTime")) {
  141. var e, t = Date.now();
  142. $("time:not(." + EnstylerTimeSeen + ")").each(function() {
  143. if (e = $(this).text(), e.length >= 9 && e.startsWith("v")) {
  144. var n = 6e4 * (60 * parseInt(e.replace(/.* ([0-9].*) h.*/, "$1")) + parseInt(e.replace(/.* ([0-9].*) m.*/, "$1")));
  145. if (DealDate.setTime(t - n), TodayStart > DealDate) {
  146. $(this).text("gestern " + ("" + DealDate).slice(16, 21) + " Uhr");
  147. } else {
  148. if (ShowTime >= n) {
  149. return;
  150. }
  151. $(this).html(e + ' (<span class="hide--toW2">heute </span>' + ("" + DealDate).slice(16, 21) + " Uhr)");
  152. }
  153. $(this).addClass(EnstylerTimeSeen);
  154. }
  155. });
  156. }
  157. }
  158.  
  159. function EnstylerLastSeen() {
  160. LastSeenOnce && (LastSeenOnce = !1, enSection.match(enMainSectionMatch) ? (enSec = enNewestBase + enSection.replace(/\//, ""), GM_setValue(enNewestBase + "LastSec", enSec), enSeenArticle = GM_getValue(enSec),
  161. void 0 === enSeenArticle && (enSeenArticle = ""), EnstylerLastSeenDo(), "" == enLocParser.search && $("article:not(.threadWidget-item)").each(function() {
  162. return $(this).length ? (GM_setValue(enSec, $(this).attr(enID)), GM_setValue(enSec + "Last", enSeenArticle), !1) : void 0;
  163. })) : EnstylerLastSeenLast());
  164. }
  165.  
  166. function EnstylerLastSeenDo() {
  167. "" != enSec && ("" != enSeenArticle ? (GM_setValue(enSec + "Last", enSeenArticle), $("#" + enSeenArticle).addClass("enClassMarkArticle")) : GM_setValue(enSec, "thread_1"));
  168. }
  169.  
  170. function EnstylerLastSeenLast() {
  171. enSec = GM_getValue(enNewestBase + "LastSec"), GM_setValue(enSec, GM_getValue(enSec + "Last"));
  172. }
  173.  
  174. function EnstylerLastSeenSkip(e) {
  175. e == "#" + enSeenArticle && (enSeenArticle = $(e).next().attr(enID), EnstylerLastSeenDo());
  176. }
  177.  
  178. function enCheckUpdates() {
  179. if (GM_config.get("enConfInjectCSS")) {
  180. var e = (Date.now() / 6e4 | 0) - GM_getValue("enLastUpdateCheck");
  181. (isNaN(e) || e > enUpdateInterval) && enUpdateCSS();
  182. }
  183. }
  184.  
  185. function enUpdateCSS() {
  186. var e = Date.now() / 6e4 | 0;
  187. enCacheExternalResource(enUpdateUrl + enComposeUpdateOpt(), "Enstyler2_CSS"), GM_setValue("enLastUpdateCheck", e);
  188. }
  189.  
  190. function enComposeUpdateOpt() {
  191. var e = GM_getValue("Enstyler2Opt");
  192. if (void 0 === e) {
  193. return "";
  194. }
  195. e = e.replace(/\n/g, "");
  196. var t = e.split(";");
  197. if ("" == e || !e.startsWith("#")) {
  198. return "";
  199. }
  200. e = "";
  201. for (var n = 0; n < t.length; n++) {
  202. if ("" != t[n]) {
  203. var a = t[n].split(":");
  204. e += "&" + a[1].slice(0, -1) + "=" + a[1];
  205. }
  206. }
  207. return e = "?" + e.slice(1);
  208. }
  209.  
  210. function EnstylerMenuActions() {
  211. EnstylerNavRemove(), enInternational || EnstylerAddNav("Main", "Alle Diskussionen", "https://www.mydealz.de/diskussion", "enMainDiscussion"), EnstylerAddNav("Main", "Enstyler Homepage", 'https://www.mydealz.de/diskussion/enstyler-856062" target="_blank', "enMainHomepage", "building"),
  212. EnstylerAddNav("MainButton", "Enstyler Einstellungen", showEnstylerConfig, EnstylerButton, "page");
  213. }
  214.  
  215. function EnstylerAddNav(e, t, n, a, o) {
  216. (void 0 === o || "" == o) && (o = enNavIconPat);
  217. var i = !1, s = enMenuItemCode[e].replace(enPATTERN[enID], a).replace(enPATTERN[enTEXT], t);
  218. o != enNavIconPat && (s = s.split(enNavIconPat).join("--type-" + o)), "function" == typeof n ? i = !0 : s = s.replace(enPATTERN[enHREF], n), "M" == e[0] && ("" == enAddMain && $(".nav-link.navMenu-trigger").click(debounce(300, EnstylerMainDo)),
  219. enAddMain += s, i && (enAddMainFunc[enAddMainCount++] = {
  220. ID: a,
  221. target: n
  222. }));
  223. }
  224.  
  225. function EnstylerMainDo() {
  226. $(enAddMain).insertBefore(".popover-content nav .navMenu-div:first");
  227. var e = $(".popover--mainNav"), t = 35 * (enAddMain.split(enNavEntry).length - 1) + parseInt(e.attr("style").split("height: ")[1]);
  228. e.attr("style", e.attr("style").replace(/height: [0-9.]*px/, "height: " + t + "px"));
  229. for (var n = 0; enAddMainCount > n; n++) {
  230. $("section #" + enAddMainFunc[n].ID).click(enAddMainFunc[n].target);
  231. }
  232. }
  233.  
  234. function EnstylerNavRemove() {
  235. enAddMain = "", enAddMainFunc = [], enAddMainCount = 0, $(".navMenu-page").unbind("click"), $(".enNavEntry").remove();
  236. }
  237.  
  238. function showEnstylerConfig() {
  239. enGMConfigOpen ? GM_config.close() : (GM_config.open(), $(".popover--mainNav").remove(), enGMConfigOpen = !0);
  240. }
  241.  
  242. function showEnstylerCSS() {
  243. enGetHome(), GM_config.open();
  244. }
  245.  
  246. function enAmazonMobileRedirect() {
  247. var e = "" + enLocParser;
  248. 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/"))),
  249. !1) : !0;
  250. }
  251.  
  252. function EnstylerStart() {
  253. EnstylerFixedNav();
  254. EnstylerLastSeen(), EnstylerDealTime(), EnstylerBlacklist(), EnstylerAvatarPopup(), EnstylerDealActions();
  255. }
  256.  
  257. function EnstylerDelayedInit() {
  258. EnstylerMenuActions(), EnstylerPagePickerCreate(), $(".js-pagi-bottom").bind("DOMSubtreeModified", debounce(100, function() {
  259. EnstylerLastSeenDo(), EnstylerPagePickerDo(), EnstylerDealTimeDo(), EnstylerBlacklistDo(), EnstylerAvatarPopupDo(), EnstylerDealActionsDo();
  260. }));
  261. }
  262.  
  263. function WaitForBody() {
  264. $("footer").length ? MAIN() : setTimeout(WaitForBody, 200);
  265. }
  266.  
  267. function MAIN() {
  268. document.body.appendChild(enGMFrame);
  269. const e = Date.now();
  270. if ($(".nav").length) {
  271. GM_config.get("enConfInjectCSS") && addStyleString(GM_getValue("Enstyler2_CSS"), 'domain("' + enLocParser.hostname), enCheckUpdates();
  272. var t = $(".nav").css("background-color");
  273. enMainHeigth = parseInt($("header").outerHeight()), enCSS += " .GM_config {background-color: " + shadeRGBColor(t, -.3) + " !important; color: " + shadeRGBColor(t, .5) + "; top: " + enMainHeigth + "px !important;} .nav-link-text:hover, .js-navDropDown-messages:hover, .js-navDropDown-activities:hover { background-color: " + shadeRGBColor(t, .11) + " !important;}";
  274. }
  275. addStyleString(enCSS), "userstyles.org" != enInternationalSite ? enAmazonMobileRedirect() && (EnstylerInit(), EnstylerStart(), EnstylerStartupDelay = Date.now() - e, "loading" == document.readyState || "interactive" == document.readyState ? $(window).bind("load", function() {
  276. EnstylerDelayedInit();
  277. }) : sleepAsync(EnstylerStartupDelay).then(function() {
  278. EnstylerDelayedInit();
  279. })) : (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; }"));
  280. }
  281.  
  282. function EnstylerHomeButton() {
  283. $("#EnstylerButton").remove(), input.setAttribute("style", "font-size: 1.1em; padding: 0.8em;"), $("#style-settings").after(input);
  284. }
  285.  
  286. function enGetHome() {
  287. var e, t, n, a = "";
  288. $("#style-settings select").each(function() {
  289. e = $(this).attr(enID), t = $(this).val(), n = $("option[value=" + t + "]").text(), a += "#" + e + ":" + t + ":" + n + ";\n";
  290. }), $("#style-settings input:checked").each(function() {
  291. e = $(this).attr(enID), t = $(this).val(), n = $("label[for=" + e + "]").text(), a += "#" + e + ":" + t + ":" + n + ";\n";
  292. }), GM_config.set("saveOpt", a);
  293. }
  294.  
  295. function enSetHome() {
  296. input.value = "Save Options";
  297. var e = GM_config.get("saveOpt");
  298. GM_setValue("Enstyler2Opt", e), e = e.replace(/\n/g, "");
  299. var t = e.split(";");
  300. if ("" != e && e.startsWith("#")) {
  301. for (var n = 0; n < t.length; n++) {
  302. var a = t[n].split(":");
  303. 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 + '"');
  304. }
  305. addStyleString(isMozilla && GM_config.get("enConfInjectCSS") ? ".install-status { display: none; }" : ".install-status { display: inline; }"), HideShowLogoSelect(), HideShowEnstyler();
  306. }
  307. }
  308.  
  309. function closeOnClick() {
  310. sleepAsync(1e4).then(function() {
  311. window.close();
  312. });
  313. }
  314.  
  315. function showNotSaved() {
  316. input.value = "Klick to save Options!", EnstylerHomeButton();
  317. }
  318.  
  319. function ShowHideItem(e, t, n) {
  320. $(e).val() == t ? $("#style-settings " + n).parent().addClass(enClassHidden) : $("#style-settings " + n).parent().removeClass(enClassHidden);
  321. }
  322.  
  323. function HideShowLogoSelect() {
  324. ShowHideItem("#setting-455195", "ik-logo1", "label:contains(MyDealz Logo)");
  325. }
  326.  
  327. function HideShowEnstyler() {
  328. ShowHideItem("#setting-451668", "ik-compact1", "label:contains(|---)");
  329. }
  330.  
  331. function addStyleString(e, t) {
  332. if (void 0 === t && (t = ""), e.match(enUserScript.detect)) {
  333. "" == t && (t = enLocParser.hostname);
  334. var n = e.split(t);
  335. e = "";
  336. for (var a = 1; a < n.length; a++) {
  337. n[a].includes("{") && (e += n[a].replace(enUserScript.split, "").replace(enUserScript.next, ""));
  338. }
  339. }
  340. var o = document.createElement("style");
  341. o.innerHTML = e, document.body.appendChild(o);
  342. }
  343.  
  344. function capitalizeFirstLetter(e) {
  345. return e[0].toUpperCase() + e.slice(1);
  346. }
  347.  
  348. function truncStringWord(e, t, n) {
  349. return void 0 === n && (n = " "), e.length > t ? (e = e.substr(0, t - 1), e.substr(0, e.lastIndexOf(n)) + "...") : e;
  350. }
  351.  
  352. function sleepAsync(e) {
  353. return new Promise(resolve = setTimeout(resolve, e));
  354. }
  355.  
  356. function shadeRGBColor(e, t) {
  357. var n = e.split(","), a = 0 > t ? 0 : 255, o = 0 > t ? -1 * t : t, i = parseInt(n[0].slice(4)), s = parseInt(n[1]), l = parseInt(n[2]);
  358. return "rgb(" + (Math.round((a - i) * o) + i) + "," + (Math.round((a - s) * o) + s) + "," + (Math.round((a - l) * o) + l) + ")";
  359. }
  360.  
  361. function debounce(e, t) {
  362. var n = null;
  363. return function() {
  364. clearTimeout(n), n = setTimeout(function() {
  365. t.call(this);
  366. }, e);
  367. };
  368. }
  369.  
  370. function enCacheExternalResource(e, t) {
  371. GM_xmlhttpRequest({
  372. method: "GET",
  373. url: e,
  374. onload: function(e) {
  375. var n = e.responseText.replace(/\r\n/g, " ").replace(enStripComments, "");
  376. GM_setValue(t, n), addStyleString(n);
  377. }
  378. });
  379. }
  380.  
  381. const enLocParser = location, enInternationalSite = enLocParser.hostname.replace("www.", ""), enInternationalName = capitalizeFirstLetter(enInternationalSite.replace(/^\.|\..*/g, "")), enInternational = "Mydealz" != enInternationalName;
  382.  
  383. var isMozilla = void 0 === GM_info.scriptHandler || !GM_info.scriptHandler.startsWith("Tamp"), enUserLogin = !1, enUserName = "", enSection = "";
  384.  
  385. const DEBUG = !1;
  386.  
  387. var enInitTime;
  388.  
  389. const enDealAction = [ '<a title="Sag was dazu" class="link ico ico--pos-l ico--type-comment-blue space--mr-3"href="<ENSTYLER-HREF-HERE>#comment-form" data-handler="track" data-track="{&quot;action&quot;:&quot;scroll_to_comment_add_form&quot;,&quot;label&quot;:&quot;engagement&quot;}">', '<span class="hide--toW3">Sag was dazu</span><span class="hide--fromW3 hide--toW2">Sag</span>', "", "</a>", '<a title="Von Liste entfernen" class="link text--color-blue ico ico--type-bookmark-blue ico--pos-l space--mr-3"data-handler="track replace" data-replace="{&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">Von Liste entfernen</span><span class="hide--fromW3 hide--toW2">Enft</span>', "", "</a>", '<a title="Bearbeiten" class="link text--color-blue ico ico--type-pencil-blue ico--pos-l space--mr-3"href="<ENSTYLER-HREF-HERE>/edit" data-handler="track" data-track="{&quot;action&quot;:&quot;goto_thread_edit_form&quot;,&quot;beacon&quot;:true}">', '<span class="hide--toW3">Bearbeiten</span><span class="hide--fromW3 hide--toW2">Bearb</span>', "", "<span></a>", '<a title="Als Mail versenden" class="link text--color-blue ico ico--type-code-blue ico--pos-l space--mr-3"href="mailto:?subject=<ENSTYLER-TEXT-HERE>" <span class="hide--toW3">', '<span class="hide--toW3">Mail versenden</span><span class="hide--fromW3 hide--toW2">Mail</span>', "", "<span></a>" ], enDealMarker = "#thread_", enDealNoAction = ".ico--type-clock-grey, .vote-temp--colder";
  390.  
  391. var enDealAdd = "", enDealUnbook = !1, enDealActionMailFooter = "";
  392.  
  393. const enDealActionOuterHtml = [ '<span class="js-options bg--em bRad--a space--h-3 space--v-3 space--mt-3 text--b">', "</span>" ], enPopupUser = [ '<button data-handler="track popover" data-track="{&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");
  394.  
  395. selectList.id = EnstylerPageEnum, selectList.setAttribute("class", EnstylerPageEnum), selectList.onchange = EnstylerPageAction;
  396.  
  397. const enClassHidden = "enClassHidden", enClassBlackDone = "enClassBlackDone";
  398.  
  399. var enBlacklisted = 0;
  400.  
  401. const unwantedRegex = [ /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\ ]/g, /[\[\]\(\)\{\}\?\.\:\;\!\"\*\+\,]/g ];
  402.  
  403. var enBlack, enBlackTrue, enWhite, enWhiteTrue, enBlackTemp;
  404.  
  405. const enUnblackText = "unBlacklist <ENSTYLER-TEXT-HERE> Dealz", myFixedCSS = {
  406. every: ".enFixedNav { display: block; position: fixed; width: 100%; z-index: 120;} .subNav, .userProfile, .tabbedInterface, .splitPage-wrapper {margin-top: <ENSTYLER-TEXT-HERE>px}",
  407. subnav: ".subNav {margin-top: 0 !important;} .nav-subheadline {margin-top: <ENSTYLER-TEXT-HERE>px}",
  408. discus: ".tGrid.page2-center.height--all-full {margin-top: calc(<ENSTYLER-TEXT-HERE>px + 10px)}"
  409. };
  410.  
  411. var enNow = new Date(), DealDate = new Date(), TodayStart, ShowTime, EnstylerTimeSeen = "enTimeSeen", enSec = "", enSeenArticle = "";
  412.  
  413. const enNewestBase = "enNewest" + enInternationalSite;
  414.  
  415. var LastSeenOnce = !0;
  416.  
  417. const enUpdateUrl = "https://userstyles.org/styles/128262/enstyler2-style-your-mydealz.css";
  418.  
  419. var enUpdateInterval = 1440;
  420.  
  421. const enMainSectionMatch = /^\/$|^\/hot$|^\/new$|^\/settings$|^\/discussed$|^\/hei%C3%9F$|^\/diskutiert$/, enHREF = "href", enID = "id", enTEXT = "text", enPATTERN = {
  422. href: /<ENSTYLER-HREF-HERE>/g,
  423. id: /<ENSTYLER-THREADID-HERE>/g,
  424. text: /<ENSTYLER-TEXT-HERE>/g
  425. }, enNavEntry = "enNavEntry", enMenuItemCode = {
  426. 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>',
  427. 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>',
  428. 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>',
  429. 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>'
  430. }, enMenuItemLength = enMenuItemCode.length, EnstylerButton = "EnstylerButton";
  431.  
  432. var enNavIconPat = "--type-discussion", enAddMain = "", enAddMainFunc = [], enAddMainCount = 0;
  433.  
  434. const enJSAutoUpdate = GM_info.scriptWillUpdate;
  435.  
  436. var enUpdateWindow;
  437.  
  438. const enJSfieldDefs = {
  439. enstylerCSS: {
  440. section: [ "additonal features for Enstyler", "" ],
  441. label: "Config CSS",
  442. type: "button",
  443. click: function() {
  444. enUpdateWindow = window.open("https://userstyles.org/styles/128262#style-info", "UserCSS", "width=600,height=950,left=0,top=0");
  445. }
  446. },
  447. enstylerJS: {
  448. label: "UserScript",
  449. type: "button",
  450. click: function() {
  451. 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() {
  452. enUpdateWindow.close();
  453. });
  454. }
  455. },
  456. dontCookies: {
  457. label: "No Cookies",
  458. type: "button",
  459. click: function() {
  460. window.open("https://addons.mozilla.org/firefox/addon/self-destructing-cookies/");
  461. }
  462. },
  463. enConfInjectCSS: {
  464. label: "Inject CSS without Stylish",
  465. type: "checkbox",
  466. default: !0
  467. },
  468. Section: {
  469. section: [ "Configuration", "" ],
  470. type: "hidden"
  471. },
  472. enConfNavFixed: {
  473. label: "Display FIXED MainNav",
  474. type: "checkbox",
  475. default: !0
  476. },
  477. enConfUser: {
  478. label: "Show Popuop Userinfo",
  479. type: "checkbox",
  480. default: !0
  481. },
  482. enConfAvatar: {
  483. label: "bigger Avatar for Popuop",
  484. type: "checkbox",
  485. default: !0
  486. },
  487. enConfAmazonRedirect: {
  488. label: "Amazon mobile redirect",
  489. type: "checkbox",
  490. default: !0
  491. },
  492. enConfMoreDeal: {
  493. label: "additional Deal actions",
  494. type: "checkbox",
  495. default: !0
  496. },
  497. enConfPagePicker: {
  498. label: "Enable Page Picker",
  499. type: "checkbox",
  500. default: !0
  501. },
  502. enConfDealTime: {
  503. label: "Show real Deal Time",
  504. type: "checkbox",
  505. default: !0
  506. },
  507. enConfDealMinTime: {
  508. label: "if older than Hours",
  509. type: "int",
  510. min: 1,
  511. max: 24,
  512. size: 4,
  513. default: 6
  514. },
  515. enConfBlackEnable: {
  516. label: "Enable Black- / Whitelist",
  517. type: "checkbox",
  518. default: !0
  519. },
  520. enConfHideColder: {
  521. label: "Blacklist if colder then",
  522. type: "int",
  523. min: -9999,
  524. max: -9,
  525. size: 4,
  526. default: -999
  527. },
  528. enConfBlacklist: {
  529. label: "Blacklist - deals, categories, @users",
  530. type: "text",
  531. size: 70,
  532. default: "Nutella, Bangood, @Admin"
  533. },
  534. enConfWhitelist: {
  535. label: "Whitelist",
  536. type: "text",
  537. size: 70,
  538. default: ""
  539. },
  540. enConfUnblacklist: {
  541. label: "UnBlacklist",
  542. type: "button",
  543. click: function() {
  544. EnstylerBlacklistUnhide();
  545. }
  546. },
  547. saveOpt: {
  548. type: "hidden"
  549. }
  550. }, enHomefieldDefs = {
  551. saveOpt: {
  552. section: [ "save your CSS options for next visit", "" ],
  553. label: 'Select your CSS on main page then come back and klick "Save" ',
  554. type: "textarea",
  555. size: 70
  556. },
  557. enConfInjectCSS: {
  558. label: "Inject CSS without Stylish",
  559. type: "checkbox",
  560. default: !0
  561. },
  562. copy: {
  563. section: [ "", '(c) Gnadelwartz - <a target="blank" href="https://www.mydealz.de/diskussion/enstyler2-style-your-mydealz-incl-pepper-sites-736219">Enstyler2 - Style your MyDealz</a>' ],
  564. type: "hidden",
  565. value: "Some hidden value"
  566. }
  567. }, enGMFrame = document.createElement("div");
  568.  
  569. enGMFrame.setAttribute("class", "GM_config");
  570.  
  571. var enGMConfigOpen = !1;
  572.  
  573. if (window.location.hostname.endsWith("userstyles.org")) {
  574. GM_config.init({
  575. id: "GM_config",
  576. title: "Enstyler2 - Settings",
  577. fields: enHomefieldDefs,
  578. events: {
  579. open: function() {
  580. isMozilla || GM_config.fields.enConfInjectCSS.remove();
  581. },
  582. save: function() {
  583. enSetHome(), enUpdateCSS(), EnstylerHomeButton(), GM_config.close();
  584. },
  585. close: function() {
  586. enGMConfigOpen = !1;
  587. }
  588. },
  589. frame: enGMFrame
  590. });
  591. } else {
  592. var enFixedNavLast = !1;
  593. GM_config.init({
  594. id: enInternational ? "GM_config" + enInternationalSite : "GM_config",
  595. title: "EnstylerJS - Settings",
  596. fields: enJSfieldDefs,
  597. events: {
  598. open: function() {
  599. var e = [ {
  600. check: !1,
  601. switch: "enConfDealTime",
  602. remove: "enConfDealMinTime"
  603. }, {
  604. check: !1,
  605. switch: "enConfBlackEnable",
  606. remove: "enConfWhitelist"
  607. }, {
  608. check: !1,
  609. switch: "enConfBlackEnable",
  610. remove: "enConfBlacklist"
  611. }, {
  612. check: !1,
  613. switch: "enConfBlackEnable",
  614. remove: "enConfHideColder"
  615. }, {
  616. check: !1,
  617. switch: "enConfBlackEnable",
  618. remove: "enConfUnblacklist"
  619. } ];
  620. enFixedNavLast = GM_config.get("enConfNavFixed"), $(e).each(function() {
  621. GM_config.get(this["switch"]) == this.check && GM_config.fields[this.remove].remove();
  622. }), enJSAutoUpdate && GM_config.fields.enstylerJS.remove(), isMozilla || (GM_config.fields.dontCookies.remove(), GM_config.fields.enConfInjectCSS.remove());
  623. },
  624. save: function() {
  625. GM_config.get("enConfNavFixed") || GM_config.get("enConfNavFixed") == enFixedNavLast || window.location.reload(!1), GM_config.close(), EnstylerStart(), EnstylerMenuActions(), EnstylerPagePickerCreate(),
  626. GM_config.open();
  627. },
  628. close: function() {
  629. enGMConfigOpen = !1;
  630. }
  631. },
  632. frame: enGMFrame
  633. });
  634. }
  635.  
  636. 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;
  637.  
  638. WaitForBody();
  639.  
  640. var input = document.createElement("input");
  641.  
  642. input.type = "button", input.setAttribute(enID, EnstylerButton), input.onclick = showEnstylerCSS, input.value = "Save Options", $(".install").click(closeOnClick), $("#style-settings").click(showNotSaved),
  643. $("#setting-455195").change(HideShowLogoSelect), $("#setting-451668").change(HideShowEnstyler);
  644.  
  645. const enUserScript = {
  646. detect: /.*?@-moz-document .*?\{\s*/,
  647. split: /^.*?\{/,
  648. next: /}\s*@-moz-document.*/
  649. }, enStripComments = /\/\*.*?\*\/| *|\t/g;