hostYaRe: new RegExp("(^|\\.)(yandex\\.([A-Za-z]{2,4})|(ya|moikrug)\\.ru)$", "i"),
hostOnlyRe: new RegExp("(^|www\\.)(yandex|ya|moikrug|google|mail|rambler)\\.", "i"),
hostReS: new RegExp("(^|(nova|www|go)\\.)(yandex|google|mail|rambler)\\.(?:com|ru|ua|by|kz)$", "i"),
pathReS: new RegExp("^((yand)?search|srch)\\?", "i"),
hostReM: new RegExp("^((web)?mail\\.yandex\\.(ru|ua|by|kz)|win\\.mail\\.ru|mail\\.rambler\\.ru)$", "i"),
urlReM: new RegExp("^http:\/\/([^\/]+\/(cgi\\-bin\/sendmsg\\?)?compose|webmail\\.yandex\\.(ru|ua|by|kz)\/messages|mail\\.yandex\\.(ru|ua|by|kz)\/((classic|modern|neo)/)?(messages|compose)|win\\.mail\\.ru\/cgi\\-bin\/(sentmsg\\?compose|msglist\\?folder=0&))|mail\\.rambler\\.ru\/mail\/(startpage\\?|mail\.cgi\\?(r|mode=(startpage|compose|mailbox;mbox=INBOX)))", "i"),
checkConditions: function(aURL) {
if (aURL && aURL.match(/^http:\/\/([^\/]+)\/?(.*)/)) {
let host = RegExp.$1,
path = RegExp.$2;
if (this.hostQuickRe.test(host)) {
if (!path && this.hostOnlyRe.test(host))
return true;
if (this.hostReM.test(host) && aURL.match(this.urlReM))
return true;
if (this.pathReS.test(path) && host.match(this.hostReS)) {
let q = "text";
switch (RegExp.$3) {
case "google": q = "(as_)?q"; break;
case "mail": q = "q"; break;
case "rambler": q = "(query|words)"; break;
}
let re = new RegExp("[\?&](?:" + q + ")=([^#&\?]*)");
if (re.test(path))
return true;
}
if (this.hostYaRe.test(host))
return true;
}
}
return false;
},
isYandexHost: function(aURL) {
if (aURL && aURL.match(/^http:\/\/([^\/]+)\/?(.*)/)) {
if (this.hostYaRe.test(RegExp.$1))
return true;
}
return false;
},
get dataSumm() {
let res = {};
if (this._browser && !this.inProgress) {
let d = this.data;
if (!d.isFromCache && d.times && d.location &&
this._browser.currentURI.spec == d.location &&
this.checkConditions(d.location)) {
let t = [];
d.times.forEach(function(aTime) {
t.push(parseInt(aTime/10, 10));
});
let yamm = null;
if (this.isYandexHost(d.location)) {
let doc = this._browser.contentDocument;
let metaNodes = doc.getElementsByTagName("meta");
for (let i = 0, len = metaNodes.length; i < len; i++) {
let metaName = (metaNodes[i].name || "").toLowerCase();