home *** CD-ROM | disk | FTP | other *** search
- var gFinalHeight = 50;
- var gSlideIncrement = 1;
- var gSlideTime = 10;
- var gOpenTime = 3500;
-
- var gAlertCookie = "";
- var gAlertListener = null;
-
- var gMouseOver = false;
- var gCloseTimeout = null;
-
- function prefillAlertInfo() {
- document.getElementById("alertTitleLabel").textContent = window.arguments[1];
- document.getElementById("alertTextLabel").textContent = window.arguments[2].shift();
-
- var mailMsg = window.arguments[2].shift();
- if (mailMsg) {
- document.getElementById("alertTextMailFrom").setAttribute("value", mailMsg[0]);
- document.getElementById("alertTextMailSubject").setAttribute("value", mailMsg[1]);
- document.getElementById("alertGrid").setAttribute("hidden", "false");
- }
-
- gAlertCookie = window.arguments[3];
- gAlertListener = window.arguments[4];
- }
-
- function onAlertLoad() {
- 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 _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);
- }
- else if (!gMouseOver)
- gCloseTimeout = setTimeout(closeAlert, gOpenTime);
- }
-
- function closeAlert() {
- if (gMouseOver)
- return;
-
- if (window.outerHeight > gSlideIncrement) {
- window.outerHeight -= gSlideIncrement;
- _moveAlert();
- setTimeout(closeAlert, gSlideTime);
- } else {
- closeWindow();
- }
- }
-
- function onAlertClick(aEvent) {
- if (aEvent.button == 2 || aEvent.target.id == "closeButton") {
- closeWindow();
- } else if (gAlertCookie.type == "mail" || gAlertCookie.type == "feeds") {
- let action = gAlertCookie.type == "mail" ? 1040 : 1120;
-
- Components.classes["@yandex.ru/yasearch;1"]
- .getService(Components.interfaces.nsIYaSearch)
- .wrappedJSObject
- .loadConditionalURI(gAlertCookie.mfdDomain || gAlertCookie.type, "tab", {action:action});
-
- closeWindow();
- }
-
- return true;
- }
-
- function closeWindow() {
- if (gAlertListener)
- gAlertListener.observe(null, "alertfinished", gAlertCookie);
-
- window.close();
- }
-
- function onMouseOver(aEvent) {
- gMouseOver = true;
- if (gCloseTimeout)
- clearTimeout(gCloseTimeout);
- }
-
- function onMouseOut(aEvent) {
- gMouseOver = false;
- gOpenTime = 1000;
- animateAlert();
- }