MediaWiki:DirectImage

  Get it! Result Preview

 function DIScript { var main = $('#DirectImage'), link = $('#DirectImage #link').val, result = $('#DirectImage #result'), render, rev, prefx, ns, srv = "http://images.wikia.com/", preview = $('#DirectImage img'); if (link.indexOf('http://') < 0) { result.html('ERROR! Format is http://*'); return; }   ns = decodeURIComponent(link); ns = ns.replace(/.*\/(\w+|\W+):.*/, "true"); if (ns === "true") { $.get(link, function (data) {           result.html('Loading... (Using GET)');           link = $('.internal', data).attr('href');        }); }   rev = link.replace(/.*(cb=|\/|cb)(20.\d+).*/, '$2');

link = link.replace(/^.*\.(net|com|org)\/(_\w+\/|)(.*)$/, '$3'); if (link.indexOf('path-prefix=') >= 0) { prefx = link.replace(/.*(\&|\?)path-\w+=(..)$/, '$2'); link = link.replace(/\/.*/, '/') + prefx + link.replace(/.*(\/images\/.*)/, '$1'); }   if (link.indexOf('/thumb') >= 0) { link = link.replace(/(.*)\/thumb\/(.*)/, '$1/$2'); }   if (link.indexOf('/revision/') >= 0) { link = link.replace(/(.*)\/revision\/.*/, '$1'); }   link = link.replace(/([a-z]{3})\/\d+px-.*$/, '$1'); result.html(srv + link); preview.attr('src', srv + link); }