MediaWiki:Gadget-sigreminder-core.js
Jump to navigation
Jump to search
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.
1 // <nowiki>
2 $(function() {
3 $('#wpSave').click(function (e) {
4 var text = $('#wpTextbox1').val(),
5 reminder = 'It looks like you forgot to sign your comment. You can sign by placing 4 tildes (~~\~~) to the end of your message.\nAre you sure you want to post it?';
6
7 if (
8 // don't trigger on minor edits
9 $('#wpMinoredit').prop('checked') ||
10
11 // check for signature
12 text.replace(/(<nowiki>.*?<\/nowiki>)/g, '').match('~~\~') ||
13
14 // check for &undo= or ?undo= in URL as summary can be altered
15 mw.util.getParamValue('undo') ||
16
17 // check for user welcome notice in edit summary
18 // since those often don't need signatures
19 $('#wpSummary').val().match(/welcome/i)
20 ) {
21 return;
22 }
23
24 if (!confirm(reminder)) {
25 e.preventDefault();
26 }
27 });
28 });