home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / AIMP2 / aimp_2.61.583.exe / $TEMP / YandexPackSetup.msi / fil798FA6A2B65C8B96B39124393AB813B9 < prev    next >
Text File  |  2010-07-12  |  3KB  |  108 lines

  1. var gFinalHeight = 50;
  2. var gSlideIncrement = 1;
  3. var gSlideTime = 10;
  4. var gOpenTime = 3500;
  5.  
  6. var gCloseTimeout = null;
  7. var gStrBundle = null;
  8.  
  9. var gYaDefence = Components.classes["@yandex.ru/yasearch;1"]
  10.                            .getService(Components.interfaces.nsIYaSearch)
  11.                            .wrappedJSObject
  12.                            .yaDefence;
  13.  
  14. function prefillAlertInfo() {
  15.   var protectedDiff = gYaDefence._getProtectedDiff();
  16.   
  17.   if (protectedDiff.protectedHost)
  18.     document.getElementById("hostProtectedLabel").value = protectedDiff.protectedHost;
  19.   
  20.   if (protectedDiff.currentHost)
  21.     document.getElementById("hostCurrentLabel").value = protectedDiff.currentHost;
  22.   
  23.   if (window.arguments[1] == true) {  // changed again
  24.     document.getElementById("homePageChangeHelpText").innerHTML = gStrBundle.getString("homePageChangeHelpText");
  25.     document.getElementById("alertBox").setAttribute("class", "changedAgain");
  26.   }
  27. }
  28.  
  29. function onAlertLoad() {
  30.   gStrBundle = document.getElementById("yasearch-string-bundle-defence");
  31.   
  32.   prefillAlertInfo();
  33.   
  34.   sizeToContent();
  35.   
  36.   var contentDim = document.getElementById("alertBox").boxObject;
  37.   window.innerWidth = contentDim.width;
  38.   
  39.   gFinalHeight = window.outerHeight- 2;
  40.   
  41.   gSlideIncrement = Math.max(1, parseInt(gFinalHeight / 40, 10));
  42.   
  43.   window.outerHeight = 1;
  44.   
  45.   _moveAlert();
  46.   
  47.   setTimeout(animateAlert, gSlideTime);
  48. }
  49.  
  50. function setHomePageAndExit(aAcceptCurrent) {
  51.   var protectEnabled = document.getElementById("protectEnabledCheckbox").checked;
  52.   gYaDefence.homepageAlertCallback(aAcceptCurrent, protectEnabled);
  53.   
  54.   window.close();
  55. }
  56.  
  57. function onAlertClick(aEvent) {
  58.   switch (aEvent.target.id) {
  59.     case "mailtoSupportLink":
  60.       let target = aEvent.originalTarget;
  61.       let targetHref = target.getAttribute("href");
  62.       
  63.       Components.classes["@yandex.ru/yasearch;1"]
  64.                 .getService(Components.interfaces.nsIYaSearch)
  65.                 .wrappedJSObject
  66.                 .loadURI(targetHref, "new-tab");
  67.       
  68.       window.close();
  69.       break;
  70.     
  71.     case "closeButton":
  72.       window.close();
  73.       break;
  74.     
  75.     case "showMore":
  76.       var currHeight = window.outerHeight;
  77.       document.getElementById("changesHelp").setAttribute("moreHelpShowed", "true");
  78.       
  79.       setTimeout(function() {
  80.         sizeToContent();
  81.         
  82.         var contentDim = document.getElementById("alertBox").boxObject;
  83.         window.innerWidth = contentDim.width;
  84.         
  85.         gFinalHeight = window.outerHeight - 2;
  86.         window.outerHeight = currHeight;
  87.         animateAlert();
  88.       }, 0);
  89.       
  90.       break;
  91.   }
  92. }
  93.  
  94. function _moveAlert() {
  95.   window.moveTo((screen.availLeft + screen.availWidth - window.outerWidth),
  96.                 screen.availTop + screen.availHeight - window.outerHeight);
  97.   
  98.   var opacityValue = Math.min(.99, Math.max(.25, window.outerHeight/gFinalHeight));
  99.   document.getElementById("alertBox").style.opacity = opacityValue;
  100. }
  101.  
  102. function animateAlert() {
  103.   if (window.outerHeight < gFinalHeight) {
  104.     window.outerHeight += Math.min(gSlideIncrement, gFinalHeight - window.outerHeight);
  105.     _moveAlert();
  106.     setTimeout(animateAlert, gSlideTime);
  107.   }
  108. }