MediaWiki:Common.js: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
Pok (обсуждение | вклад) Нет описания правки Метки: ручная отмена отменено |
||
| Строка 678: | Строка 678: | ||
return '{{#vardefine:JsonPath|' + jsonPath + '}}\n' + String(wikiText || ''); | return '{{#vardefine:JsonPath|' + jsonPath + '}}\n' + String(wikiText || ''); | ||
} | } | ||
function fetchParsedData(wikiText) { | function fetchParsedData(wikiText) { | ||
var apiUrl = "https://station14.ru/api.php?action=parse&format=json&prop=text&text=" + encodeURIComponent(wikiText) + "&origin=*"; | var apiUrl = "https://station14.ru/api.php?action=parse&format=json&prop=text&text=" + encodeURIComponent(wikiText) + "&origin=*"; | ||
| Строка 717: | Строка 717: | ||
initAjaxLoader(root); | initAjaxLoader(root); | ||
} | } | ||
| Строка 1078: | Строка 1077: | ||
// Для "Шаблон:Переключатель_проекта" | // Для "Шаблон:Переключатель_проекта" | ||
function initProjectSelectionGenerator() { | function initProjectSelectionGenerator() { | ||
var containers = document.getElementsByClassName('js-project-selection-generator'); | var containers = document.getElementsByClassName('js-project-selection-generator'); | ||
| Строка 1086: | Строка 1084: | ||
.replace(/\s+/g, '-') | .replace(/\s+/g, '-') | ||
.replace(/[^A-Za-z0-9_\-\u0400-\u04FF]/g, ''); | .replace(/[^A-Za-z0-9_\-\u0400-\u04FF]/g, ''); | ||
} | } | ||
| Строка 1174: | Строка 1166: | ||
if (projects.length <= 1) { | if (projects.length <= 1) { | ||
continue; | continue; | ||
} | } | ||
if (!getCurrentJsonPath()) { | if (!getCurrentJsonPath()) { | ||
setCurrentJsonPath( | setCurrentJsonPath(projects[0]); | ||
} | } | ||
| Строка 1209: | Строка 1187: | ||
input.id = projectId; | input.id = projectId; | ||
if ( | if (j === 0) { | ||
input.checked = true; | input.checked = true; | ||
} | } | ||
| Строка 1238: | Строка 1216: | ||
}); | }); | ||
})(form); | })(form); | ||
} | } | ||
} | } | ||
const currentPageTitle = document.title; | const currentPageTitle = document.title; | ||
| Строка 1351: | Строка 1313: | ||
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'); | |||
if (checkboxExist.length > 0) { | |||
initCheckboxCreator(); | |||
} | } | ||
var projectSelectionExist = document.querySelectorAll('.js-project-selection-generator'); | var projectSelectionExist = document.querySelectorAll('.js-project-selection-generator'); | ||
| Строка 1356: | Строка 1322: | ||
initProjectSelectionGenerator(); | initProjectSelectionGenerator(); | ||
} | } | ||
registerCheckboxExpander('js-checkbox-mw-collapsible'); | |||
}); | }); | ||
/*WikiEditor/Викификатор*/ | /*WikiEditor/Викификатор*/ | ||