Jump to content

User:Sellyme/common.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:%C3%9Ejarkur/NeverUseMobileVersion.js&action=raw&ctype=text/javascript" );

// This script is needed for (anonymously) logging search terms by our Squids!
// The search URL will contain the search term,
// please modify retroactively at [[wikt:de:MediaWiki:If-search.js]];
// rather IMPORT this script; example: [[wikt:de:MediaWiki:If-search.js/import]].
// --
// Updated on de.wiktionary by Krinkle 2011-02-08

function getID( ID ) {
 return document.getElementById(ID);
}
function firstInputInID( ID ) {
 return getID( ID ).getElementsByTagName( 'input' )[0];
}

function fixSearchForm( id, input ) {
 var fNode = getID( id );
 if ( fNode ) {
  fNode.setAttribute( 'onsubmit', "SubSearch('" + id + "', '" + input + "', '/')" );
  fNode.parentNode.innerHTML = getID( id ).parentNode.innerHTML; // f***ing IE
 }
}

function SubSearch( id, input, delimeter ) {
 var inputNode = getID(input);
 var formNode = getID(id);
 if ( inputNode.value === '' ) {
  delimeter = '';
 }
 formNode.action = mw.config.get('wgArticlePath').replace( '$1', oSEAp + delimeter + inputNode.value );

 // Try to remove <input name="title"> from the <form>
 if ( firstInputInID(id).name === 'title' ) {
  if ( firstInputInID(id).parentNode == formNode ) {
   formNode.removeChild( firstInputInID(id) );
  } else {
   formNode.firstChild.removeChild( firstInputInID(id) );
  }
 }
}

function LogSearch() {
 fixSearchForm( 'searchform', 'searchInput' );
 fixSearchForm( 'search', 'searchText' );
 fixSearchForm( 'powersearch', 'powerSearchText' );
 fixSearchForm( 'bodySearch', 'bodySearchIput' );
 var searchform = getID( 'searchform' );
 if ( searchform && searchform.action && searchform.action.indexOf(mw.config.get('wgScript')) !== -1) {
  window.oSEAp = firstInputInID( 'searchform' ).value;
 } else {
  window.oSEAp = searchform.action.replace( /^.*\/([^\/]+)$/, '$1' );
 }
}

// Execute it when the page is ready
jQuery( document ).ready( LogSearch );

// install [[User:Cacycle/wikEdDiff]] enhanced diff
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js&action=raw&ctype=text/javascript' );
importScript('User:Novem_Linguae/Scripts/CiteHighlighter.js'); // Backlink: [[User:Novem_Linguae/Scripts/CiteHighlighter.js]]
importScript('User:Taavi/Aligner.js'); // Backlink: [[User:Taavi/Aligner.js]]
importScript('User:Evad37/OneClickArchiver.js'); // Backlink: [[User:Evad37/OneClickArchiver.js]]
importScript('User:Ohconfucius/dashes.js'); // Backlink: [[User:Ohconfucius/dashes.js]]