Մասնակից:HrantKhachatrian/WikiAutoDates.js
Ծանուցում. Հիշելուց հետո կատարված փոփոխությունները տեսնելու համար մաքրեք ձեր զննարկիչի հիշապահեստը. Mozilla / Firefox / Safari՝ Ctrl+Shift+R (Cmd+Shift+R Mac OS X-ում) Konqueror՝ F5 Opera՝ Tools→Preferences ընտրացանկից։ Internet Explorer՝ Ctrl+F5
/**
* Created by Admin on 18.02.14.
*/
$.when(
$.getScript("/w/index.php?title=User:HrantKhachatrian/morebits.js&action=raw&ctype=text/javascript"),
$.getScript("/w/index.php?title=User:HGayane/GetNameDescrFromInfoBox.js&action=raw&ctype=text/javascript"),
// $.getScript("linkOf getDatesFromInfoBox"),
$.getScript("/w/index.php?title=User:ATaguhi/getDatesFromArticleText.js&action=raw&ctype=text/javascript"),
// $.getScript("link of getNameDescriptionFromArticleText(text)"),
$.getScript("/w/index.php?title=User:HGayane/GetDatePageText.js&action=raw&ctype=text/javascript"),
$.getScript("/w/index.php?title=User:HGayane/GetYearPage.js&action=raw&ctype=text/javascript"),
$.getScript("/w/index.php?title=User:SaroMarkosyan/checkPersonExists.js&action=raw&ctype=text/javascript"),
$.getScript("/w/index.php?title=User:Tik-ionut/add person.js&action=raw&ctype=text/javascript"),
// $.getScript("link of B_D_Dates.js"),
$.Deferred(function (deferred) {
$(deferred.resolve);
})
).done(
function () {
var htmlAdd=' <fieldset style="position: fixed; top: 40px; left: 100px; display: block;background: white;border: 5px grey solid;padding: 5px 10px 10px 10px;"><legend>Are you sure to change this?</legend><p> <textarea rows="30" cols="145" id="wiki_text_B_D"></textarea></p><p> <input type="button" name="close_b_d" id="Close_button_B_D" value="NO"><input type="button" name="save_b_d" id="Save_button_B_D" value="Yes"></p><legend>Are you sure to change this?</legend><p> <textarea rows="30" cols="145" id="wiki_text_B_Y"></textarea></p><p> <input type="button" name="close_b_y" id="Close_button_B_Y" value="NO"><input type="button" name="save_b_y" id="Save_button_B_Y" value="Yes"></p><legend>Are you sure to change this?</legend> <p> <textarea rows="30" cols="145" id="wiki_text_D_D"></textarea></p> <p> <input type="button" name="close_b_d" id="Close_button_D_D" value="NO"><input type="button" name="save_b_d" id="Save_button_D_D" value="Yes"></p><legend>Are you sure to change this?</legend><p> <textarea rows="30" cols="145" id="wiki_text_D_Y"></textarea></p><p> <input type="button" name="close_b_y" id="Close_button_D_Y" value="NO"> <input type="button" name="save_b_y" id="Save_button_D_Y" value="Yes"></p></fieldset>'
var buttonHtml = '<a href="#" style="font-size: 9pt;font-weight: bold; float: right;">WikiAutoDates</a>';
var formHtml = '<div id="display1" style="position: fixed; top: 40px; left: 100px; display: block;background: white;border: 5px grey solid;padding: 5px 10px 10px 10px;"> <h1>Ծննդյան և Մահվան ամսաթվեր </h1> <div> <table> <tr><td><h2>Ծննդյան ամսաթիվ</h2></td> <td></td> <td ><input type="text" id="ID_Birth_Day" style="width:25px"></td> <td ><input type="text" id="ID_Birth_Month" style="width:25px"></td> <td ><input type="text" id="ID_Birth_Year" style="width:50px"></td> </tr> <tr><td><h2>Մահվան ամսաթիվ</h2></td> <td></td> <td ><input type="text" id="ID_Death_Day" style="width:25px"></td> <td ><input type="text" id="ID_Death_Month" style="width:25px"></td> <td ><input type="text" id="ID_Death_Year" style="width:50px"></td></tr> </table> </div> <div id="button"> <input id="submitDates" type="button" value="Հաստատել"><input id="closeForm" type="button" value="Փակել"></div></div>';
var DayObject = {
day: "00",
month: "00",
year: "0000"
};
var NameObject = {
name: "",
description: ""
};
var mann = {
death: DayObject,
birth: DayObject
};
var Man = {
date: mann,
describe: NameObject
};
var currentPage = new Morebits.wiki.page(mw.config.get('wgPageName'));
currentPage.load(function () {
var text = currentPage.getPageText();
var objArticle = Man;
var objInfoBox = Man;
var Obj = Man;
objArticle.mann = getDatesFromArticleText(text);
// objInfoBox.mann = WikiAutoDates.getDatesFromInfoBox(text);
objInfoBox.describe = WikiAutoDates.getNameDescriptionFromInfoBox(text);
debugger;
if (!(objArticle.mann.birth.year || objArticle.mann.death.year || objInfoBox.mann.birth.year|| objInfoBox.mann.death.year)) {
// no dates are detected
return;
}
var $button = $(buttonHtml);
$('#firstHeading').append($button);
var $form = $(formHtml);
$form.appendTo($('body'));
$form.hide();
var $form2 = $(htmlAdd);
$form2.appendTo($('body'));
$form2.hide();
$button.click(function (event) {
$form.show();
$("#ID_Birth_Day").val(Obj.mann.birth.day);
$("#ID_Birth_Month").val(Obj.mann.birth.month);
$("#ID_Birth_Year").val(Obj.mann.birth.year);
$("#ID_Death_Day").val(Obj.mann.death.day);
$("#ID_Death_Month").val(Obj.mann.death.month);
$("#ID_Death_Year").val(Obj.mann.death.year);
event.preventDefault();
return false;
});
$("#closeForm").click(function()
{
$form.hide();
});
$("#submitDates").click(function () {
Obj.mann.birth.day = $("#ID_Birth_Day").val();
Obj.mann.birth.month = $("#ID_Birth_Month").val();
Obj.mann.birth.year = $("#ID_Birth_Year").val();
Obj.mann.death.day = $("#ID_Death_Day").val();
Obj.mann.death.month = $("#ID_Death_Month").val();
Obj.mann.death.year = $("#ID_Death_Year").val();
$.when(
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.mann.birth.year, function (textOfYearBirth) {
textOfYearBirthF(textOfYearBirth);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.mann.birth, function (textOfDateBirth) {
textOfDateBirthF(textOfDateBirth);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.mann.death, function (textOfDateDeath) {
textOfDateDeathF(textOfDateDeath);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getYearPageText(Obj.mann.death.year, function (textOfYearDeath) {
textOfYearDeathF(textOfYearDeath);
deferred.resolve();
});
})
).done(function () {
$form2.show();
});
});
if (objArticle.describe.name == "" && objArticle.describe.description == "") {
Obj.describe = objInfoBox.describe;
}
else {
Obj.describe = objArticle.describe;
}
var sectionBirth = "Ծնունդներ";
var sectionDeath = "Մահեր";
$("#Close_button_B_D").click(function(){
$("#wiki_text_B_D").val("You don't change it ")
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_B_Y").click(function(){
$("#wiki_text_B_Y").val("You don't change it ")
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_D_D").click(function(){
$("#wiki_text_D_D").val("You don't change it ")
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_D_Y").click(function(){
$("#wiki_text_D_Y").val("You don't change it ")
/*textareayi poxaren haytararutyun*/
});
$("#Save_button_B_D").click(function(){
/*funcia vor add anum wikium text@ u grum html-um*/
});
$("#Save_button_B_Y").click(function(){
/*funcia vor add anum wikium text@ u grum html-um*/
});
$("#Save_button_D_D").click(function(){
/*funcia vor add anum wikium text@ u grum html-um*/
});
$("#Save_button_D_Y").click(function(){
/*funcia vor add anum wikium text@ u grum html-um*/
});
var textOfDateBirthF = function(textOfDateBirth){
if (!checkPersonExists(textOfDateBirth, sectionBirth, Obj.describe, Obj.mann.birth, 0)) {
var showtextBDate = WikiAutoDates.addPerson(textOfDateBirth, sectionBirth, Obj.describe, Obj.mann.birth, 0);
$("#wiki_text_B_D").val(showtextBDate);
}
};
var textOfYearBirthF=function(textOfYearBirth){
if (!checkPersonExists(textOfYearBirth, sectionBirth, Obj.describe, Obj.mann.birth, 1)) {
var showtextBYear = WikiAutoDates.addPerson(textOfYearBirth, sectionBirth, Obj.describe, Obj.mann.birth, 1);
$("#wiki_text_B_Y").val(showtextBYear);
}
};
var textOfDateDeathF=function(textOfDateDeath){
if (!checkPersonExists(textOfDateDeath, sectionDeath, Obj.describe, Obj.mann.death, 0)) {
var showtextDDate=WikiAutoDates.addPerson(textOfDateDeath, sectionDeath, Obj.describe, Obj.mann.death, 0);
$("#wiki_text_D_D").val(showtextDDate);
}
};
var textOfYearDeathF=function(textOfYearDeath){
if (!checkPersonExists(textOfYearDeath, sectionDeath, Obj.describe, Obj.mann.death, 1)) {
var showtextDYear= WikiAutoDates.addPerson(textOfYearDeath, sectionDeath, Obj.describe, Obj.mann.death, 1);
$("#wiki_text_D_Y").val(showtextDYear);
}
};
});
}).fail(function () {
debugger;
});