Jump to content

User:Allstarecho/wplgbt.js

From Wikipedia, the free encyclopedia
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 (wplgbtAddText == null) var wplgbtAddText = '{'+'{LGBTProject|class=?|explanation=?}'+'}\n\n';
if (wplgbtSummary == null) var wplgbtSummary = 'Add [[WP:LGBT]] project tag';
 
function addwplgbtText() {
  var box = document.getElementById('wpTextbox1');
  var content = box.value;
  content = wplgbtAddText + content;
  box.value = content;
 
  var sumBox = document.getElementById('wpSummary');
  sumBox.value = wplgbtSummary;
}
 
function goTowplgbt() {
  var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + wgPageName + '&action=edit&addwplgbt=true'; 
  window.location = url;
}
 
function attachwplgbtLink() {
  var wplgbtLink = new wa_element('li');
  wplgbtLink.ele_obj.id = 't-wplgbt';
  wplgbtLink.ele_obj.innerHTML = '<a href="#" title="Add WP LGBT tag">Add WP LGBT tag</a>';
  wplgbtLink.addScriptEvent('click', function() { goTowplgbt(); });
 
  wplgbtLink.attach(document.getElementById('pt-userpage'), 'before');
}
 
importScript('User:Ale_jrb/Scripts/waLib.js'); 
hookEvent('load', attachwplgbtLink);
if (window.location.href.indexOf('&addwplgbt=true') > -1) { hookEvent('load', addwplgbtText); }