Site Notice

We have a limited coverage policy. Please check our coverage page to see which articles are allowed.
Please no leaked content less than one year old, or videos of leaks.
Content copied verbatim from other websites or wikis will be removed.

Difference between revisions of "MediaWiki:Common.js"

From NintendoWiki, your source on Nintendo information. By fans, for fans.
Jump to navigation Jump to search
m (Created page with "Any JavaScript here will be loaded for all users on every page load.: Collapsible Tables: if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 ) { ...")
 
m
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
+
// --------------------------------------------------------
/* Collapsible Tables */
+
// addPurge
 
+
// adds a "purge" tab (after "watch")
if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 )
+
// --------------------------------------------------------
{
+
addOnloadHook(function () {
  var script  = document.createElement( 'script' );
+
    if (wgAction != 'edit' && wgCanonicalNamespace != 'Special' && wgAction != 'history' && wgAction != 'delete' && wgAction != 'watch' && wgAction
  script.src  = '/index.php?title=MediaWiki:Common.js/CollapsibleTables.js&action=raw&ctype=text/javascript';
+
    != 'unwatch' && wgAction != 'protect' && wgAction != 'markpatrolled' && wgAction != 'rollback' && document.URL.indexOf('diff=') <= 0
  script.type = 'text/javascript';
+
    && document.URL.indexOf('oldid=') <=0)
  document.getElementsByTagName( 'head' )[0].appendChild( script );
+
    { var hist; var url;
 
+
    if (!(hist = document.getElementById('ca-history') )) return;
  hookEvent( 'load', function()
+
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
  { new CollapsibleTables(); } );
+
    if (!(url = url.href )) return;
 +
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
 +
                  'purge', 'ca-purge', 'Purge server cache for this page', '0');
 
}
 
}
 +
});
 +
//

Revision as of 03:52, 21 November 2010

// --------------------------------------------------------
// addPurge
// adds a "purge" tab (after "watch")
// --------------------------------------------------------
addOnloadHook(function () {
    if (wgAction != 'edit' && wgCanonicalNamespace != 'Special' && wgAction != 'history' && wgAction != 'delete' && wgAction != 'watch' && wgAction 
    != 'unwatch' && wgAction != 'protect' && wgAction != 'markpatrolled' && wgAction != 'rollback' && document.URL.indexOf('diff=') <= 0
    && document.URL.indexOf('oldid=') <=0)
    { var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', '0');
}
});
//