User:Panamitsu/Hello-world.js

// // &lt;nowiki&gt;If you are editing a page, click the wikify button on your tab bar to add "" to the top, set "Marked for wikification" as the edit summary, mark it as a minor edit, and submit.&lt;/nowiki&gt;

function doTest { // Check if syntax highlighting is enabled const highlightButton = $("#mw-editbutton-codemirror").find("a"); const highlight = highlightButton.attr('aria-pressed'); if (highlight === "true") { // Disable syntax highlighting highlightButton[0].click; } // Prevent "Changes you made may not be saved" popup $(window).off('beforeunload'); document.editform.wpTextbox1.value = 'Test on  \n\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'Testing using a script'; document.editform.wpMinoredit.checked = true; if (highlight === "true") { // Re-enable syntax highlighting highlightButton[0].click; } document.editform.submit; }

addOnloadHook(function { if (mw.config.get('wgCanonicalNamespace') != "User") {     return;  }  if (document.editform) {     let link = addPortletLink("p-cactions", "javascript:doTest;", "test", "ca-test", "Do test", "");  } });

// Modified from raylu //