User:ClaudineChionh/Scripts/scriptSandbox.js

// copyPageToClipboard // Copy the page content to the system clipboard.

function copyPageToClipboard { try { var textbox = $("#wpTextbox1").val; navigator.clipboard.writeText(textbox).then(function {            console.log("Copied content to system clipboard");        }); } catch (error) { console.log(error); } }

$(document).ready(function {    // Add the portlet link to copy to clipboard.    if ($("#wpTextbox1").val != undefined) {        var copyLink = mw.util.addPortletLink("p-cactions", "#", "Copy page", "ca-copypage", "Copy page to clipboard");        $(copyLink).click(function (event) { copyPageToClipboard; })   } });