Vikidia currently has 4,625 articles. Improve it!

Join Vikidia: create your account now and improve it!

User:Wynter/common.js

From Vikidia, the encyclopedia for 8 to 13-year-old children that everybody can make better
Jump to navigation Jump to search

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
if ($.inArray( mw.config.get('wgAction'), [ 'view', 'purge' ]) !== -1 && mw.config.get( 'wgNamespaceNumber' ) >=0) {
  $(function edittop_hook () {
 
    var our_content = $("#content, #mw_content").first();
    var span1 = our_content.find("span.mw-editsection:not(.plainlinks)").first();
    if (!span1.length) {
      return;
    }
    var span0 = span1.clone();

    $("#mw_header h1, #content h1").first().append(span0);
    span0.find("a").each(function (idx) {
      var a = $(this);
      a.attr("title", 'Edit lead section');
      if (a.attr("href").indexOf("&section=T") == -1) {
        a.attr("href", a.attr("href").replace(/&section=\d+/, "&section=0&summary=/*%20top%20*/%20"));
      }
      else { //transcluded
        a.attr("href", mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) + "?action=edit&section=0&summary=/*%20top%20*/%20");
      }
    });
  });
}

// copied from https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-NewImageThumb.js&oldid=590263365

mw.hook( 'wikipage.content' ).add( function() {
    $( '.thumbinner' ).each( function() {
        $( this ).css( 'width', ( parseInt( $( this ).css( 'width' ) ) - 2 ) + 'px' );
    } );
} );