MediaWiki:Mobile.js: различия между версиями

нет описания правки
Нет описания правки
Метки: с мобильного устройства из мобильной версии
Нет описания правки
Метки: с мобильного устройства из мобильной версии
 
(не показано 7 промежуточных версий этого же участника)
Строка 1: Строка 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* All JavaScript here will be loaded for users of the mobile site */
var formCreatePage = document.querySelector('.createbox');
var formCreatePage = document.querySelector('#newThemeForm');


if (formCreatePage) {
if (formCreatePage) {
Строка 19: Строка 19:
    // Отправка запроса POST к API MediaWiki
    // Отправка запроса POST к API MediaWiki
    $.post(mw.util.wikiScript('api'), params, function(data) {
    $.post(mw.util.wikiScript('api'), params, function(data) {
    console.log('>>post', data.edit.result);
    console.log('>>post', data && data.edit && data.edit.result);
        if (data && data.edit && data.edit.result === 'Success') {
        if (data && data.edit && data.edit.result === 'Success') {
            // Если страница успешно создана, перенаправляем пользователя на неё
            // Если страница успешно создана, перенаправляем пользователя на неё
Строка 51: Строка 51:


// свернуть все заголовки
// свернуть все заголовки
console.log('Mediawiki:Mobile.js', 4);
console.log('Mediawiki:Mobile.js', 7);
var headings = document.querySelector('.section-heading');
setTimeout(function(){
var headings = $.find('.section-heading.open-block');
console.log('>> headings', headings);
console.log('>> headings', headings);
 
headings.forEach(function(h){
document.addEventListener('DOMContentLoaded', function() {
h.click();
  var sections = document.querySelectorAll('.section-heading[aria-expanded="true"]');
});
  sections.forEach(function(section) {
}, 100);
    section.click();
  });
});
document.addEventListener("DOMContentLoaded", function() {
 
// console.log('DOMContentLoaded');
// var headings = document.querySelector('.section-heading.open-block');
// console.log('>> headings', headings);
 
// headings.forEach(function(h){
// h.click();
// });
});