RationalWiki's 2019 Fundraiser

There is no RationalWiki without you. We are a small non-profit with no staff – we are hundreds of volunteers who document pseudoscience and crankery around the world every day. We will never allow ads because we must remain independent. We cannot rely on big donors with corresponding big agendas. We are not the largest website around, but we believe we play an important role in defending truth and objectivity.

If everyone seeing this today donates $5, we will meet our goal for 2019.

Fighting pseudoscience isn't free.
We are 100% user-supported! Help and donate $5, $20 or whatever you can today with PayPal Logo.png!

Donations so far: $2900Goal: $6000

User:PeterL/exasperation.js

From RationalWiki
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/*
Adds a list of quick statements to the edit tools at the bottom of the edit screen (Where it says "Sign your username: ~~~~", but at the bottom). 
Click where it says "Exasperated remarks" to get a list. Add more to User:PeterL/ex.
Code from MediaWiki:Gadget-smileylist.js. PeterL, 09:25, 29 May 2012 (UTC)
*/
var exasperationList;
 
function showExasperationList()
{
  vis = (exasperationList.style.display == "block");
  if (!vis)
  {
    var toolbar = document.getElementById('editpage-specialchars');
    toolbar.appendChild(exasperationList);
    exasperationList.style.display = "block";
  } else {
    exasperationList.style.display = "none";
  }
}
 
function exasperations2()
{
 
  var toolbar = document.getElementById('editpage-specialchars');
  if (!toolbar) { return false; }
 
  var textbox = document.getElementById('wpTextbox1');
 
  var exasperationspan = document.createElement("span");
  exasperationspan.innerHTML = "<b>Exasperated remarks</b>"
  exasperationspan.id = "edittools_exasperations"
  exasperationspan.title = "Exasperated remarks";
  exasperationspan.style.cursor = "pointer";
  exasperationspan.onclick = function() {
    showExasperationList();
    return false;
  };
 
  toolbar.appendChild(exasperationspan);
 
  exasperationList = document.createElement("div");
  exasperationList.id = "exasperationList";
  exasperationList.style.position = "static";
  /*populate exasperation box*/
  var req = false;
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req) {
    req.open("GET", wgServer + wgScript + "?title=User:" + wgUserName + "/ex", true);
    //req.overrideMimeType("text/xml");
    req.onreadystatechange = function()
    {
      if (req.readyState==4 && req.status == 200) {
        var xmlhack = document.createElement("div");
        xmlhack.innerHTML = req.responseText;
        var divs = xmlhack.getElementsByTagName("div");
        //var divs = req.responseXML.documentElement.getElementsByTagName("div");
        var bci;
        var i;
        for (i=0; i<divs.length; i++ ) {
          if ( divs[i].id == "bodyContent" ) {
            bci = i;
            break;
          }
        }
        var ps = divs[bci].getElementsByTagName("p");
        while (ps.length>0)
        {
          addExasperation2(exasperationList,ps.item(0));
        }
      }
    }
    req.send(null);
  }
   
  exasperationList.style.display = "none";
 
  return true;
}
 
function addExasperation2(parent, item)
{
  item.onclick = function() {
    insertTags(item.innerHTML,'','');
    return false;
  };
  item.style.margin="4px";  
  item.style.cursor = "pointer";
  parent.appendChild(item);
}
 
hookEvent("load", exasperations2);