Jump to content

User:Eejit43/scripts/search-links.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
// Note: This script was compiled and minified from TypeScript. For a more readable version, see https://github.com/Eejit43/wikipedia-scripts/blob/main/scripts/search-links.ts

"use strict";(()=>{if(mw.config.get("wgCanonicalSpecialPageName")==="Search")for(let n of document.querySelectorAll(".mw-search-result-heading")){let c=n.querySelector("a")?.href;if(!c)continue;let o=["edit","history"].map(e=>{let r=new mw.Uri(c).extend({action:e}).toString(),t=document.createElement("a");return t.href=r,t.textContent=e,t});n.append(document.createTextNode(" ("),...o.flatMap(e=>[e,document.createTextNode(" | ")]).slice(0,-1),document.createTextNode(")"))}})();

// </nowiki>
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc2NyaXB0cy9zZWFyY2gtbGlua3MudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImlmIChtdy5jb25maWcuZ2V0KCd3Z0Nhbm9uaWNhbFNwZWNpYWxQYWdlTmFtZScpID09PSAnU2VhcmNoJylcbiAgICBmb3IgKGNvbnN0IGhlYWRlciBvZiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCcubXctc2VhcmNoLXJlc3VsdC1oZWFkaW5nJykpIHtcbiAgICAgICAgY29uc3QgbGluayA9IGhlYWRlci5xdWVyeVNlbGVjdG9yKCdhJyk/LmhyZWY7XG4gICAgICAgIGlmICghbGluaykgY29udGludWU7XG5cbiAgICAgICAgY29uc3QgbGlua3MgPSBbJ2VkaXQnLCAnaGlzdG9yeSddLm1hcCgoYWN0aW9uKSA9PiB7XG4gICAgICAgICAgICBjb25zdCB1cmwgPSBuZXcgbXcuVXJpKGxpbmspLmV4dGVuZCh7IGFjdGlvbiB9KS50b1N0cmluZyg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