Jump to content

User:Þjarkur/Draft submit button.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Þjarkur (talk | contribs) at 17:59, 20 January 2020 (Created page with '(function () { if ( mw.config.get('wgAction') !== 'view' || mw.config.get('wgNamespaceNumber') !== 118 || mw.config.get('wgDiffOldId') || // Set on...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
(function () {
  if (
    mw.config.get('wgAction') !== 'view' ||
    mw.config.get('wgNamespaceNumber') !== 118 ||
    mw.config.get('wgDiffOldId') || // Set on diff pages
    mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId') // Viewing old version
  ) return;
  var hasDraftTemplate = 0 <= mw.config.get('wgCategories').findIndex(function (category) {
    return /(AfC)/.test(category)
  })
  if (hasDraftTemplate) return;

  var url = (new mw.Uri()).extend({
    action: 'edit',
    section: 'new',
    preload: 'Template:AFC_submission/Subst',
    editintro: 'Template:AFC_submission/Subst/Editintro',
  }).toString();
  var draftnotice = `
  <table id="" class="plainlinks ombox ombox-notice" role="presentation" style="background-color: #eaebe4;">
    <tbody>
      <tr>
        <td class="mbox-image"></td>
        <td class="mbox-text">
          This <a href="https://en.wikipedia.org/wiki/Wikipedia:Drafts">draft</a> is not currently submitted for review.
          <div class="afc-draft-submit-button" style="float:right;"> <span class="plainlinks"><a class="external text" href="${url}"><span class="mw-ui-button mw-ui-progressive" style="padding: 4px 6px;">Submit your draft for review!</span></a>
            </span>
          </div>
        </td>
      </tr>
    </tbody>
  </table>`;
  $('#mw-content-text').prepend($(draftnotice))
})()