User:AFigureOfBlue/nowphoto.js

// See User:Drilnoth/nowphoto.js/doc for details

// Set default values for any unset variables if( typeof( nowPhotoMinor ) == 'undefined' ) { nowPhotoMinor = true; } if( typeof( nowPhotoTag ) == 'undefined' ) { nowPhotoTag = "Cleaned up using NowPhoto"; } if( typeof( nowPhotoLinkHover ) == 'undefined' ) { nowPhotoLinkHover = "Article now has an appropriate photo or image"; } if( typeof( nowPhotoLinkName ) == 'undefined' ) { nowPhotoLinkName = "now photo"; } if( typeof( nowPhotoLinkLocation ) == 'undefined' ) { nowPhotoLinkLocation = "p-cactions"; } //Initiates NowPhoto function nowPhotoExecute { if(!document.getElementById('wpTextbox1')) return; var txt = document.editform.wpTextbox1; var str = txt.value; str = str.replace(/\{\{Reqmap\}\}/gi, '');

nowPhotoEditSummary; } //Adds Tag to edit summary textbox function nowPhotoEditSummary { var txt = document.editform.wpSummary; var tag = nowPhotoTag; txt.value += tag;

// Check 'This is a minor edit' if( nowPhotoMinor ) { document.editform.wpMinoredit.checked = nowPhotoMinor; }

document.editform.wpSave.click; } //Allows URI to be properly decoded for NowPhoto in View Mode function nowPhotoQueryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }  return null; }

//Execute NowPhoto after call from View Mode if( nowPhotoQueryString('NowPhoto') ) { addOnloadHook(function {    nowPhotoExecute;  }); } // Add "auto ed" tabs and associate with actions $(function {  if(wgCanonicalNamespace == "") {    if(document.forms.editform) {      mw.util.addPortletLink( nowPhotoLinkLocation, 'javascript:nowPhotoExecute', nowPhotoLinkName, 'ca-NowPhoto', nowPhotoLinkHover, , document.getElementById('ca-move'));    } //End editform if    if(wgAction == "view"){      var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Talk:' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit';      mw.util.addPortletLink( nowPhotoLinkLocation, url + '&NowPhoto=true', nowPhotoLinkName, 'ca-NowPhoto', nowPhotoLinkHover, , document.getElementById('ca-move'));    } //End pageview if  } //End namespace if });