(Removing all content from page) |
No edit summary |
||
Line 1: | Line 1: | ||
+ | importArticles({ |
||
+ | type: 'script', |
||
+ | articles: [ |
||
+ | //"external:eladkse:MediaWiki:RelatedDiscussionsModule.js", |
||
+ | "external:dev:SearchSuggest/code.js", |
||
+ | "external:dev:RevealAnonIP/usercode.js" |
||
+ | ] |
||
+ | }); |
||
+ | |||
+ | |||
+ | /* File Usage List - thanks to Callofduty4 */ |
||
+ | function AddWhatLinksHere() { |
||
+ | html = '<h2 id="fileusage">File usage</h2><div class="TransclusionsLoading"><img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" /></div>'; |
||
+ | $('#mw-imagepage-content').append(html); |
||
+ | |||
+ | Pages = []; |
||
+ | PageTitle = mw.config.get('wgPageName'); |
||
+ | $.getJSON('/api.php?action=query&list=imageusage&iutitle=' + PageTitle + '&iulimit=max&format=json', function(data) { |
||
+ | $.each(data.query.imageusage, function(index, value) { |
||
+ | Page = value.title; |
||
+ | Pages.push('<li><a href="/wiki/' + Page + '">' + Page + '</a></li>'); |
||
+ | }); |
||
+ | }) |
||
+ | .done(function() { |
||
+ | if (Pages.length == 0) { |
||
+ | html = '<p>There are no pages that link to this file.</p><br>'; |
||
+ | } |
||
+ | else { |
||
+ | ListOfPages = Pages.join(''); |
||
+ | html = '<p>The following ' + (Pages.length == 1 ? 'page uses' : Pages.length + ' pages use') + ' this file:</p><ul class="FileTransclusions">' + ListOfPages + '</ul><br>'; |
||
+ | } |
||
+ | $('.TransclusionsLoading').remove(); |
||
+ | $('#mw-imagepage-content').append(html); |
||
+ | }) |
||
+ | .fail(function() { |
||
+ | html = '<p>There was an error fetching this list. For a list of pages which use this file, see <a href="/wiki/Special:WhatLinksHere/wgPageName">here</a>.</p>'; |
||
+ | $('#mw-imagepage-content').append(html); |
||
+ | }); |
||
+ | } |
||
+ | |||
+ | $(document).ready(function() { |
||
+ | Namespace = mw.config.get('wgCanonicalNamespace'); |
||
+ | if (Namespace == 'File') { |
||
+ | AddWhatLinksHere(); |
||
+ | } |
||
+ | }); |
||
+ | |||
+ | /* Navigation bar focus */ |
||
+ | $(document).ready(function() { |
||
+ | $('.WikiNav .nav-item:nth-child(2)').addClass('marked'); |
||
+ | $('.WikiNav .nav-item:nth-child(2) .subnav-2').css('display', 'block'); |
||
+ | }); |
||
+ | |||
+ | /* Focus cursor on file delete */ |
||
+ | $(document).ready(function() { |
||
+ | Namespace = mw.config.get('wgCanonicalNamespace'); |
||
+ | Action = mw.config.get('wgAction'); |
||
+ | if (Namespace == 'File' && Action == 'delete') { |
||
+ | $('input[name="wpReason"]').focus() |
||
+ | } |
||
+ | }); |
||
+ | |||
+ | |||
+ | //function HideAdminDashboard() { |
||
+ | // if ($('.AdminDashboardHeader').length) { |
||
+ | // |
||
+ | // Get 'friendly' page title |
||
+ | // var title = ($('.mw-special-Browse').length ? 'Browse' : document.title.split(" -", 1)); |
||
+ | // |
||
+ | // Add wiki-style header |
||
+ | // $('header.AdminDashboardHeader').replaceWith('<header id="WikiaPageHeader" class="WikiaPageHeader HideAdminDashboard"><h1>' + title + '</h1><h2>Special page</h2></header>'); |
||
+ | // |
||
+ | // Add default toolset to Special:Watchlist |
||
+ | // $('.page-Special_Watchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id")); |
||
+ | // $('.page-Special_EditWatchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id")); |
||
+ | // } |
||
+ | //} |
||
+ | //addOnloadHook(HideAdminDashboard); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* Recent Changes Links */ |
||
+ | function RecentChanges() { |
||
+ | $('.WikiaActivityModule a.more').replaceWith('<a class="more" title="Special:RecentChanges" href="/wiki/Special:RecentChanges">See more ></a>'); |
||
+ | $('nav.contribute').after('<a data-id="recentchanges" class="wikia-button secondary" accesskey="g" title="Recent Changes" href="/wiki/Special:RecentChanges"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite activity"> Recent Changes</a>'); |
||
+ | } |
||
+ | addOnloadHook(RecentChanges); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* Purge Button */ |
||
+ | function PurgeDropdownMenuItem() { |
||
+ | function addPurgeButton () { |
||
+ | var theText = 'Purge'; |
||
+ | |||
+ | switch( skin ) { |
||
+ | case 'uncyclopedia': |
||
+ | case 'monobook': |
||
+ | $('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a href="/wiki/' + encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>'); |
||
+ | break; |
||
+ | |||
+ | case 'oasis': |
||
+ | case 'wikia': |
||
+ | $(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? '.UserProfileActionButton' : (wgNamespaceNumber == 500 ? '.WikiaBlogPostHeader' : '#WikiaPageHeader')) + ' > .wikia-menu-button > ul').append('<li><a href="/wiki/'+ encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>'); |
||
+ | break; |
||
+ | |||
+ | } |
||
+ | } |
||
+ | |||
+ | if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null) { |
||
+ | addOnloadHook( addPurgeButton ); |
||
+ | } |
||
+ | |||
+ | var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code) |
||
+ | } |
||
+ | addOnloadHook(PurgeDropdownMenuItem); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* User Dropdown Items */ |
||
+ | function UserItems() { |
||
+ | // $('#AccountNavigation ul.subnav li:first-child').after('<li><a href="/wiki/User_blog:Eladkse">My blog</a></li><li><a href="/wiki/Special:Contributions/Eladkse">My contributions</a></li><li><a href="/wiki/Special:Watchlist">My watchlist</a></li>'); |
||
+ | |||
+ | var watchlistlink = '<li data-id="watchlist"><a href="/wiki/Special:Watchlist" title="Special:Watchlist">Watchlist</a></li>'; |
||
+ | |||
+ | $('.page-User_Eladkse li[data-id="following"]').replaceWith(watchlistlink); |
||
+ | $('.page-User_talk_Eladkse li[data-id="following"]').replaceWith(watchlistlink); |
||
+ | $('.page-Special_Contributions_Eladkse li[data-id="following"]').replaceWith(watchlistlink); |
||
+ | $('.page-User_blog_Eladkse li[data-id="following"]').replaceWith(watchlistlink); |
||
+ | $('.page-Message_Wall_Eladkse li[data-id="following"]').replaceWith(watchlistlink); |
||
+ | } |
||
+ | addOnloadHook(UserItems); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* Editor Dropdown */ |
||
+ | function EditorDropdown() { |
||
+ | if (wgCanonicalNamespace != 'Special') { |
||
+ | $('section#EditPage nav.wikia-menu-button ul').prepend('<li><a id="wpHistory" href="/wiki/'+ encodeURI(wgPageName) +'?action=history" target="_blank"> History </a></li>'); |
||
+ | } |
||
+ | } |
||
+ | addOnloadHook(EditorDropdown); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* Disable Photo Tooltip */ |
||
+ | function PhotoTooltip() { |
||
+ | $('.wikia-button.upphotos').removeAttr("data-original-title"); |
||
+ | } |
||
+ | addOnloadHook(PhotoTooltip); |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /* AJAX RC */ |
||
+ | var ajaxTimer, |
||
+ | ajaxRefresh = 30000, |
||
+ | doRefresh = true; |
||
+ | |||
+ | if ( !window.ajaxCallAgain ) { |
||
+ | var ajaxCallAgain = []; |
||
+ | } |
||
+ | |||
+ | function preloadAJAXRL() { |
||
+ | $( '#ajaxLoadProgress' ).ajaxSend( function ( event, xhr, settings ) { |
||
+ | if ( location.href == settings.url ) { |
||
+ | $( this ).show(); |
||
+ | } |
||
+ | } ).ajaxComplete ( function ( event, xhr, settings ) { |
||
+ | var $collapsibleElements = $( '#mw-content-text' ).find( '.mw-collapsible' ); |
||
+ | if ( location.href == settings.url ) { |
||
+ | $( this ).hide(); |
||
+ | for ( var i = 0; i < ajaxCallAgain.length; i++ ) { |
||
+ | ajaxCallAgain[i](); |
||
+ | } |
||
+ | if ( $collapsibleElements.length ) { |
||
+ | $collapsibleElements.makeCollapsible(); |
||
+ | } |
||
+ | if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ) { |
||
+ | mw.special.recentchanges.init(); |
||
+ | } |
||
+ | } |
||
+ | } ); |
||
+ | loadPageData(); |
||
+ | } |
||
+ | |||
+ | function loadPageData() { |
||
+ | var cC = '#mw-content-text'; |
||
+ | $('#mw-content-text').load( location.href + " #mw-content-text > *", function ( data ) { |
||
+ | if ( doRefresh ) { |
||
+ | ajaxTimer = setTimeout( loadPageData, ajaxRefresh ); |
||
+ | } |
||
+ | } ); |
||
+ | } |
||
+ | |||
+ | $( function () { |
||
+ | if ( wgPageName == 'Special:RecentChanges' ) { |
||
+ | preloadAJAXRL(); |
||
+ | } |
||
+ | } ); |
Revision as of 11:07, 3 January 2015
importArticles({
type: 'script',
articles: [
//"external:eladkse:MediaWiki:RelatedDiscussionsModule.js",
"external:dev:SearchSuggest/code.js",
"external:dev:RevealAnonIP/usercode.js"
]
});
/* File Usage List - thanks to Callofduty4 */
function AddWhatLinksHere() {
html = '<h2 id="fileusage">File usage</h2><div class="TransclusionsLoading"><img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" /></div>';
$('#mw-imagepage-content').append(html);
Pages = [];
PageTitle = mw.config.get('wgPageName');
$.getJSON('/api.php?action=query&list=imageusage&iutitle=' + PageTitle + '&iulimit=max&format=json', function(data) {
$.each(data.query.imageusage, function(index, value) {
Page = value.title;
Pages.push('<li><a href="/wiki/' + Page + '">' + Page + '</a></li>');
});
})
.done(function() {
if (Pages.length == 0) {
html = '<p>There are no pages that link to this file.</p><br>';
}
else {
ListOfPages = Pages.join('');
html = '<p>The following ' + (Pages.length == 1 ? 'page uses' : Pages.length + ' pages use') + ' this file:</p><ul class="FileTransclusions">' + ListOfPages + '</ul><br>';
}
$('.TransclusionsLoading').remove();
$('#mw-imagepage-content').append(html);
})
.fail(function() {
html = '<p>There was an error fetching this list. For a list of pages which use this file, see <a href="/wiki/Special:WhatLinksHere/wgPageName">here</a>.</p>';
$('#mw-imagepage-content').append(html);
});
}
$(document).ready(function() {
Namespace = mw.config.get('wgCanonicalNamespace');
if (Namespace == 'File') {
AddWhatLinksHere();
}
});
/* Navigation bar focus */
$(document).ready(function() {
$('.WikiNav .nav-item:nth-child(2)').addClass('marked');
$('.WikiNav .nav-item:nth-child(2) .subnav-2').css('display', 'block');
});
/* Focus cursor on file delete */
$(document).ready(function() {
Namespace = mw.config.get('wgCanonicalNamespace');
Action = mw.config.get('wgAction');
if (Namespace == 'File' && Action == 'delete') {
$('input[name="wpReason"]').focus()
}
});
//function HideAdminDashboard() {
// if ($('.AdminDashboardHeader').length) {
//
// Get 'friendly' page title
// var title = ($('.mw-special-Browse').length ? 'Browse' : document.title.split(" -", 1));
//
// Add wiki-style header
// $('header.AdminDashboardHeader').replaceWith('<header id="WikiaPageHeader" class="WikiaPageHeader HideAdminDashboard"><h1>' + title + '</h1><h2>Special page</h2></header>');
//
// Add default toolset to Special:Watchlist
// $('.page-Special_Watchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id"));
// $('.page-Special_EditWatchlist .HideAdminDashboard').append($('#contentSub').addClass("subtitle").removeAttr("id"));
// }
//}
//addOnloadHook(HideAdminDashboard);
/* Recent Changes Links */
function RecentChanges() {
$('.WikiaActivityModule a.more').replaceWith('<a class="more" title="Special:RecentChanges" href="/wiki/Special:RecentChanges">See more ></a>');
$('nav.contribute').after('<a data-id="recentchanges" class="wikia-button secondary" accesskey="g" title="Recent Changes" href="/wiki/Special:RecentChanges"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite activity"> Recent Changes</a>');
}
addOnloadHook(RecentChanges);
/* Purge Button */
function PurgeDropdownMenuItem() {
function addPurgeButton () {
var theText = 'Purge';
switch( skin ) {
case 'uncyclopedia':
case 'monobook':
$('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a href="/wiki/' + encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>');
break;
case 'oasis':
case 'wikia':
$(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? '.UserProfileActionButton' : (wgNamespaceNumber == 500 ? '.WikiaBlogPostHeader' : '#WikiaPageHeader')) + ' > .wikia-menu-button > ul').append('<li><a href="/wiki/'+ encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>');
break;
}
}
if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null) {
addOnloadHook( addPurgeButton );
}
var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code)
}
addOnloadHook(PurgeDropdownMenuItem);
/* User Dropdown Items */
function UserItems() {
// $('#AccountNavigation ul.subnav li:first-child').after('<li><a href="/wiki/User_blog:Eladkse">My blog</a></li><li><a href="/wiki/Special:Contributions/Eladkse">My contributions</a></li><li><a href="/wiki/Special:Watchlist">My watchlist</a></li>');
var watchlistlink = '<li data-id="watchlist"><a href="/wiki/Special:Watchlist" title="Special:Watchlist">Watchlist</a></li>';
$('.page-User_Eladkse li[data-id="following"]').replaceWith(watchlistlink);
$('.page-User_talk_Eladkse li[data-id="following"]').replaceWith(watchlistlink);
$('.page-Special_Contributions_Eladkse li[data-id="following"]').replaceWith(watchlistlink);
$('.page-User_blog_Eladkse li[data-id="following"]').replaceWith(watchlistlink);
$('.page-Message_Wall_Eladkse li[data-id="following"]').replaceWith(watchlistlink);
}
addOnloadHook(UserItems);
/* Editor Dropdown */
function EditorDropdown() {
if (wgCanonicalNamespace != 'Special') {
$('section#EditPage nav.wikia-menu-button ul').prepend('<li><a id="wpHistory" href="/wiki/'+ encodeURI(wgPageName) +'?action=history" target="_blank"> History </a></li>');
}
}
addOnloadHook(EditorDropdown);
/* Disable Photo Tooltip */
function PhotoTooltip() {
$('.wikia-button.upphotos').removeAttr("data-original-title");
}
addOnloadHook(PhotoTooltip);
/* AJAX RC */
var ajaxTimer,
ajaxRefresh = 30000,
doRefresh = true;
if ( !window.ajaxCallAgain ) {
var ajaxCallAgain = [];
}
function preloadAJAXRL() {
$( '#ajaxLoadProgress' ).ajaxSend( function ( event, xhr, settings ) {
if ( location.href == settings.url ) {
$( this ).show();
}
} ).ajaxComplete ( function ( event, xhr, settings ) {
var $collapsibleElements = $( '#mw-content-text' ).find( '.mw-collapsible' );
if ( location.href == settings.url ) {
$( this ).hide();
for ( var i = 0; i < ajaxCallAgain.length; i++ ) {
ajaxCallAgain[i]();
}
if ( $collapsibleElements.length ) {
$collapsibleElements.makeCollapsible();
}
if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ) {
mw.special.recentchanges.init();
}
}
} );
loadPageData();
}
function loadPageData() {
var cC = '#mw-content-text';
$('#mw-content-text').load( location.href + " #mw-content-text > *", function ( data ) {
if ( doRefresh ) {
ajaxTimer = setTimeout( loadPageData, ajaxRefresh );
}
} );
}
$( function () {
if ( wgPageName == 'Special:RecentChanges' ) {
preloadAJAXRL();
}
} );