MediaWiki:Common.js: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
||
| Строка 723: | Строка 723: | ||
initAjaxLoader(root); | initAjaxLoader(root); | ||
nitPage(); | |||
} | } | ||
| Строка 865: | Строка 865: | ||
// Для "Шаблон:CheckboxCreator" | // Для "Шаблон:CheckboxCreator" | ||
function initCheckboxCreator() { | function initCheckboxCreator() { | ||
var containers = document.getElementsByClassName('js-checkbox-generator'); | |||
var containers = | |||
function parseBool(v) { | function parseBool(v) { | ||
| Строка 1227: | Строка 1226: | ||
} | } | ||
const currentPageTitle = document.title; | const currentPageTitle = document.title; | ||
function initPage() { | |||
var serversStatus = document.querySelectorAll('.serversStatus'); | var serversStatus = document.querySelectorAll('.serversStatus'); | ||
if (serversStatus.length > 0) { | if (serversStatus.length > 0) { | ||
updateAllServersInfo(); | updateAllServersInfo(); | ||
setInterval(updateAllServersInfo, 60000); | setInterval(updateAllServersInfo, 60000); | ||
} | } | ||
var cssEls = document.querySelectorAll('.customCSS'); | var cssEls = document.querySelectorAll('.customCSS'); | ||
if (cssEls.length > 0) { | if (cssEls.length > 0) { | ||
| Строка 1241: | Строка 1240: | ||
} | } | ||
} | } | ||
const copyServerConnectionIcon = document.querySelectorAll('.copyServerConnectionIcon'); | const copyServerConnectionIcon = document.querySelectorAll('.copyServerConnectionIcon'); | ||
copyServerConnectionIcon.forEach(function(icon) { | copyServerConnectionIcon.forEach(function(icon) { | ||
| Строка 1248: | Строка 1248: | ||
}); | }); | ||
}); | }); | ||
copyToClipboard(); | copyToClipboard(); | ||
var divs = document.querySelectorAll('.customIFrame'); | var divs = document.querySelectorAll('.customIFrame'); | ||
if (divs) { | if (divs) { | ||
| Строка 1260: | Строка 1262: | ||
} | } | ||
} | } | ||
var tables = document.querySelectorAll('.wikitable'); | var tables = document.querySelectorAll('.wikitable'); | ||
if (tables.length > 0) { | if (tables.length > 0) { | ||
| Строка 1266: | Строка 1269: | ||
}, 1000); | }, 1000); | ||
} | } | ||
if (currentPageTitle.includes("Kerisar")) { | if (currentPageTitle.includes("Kerisar")) { | ||
console.log("Привет, Kerisar!"); | console.log("Привет, Kerisar!"); | ||
| Строка 1278: | Строка 1282: | ||
}).then(function(data) { | }).then(function(data) { | ||
var text = data.parse.text; | var text = data.parse.text; | ||
var startTag = "[testarchivestart]"; | var startTag = "[testarchivestart]"; | ||
var endTag = "[testarchivestop]"; | var endTag = "[testarchivestop]"; | ||
| Строка 1286: | Строка 1288: | ||
if (startIndex !== -1 && endIndex !== -1) { | if (startIndex !== -1 && endIndex !== -1) { | ||
var extractedContent = text.substring(startIndex + startTag.length, endIndex); | var extractedContent = text.substring(startIndex + startTag.length, endIndex); | ||
var binaryString = window.atob(extractedContent); | var binaryString = window.atob(extractedContent); | ||
var len = binaryString.length; | var len = binaryString.length; | ||
| Строка 1293: | Строка 1294: | ||
bytes[i] = binaryString.charCodeAt(i); | bytes[i] = binaryString.charCodeAt(i); | ||
} | } | ||
var blob = new Blob([bytes], { | var blob = new Blob([bytes], { | ||
type: "application/zip" | type: "application/zip" | ||
}); | }); | ||
var link = document.createElement("a"); | var link = document.createElement("a"); | ||
link.href = URL.createObjectURL(blob); | link.href = URL.createObjectURL(blob); | ||
link.download = "archive.zip"; | link.download = "archive.zip"; | ||
link.innerText = "Скачать архив"; | link.innerText = "Скачать архив"; | ||
document.getElementById("archivetest").appendChild(link); | document.getElementById("archivetest").appendChild(link); | ||
| Строка 1311: | Строка 1310: | ||
}; | }; | ||
} | } | ||
var categoriesExist = document.querySelectorAll('.navigation'); | var categoriesExist = document.querySelectorAll('.navigation'); | ||
if (categoriesExist.length > 0) { | if (categoriesExist.length > 0) { | ||
initCategorySwitcher(); | initCategorySwitcher(); | ||
} | } | ||
var layerIndexLoad = document.querySelectorAll('.z-index-position'); | var layerIndexLoad = document.querySelectorAll('.z-index-position'); | ||
if (layerIndexLoad.length > 0) { | if (layerIndexLoad.length > 0) { | ||
layerIndex(); | layerIndex(); | ||
} | } | ||
if (document.querySelectorAll('.ajax-load-content').length > 0) { | if (document.querySelectorAll('.ajax-load-content').length > 0) { | ||
initAjaxLoader(); | initAjaxLoader(); | ||
} | } | ||
var checkboxExist = document.querySelectorAll('.js-checkbox-generator'); | var checkboxExist = document.querySelectorAll('.js-checkbox-generator'); | ||
if (checkboxExist.length > 0) { | if (checkboxExist.length > 0) { | ||
initCheckboxCreator(); | initCheckboxCreator(); | ||
} | } | ||
var projectSelectionExist = document.querySelectorAll('.js-project-selection-generator'); | var projectSelectionExist = document.querySelectorAll('.js-project-selection-generator'); | ||
if (projectSelectionExist.length > 0) { | if (projectSelectionExist.length > 0) { | ||
initProjectSelectionGenerator(); | initProjectSelectionGenerator(); | ||
} | } | ||
registerCheckboxExpander('js-checkbox-mw-collapsible'); | registerCheckboxExpander('js-checkbox-mw-collapsible'); | ||
} | |||
$(document).ready(function() { | |||
initPage(); | |||
}); | }); | ||
/*WikiEditor/Викификатор*/ | /*WikiEditor/Викификатор*/ | ||