Перейти к содержанию

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

нет описания правки
Нет описания правки
Нет описания правки
 
(не показано 20 промежуточных версий этого же участника)
Строка 1: Строка 1:
// Get the select element and the forms
// Get the select element and the forms
 
var currentPageHref = decodeURI(window.location.href);
var test = 'Вики-энциклопедия_университета:Главная';
if (currentPageHref .indexOf(test) > -1) {
var forms = document.querySelectorAll('.createbox');
var select = document.createElement('select');
var select = document.createElement('select');
select.id = 'select-template';
select.id = 'select-template';
select.className = 'mw-ui-input mw-ui-input-inline mw-inputbox-centered';
select.className = 'mw-ui-input mw-ui-input-inline mw-inputbox-centered';
var forms = document.querySelectorAll('.createbox');
 


// Create the select options
// Create the select options
var options = [
var options = [
   { value: 'Шаблон:Личность', text: 'Шаблон: Личность' },
   { value: 'Шаблон:Личность', text: 'Шаблон: Личность' },
   { value: 'Шаблон:Объект:', text: 'Шаблон: Подразделение' }
   { value: 'Шаблон:Структура', text: 'Шаблон: Структура' },
   { value: 'Шаблон:Событие:', text: 'Шаблон: Событие' }
   { value: 'Шаблон:Событие', text: 'Шаблон: Событие' }
];
];
var opt;
var opt;
Строка 17: Строка 20:
   opt.value = options[i].value;
   opt.value = options[i].value;
   opt.text = options[i].text;
   opt.text = options[i].text;
  console.log(opt.text);
   select.appendChild(opt);
   select.appendChild(opt);
}
}
Строка 37: Строка 39:
var form = document.querySelector('.createbox');
var form = document.querySelector('.createbox');
form.insertBefore(select, form.querySelector('input[name="veaction"]'));
form.insertBefore(select, form.querySelector('input[name="veaction"]'));
}