User:Valento/common.js

From Final Fantasy XIV Online Wiki
Jump to navigation Jump to 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// Scripts to use when viewing articles
$(window).keydown(function(event) {

  if(event.keyCode == 118) { // F7 - Edit
    window.location.href = (window.location.href).replace("wiki/", "mediawiki/index.php?title=").replace(/#.+/, "")+"&action=edit&customedit=y";
    event.preventDefault();
  }
});

setTimeout(function(){
    if (window.location.search.indexOf('customedit')>-1) {
        var editArea = document.querySelector('.wikiEditor-ui');
        editArea.scrollIntoView({behavior: "smooth", block: "start"}); // Scrolls down to editable area
    }
},4000);


// Other

    setTimeout(function(){
        if (document.getElementById('firstHeading').innerHTML.indexOf('Creating')>=0) {
            document.getElementById('wpSummary').value = 'creation'; // Default new page text
            //document.getElementById('wpTextbox1').value = '#REDIRECT '; // TEMPORARY!
        }
    }, 1000);