User:Eejit43/scripts/search-links.js

// // 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(const n of document.querySelectorAll(".mw-search-result-heading")){const c=n.querySelector("a")?.href;if(!c)continue;const o=["edit","history"].map(e=>{const 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(")"))}

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