home *** CD-ROM | disk | FTP | other *** search
- var gFinalHeight = 50;
- var gSlideIncrement = 1;
- var gSlideTime = 10;
- var gOpenTime = 3500;
-
- var gCloseTimeout = null;
- var gStrBundle = null;
-
- var gYaDefence = Components.classes["@yandex.ru/yasearch;1"]
- .getService(Components.interfaces.nsIYaSearch)
- .wrappedJSObject
- .yaDefence;
-
- function prefillAlertInfo() {
- var protectedDiff = gYaDefence._getProtectedDiff();
-
- if (protectedDiff.protectedHost)
- document.getElementById("hostProtectedLabel").value = protectedDiff.protectedHost;
-
- if (protectedDiff.currentHost)
- document.getElementById("hostCurrentLabel").value = protectedDiff.currentHost;
-
- if (window.arguments[1] == true) { // changed again
- document.getElementById("homePageChangeHelpText").innerHTML = gStrBundle.getString("homePageChangeHelpText");
- document.getElementById("alertBox").setAttribute("class", "changedAgain");
- }
- }
-
- function onAlertLoad() {
- gStrBundle = document.getElementById("yasearch-string-bundle-defence");
-
- prefillAlertInfo();
-
- sizeToContent();
-
- var contentDim = document.getElementById("alertBox").boxObject;
- window.innerWidth = contentDim.width;
-
- gFinalHeight = window.outerHeight- 2;
-
- gSlideIncrement = Math.max(1, parseInt(gFinalHeight / 40, 10));
-
- window.outerHeight = 1;
-
- _moveAlert();
-
- setTimeout(animateAlert, gSlideTime);
- }
-
- function setHomePageAndExit(aAcceptCurrent) {
- var protectEnabled = document.getElementById("protectEnabledCheckbox").checked;
- gYaDefence.homepageAlertCallback(aAcceptCurrent, protectEnabled);
-
- window.close();
- }
-
- function onAlertClick(aEvent) {
- switch (aEvent.target.id) {
- case "mailtoSupportLink":
- let target = aEvent.originalTarget;
- let targetHref = target.getAttribute("href");
-
- Components.classes["@yandex.ru/yasearch;1"]
- .getService(Components.interfaces.nsIYaSearch)
- .wrappedJSObject
- .loadURI(targetHref, "new-tab");
-
- window.close();
- break;
-
- case "closeButton":
- window.close();
- break;
-
- case "showMore":
- var currHeight = window.outerHeight;
- document.getElementById("changesHelp").setAttribute("moreHelpShowed", "true");
-
- setTimeout(function() {
- sizeToContent();
-
- var contentDim = document.getElementById("alertBox").boxObject;
- window.innerWidth = contentDim.width;
-
- gFinalHeight = window.outerHeight - 2;
- window.outerHeight = currHeight;
- animateAlert();
- }, 0);
-
- break;
- }
- }
-
- function _moveAlert() {
- window.moveTo((screen.availLeft + screen.availWidth - window.outerWidth),
- screen.availTop + screen.availHeight - window.outerHeight);
-
- var opacityValue = Math.min(.99, Math.max(.25, window.outerHeight/gFinalHeight));
- document.getElementById("alertBox").style.opacity = opacityValue;
- }
-
- function animateAlert() {
- if (window.outerHeight < gFinalHeight) {
- window.outerHeight += Math.min(gSlideIncrement, gFinalHeight - window.outerHeight);
- _moveAlert();
- setTimeout(animateAlert, gSlideTime);
- }
- }