Jump to content

User:Halfcookie/global.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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// for enter key
$(document).ready(function() {
    mw.loader.using(['mediawiki.util', 'jquery.ui'], function() {
        // Код функции оформления страницы здесь
						const summaryField = document.getElementById("wpSummary");
						if (summaryField)
							{
							summaryField.addEventListener("keydown", function(event) {
							  if (event.keyCode === 13) { // 13 is the keycode for Enter key
							    event.preventDefault();
							    return false;
							  }
							});
						}
    });
});




// for diff
$(document).ready(function() {
    mw.loader.using(['mediawiki.util', 'jquery.ui'], function() {
						const testdiff = document.getElementById("mw-fr-diff-headeritems");
						if (testdiff)
							{
							const table_left = document.querySelector(".diff-otitle");	
							const firstChildL = table_left.firstChild;
							const lastChildL = table_left.lastChild;
							table_left.insertBefore(lastChildL, firstChildL);
							const table_right = document.querySelector(".diff-ntitle");	
							const firstChildR = table_right.firstChild;
							const lastChildR = table_right.lastChild;
							table_right.insertBefore(lastChildR, firstChildR);
						}
    });
});