Jump to content

User:Allstarecho/unsigned2.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if (unsigned2AddText == null) var unsigned2AddText = '{'+'{subst:Unsigned2|?|?}'+'}\n\n';
if (unsigned2Summary == null) var unsigned2Summary = 'Add [[Template:Unsigned2]] to unsigned comment';
 
function addunsigned2Text() {
  var box = document.getElementById('wpTextbox1');
  var content = box.value;
  content = unsigned2AddText + content;
  box.value = content;
 
  var sumBox = document.getElementById('wpSummary');
  sumBox.value = unsigned2Summary;
}
 
function goTounsigned2() {
  var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + wgPageName + '&action=edit&addunsigned2=true'; 
  window.location = url;
}
 
function attachunsigned2Link() {
  var unsigned2Link = new wa_element('li');
  unsigned2Link.ele_obj.id = 't-unsigned2';
  unsigned2Link.ele_obj.innerHTML = '<a href="#" title="Add unsigned2 tag">Add unsigned2 tag</a>';
  unsigned2Link.addScriptEvent('click', function() { goTounsigned2(); });
 
  unsigned2Link.attach(document.getElementById('pt-userpage'), 'before');
}
 
importScript('User:Ale_jrb/Scripts/waLib.js'); 
hookEvent('load', attachunsigned2Link);
if (window.location.href.indexOf('&addunsigned2=true') > -1) { hookEvent('load', addunsigned2Text); }