Jump to content

User:SD0001/oldSearchHistory.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.
// Revert to the non-OOUI version of page history search form, that appears
// at the top of page histories

if (mw.config.get('wgAction') === 'history') {
	var oldFormHTML = `<form action="/w/index.php" method="get" id="mw-history-searchform">
	  <fieldset id="mw-history-search">
	    <legend>Search for revisions</legend>
	    <input type="hidden" value="` + mw.config.get('wgPageName') + `" name="title">
	    <input type="hidden" value="history" name="action">
	    <label for="year">From year (and earlier):</label>
	    <input id="year" maxlength="4" size="7" type="number" name="year">
	    <label for="month">From month (and earlier):</label>
	    <select name="month" id="month" class="mw-month-selector">
	      <option value="-1">all</option>
	      <option value="1">January</option>
	      <option value="2">February</option>
	      <option value="3">March</option>
	      <option value="4">April</option>
	      <option value="5">May</option>
	      <option value="6">June</option>
	      <option value="7">July</option>
	      <option value="8">August</option>
	      <option value="9">September</option>
	      <option value="10">October</option>
	      <option value="11">November</option>
	      <option value="12">December</option>
	    </select>&nbsp;<label for="tagfilter"><a href="/wiki/Special:Tags" title="Special:Tags">Tag</a> filter:</label>&nbsp;<input name="tagfilter" size="20" value="" class="mw-tagfilter-input mw-ui-input mw-ui-input-inline" id="tagfilter">&nbsp;<input type="submit" value="Show">
	  </fieldset>
	</form>`;
	
	$('.action-history #mw-content-text > .mw-htmlform-ooui-wrapper:first-child')
		.before(oldFormHTML)
		.hide();
	
	$('#year').val( mw.util.getParamValue('year') || (new Date().getFullYear()));
	$('#month').val(mw.util.getParamValue('month') || '-1');
	$('#tagfilter').val(mw.util.getParamValue('tagfilter') || '');
}