Community Central
Community Central

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.
nullEditDelay = 1000; //Part of MassNullEdit
batchDeleteDelay = 1000; //Part of AjaxBatchDelete
 
importArticle({
    type: 'script',
    articles: [
        'u:dev:NullEditButton/code.js',
        //'u:dev:FileUsageAuto-update/code.js',
        //'u:dev:CategoryRenameAuto-update/code.js',
        'u:dev:MassNullEdit/code.js',
        'u:dev:AjaxBatchDelete/code.2.js'
    ]
});


/* Custom "NewFilesModule" by 452 (with fixes by JoshuaJSlone)
   This script displays [[Special:NewFiles]] in the right rail
   There are three ways to use this, by setting the NewFilesModuleCompact variable
   0 - Normal, width is 212
   1 - Compact, width is 106
   2 - Random, if you're not sure which version you like best.

   In both modes, hovering over each displays the uploader info.

   NewFilesModuleCount can be used to specify the number of displayed images.
   ...at least it used to.  Apparently this number is now ignored.
*/
var NewFilesModuleCompact = 1; //must be 0, 1, or 2.
var NewFilesModuleCount = 6; //any integer

if ($('#WikiaRail').length) { //only on pages where the rail is present
  $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.
    if ($('#WikiaRail section').length && !$("#NewFilesModule").length && typeof $NewFilesPage == "undefined") { // Only add it ''once''
        $NewFilesPage = $('<div>'); // this line, and the next, originate from http://dev.wikia.com/wiki/AjaxRC/code.js <3
        $NewFilesPage.load("/wiki/Special:Images/" +NewFilesModuleCount + " #gallery-", function () {
          $('#WikiaRail>section:last-of-type').after("<section id='NewFilesModule' class='module'><h2><a href='/wiki/Special:NewFiles'>New Files</a><a class='wikia-button' href='/wiki/Special:MultipleUpload'>Upload</a></h2>");
          if (typeof NewFilesModuleCompact == "undefined") NewFilesModuleCompact = 0;
          if (NewFilesModuleCompact == 2) NewFilesModuleCompact = Math.floor(Math.random()*2);
          if (NewFilesModuleCompact) {
            $('#gallery-', $NewFilesPage).html(
              $('#gallery-', $NewFilesPage).html()
              .replace(/\/revision\/latest\?/g, "/revision/latest/scale-to-width-down/70?")
              .replace(/\/scale-to-width-down\/\d*\?/g, "/scale-to-width-down/70?") //-down is redundant on this line, but kept for consistency
            );
            $("#NewFilesModule").addClass("compact");
          }
          $("#NewFilesModule").append('<div id="gallery-" hash="" class="wikia-gallery wikia-gallery-caption-below wikia-gallery-position- wikia-gallery-spacing- wikia-gallery-border- wikia-gallery-captions- wikia-gallery-caption-size-"></div>');
          $(".wikia-gallery-item", $NewFilesPage).each(function() { 
            $(".lightbox-caption", this).prepend($("<a>").attr("href",$(".gallery-image-wrapper>a", this).attr("href")).html($(".gallery-image-wrapper>a", this).attr("title")).append($("<br>")));
            $("#NewFilesModule #gallery-").append(this);
          });

          delete $NewFilesPage; //delete it, in case the rail is wiped after this point.
        });
        if (!$("#NewFilesModuleCSS").length) $('head').append('<style type="text/css">\n#gallery- { position:relative;overflow-y:auto; clear: both; text-align:center; height:200px; }\n#NewFilesModule .gallery-image-wrapper { top: 0 !important; height: auto !important; border:none; background: none; }\n#NewFilesModule.compact .gallery-image-wrapper { width: auto !important; }\n#NewFilesModule .thumb { height:auto !important; }\n#NewFilesModule .wikia-gallery-item { margin: 1px !important; padding: 0 !important; height: auto !important; border: none !important; }\n#NewFilesModule.compact .wikia-gallery-item { width: auto !important; }\n#NewFilesModule .wikia-gallery-item .lightbox-caption { display: none; }\n#NewFilesModule .wikia-gallery-item:hover .lightbox-caption { display:block; padding: 5px; margin-top: 0; position: absolute; border: 1px solid; background-color: #fff; z-index: 2; right: 0; width: 250px !important; }\n#NewFilesModule h2 {margin: 0 2em 0 0;}\n#NewFilesModule h2 a:first-child {color:inherit;}\n#NewFilesModule img { display: block; height: auto !important; width: auto !important; margin-left: auto !important; margin-top: auto !important;}\n.wikia-gallery-item .gallery-image-wrapper a { width: auto !important; height: auto !important; }\n.wikia-gallery-item .gallery-image-wrapper a.image-no-lightbox { line-height: normal; display: block; padding: 1em; }\n</style>');
    }
  });  //end of DOMNodeInserted block
  $('#WikiaRail').trigger('DOMNodeInserted'); //Prevent race condition by firing the event.
} /* End of custom "NewFilesModule " */