User:KurwaAntics/global.js

// AjaxBatchDelete delay // batchDeleteDelay = 750;

// Import script files // importArticles({   type: "script",    articles: [        "w:c:dev:DisplayClock/code.js",        "w:c:dev:ReferencePopups/code.js",        "w:c:dev:FindAndReplace/code.js",        "w:c:dev:RevealAnonIP/usercode.js",        "w:c:dev:SearchSuggest/code.js"    ] });

// Quick redirect templates // if( window.location.href.indexOf('T:') > -1) window.location.href = window.location.href.replace('T:','Template:');

// Teleporter // $(".page-User_Yhynerson1 .mw-content-ltr.mw-content-text, .page-用戶_Yhynerson1 .mw-content-ltr.mw-content-text").prepend(' ')

// Replace pictures with Font Awesome icons// $('a[data-name="whatlinkshere"]').prepend(' '); $('a[data-name="themedesigner"], span[title="This tool can be used by wiki administrators."]').prepend(' '); $('.mytools.menu > a').prepend('  '); $('a.tools-customize').prepend('  ');

var x = (window.location.href.indexOf('?') > -1) ? '&' : '?';

// Edit wiki navigation // $(".WikiHeader div.buttons").append(   ' '+    '  Edit wiki navigation'+    '  ' ); // Edit the section before TOC // $(".header-column.header-title").append(   'Edit' );

// Wikia bar // $("ul.tools").append( // Edit menu // ''+ '</i>  Page actions</a>'+ '<ul id="my-tools-menu" class="tools-menu">'+ '<li class="overflow editpage">'+ '<a href="' + $("#ca-edit").attr("href") + '"></i>  Edit</a>'+ '</li>'+ '<li class="overflow view-source">'+ '<a href="' + window.location.href + x + 'action=raw"></i>  Source</a>'+ '</li>'+ '<li class="overflow history">'+ '<a href="' + $("#ca-history").attr("href") + '"></i>  History</a>'+ '</li>'+ '<li class="overflow move">'+ '<a href="' + $("#ca-move").attr("href") + '"></i>  Move</a>'+ '</li>'+ '<li class="overflow talk-comments">'+ '<a href="' + $(".wikia-button.comments.secondary").attr("href") + '"></i>  Talk</a>'+ '</li>'+ '<li class="overflow protect">'+ '<a href="' + $("#ca-protect").attr("href") + '"></i> Protect</a>'+ '</li>'+ '<li class="overflow unprotect">'+ '<a href="' + $("#ca-unprotect").attr("href") + '"></i> Change protection</a>'+ '</li>'+ '<li class="overflow delete">'+ '<a href="' + $("#ca-delete").attr("href") + '"></i> Delete</a>'+ '</li>'+ '</ul>'+ '</li>'+

// User menu // '<li class="mytools menu">'+ '</i>  User</a>'+ '<ul id="my-tools-menu" class="tools-menu">'+ ' '+ '<a href="' + $("a[data-id=userpage]").attr("href") + '"></i> My page</a>'+ '</li>'+ ' '+ '<a href="' + $("a[data-id=mytalk]").attr("href") + '"></i> Talk</a>'+ '</li>'+ ' '+ '<a href="/wiki/Special:Contributions/' + wgUserName + '"></i> Contributions</a>'+ '</li>'+ ' '+ '<a href="/wiki/Special:Preferences"></i> Settings</a>'+ '</li>'+ '</ul>'+ '</li>'+

// Search box // ' <a><i class="fa fa-search"></i>  </a>'+ '<form name="searchbox" id="searchbox" class="searchbox" action="/wiki/Special:Search" style="float: right; ">'+ '<input class="searchboxInput" name="search" type="text" placeholder="Search..." autocomplete="off" style="width:48px; background:transparent; border:none; padding:0; height:14px !important; font-size: 12px; font-family: helvetica, arial, sans-serif;">'+ '<input type="submit" name="go" class="searchboxGoButton" value="Try exact match" style="display:none">'+ '<input type="submit" name="fulltext" class="searchboxSearchButton" value="Search full text" style="display:none">'+ ' '+ '</li>');

