MediaWiki:AboutArticle.js: различия между версиями
Материал из ЕЖЕВИКИ - EJWiki.org - Академической Вики-энциклопедии по еврейским и израильским темам
Перейти к навигацииПерейти к поиску
Arielybot (обсуждение | вклад) м Замена текста — «| АВТОР1» на «| АВТОР» |
BorisG (обсуждение | вклад) Нет описания правки |
||
| Строка 8: | Строка 8: | ||
// For a description, see [[User:Mr.Z-man/refToolbar]] | // For a description, see [[User:Mr.Z-man/refToolbar]] | ||
var numforms = 0; | //modified to work with new Wiki API - 2014-11-04 - BaruchG | ||
var numforms1 = 0; | //modified to change the template fields - 2014-11-04 - BaruchG | ||
//modified to change the template fields - 2014-11-13 - BaruchG | |||
//var numforms = 0; | |||
//var numforms1 = 0; | |||
//var isIE = detectIE(); | |||
var supervisors = [ | |||
["0", ""], | |||
["1", "Пинхас Полонский"], | |||
["2", "Арье Ольман"], | |||
["3", "Шломо Коль-Яаков"], | |||
["4", "Александр Черницкий"], | |||
["5", "Борис Гулько"], | |||
["6", "Леви Китросский"], | |||
["7", "Г. Ахиезер"], | |||
["8", "Анна Гейфман"], | |||
["9", "Ш. Гендельман"], | |||
["10", "Илья Дворкин"], | |||
["11", "Давид Копелиович"], | |||
["12", "М. Левинов"], | |||
["13", "Л. Прайсман"], | |||
["14", "Михаэль Рыжик"], | |||
["15", "Тали Тамарин"], | |||
["16", "Яков Файтельсон"], | |||
["17", "Зеев Ханин"], | |||
["18", "Велвл Чернин"], | |||
["19", "М. Шерман"], | |||
["20", "Михаил Шнейдер"], | |||
["21", "Ася Энтова"], | |||
["22", "Моше Гончарок"] | |||
]; | |||
function Articlebutton() { | function Articlebutton() { | ||
if (document.getElementById('wpTextbox1')) { | |||
// if (document.getElementById('toolbar')) { | |||
// var button = document.createElement('a'); | |||
// button.href = "javascript:easyArticleMain()"; | |||
// button.title = "Добавить шаблон О_статье"; | |||
// buttonimage = document.createElement('img'); | |||
// buttonimage.src = "http://upload.wikimedia.org/wikipedia/commons/9/9f/Button_defaultsort.png"; | |||
// buttonimage.alt = "Вставить описание статьи"; | |||
// button.appendChild(buttonimage); | |||
// var toolbar = document.getElementById('toolbar'); | |||
var toolbar = jQuery('#wikiEditor-ui-toolbar').find('.group-insert')[0]; | |||
var buttonTitle = "Добавить шаблон О_статье"; | |||
var buttonImageSrc = "http://upload.wikimedia.org/wikipedia/commons/9/9f/Button_defaultsort.png"; | |||
// var buttonimageAlt = "Вставить описание статьи"; | |||
// if (!isIE) { //navigator.userAgent.indexOf('MSIE') == -1) { | |||
// if (toolbar.style != null) { | |||
// toolbar.style.height = 'auto'; | |||
// } | |||
// else { | |||
// toolbar.setAttribute('style', 'margin-bottom: 6px; height: auto;'); | |||
// } | |||
// toolbar.appendChild(button); | |||
try { | |||
jQuery('#wpTextbox1').wikiEditor('addToToolbar', { | |||
section: 'advanced', | |||
group: 'insert', | |||
tools: { | |||
buttonId: { | |||
label: buttonTitle, | |||
type: 'button', | |||
icon: buttonImageSrc, | |||
action: { | |||
type: 'callback', | |||
execute: function(context) { | |||
easyArticleMain(); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
} catch (e) { | |||
console.log(e.message); | |||
} | } | ||
// | |||
var articlemain = document.createElement('div'); | |||
articlemain = document.createElement('div'); | |||
articlemain.style.display = 'none'; | articlemain.style.display = 'none'; | ||
articlemain.style.margin = '0.2em 0 -0.2em 0'; | articlemain.style.margin = '0.2em 0 -0.2em 0'; | ||
articlemain.setAttribute('Id', 'articleselect'); | articlemain.setAttribute('Id', 'articleselect'); | ||
articlemain.appendChild( addOption("aboutArticle()", "О статье") ); | articlemain.appendChild(addOption("aboutArticle()", "О статье")); | ||
articlemain.appendChild( addOption("aboutTemplate()", "?") ); | articlemain.appendChild(addOption("aboutTemplate()", "?")); | ||
articlemain.appendChild( addOption("hideInit()", "Отмена") ); | articlemain.appendChild(addOption("hideInit()", "Отмена")); | ||
toolbar.appendChild(articlemain); | toolbar.appendChild(articlemain); | ||
// } | |||
// else { | |||
// toolbar.appendChild(button); | |||
// selection = '<div id="articleselect" style="display:none"><input type="button" value="О статье" onclick="aboutArticle()" />' + | |||
// '<input type="button" value="?" onclick="aboutTemplate()" />' + | |||
// '<input type="button" value="Отмена" onclick="hideInit()" /></div>'; | |||
// document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML; | |||
// } | |||
} | |||
} | } | ||
function addOption(script, text) { | function addOption(script, text) { | ||
option = document.createElement('input'); | var option = document.createElement('input'); | ||
option.setAttribute('type', 'button'); | option.setAttribute('type', 'button'); | ||
option.setAttribute('onclick', script); | option.setAttribute('onclick', script); | ||
| Строка 55: | Строка 117: | ||
return option; | return option; | ||
} | } | ||
function hideInit() { | function hideInit() { | ||
document.getElementById('articleselect').style.display = 'none'; | document.getElementById('articleselect').style.display = 'none'; | ||
oldFormHide1(); | oldFormHide1(); | ||
} | } | ||
function oldFormHide1() { | function oldFormHide1() { | ||
// if (numforms != 0) { | |||
// document.getElementById('articlediv'+numforms).style.display = 'none'; | |||
// } | |||
// if (numforms1 != 0) { | |||
// document.getElementById('helpdiv'+numforms1).style.display = 'none'; | |||
// } | |||
jQuery('#articlediv1').css("display", 'none'); | |||
jQuery('#helpdiv1').css("display", 'none'); | |||
} | } | ||
function easyArticleMain() { | function easyArticleMain() { | ||
document.getElementById('articleselect').style.display = ''; | document.getElementById('articleselect').style.display = ''; | ||
} | } | ||
function getTime() { | function getTime() { | ||
var time = new Date(); | var time = new Date(); | ||
| Строка 82: | Строка 145: | ||
if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); } | if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); } | ||
var nowyear = time.getUTCFullYear(); | var nowyear = time.getUTCFullYear(); | ||
newtime = nowdate + '/' + nowmonth + '/' + nowyear; | var newtime = nowdate + '/' + nowmonth + '/' + nowyear; | ||
return (newtime); | return (newtime); | ||
} | } | ||
function aboutTemplate() { | function aboutTemplate() { | ||
oldFormHide1(); | |||
var legend; | |||
legend = "Справка"; | |||
// numforms1++; | |||
var form = '<div id="helpdiv1" style="background-color:white">' + | |||
'<fieldset><legend>' + legend + '</legend>' + | |||
'{{О_статье <br>' + | |||
'| ТИП СТАТЬИ = <br>' + | |||
' 1. Регулярная статья<br>' + | |||
' 2. Регулярная исправленная статья<br>' + | |||
// ' 3. Статья-справка<br>'+ | |||
// ' 4. Текст унаследован из Википедии<br>'+ | |||
' 3. Служебная статья<br>' + | |||
'| АВТОР1 = <br>' + | |||
'| АВТОР2 = <br>' + | |||
'| АВТОР3 = <br>' + | |||
'| СУПЕРВАЙЗЕР = <br>' + | |||
'| ПРОЕКТ = <br>' + | |||
//'| ПОДТЕМА = <br>'+ | |||
//'| КАЧЕСТВО = <br>'+ | |||
//'| УРОВЕНЬ = <br>'+ | |||
'| ДАТА СОЗДАНИЯ = <br>' + | |||
//'| ВИКИПЕДИЯ = <br>'+ | |||
//'| НЕОДНОЗНАЧНОСТЬ = <br>'+ | |||
'}} <br> <br>' + | |||
'</fieldset></div>'; | |||
if (jQuery('#helpdiv1').length > 0) { | |||
jQuery('#helpdiv1').replaceWith(form); | |||
' | } else { | ||
document.getElementById('articleselect').innerHTML += form; | |||
} | |||
} | } | ||
function aboutArticle() { | function aboutArticle() { | ||
oldFormHide1(); | |||
var legend; | |||
template = " | var template = "О_статье"; | ||
legend = "Описание статьи"; | |||
var newtime = getTime(); | |||
// numforms++; | |||
var form = '<div id="articlediv1" style="background-color:white">' + | |||
'<fieldset><legend>' + legend + '</legend>' + | |||
'<table cellspacing="6">' + | |||
'<input type="hidden" value="' + template + '" id="template">' + | |||
'<tr>' + | |||
'<td width="150"><label for="АВТОР1"> основной автор: </label></td>' + | |||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР1"></td>' + | |||
'<td width="150"><label for="ТИП СТАТЬИ"> тип статьи: </label></td>' + | |||
'<td width="80">' + | |||
'<SELECT NAME="ТИП СТАТЬИ" SIZE=0 id="typebox">' + | |||
'<OPTION VALUE="0"></option>' + | |||
'<OPTION VALUE="1">1. Регулярная статья</option>' + | |||
'<OPTION VALUE="2">2. Регулярная исправленная статья</option>' + | |||
// '<OPTION VALUE="3">3. Статья-справка</option>' + | |||
// '<OPTION VALUE="4">4. Текст унаследован из Википедии</option>' + | |||
'<OPTION VALUE="3">3. Служебная статья</option>' + | |||
'</SELECT>' + | |||
'</td>' + | |||
'</tr>' + | |||
'<tr>' + | |||
'<td width="150"><label for="АВТОР2"> автор 2: </label></td>' + | |||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР2"></td>' + | |||
// '<td width="150"><label for="УРОВЕНЬ"> энциклопедический уровень: </label></td>' + | |||
// '<td width="80"><SELECT NAME="УРОВЕНЬ" SIZE=0 id="level">' + | |||
// '<OPTION VALUE="0"></option>' + | |||
// '<OPTION VALUE="1">I. Обычная статья</option>' + | |||
// '<OPTION VALUE="2">II. Корневая статья</option>' + | |||
// '<OPTION VALUE="3">III. Краткое общее объяснение</option>' + | |||
// '<OPTION VALUE="4">IV. Детальное и техническое обсуждение</option></SELECT></td>' + | |||
'</tr>' + | |||
'<tr>' + | |||
'<td width="150"><label for="АВТОР3"> автор 3: </label></td>' + | |||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР3"></td>' + | |||
// '<td width="150"><label for="КАЧЕСТВО"> качество: </label></td>' + | |||
// '<td width="80"><SELECT NAME="КАЧЕСТВО" SIZE=0 id="quality">' + | |||
// '<OPTION VALUE="0"></option>' + | |||
// '<OPTION VALUE="1">25%</option>' + | |||
// '<OPTION VALUE="2">50%</option>' + | |||
// '<OPTION VALUE="3">75%</option>' + | |||
// '<OPTION VALUE="4">100%</option></SELECT></td>' + | |||
'</tr>' + | |||
'<tr><td width="200"><label for="СУПЕРВАЙЗЕР"> академический супервайзер: </label></td>' + | |||
'<td width="100">' + | |||
'<SELECT NAME="СУПЕРВАЙЗЕР" SIZE=0 id="supervisor">'; | |||
for (var i = 0; i < supervisors.length; i++) { | |||
form += '<OPTION VALUE="' + supervisors[i][0] + '">' + supervisors[i][1] + '</option>'; | |||
} | |||
form += '</SELECT>' + | |||
' | |||
'</td>' + | |||
// '<td width="150"><label for="ВИКИПЕДИЯ"> в Википедии: </label></td>' + | |||
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="ВИКИПЕДИЯ"></td>' + | |||
' | '</tr>' + | ||
'<tr>' + | |||
'<td width=" | '<td width="150"><label for="ПРОЕКТ"> тематический проект: </label></td>' + | ||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="ПРОЕКТ"></td>' + | |||
// '<td width="150"><label for="НЕОДНОЗНАЧНОСТЬ"> разрешение неоднозначности: </label></td>' + | |||
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="НЕОДНОЗНАЧНОСТЬ"></td>' + | |||
'</tr>' + | |||
'<tr>' + | |||
// '<td width="150"><label for="ПОДТЕМА"> подтема: </label></td>' + | |||
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="ПОДТЕМА"></td>' + | |||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id=" | '<td width="150"><label for="ДАТА СОЗДАНИЯ"> дата создания: </label></td>' + | ||
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="ДАТА СОЗДАНИЯ" value="' + newtime + '"></td>' + | |||
'</tr>' + | |||
'</table>' + | |||
' | '<input type="button" value="Добавить" onClick="addtemplate()">' + | ||
'</fieldset></div>'; | |||
' | |||
if (jQuery('#articlediv1').length > 0) { | |||
jQuery('#articlediv1').replaceWith(form); | |||
} else { | |||
document.getElementById('articleselect').innerHTML += form; | document.getElementById('articleselect').innerHTML += form; | ||
} | |||
} | } | ||
function addtemplate() { | function addtemplate() { | ||
var cites = document.getElementById('articlediv1').getElementsByTagName('input'); | |||
var citebegin = ''; | |||
var citeinner = ''; | |||
if (document.getElementById ('typebox').selectedIndex !="0") { | if (document.getElementById('typebox').selectedIndex != "0") { | ||
citeinner += "\n|" + document.getElementById ('typebox').name + "=" + document.getElementById ('typebox').selectedIndex; | citeinner += "\n|" + document.getElementById('typebox').name + "=" + document.getElementById('typebox').selectedIndex; | ||
} | |||
else { | else { | ||
citeinner += "\n|" + document.getElementById('typebox').name + "=" | |||
} | |||
if (document.getElementById ('supervisor').selectedIndex !="0") { | if (document.getElementById('supervisor').selectedIndex != "0") { | ||
citeinner += "\n|" + document.getElementById ('supervisor').name + "=" + document.getElementById ('supervisor').selectedIndex; | citeinner += "\n|" + document.getElementById('supervisor').name + "=" + document.getElementById('supervisor').selectedIndex; | ||
} | |||
else { | else { | ||
citeinner += "\n|" + document.getElementById('supervisor').name + "=" | |||
} | |||
if (document.getElementById ('level').selectedIndex !="0") { | // if (document.getElementById('level').selectedIndex != "0") { | ||
// citeinner += "\n|" + document.getElementById('level').name + "=" + document.getElementById('level').selectedIndex; | |||
} | // } | ||
else { | // else { | ||
// citeinner += "\n|" + document.getElementById('level').name + "=" | |||
} | // } | ||
if (document.getElementById ('quality').selectedIndex !="0") { | // if (document.getElementById('quality').selectedIndex != "0") { | ||
// citeinner += "\n|" + document.getElementById('quality').name + "=" + document.getElementById('quality').selectedIndex; | |||
} | // } | ||
else { | // else { | ||
// citeinner += "\n|" + document.getElementById('quality').name + "=" | |||
} | // } | ||
for (var i = 0; i < cites.length - 1; i++) { | |||
if (cites[i].id != "template") { | |||
citeinner += "\n|" + cites[i].id + "=" + cites[i].value; | |||
} | |||
else if (cites[i].id == "template") { | |||
citebegin = '{{' + cites[i].value; | |||
} | |||
} | |||
var cite = citebegin + citeinner + "\n}}\n"; | |||
insertTags(cite, '', ''); | |||
document.getElementById(' | // insertFilledTemplate(cite); | ||
document.getElementById('articlediv1').style.display = 'none'; | |||
} | } | ||
//function detectIE() { | |||
//// return doXjo.isIE; | |||
// var ieVersion; | |||
// try { | |||
// if (jQuery.browser.msie) { | |||
// ieVersion = jQuery.browser.version; | |||
// ieVersion = parseInt(extractSubstring(ieVersion, "", ".")); | |||
//// console.debug("!!!!"); | |||
// } | |||
// else if (jQuery.browser.mozilla && jQuery.browser.version === "11.0") { | |||
// ieVersion = 11; | |||
// } | |||
// } catch (e) { | |||
//// console.debug("----"); | |||
// } | |||
// | |||
// return ieVersion; | |||
//} | |||
// | |||
//function extractSubstring(value,startstring,endstring, ignoreCase){ | |||
// var valueString; | |||
// if (ignoreCase) { | |||
// valueString = value.toLowerCase(); | |||
// startstring = startstring.toLowerCase(); | |||
// endstring = endstring.toLowerCase(); | |||
// } else { | |||
// valueString = value; | |||
// } | |||
// var startIndex = valueString.indexOf(startstring); | |||
// var endIndex = valueString.indexOf(endstring, startIndex+1); | |||
// if(startIndex != -1){ | |||
// if(endIndex != null && endIndex > startIndex) | |||
// return value.substring(startIndex + startstring.length,endIndex); | |||
// else | |||
// return value.substring(startIndex + startstring.length); | |||
// } | |||
// else | |||
// return value; | |||
//}// end function | |||
//function insertFilledTemplate(filledTemplate) { | |||
// jQuery('#wpTextbox1').wikiEditor("setContent", filledTemplate); | |||
//} | |||
//hookEvent("load", Articlebutton); | //hookEvent("load", Articlebutton); | ||
addOnloadHook(Articlebutton); | //addOnloadHook(Articlebutton); | ||
//$(document).ready(function(){ | |||
// setTimeout(Articlebutton, 1000); | |||
//}); | |||
jQuery( '#wpTextbox1' ).on('wikiEditor-toolbar-doneInitialSections', function () { | |||
Articlebutton(); | |||
}); | |||
Текущая версия от 18:40, 13 ноября 2014
// ____________________________________________________________________________________________
// | |
// | Основано на версии 264413579 гаджета refToolbar.js |
// | (http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&oldid=264413579) |
// |____________________________________________________________________________________________|
//
// Imported from revision 264412998 as of 2009-01-16T05:53:39 from [[User:Mr.Z-man/refToolbar.js]]
// For a description, see [[User:Mr.Z-man/refToolbar]]
//modified to work with new Wiki API - 2014-11-04 - BaruchG
//modified to change the template fields - 2014-11-04 - BaruchG
//modified to change the template fields - 2014-11-13 - BaruchG
//var numforms = 0;
//var numforms1 = 0;
//var isIE = detectIE();
var supervisors = [
["0", ""],
["1", "Пинхас Полонский"],
["2", "Арье Ольман"],
["3", "Шломо Коль-Яаков"],
["4", "Александр Черницкий"],
["5", "Борис Гулько"],
["6", "Леви Китросский"],
["7", "Г. Ахиезер"],
["8", "Анна Гейфман"],
["9", "Ш. Гендельман"],
["10", "Илья Дворкин"],
["11", "Давид Копелиович"],
["12", "М. Левинов"],
["13", "Л. Прайсман"],
["14", "Михаэль Рыжик"],
["15", "Тали Тамарин"],
["16", "Яков Файтельсон"],
["17", "Зеев Ханин"],
["18", "Велвл Чернин"],
["19", "М. Шерман"],
["20", "Михаил Шнейдер"],
["21", "Ася Энтова"],
["22", "Моше Гончарок"]
];
function Articlebutton() {
if (document.getElementById('wpTextbox1')) {
// if (document.getElementById('toolbar')) {
// var button = document.createElement('a');
// button.href = "javascript:easyArticleMain()";
// button.title = "Добавить шаблон О_статье";
// buttonimage = document.createElement('img');
// buttonimage.src = "http://upload.wikimedia.org/wikipedia/commons/9/9f/Button_defaultsort.png";
// buttonimage.alt = "Вставить описание статьи";
// button.appendChild(buttonimage);
// var toolbar = document.getElementById('toolbar');
var toolbar = jQuery('#wikiEditor-ui-toolbar').find('.group-insert')[0];
var buttonTitle = "Добавить шаблон О_статье";
var buttonImageSrc = "http://upload.wikimedia.org/wikipedia/commons/9/9f/Button_defaultsort.png";
// var buttonimageAlt = "Вставить описание статьи";
// if (!isIE) { //navigator.userAgent.indexOf('MSIE') == -1) {
// if (toolbar.style != null) {
// toolbar.style.height = 'auto';
// }
// else {
// toolbar.setAttribute('style', 'margin-bottom: 6px; height: auto;');
// }
// toolbar.appendChild(button);
try {
jQuery('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
buttonId: {
label: buttonTitle,
type: 'button',
icon: buttonImageSrc,
action: {
type: 'callback',
execute: function(context) {
easyArticleMain();
}
}
}
}
});
} catch (e) {
console.log(e.message);
}
//
var articlemain = document.createElement('div');
articlemain.style.display = 'none';
articlemain.style.margin = '0.2em 0 -0.2em 0';
articlemain.setAttribute('Id', 'articleselect');
articlemain.appendChild(addOption("aboutArticle()", "О статье"));
articlemain.appendChild(addOption("aboutTemplate()", "?"));
articlemain.appendChild(addOption("hideInit()", "Отмена"));
toolbar.appendChild(articlemain);
// }
// else {
// toolbar.appendChild(button);
// selection = '<div id="articleselect" style="display:none"><input type="button" value="О статье" onclick="aboutArticle()" />' +
// '<input type="button" value="?" onclick="aboutTemplate()" />' +
// '<input type="button" value="Отмена" onclick="hideInit()" /></div>';
// document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;
// }
}
}
function addOption(script, text) {
var option = document.createElement('input');
option.setAttribute('type', 'button');
option.setAttribute('onclick', script);
option.setAttribute("value", text);
return option;
}
function hideInit() {
document.getElementById('articleselect').style.display = 'none';
oldFormHide1();
}
function oldFormHide1() {
// if (numforms != 0) {
// document.getElementById('articlediv'+numforms).style.display = 'none';
// }
// if (numforms1 != 0) {
// document.getElementById('helpdiv'+numforms1).style.display = 'none';
// }
jQuery('#articlediv1').css("display", 'none');
jQuery('#helpdiv1').css("display", 'none');
}
function easyArticleMain() {
document.getElementById('articleselect').style.display = '';
}
function getTime() {
var time = new Date();
var nowdate = time.getUTCDate();
if (nowdate<10) { nowdate = "0"+ nowdate.toString(); }
var nowmonth = time.getUTCMonth()+1;
if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); }
var nowyear = time.getUTCFullYear();
var newtime = nowdate + '/' + nowmonth + '/' + nowyear;
return (newtime);
}
function aboutTemplate() {
oldFormHide1();
var legend;
legend = "Справка";
// numforms1++;
var form = '<div id="helpdiv1" style="background-color:white">' +
'<fieldset><legend>' + legend + '</legend>' +
'{{О_статье <br>' +
'| ТИП СТАТЬИ = <br>' +
' 1. Регулярная статья<br>' +
' 2. Регулярная исправленная статья<br>' +
// ' 3. Статья-справка<br>'+
// ' 4. Текст унаследован из Википедии<br>'+
' 3. Служебная статья<br>' +
'| АВТОР1 = <br>' +
'| АВТОР2 = <br>' +
'| АВТОР3 = <br>' +
'| СУПЕРВАЙЗЕР = <br>' +
'| ПРОЕКТ = <br>' +
//'| ПОДТЕМА = <br>'+
//'| КАЧЕСТВО = <br>'+
//'| УРОВЕНЬ = <br>'+
'| ДАТА СОЗДАНИЯ = <br>' +
//'| ВИКИПЕДИЯ = <br>'+
//'| НЕОДНОЗНАЧНОСТЬ = <br>'+
'}} <br> <br>' +
'</fieldset></div>';
if (jQuery('#helpdiv1').length > 0) {
jQuery('#helpdiv1').replaceWith(form);
} else {
document.getElementById('articleselect').innerHTML += form;
}
}
function aboutArticle() {
oldFormHide1();
var legend;
var template = "О_статье";
legend = "Описание статьи";
var newtime = getTime();
// numforms++;
var form = '<div id="articlediv1" style="background-color:white">' +
'<fieldset><legend>' + legend + '</legend>' +
'<table cellspacing="6">' +
'<input type="hidden" value="' + template + '" id="template">' +
'<tr>' +
'<td width="150"><label for="АВТОР1"> основной автор: </label></td>' +
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР1"></td>' +
'<td width="150"><label for="ТИП СТАТЬИ"> тип статьи: </label></td>' +
'<td width="80">' +
'<SELECT NAME="ТИП СТАТЬИ" SIZE=0 id="typebox">' +
'<OPTION VALUE="0"></option>' +
'<OPTION VALUE="1">1. Регулярная статья</option>' +
'<OPTION VALUE="2">2. Регулярная исправленная статья</option>' +
// '<OPTION VALUE="3">3. Статья-справка</option>' +
// '<OPTION VALUE="4">4. Текст унаследован из Википедии</option>' +
'<OPTION VALUE="3">3. Служебная статья</option>' +
'</SELECT>' +
'</td>' +
'</tr>' +
'<tr>' +
'<td width="150"><label for="АВТОР2"> автор 2: </label></td>' +
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР2"></td>' +
// '<td width="150"><label for="УРОВЕНЬ"> энциклопедический уровень: </label></td>' +
// '<td width="80"><SELECT NAME="УРОВЕНЬ" SIZE=0 id="level">' +
// '<OPTION VALUE="0"></option>' +
// '<OPTION VALUE="1">I. Обычная статья</option>' +
// '<OPTION VALUE="2">II. Корневая статья</option>' +
// '<OPTION VALUE="3">III. Краткое общее объяснение</option>' +
// '<OPTION VALUE="4">IV. Детальное и техническое обсуждение</option></SELECT></td>' +
'</tr>' +
'<tr>' +
'<td width="150"><label for="АВТОР3"> автор 3: </label></td>' +
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="АВТОР3"></td>' +
// '<td width="150"><label for="КАЧЕСТВО"> качество: </label></td>' +
// '<td width="80"><SELECT NAME="КАЧЕСТВО" SIZE=0 id="quality">' +
// '<OPTION VALUE="0"></option>' +
// '<OPTION VALUE="1">25%</option>' +
// '<OPTION VALUE="2">50%</option>' +
// '<OPTION VALUE="3">75%</option>' +
// '<OPTION VALUE="4">100%</option></SELECT></td>' +
'</tr>' +
'<tr><td width="200"><label for="СУПЕРВАЙЗЕР"> академический супервайзер: </label></td>' +
'<td width="100">' +
'<SELECT NAME="СУПЕРВАЙЗЕР" SIZE=0 id="supervisor">';
for (var i = 0; i < supervisors.length; i++) {
form += '<OPTION VALUE="' + supervisors[i][0] + '">' + supervisors[i][1] + '</option>';
}
form += '</SELECT>' +
'</td>' +
// '<td width="150"><label for="ВИКИПЕДИЯ"> в Википедии: </label></td>' +
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="ВИКИПЕДИЯ"></td>' +
'</tr>' +
'<tr>' +
'<td width="150"><label for="ПРОЕКТ"> тематический проект: </label></td>' +
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="ПРОЕКТ"></td>' +
// '<td width="150"><label for="НЕОДНОЗНАЧНОСТЬ"> разрешение неоднозначности: </label></td>' +
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="НЕОДНОЗНАЧНОСТЬ"></td>' +
'</tr>' +
'<tr>' +
// '<td width="150"><label for="ПОДТЕМА"> подтема: </label></td>' +
// '<td width="300"><input type="text" tabindex=1 style="width:100%" id="ПОДТЕМА"></td>' +
'<td width="150"><label for="ДАТА СОЗДАНИЯ"> дата создания: </label></td>' +
'<td width="300"><input type="text" tabindex=1 style="width:100%" id="ДАТА СОЗДАНИЯ" value="' + newtime + '"></td>' +
'</tr>' +
'</table>' +
'<input type="button" value="Добавить" onClick="addtemplate()">' +
'</fieldset></div>';
if (jQuery('#articlediv1').length > 0) {
jQuery('#articlediv1').replaceWith(form);
} else {
document.getElementById('articleselect').innerHTML += form;
}
}
function addtemplate() {
var cites = document.getElementById('articlediv1').getElementsByTagName('input');
var citebegin = '';
var citeinner = '';
if (document.getElementById('typebox').selectedIndex != "0") {
citeinner += "\n|" + document.getElementById('typebox').name + "=" + document.getElementById('typebox').selectedIndex;
}
else {
citeinner += "\n|" + document.getElementById('typebox').name + "="
}
if (document.getElementById('supervisor').selectedIndex != "0") {
citeinner += "\n|" + document.getElementById('supervisor').name + "=" + document.getElementById('supervisor').selectedIndex;
}
else {
citeinner += "\n|" + document.getElementById('supervisor').name + "="
}
// if (document.getElementById('level').selectedIndex != "0") {
// citeinner += "\n|" + document.getElementById('level').name + "=" + document.getElementById('level').selectedIndex;
// }
// else {
// citeinner += "\n|" + document.getElementById('level').name + "="
// }
// if (document.getElementById('quality').selectedIndex != "0") {
// citeinner += "\n|" + document.getElementById('quality').name + "=" + document.getElementById('quality').selectedIndex;
// }
// else {
// citeinner += "\n|" + document.getElementById('quality').name + "="
// }
for (var i = 0; i < cites.length - 1; i++) {
if (cites[i].id != "template") {
citeinner += "\n|" + cites[i].id + "=" + cites[i].value;
}
else if (cites[i].id == "template") {
citebegin = '{{' + cites[i].value;
}
}
var cite = citebegin + citeinner + "\n}}\n";
insertTags(cite, '', '');
// insertFilledTemplate(cite);
document.getElementById('articlediv1').style.display = 'none';
}
//function detectIE() {
//// return doXjo.isIE;
// var ieVersion;
// try {
// if (jQuery.browser.msie) {
// ieVersion = jQuery.browser.version;
// ieVersion = parseInt(extractSubstring(ieVersion, "", "."));
//// console.debug("!!!!");
// }
// else if (jQuery.browser.mozilla && jQuery.browser.version === "11.0") {
// ieVersion = 11;
// }
// } catch (e) {
//// console.debug("----");
// }
//
// return ieVersion;
//}
//
//function extractSubstring(value,startstring,endstring, ignoreCase){
// var valueString;
// if (ignoreCase) {
// valueString = value.toLowerCase();
// startstring = startstring.toLowerCase();
// endstring = endstring.toLowerCase();
// } else {
// valueString = value;
// }
// var startIndex = valueString.indexOf(startstring);
// var endIndex = valueString.indexOf(endstring, startIndex+1);
// if(startIndex != -1){
// if(endIndex != null && endIndex > startIndex)
// return value.substring(startIndex + startstring.length,endIndex);
// else
// return value.substring(startIndex + startstring.length);
// }
// else
// return value;
//}// end function
//function insertFilledTemplate(filledTemplate) {
// jQuery('#wpTextbox1').wikiEditor("setContent", filledTemplate);
//}
//hookEvent("load", Articlebutton);
//addOnloadHook(Articlebutton);
//$(document).ready(function(){
// setTimeout(Articlebutton, 1000);
//});
jQuery( '#wpTextbox1' ).on('wikiEditor-toolbar-doneInitialSections', function () {
Articlebutton();
});