MediaWiki:Gadget-EditIntro.js

From AnOtherWiki, the free encyclopedia written by, for, and about the Otherkin community.

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.


$(function () {
  var preload = editintro = '';
 
  if ( location.href.indexOf('?preload') > -1 | location.href.indexOf('&preload') > -1 ) {
    preload = location.href.split('preload')[1].split('&')[0];
    preload = location.href.split('?')[0] + "?title" + preload;
  }
 
  if ( location.href.indexOf('?editintro') > -1 | location.href.indexOf('&editintro') > -1) {
    editintro = location.href.split('editintro')[1].split('&')[0];
    editintro= location.href.split('?')[0] + "?title" + editintro;
  }
 
  if ( preload != '' | editintro != '' ) {
    el = document.createElement('span');
    el.style.fontSize = "10pt";
 
    if( preload != '') {
      pr = document.createElement('a');
      pr.innerHTML = '(preloaded content)';
      pr.href = preload;
      pr.style.marginLeft = "10px";
      el.appendChild(pr);
    }
 
    if( editintro != '') {
      ei = document.createElement('a');
      ei.innerHTML = '(edit intro)';
      ei.href = editintro;
      ei.style.marginLeft = "10px";
      el.appendChild(ei);
    }
 
    document.getElementById('firstHeading').appendChild(el);
  }
});