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.
// Please do not use
// It has been customized by [[User:Legoktm]] for him.
if(wgNamespaceNumber == 6) {
  if(wgAction == 'edit' || wgAction == 'submit') {
    addOnloadHook(function () { mw.util.addPortletLink('p-cactions','javascript:doiMtc()','imtc','ca-imtc'); });
  } else {
    var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + 'User:Legoktm/MTC' + '&action=edit&autoimtc=true';
    addOnloadHook(function () { mw.util.addPortletLink('p-cactions',url,'imtc','ca-imtc'); });
  }
}
if(queryString('autoimtc')) addOnloadHook(function() { doiMtc(); })
function doiMtc() {
  var txt = document.getElementById('wpTextbox1');
  if(!txt) return;
  txt.value = '<' + 'gallery>[[:' + encodeURIComponent(mw.config.get('wgPageName')) + ']]</galler>\n\n' + txt.value;
  document.getElementById('wpSummary').value += 'adding to my gallery';
  document.getElementById('wpPreview').click();
}
 
function queryString(p) {
  var re = RegExp('[&?]' + p + '=([^&]*)');
  var matches;
  if (matches = re.exec(document.location)) {
    try { 
      return decodeURI(matches[1]);
    } catch (e) {
    }
  }
  return null;
}