משתמש:Neriah/common.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
אין תקציר עריכה |
אין תקציר עריכה |
||
(14 גרסאות ביניים של אותו משתמש אינן מוצגות) | |||
שורה 11: | שורה 11: | ||
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js&action=raw&ctype=text/javascript'); | mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js&action=raw&ctype=text/javascript'); | ||
// | /* | ||
if(mw.config.get('wgNamespaceNumber') | // סקריפט לצנזור שם ה' - נכתב ע"י [[user:Neriah]] | ||
//if ( | |||
// mw.config.get('wgNamespaceNumber') === 0 || | |||
// mw.config.get('wgNamespaceNumber') === 106 || | |||
// mw.config.get('wgNamespaceNumber') === 14 | |||
//) | |||
{ | |||
var buttonSpan = document.createElement("span"); | |||
buttonSpan.className = "plainlinks mw-ui-button"; | |||
buttonSpan.id = "censorButton"; | |||
buttonSpan.innerText = "צנזור שם ה'"; | |||
var buttonDiv = document.createElement("div"); | |||
function | buttonDiv.className = "mw-parser-output"; | ||
buttonDiv.id = "censorButton-div"; | |||
buttonDiv.appendChild(buttonSpan); | |||
var heading = document.getElementById('firstHeading'); | |||
heading.appendChild(buttonDiv); | |||
buttonSpan.addEventListener("click", function() { | |||
function censore(element, word) { | |||
let split_str = word.split(""); | |||
const nikud = "[-/]*" | |||
const reg_list = split_str.reduce((list, elem, i) => { | |||
list.push(elem, nikud); | |||
return list; | |||
}, []); | |||
reg_list.splice(0, 0, '('); | |||
reg_list.splice(3, 0, ')', '('); | |||
reg_list.push(')'); | |||
if (word === "אדני") reg_list[reg_list.length-4] = "[-֯/ָּ]*" | |||
const regex = new RegExp(reg_list.join(""), "g"); | |||
element.innerHTML = element.innerHTML.replace(regex, "$1-$2"); | |||
} | |||
var elements = document.getElementsByTagName("*"); | |||
for (var i = 0; i < elements.length; i++) { | |||
censore(elements[i], "יהוה"); | |||
censore(elements[i], "אדני"); | |||
censore(elements[i], "אלוה"); | |||
censore(elements[i], "אלהי"); | |||
censore(elements[i], "אלהים"); | |||
censore(elements[i], "אלוהים"); | |||
censore(elements[i], "צבאות"); | |||
censore(elements[i], "שדי"); | |||
} | |||
}); | |||
} | } | ||
*/ | |||
var buttonSpan = document.createElement("span"); | var buttonSpan = document.createElement("span"); | ||
שורה 68: | שורה 73: | ||
buttonDiv.className = "mw-parser-output"; | buttonDiv.className = "mw-parser-output"; | ||
buttonDiv.style.display = "inline-block"; | buttonDiv.style.display = "inline-block"; | ||
buttonDiv.style.verticalAlign = "left"; | |||
buttonDiv.appendChild(buttonSpan); | buttonDiv.appendChild(buttonSpan); | ||
var heading = document.getElementById('firstHeading'); | var heading = document.getElementById('firstHeading'); | ||
heading.appendChild(buttonDiv); | heading.appendChild(buttonDiv); | ||
גרסה אחרונה מ־15:49, 12 בינואר 2024
/** This script contains the code required for loading [[User:Joeytje50/JWB.js]].
* All other code is located at that page.
*/
//Idea by [[User:Epicgenius]]
$.when(mw.loader.using(['mediawiki.util'], $.ready)).done( function() {
mw.util.addPortletLink("p-tb", mw.config.get('wgArticlePath').replace('$1', "Project:AutoWikiBrowser/Script"), "AWB אונליין", "tb-awbscript", "Run Javascript Wiki Browser");
});
if (mw.config.get('wgCanonicalNamespace')+':'+mw.config.get('wgTitle') === 'Project:AutoWikiBrowser/Script' && mw.config.get('wgAction') == 'view')
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js&action=raw&ctype=text/javascript');
/*
// סקריפט לצנזור שם ה' - נכתב ע"י [[user:Neriah]]
//if (
// mw.config.get('wgNamespaceNumber') === 0 ||
// mw.config.get('wgNamespaceNumber') === 106 ||
// mw.config.get('wgNamespaceNumber') === 14
//)
{
var buttonSpan = document.createElement("span");
buttonSpan.className = "plainlinks mw-ui-button";
buttonSpan.id = "censorButton";
buttonSpan.innerText = "צנזור שם ה'";
var buttonDiv = document.createElement("div");
buttonDiv.className = "mw-parser-output";
buttonDiv.id = "censorButton-div";
buttonDiv.appendChild(buttonSpan);
var heading = document.getElementById('firstHeading');
heading.appendChild(buttonDiv);
buttonSpan.addEventListener("click", function() {
function censore(element, word) {
let split_str = word.split("");
const nikud = "[-/]*"
const reg_list = split_str.reduce((list, elem, i) => {
list.push(elem, nikud);
return list;
}, []);
reg_list.splice(0, 0, '(');
reg_list.splice(3, 0, ')', '(');
reg_list.push(')');
if (word === "אדני") reg_list[reg_list.length-4] = "[-֯/ָּ]*"
const regex = new RegExp(reg_list.join(""), "g");
element.innerHTML = element.innerHTML.replace(regex, "$1-$2");
}
var elements = document.getElementsByTagName("*");
for (var i = 0; i < elements.length; i++) {
censore(elements[i], "יהוה");
censore(elements[i], "אדני");
censore(elements[i], "אלוה");
censore(elements[i], "אלהי");
censore(elements[i], "אלהים");
censore(elements[i], "אלוהים");
censore(elements[i], "צבאות");
censore(elements[i], "שדי");
}
});
}
*/
var buttonSpan = document.createElement("span");
buttonSpan.className = "plainlinks mw-ui-button";
buttonSpan.innerText = "הסר ניקוד";
var buttonDiv = document.createElement("div");
buttonDiv.className = "mw-parser-output";
buttonDiv.style.display = "inline-block";
buttonDiv.style.verticalAlign = "left";
buttonDiv.appendChild(buttonSpan);
var heading = document.getElementById('firstHeading');
heading.appendChild(buttonDiv);
buttonSpan.addEventListener("click", function() {
var elements = document.body.getElementsByTagName("*");
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = elements[i].innerHTML.replace(/[֑-ֽֿׁ-ׇׇ]*/g, "");
}
});