Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// copied from [[User:Dschwen/monobook.js]] 2008-08-15T16:44:45
// I'm not familiar with js. If there is any bug, please fix it if you can.--miya 2008-08-18
// I want a big WikiMiniAtlas to use the new image preview feature
var wma_settings =
{
 //quicklink : true,
 height : 500,
 width : 800
}

importScript( 'MediaWiki:Delete.js' );         //[[MediaWiki:Delete.js]]
//importScript( 'User:Dschwen/quickbar.js' );    //[[User:Polarlys/quickbar.js]]
importScript( 'MediaWiki:Quick-delete.js' );   //[[MediaWiki talk:Quick-delete.js]]

//importScript( 'User:Dschwen/QImore.js' );

// [[User:Dschwen/coordinates.js]] - please include this line 
//importScript( 'User:Dschwen/coordinates2.js' );
importScript( 'User:Dschwen/coordinates.js' );

// [[User:Dschwen/qihelper.js]] - please include this line 
// importScript( User:Dschwen/qihelper.js' );

// [[User:Dschwen/coordupdate.js]] - please include this line 
importScript( 'User:Dschwen/coordupdate.js' );

//
// Insert a personalized Texttemplate into the Special:Upload edit box.
//
function setSpecialUploadTemplate()
{
 var uploadURL = 'http://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=ownwork';

 // I upload mostly my own work
 document.getElementById('n-uploadbtn').firstChild.href = uploadURL;

 // preload input form
 if(window.location.href == uploadURL)
 {
  var editbox = document.getElementById('wpUploadDescription');
  if( editbox.value == '' )
  {
   editbox.value = "{"+"{Information\n"
                 + "|Description={{de|}} {{en| }}\n"
                 + "|Source=Own work\n"
                 + "|Date=\n"
                 + "|Author=[[User:Dschwen|Daniel Schwen]]\n"
                 + "|Permission=See license\n"
                 + "|other_versions=\n"
                 + "}"+"}\n\n"
                 + "== Licensing ==\n"
                 + "{"+"{self|GFDL|cc-by-sa-2.5|author=I, [[User:Dschwen|Daniel Schwen]]}"+"}";
  }

  //var licensemenu = document.getElementById('wpLicense');
  //licensemenu.value = "self|GFDL|cc-by-sa-2.5";
 }
}

$(setSpecialUploadTemplate);

// Calculate Megapixels on image pages
function calculateMegapixels()
{
 var file = document.getElementById('file');
 var data = file.lastChild.nodeValue;
 pixel_filter = /([\d,]+) × ([\d,]+) pixels/;
 if(pixel_filter.test(data))
 {
  pixel_filter.exec(data);
  var wt = RegExp.$1;
  var ht = RegExp.$2;
  var w = parseFloat( wt.replace(/,/,'') );
  var h = parseFloat( ht.replace(/,/,'') );
  file.appendChild( document.createTextNode(' (' + ((w*h)/(1024.0*1024.0)).toFixed(2) + ' Megapixel)' ) );
 }
}
if( wgAction == 'view' && wgNamespaceNumber == 6 ) addOnloadHook(calculateMegapixels);

function replaceimportScript()
{
 var editbox = document.getElementById('wpTextbox1');
 var text = editbox.value;
 editbox.value = text.replace( /includePage\s*\(/g, "importScript(" );
 if( text != editbox.value ) 
  document.getElementById('wpSummary').value = 'replacing deprecated includePage. you should have been notified in May.';
}
//if( wgAction == 'edit' && wgTitle.substr(-3) == '.js' && wgTitle != 'User:Dschwen/monobook.js' ) 
// addOnloadHook(replaceimportScript);


/*
var old_os_fetchResults = os_fetchResults;
os_fetchResults = function(r,query,os_search_timeout)
{
 var newquery = query;
 if( query.substring(0,2) == 'c:' ) newquery = "Category:" + query.substring(2);
 if( query.substring(0,2) == 'i:' ) newquery = "Image:" + query.substring(2);
 newquery = "New York City";
 old_os_fetchResults(r,newquery,os_search_timeout)
}
*/

// Replacer
function wpTextboxReplace(){
  var s = prompt("Search regexp:");
  if(s){
    var r = prompt("Replace /"+s+"/ with:");
    if(!r && r != '') return;
    var txt = document.editform.wpTextbox1;
    txt.value = txt.value.replace(new RegExp(s, "mg"), r);
  }
}
$(function(){
  if(document.forms.editform){
    mw.util.addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'Replace', 'ca-replace',
                   'Regexp replace for the edit window', 'R', document.getElementById('ca-history'));
  }
});