|
|
| (Aynı kullanıcı tarafından yapılan 1 ara revizyon gösterilmiyor) |
| 1. satır: |
1. satır: |
| // === Twinkle Tag Detection A/B Test ===
| | mw.notify("Hello World!"); mw.loader.load('/AutosuggestSitelink-test.js'); |
| $(function() {
| |
| mw.loader.using(["mediawiki.util"], function() {
| |
| var origLink = mw.util.addPortletLink("p-cactions", "#", "Tag-Original", "tw-orig");
| |
| if (origLink) {
| |
| origLink.addEventListener("click", function(ev) {
| |
| ev.preventDefault();
| |
| var tags = [];
| |
| $(".mw-parser-output").children().each(function(i, e) {
| |
| if (e.classList.contains("mw-heading")) return false;
| |
| if (e.className.indexOf("box-") === 0)
| |
| tags.push(e.classList[0].slice(4).replace(/_/g, " "));
| |
| });
| |
| alert("ORIGINAL: " + (tags.length ? tags.join(", ") : "(none found)"));
| |
| });
| |
| }
| |
| | |
| var fixLink = mw.util.addPortletLink("p-cactions", "#", "Tag-Fixed", "tw-fix");
| |
| if (fixLink) {
| |
| fixLink.addEventListener("click", function(ev) {
| |
| ev.preventDefault();
| |
| var tags = [];
| |
| var po = $(".mw-parser-output");
| |
| var lead = po.children('section[data-mw-section-id="0"]');
| |
| (lead.length ? lead : po).children().each(function(i, e) {
| |
| if (e.classList.contains("mw-heading")) return false;
| |
| if (e.className.indexOf("box-") === 0)
| |
| tags.push(e.classList[0].slice(4).replace(/_/g, " "));
| |
| });
| |
| alert("FIXED: " + (tags.length ? tags.join(", ") : "(none found)"));
| |
| });
| |
| }
| |
| });
| |
| });
| |
mw.notify("Hello World!"); mw.loader.load('/AutosuggestSitelink-test.js');