User:Tobias Alcaraz/common.min.js

From Mine Blocks Wiki
< User:Tobias Alcaraz
Revision as of 17:14, 2 January 2022 by Tobias Alcaraz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
function setColorScheme(e){switch(e){case"dark":syntaxHighlighterConfig={backgroundColor:"transparent",foregroundColor:"unset",boldOrItalicColor:"#44466d",commentColor:"#4d1a19",entityColor:"#474d23",externalLinkColor:"",headingColor:"#44466d",hrColor:"#44466d",listOrIndentColor:"#4d1a19",parameterColor:"#66331e",signatureColor:"#66331e",tagColor:"#662946",tableColor:"#5e5129",templateColor:"#5e5129",wikilinkColor:"#245477"};break;case"light":syntaxHighlighterConfig={boldOrItalicColor:"#e4e5f3",commentColor:"#f8dbda",entityColor:"#e8ebda",externalLinkColor:"#dbeceb",headingColor:"#e4e5f3",hrColor:"#e4e5f3",listOrIndentColor:"#f8dbda",parameterColor:"#f5e0d8",signatureColor:"#f5e0d8",tagColor:"#f6dde9",tableColor:"#f0ebdb",templateColor:"#f0ebdb",wikilinkColor:"#d9eaf6"};break;default:syntaxHighlighterConfig={boldOrItalicColor:"#e4e5f3",commentColor:"#f8dbda",entityColor:"#e8ebda",externalLinkColor:"#dbeceb",headingColor:"#e4e5f3",hrColor:"#e4e5f3",listOrIndentColor:"#f8dbda",parameterColor:"#f5e0d8",signatureColor:"#f5e0d8",tagColor:"#f6dde9",tableColor:"#f0ebdb",templateColor:"#f0ebdb",wikilinkColor:"#d9eaf6"};break}}function getPreferredColorScheme(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(mw.loader.load("//code.jquery.com/jquery-3.6.0.min.js"),mw.loader.load("//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript"),function(){var e,t,r,o,i={"\\&":"&#38;","<":"&#60;",">":"&#62;"},a=function(e){return e.replace(/\\\\/g,"&#92;").replace(/\\&|[<>]/g,(function(e){return i[e]}))},n=$(),l=$(window);$("#mw-content-text").on({"mouseenter.minetip":function(i){n.remove();var d=$(this),s=d.attr("data-minetip-title");if(void 0===s&&void 0!==(s=d.attr("title"))&&(s=$.trim(s.replace(/&/g,"\\&")),d.attr("data-minetip-title",s)),"Empty"!==s){if(void 0===s||""!==s&&""===s.replace(/&([0-9a-fl-or])/g,"")){var c,m=d[0];do{m.hasAttribute("title")&&(c=m.title),m=m.firstChild}while(m&&1===m.nodeType);if(void 0===c)return;s||(s=""),s+=$.trim(c.replace(/&/g,"\\&")),d.attr("data-minetip-title",s)}if(d.data("minetip-ready")||(d.find("[title]").addBack().removeAttr("title"),d.data("minetip-ready",!0)),""!==s&&"Invisible-sprite"!==s){var f='<span class="minetip-title">'+a(s)+"&r</span>",g=$.trim(d.attr("data-minetip-text"));g&&(f+='<span class="minetip-description">'+(g=a(g).replace(/\\\//g,"&#47;")).replace(/\//g,"<br>")+"&r</span>"),f=f.replace(/&r/g,""),(n=$('<div id="minetip-tooltip">')).html(f).appendTo("body"),e=l.width(),t=l.height(),r=n.outerWidth(!0),o=n.outerHeight(!0),d.trigger("mousemove",i)}}},"mousemove.minetip":function(i,a){if(n.length){var l=(i=a||i).clientY-34,d=i.clientX+14;d+r>e&&(d-=r+36),d<0?(d=0,(l-=o-22)<0&&(l+=o+47)):l<0?l=0:l+o>t&&(l=t-o),n.css({top:l,left:d})}else $(this).trigger("mouseenter")},"mouseleave.minetip":function(){n.length&&(n.remove(),n=$())}},".minetip, .invslot-item")}(),jQuery((function(e){function t(){var t=e(this).children(),r=t.filter(".ts-active"),o=r.next();0===o.length&&(o=t.first()),r.removeClass("ts-active"),o.addClass("ts-active")}e(".ts-container").each((function(){var r,o=e(this);if(o.children().length>1){"string"==typeof(r=o.attr("data-delay-ms"))||"number"==typeof r?(r=r||0)<100&&(r=100):r=1500,o.data("delayms",r),o.on("tsanimate",t),o.trigger("tsanimate");var i=window.setInterval((function(){o.trigger("tsanimate")}),r);o.mouseenter((function(){o.parents(".ts-sync").length||clearInterval(i)})).mouseleave((function(){o.parents(".ts-sync").length||(i=window.setInterval((function(){o.trigger("tsanimate")}),r))})),e(".ts-sync").each((function(){e(this).mouseenter((function(){clearInterval(i)})).mouseleave((function(){i=window.setInterval((function(){o.trigger("tsanimate")}),r)}))}))}}))})),window.matchMedia){var colorSchemeQuery=window.matchMedia("(prefers-color-scheme: dark)");colorSchemeQuery.addEventListener("change",setColorScheme(getPreferredColorScheme()))}