Jump to content

User:SD0001/oldSearchHistory.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 14:02, 11 April 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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

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>`

$('#mw-content-text > div.mw-htmlform-ooui-wrapper.oo-ui-layout.oo-ui-panelLayout.oo-ui-panelLayout-padded.oo-ui-panelLayout-framed')
	.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') || '');