// Edit boolean // if( $(".wikia-button.comments.secondary").attr("href")===undefined){ $(".talk-comments").hide; } if( $("#ca-edit").attr("href")===undefined){ $(".editpage").hide; } if( $("#ca-history").attr("href")===undefined){ $(".history").hide; } if( $("#ca-move").attr("href")===undefined){ $(".move").hide; } if( $("#ca-protect").attr("href")===undefined){ $(".protect").hide; } if( $("#ca-unprotect").attr("href")===undefined){ $(".unprotect").hide; } if( $("#ca-delete").attr("href")===undefined){ $(".delete").hide; } if( $("a[data-id=wikinavedit]").attr("href")===undefined){ $(".wikinavedit").hide; } if( window.location.href.indexOf('Message_Wall:') >= 0 || window.location.href.indexOf('Thread:') >= 0 || window.location.href.indexOf('Special:') >= 0 || window.location.href.endsWith("User_blog:" + wgUserName ) ){ $('.page-actions').hide; }

// The search Bar // $("#WikiaBar .searchboxInput").focusin(function {   $("#WikiaBar .searchbox, #WikiaBar .searchboxInput").animate({"width":"200px"},300);    }).focusout(function {        if( $(this).val.length === 0 ) {            $("#WikiaBar .searchbox, #WikiaBar .searchboxInput").animate({"width":"48px"},300);        }    });

// Show Hide Bar // $("body:not(.mainpage):not(.editor)").prepend(' <i class="fa fa-chevron-left"></i> ');

$(".WikiaPage").prepend(' ');

$( "#WikiaRail" ).addClass( "show-hide-hidden" );

$( ".show-hide-rail" ).click(function {   if ( $( "#WikiaRail" ).hasClass( "show-hide-hidden" ) === false ) {        HideRail;    } else if ( $( "#WikiaRail" ).is(":visible") === true ) {        ShowRail;    } }); $( ".show-hide-greyout" ).click(function {   HideRail; });

function ShowRail { $( "#WikiaRail" ).removeClass( "show-hide-hidden" ); $( "#WikiaRail" ).animate( {"right": "0"}, 250 ); $( "#WikiaPage" ).animate( {"left": "-300px"}, 250 ); $( ".show-hide-rail" ).animate( {"right": "300px"}, 250 ); $( ".show-hide-rail i" ).addClass( "fa-chevron-right" ).removeClass( "fa-chevron-left" ); $( ".show-hide-greyout" ).fadeIn(250); }

function HideRail { $( "#WikiaRail" ).addClass( "show-hide-hidden" ); $( "#WikiaRail" ).animate( {"right": "-300px"}, 250 ); $( "#WikiaPage" ).animate( {"left": "0"}, 250 ); $( ".show-hide-rail" ).animate( {"right": "0"}, 250 ); $( ".show-hide-rail i" ).addClass( "fa-chevron-left" ).removeClass( "fa-chevron-right" ); $( ".show-hide-greyout" ).fadeOut(250); }

// Font changer // function changefont { var x = document.getElementById("changefont").value; $( "body" ).css( 'font-family', x ); }

$('body').prepend(   '<div style="position: fixed; z-index: 9; left: 50%; transform: translateX(-50%);">\    <select id="changefont" onchange="changefont;">\    <option name="font" value="Helvetica">Helvetica \    <option name="font" value="Helvetica Neue">Helvetica Neue \    <option name="font" value="Arial">Arial \    <option name="font" value="Roboto">Roboto \    <option name="font" value="\'.SFNSDisplay-Regular\'">San Francisco Display \    <option name="font" value="-apple-system, San Francisco">San Francisco Text \    \    ');

// Background color brightness // var bgColor = $('#WikiaPageBackground').css('background-color'); if ('transparent' == bgColor) bgColor = $('#WikiaPage').css('background-color'); if ('transparent' == bgColor) bgColor = $('#EditPageHeader').css('background-color'); var color = bgColor; function isBright (color) { var m = color.match(/(?:([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2}))|(?:(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3}))/); if (!m) return false; var rgb = m[1] ? { r: parseInt(m[1], 16), g: parseInt(m[2], 16), b: parseInt(m[3], 16) } : { r: parseInt(m[4], 10), g: parseInt(m[5], 10), b: parseInt(m[6], 10) }; return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 >= 128; } if(isBright (color)===false) { $(".show-hide-rail, #WikiaRail").css({"background":"#333", "border-color":"#666", "color":"#ccc"}); $(".changefont").css('background', 'rgba(96, 96, 96, 0.5)'); }