Մասնակից:ATaguhi/main.js
Appearance
Ծանուցում. Հիշելուց հետո կատարված փոփոխությունները տեսնելու համար մաքրեք ձեր զննարկիչի հիշապահեստը. Mozilla / Firefox / Safari՝ Ctrl+Shift+R (Cmd+Shift+R Mac OS X-ում) Konqueror՝ F5 Opera՝ Tools→Preferences ընտրացանկից։ Internet Explorer՝ Ctrl+F5
$.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("/w/index.php?title=User:Mariamarutunian/getDatesFromInfoBox.js&action=raw&ctype=text/javascript"),
$.getScript("/w/index.php?title=User:ATaguhi/getDatesFromArticleText.js&action=raw&ctype=text/javascript"),
//$.getScript("/w/index.php?title=User:MariamMarti/GetNameDescriptionFromArticleText.js&action=raw&ctype=text/javascript"),
// //$.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=' <div style=" top: 40px; left: 100px; display: block;background: white;border: 5px black solid;border-radius:15px;padding: 5px 10px 10px 10px;"><div id="birth_day"><p><input type="button" name="close_b_d" id="Close_button_B_D" value="Փակել" position="right"></p><p>Կատարե՞լ փոփոխություն:</p><p> <textarea rows="20" cols="66" id="wiki_text_B_D"></textarea></p><p> <input type="button" name="save_b_d" id="Save_button_B_D" value="Այո" ></p></div> <div id="birth_year"><p><input type="button" name="close_b_y" id="Close_button_B_Y" value="Փակել" position="right"></p><p>Կատարե՞լ փոփոխություն:</p> <p> <textarea rows="20" cols="66" id="wiki_text_B_Y"></textarea></p><p><input type="button" name="save_b_y" id="Save_button_B_Y" value="Այո"></p></div><div id="death_day"><p><input type="button" name="close_d_d" id="Close_button_D_D" value="Փակել" position="right"></p><p>Կատարե՞լ փոփոխություն:</p> <p> <textarea rows="20" cols="66" id="wiki_text_D_D"></textarea></p> <p> <input type="button" name="save_b_d" id="Save_button_D_D" value="Այո"></p></div> <div id="death_year"> <p><input type="button" name="close_d_y" id="Close_button_D_Y" value="Փակել" position="right"></p><p>Կատարե՞լ փոփոխություն:</p><p> <textarea rows="20" cols="66" id="wiki_text_D_Y"></textarea></p><p> <input type="button" name="save_b_y" id="Save_button_D_Y" value="Այո"></p></div></div>'
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 colspan="3" > <input type="text" id="name_description" </td></tr> <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>'
function DayObject(dday, mmonth, yyear)
{
this.day=dday;
this.month=mmonth;
this.year=yyear;
};
function NameObject(namm, descr)
{
this.name=namm;
this.description=descr;
};
function ManObject( birth1, death1){
this.death=new DayObject;
this.death= death1;
this.birth= new DayObject;
this.birth=birth1;
};
function Man(mano, descr)
{
this.data=new ManObject;
this.data= mano;
this.describe= new NameObject;
this.describe=descr;
}
var currentPage = new Morebits.wiki.page(mw.config.get('wgPageName'));
currentPage.load(function () {
var text = currentPage.getPageText();
var datArt= new ManObject();
var describeArt= new NameObject();
var datInf= new ManObject();
var describeInf= new NameObject();
datArt=WikiAutoDates.getDatesFromArticleText(text);
describeArt=WikiAutoDates.getNameDescriptionFromArticleText(text);
datInf=WikiAutoDates.getDatesFromInfoBox(text);
describeInf=WikiAutoDates.getNameDescriptionFromInfoBox(text);
var objArticle =new Man(datArt,describeArt);
var objInfoBox =new Man(datInf,describeInf);
var Obj= objArticle;
debugger;
Obj.data.birth.day = objInfoBox.data.birth.day || objArticle.data.birth.day;
Obj.data.birth.month = objInfoBox.data.birth.month || objArticle.data.birth.month;
Obj.data.birth.year = objInfoBox.data.birth.year || objArticle.data.birth.year;
Obj.data.death.day = objInfoBox.data.death.day || objArticle.data.death.day;
Obj.data.death.month = objInfoBox.data.death.month || objArticle.data.death.month;
Obj.data.death.year = objInfoBox.data.death.year || objArticle.data.death.year;
Obj.describe.name = objInfoBox.describe.name || objArticle.describe.name;
Obj.describe.description = objInfoBox.describe.description || objArticle.describe.description;
if (!(Obj.data.birth.year || Obj.data.death.year)) {
// no dates are detected
return;
}
var textOfDateBirthF = function(textOfDateBirth){
if (!checkPersonExists(textOfDateBirth, sectionBirth, Obj.describe, Obj.data.birth, 0)) {
var showtextBDate = WikiAutoDates.addPerson(textOfDateBirth, sectionBirth, Obj.describe, Obj.data.birth, 0);
$("#wiki_text_B_D").val(showtextBDate);
}
};
var textOfYearBirthF=function(textOfYearBirth){
if (!checkPersonExists(textOfYearBirth, sectionBirth, Obj.describe, Obj.data.birth, 1)) {
var showtextBYear = WikiAutoDates.addPerson(textOfYearBirth, sectionBirth, Obj.describe, Obj.data.birth, 1);
$("#wiki_text_B_Y").val(showtextBYear);
}
};
var textOfDateDeathF=function(textOfDateDeath){
if (!checkPersonExists(textOfDateDeath, sectionDeath, Obj.describe, Obj.data.death, 0)) {
var showtextDDate=WikiAutoDates.addPerson(textOfDateDeath, sectionDeath, Obj.describe, Obj.data.death, 0);
$("#wiki_text_D_D").val(showtextDDate);
}
};
var textOfYearDeathF=function(textOfYearDeath){
if (!checkPersonExists(textOfYearDeath, sectionDeath, Obj.describe, Obj.data.death, 1)) {
var showtextDYear= WikiAutoDates.addPerson(textOfYearDeath, sectionDeath, Obj.describe, Obj.data.death, 1);
$("#wiki_text_D_Y").val(showtextDYear);
}
};
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.data.birth.day);
$("#ID_Birth_Month").val(Obj.data.birth.month);
$("#ID_Birth_Year").val(Obj.data.birth.year);
$("#ID_Death_Day").val(Obj.data.death.day);
$("#ID_Death_Month").val(Obj.data.death.month);
$("#ID_Death_Year").val(Obj.data.death.year);
$("#name_descibtion").val(Obj.describe);
event.preventDefault();
return false;
});
$("#closeForm").click(function()
{
$form.hide();
});
$("#submitDates").click(function () {
Obj.data.birth.day = $("#ID_Birth_Day").val();
Obj.data.birth.month = $("#ID_Birth_Month").val();
Obj.data.birth.year = $("#ID_Birth_Year").val();
Obj.data.death.day = $("#ID_Death_Day").val();
Obj.data.death.month = $("#ID_Death_Month").val();
Obj.data.death.year = $("#ID_Death_Year").val();
Obj.describe=$("#name_describtion").val();
$form.hide();
$.when(
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.data.birth.year, function (textOfYearBirth) {
textOfYearBirthF(textOfYearBirth);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.data.birth, function (textOfDateBirth) {
textOfDateBirthF(textOfDateBirth);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getDatePageText(Obj.data.death, function (textOfDateDeath) {
textOfDateDeathF(textOfDateDeath);
deferred.resolve();
});
}),
$.Deferred(function (deferred) {
WikiAutoDates.getYearPageText(Obj.data.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(){
$("#birth_day").remove();
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_B_Y").click(function(){
$("#birth_year").remove();
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_D_D").click(function(){
$("#death_day").remove();
/*textareayi poxaren haytararutyun*/
});
$("#Close_button_D_Y").click(function(){
$("#death_year").remove();
/*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*/
});
});
}).fail(function () {
debugger;
});