Jump to content

User:Allstarecho/unsigned2.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Ladsgroup (talk | contribs) at 06:15, 21 February 2021 (Maintenance: Replacing legacy global variable (phab:T72470)). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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); }