אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Common.js/externalsmaker.js"

קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
שורה 82: שורה 82:


function getWikiLink() {
function getWikiLink() {
var result = '',
  let result = "";
oldid = getParameterByName('oldid') || getParameterByName('diff');
  const oldid = getParameterByName("oldid") || getParameterByName("diff");
  const host = window.location.host;


if (window.location.host == 'yi.hamichlol.org.il' && oldid) {
  if (host.startsWith("yi.hamichlol.org.il") && oldid) {
var oldComment = '';
    const oldComment = window.prompt("קעפּל פאַר די לינק. קען בלייבן ליידיג.", "");
oldComment = window.prompt("קעפּל פאַר די לינק. קען בלייבן ליידיג.", oldComment);
    result = `{{אונטערשייד צווישן ווערסיעס|${getParameterByName("title")}|${oldid}||${oldComment || "אונטערשייד צווישן ווערסיעס"}}}`;
result = '{{אונטערשייד צווישן ווערסיעס|' + getParameterByName('title') + '|' + oldid + '||' + (oldComment ? oldComment : 'אונטערשייד צווישן ווערסיעס') + '}}';
  } else {
} else {
    const nms = {
var nms = {
      "yi.hamichlol.org.il": "",
'yi.hamichlol.org.il': '',
      "www.hamichlol.org.il": "ע:",
'www.hamichlol.org.il': 'ע:',
      "he.wikiquote.org": "q:",
'he.wikiquote.org': 'q:',
      "he.wikisource.org": "s:",
'he.wikisource.org': 's:',
      "en.wiktionary.org": "wikt:",
'en.wiktionary.org': 'wikt:'
    };
},
wikinamespace = document.querySelector('.mw-page-title-namespace'),
wikiname = document.querySelector('.mw-page-title-main'),
wikiarticle = wikiname ? wikinamespace ? wikinamespace.textContent + ':' + wikiname.textContent : wikiname.textContent : null,
wikitype = nms[window.location.host];


if (wikitype != undefined && wikiname) {
    const wikinamespace = document.querySelector(".mw-page-title-namespace");
result = '[[' + wikitype + wikiarticle + (wikitype ? '|' + wikiname.textContent : '') + ']]';
    const wikiname = document.querySelector(".mw-page-title-main");
}
    const wikiarticle = wikiname
}
      ? wikinamespace
        ? `${wikinamespace.textContent}:${wikiname.textContent}`
        : wikiname.textContent
      : null;
    const wikitype = nms[host];


if (result) {
    if (wikitype !== undefined && wikiname) {
if (prompt("דרוקן OK וועט קאפּירן דעם מוסטער:", result) != null) {
      result = `[[${wikitype}${wikiarticle}${wikitype ? "|" + wikiname.textContent : ""}]]`;
$('<input>').val(result).appendTo('body').select();document.execCommand('copy');
    }
}
  }
return true;
 
}
  if (result) {
return false;
    navigator.clipboard.writeText(result).then(() => {
      alert("✅ קאפירט: " + result);
    });
    return true;
  }
  return false;
}
}
 
if (window.location.host.indexOf('hamichlol') == 0) {
if (window.location.host.includes("hamichlol")) {
if (getWikiLink()) {
  getWikiLink();
return true;
}
}
}