User:He7d3r/Tools/WarningOnUnsignedComments.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, 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.
// [[File:User:He7d3r/Tools/WarningOnUnsignedComments.js]] (workaround for [[phab:T35355]])
/**
 * Warning on unsigned comments
 * @author: Helder (https://github.com/he7d3r)
 * @license: CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0/>
 */
// <nowiki>
(function(e,a){"use strict";function i(){a("#wpSave").on("click",function(i){var n=a("#wpTextbox1"),o=n.val(),c=e.config.get("wgNamespaceNumber")%2===1||o.indexOf(" (UTC)")!==-1,s=/~{4}(?!<\/nowiki>)/.test(o),t='Parece que esqueceu de colocar "~~~~" no final da mensagem para assinar o seu comentário. Deseja salvar mesmo assim?';!c||s||confirm(t)||(n.focus(),i.preventDefault(),e.log("Não salvar"))})}a.inArray(e.config.get("wgAction"),["edit","submit"])!==-1&&a(i)})(mediaWiki,jQuery);
// </nowiki>