home *** CD-ROM | disk | FTP | other *** search
/ PC World Plus! (NZ) 2001 November / PCW1101.ISO / BrowsingTools / Flyswat / flyswat6602.exe / flylib.dll / JAVASCRIPT / 102
Encoding:
Text File  |  2000-10-30  |  9.7 KB  |  376 lines

  1. <HTML> 
  2. <HEAD>
  3. <SCRIPT LANGUAGE="Javascript1.2">
  4.  
  5. ///////////////// BEGIN FLYOBJECTS ///////////////////////////////
  6. //------------------------------------------
  7. // catch javascript errors
  8. //------------------------------------------
  9. function myonerror(msg, URL, lineNum) {
  10.   /*
  11.   window.alert("!!! A Javascript error has occurred !!!\n\n" +
  12.     "Msg:\t" + msg + "\n" +
  13.     "URL:\t" + URL + "\n" +
  14.     "Line:\t" + lineNum + "\n\n" +
  15.     "Please email clientdev@flyswat.com immediately!\n\n" +
  16.     "NOTE: This message should only appear internally.");
  17.   */
  18.   return true;
  19. }
  20. window.onerror = myonerror;
  21. //------------------------------------------
  22.  
  23. var flyobjectsversion = 8;
  24.  
  25. // Javascript Objects which are used by the Win32 code 
  26. // when generating data.
  27. // Any of the flystyle pages should be able to assume that
  28. // these data structures are present.
  29.  
  30. //------------------------------------------------------------------
  31. // The environment object
  32. //------------------------------------------------------------------
  33. function FSSystemEnvironment(userID, serialNum, sessionID, distTag, buildNum)
  34. {
  35.   this.userID = userID;
  36.   this.serialNum = serialNum;
  37.   this.sessionID = sessionID;
  38.   this.distTag = distTag;
  39.   this.buildNum = buildNum;
  40. }
  41.  
  42. function FSLinksEnvironment(redURL, src, requestID, isValidLinksSet)
  43. {
  44.   this.redURL = redURL;
  45.   this.src = src;
  46.   this.requestID = requestID;
  47.   if (isValidLinksSet.toLowerCase() == "true") {
  48.     this.isValidLinksSet = true;
  49.   }
  50.   else {
  51.     this.isValidLinksSet = false;
  52.   }
  53. }
  54.  
  55. //------------------------------------------------------------------
  56.  
  57.  
  58. //------------------------------------------------------------------
  59. // The category object
  60. //------------------------------------------------------------------
  61. function FSCategory(name, keywords, hidden, boosterPackCategory, bpID, bpRev)
  62. {
  63.   this.name = name;
  64.   this.keywords = keywords;
  65.   this.hidden = hidden;
  66.   this.boosterPackCategory = boosterPackCategory;
  67.   this.bpID = bpID;
  68.   this.bpRev = bpRev;
  69.  
  70.   /* display properties */
  71.   this.globalID;
  72.   this.keyListID;
  73.   this.expandImageID;
  74.   this.keyListShowing;
  75.  
  76.   /* display functions */
  77.   this.initializeDisplayProperties = initializeCategoryDisplayProperties;
  78.   this.showKeyList = showKeyList;
  79.   this.hideKeyList = hideKeyList;
  80. }
  81.  
  82. function initializeCategoryDisplayProperties(cat)
  83. {
  84.   this.globalID = setGlobalID("CAT");
  85.   this.keyListID = setGlobalID("KEYLIST");
  86.   this.expandImageID = setGlobalID("CATEXPANDIMG");
  87.   this.keyListShowing = false;
  88. }
  89.  
  90. function hideKeyList()
  91. {
  92.   with (eval("document.all." + this.keyListID)) {
  93.     style.display = "none";
  94.     this.keyListShowing = false;
  95.   }
  96.  
  97.   if (FS_WINDOW_TYPE == "POPUP") {
  98.       with (eval("document.all." + this.expandImageID)) {
  99.         src = DownNormal.src;
  100.       }
  101.   }
  102. }
  103.  
  104. function showKeyList(cat)
  105. {
  106.  with (eval("document.all." + this.keyListID)) {
  107.     if (innerHTML == "") {
  108.  
  109.         if (FS_WINDOW_TYPE == "POPUP") {
  110.             innerHTML = assemblePopupKeyListHTML(cat);
  111.         }
  112.         else {
  113.             innerHTML = assembleVertKeyListHTML(cat);
  114.         }
  115.  
  116.         if (FS_WINDOW_TYPE == "POPUP") {
  117.             //also show link types
  118.             for (var k in this.keywords) {
  119.                 if (!this.keywords[k].ltListShowing) {
  120.                     this.keywords[k].showLTList(cat,k);
  121.                 }
  122.             }
  123.         }
  124.  
  125.     }
  126.     style.display = "block";
  127.     this.keyListShowing = true;
  128.  
  129.   }
  130.  
  131.   if (FS_WINDOW_TYPE == "POPUP") {
  132.       with (eval("document.all." + this.expandImageID)) {
  133.         src = UpNormal.src;
  134.       }
  135.   }
  136.  
  137.   if ((FS_WINDOW_TYPE == "SEARCH") || (FS_WINDOW_TYPE == "LINKS_LIST"))
  138.     scrollVertPanel("document.all." + this.globalID, "document.all." + this.keyListID);
  139. }
  140.  
  141.  
  142. //key list used only in vertical panel
  143. function initializeKeyListHTML(cat)
  144. {
  145.   var keywords = this.keywords;
  146.   var keyHTML = "";
  147.   var catWideHTML = "";
  148.   for (var k in keywords) {
  149.     keywords[k].initializeDisplayProperties(cat, k);
  150.     if (keywords[k].categoryWide)
  151.         catWideHTML += keywords[k].HTML;
  152.     else
  153.         keyHTML += keywords[k].HTML;
  154.   }
  155.  
  156.   this.keyListHTML = combineKeyAndCatWideHTML(keyHTML, catWideHTML);
  157.  
  158. }
  159.  
  160. //------------------------------------------------------------------
  161.  
  162.  
  163. //------------------------------------------------------------------
  164. // The keyword object
  165. //------------------------------------------------------------------
  166. function FSKeyword(name, code, linktypes, mt, cat, categoryWide, categoryCode)
  167. {
  168.   this.name = name;
  169.   this.code = code;
  170.   this.mt = mt;
  171.   this.linktypes = linktypes;
  172.   this.category = cat;
  173.   this.categoryWide = categoryWide;
  174.   this.categoryCode = categoryCode;
  175.   
  176.   /* display properties */
  177.   this.globalID;
  178.   this.ltListID;
  179.   this.ltListShowing;
  180.  
  181.   /* display functions */
  182.   this.initializeDisplayProperties = initializeKeywordDisplayProperties;
  183.   this.showLTList = showLTList;
  184.   this.hideLTList = hideLTList;
  185. }
  186.  
  187. function initializeKeywordDisplayProperties(cat, k)
  188. {
  189.   this.globalID = setGlobalID("KEY");
  190.   this.ltListID = setGlobalID("LTLIST");
  191.   this.ltListShowing = false;
  192. }
  193.  
  194. function initializeVertKeywordDisplayProperties(cat, k)
  195. {
  196.   this.globalID = setGlobalID("KEY");
  197.   this.ltListID = setGlobalID("LTLIST");
  198.   this.ltListShowing = false;
  199.  
  200.   if (this.categoryWide) {
  201.     //put provider list in place of lt list
  202.     var linktype = this.linktypes[0];
  203.     this.ltListID = linktype.providerListID;
  204.     linktype.initializeDisplayProperties(cat, k, 0);
  205.     this.vertHTML = assembleVertKeywordCatWideHTML(this.categoryCode, this.name, this.globalID, linktype.URL, linktype.providers,
  206.                                                    linktype.providerListID, linktype.expandImageID, cat, k, 0);
  207.   }
  208.   else {
  209.     this.vertHTML = assembleVertKeywordHTML(this.name, this.globalID, cat, k);
  210.   }
  211.  
  212. }
  213.  
  214. function hideLTList()
  215. {
  216.   with (eval("document.all." + this.ltListID)) {
  217.     style.display = "none";
  218.     this.ltListShowing = false;
  219.   }
  220. }
  221.  
  222. function showLTList(cat, k)
  223. {
  224.   with (eval("document.all." + this.ltListID)) {
  225.  
  226.     if (innerHTML == "") {
  227.         innerHTML = assembleLTListHTML(cat, k);
  228.     }
  229.  
  230.     style.display = "block";
  231.     this.ltListShowing = true;
  232.   }
  233.  
  234.   if ((FS_WINDOW_TYPE == "SEARCH") || (FS_WINDOW_TYPE == "LINKS_LIST")) {
  235.     scrollVertPanel("document.all." + this.globalID, "document.all." + this.ltListID);
  236.   }
  237. }
  238.  
  239.  
  240. //------------------------------------------------------------------
  241.  
  242.  
  243. //------------------------------------------------------------------
  244. // The linktype object
  245. //------------------------------------------------------------------
  246. function FSLinkType(name, type)
  247. {
  248.   this.name = name;
  249.   this.type = type;
  250.  
  251.   /* display properties */
  252.   this.globalID;
  253.   this.URL;
  254.  
  255.   this.providers;
  256.   this.providerListID;
  257.   this.expandImageID;
  258.   this.providerListHTML;
  259.   this.showProviderList = showProviderList;
  260.   this.hideProviderList = hideProviderList;
  261.   this.providerListShowing;
  262.  
  263.   /* display functions */
  264.   this.initializeDisplayProperties = initializeLinkTypeDisplayProperties;
  265. }
  266.  
  267. function initializeLinkTypeDisplayProperties(cat, k, l)
  268. {
  269.   this.globalID = setGlobalID("LT");
  270.   this.providerListID = setGlobalID("PROVLIST");
  271.   this.expandImageID = setGlobalID("LTEXPANDIMG");
  272.   this.URL = "flyswat:clickthrough2:" + assembleFSURL(cat, k, l);
  273.   this.providers = fsproviderhash.GetProviderList(this.type);
  274.   this.providerListShowing = false;
  275. }
  276.  
  277. function hideProviderList()
  278. {
  279.   with (eval("document.all." + this.providerListID)) {
  280.     style.display = "none";
  281.     this.providerListShowing = false;
  282.   }
  283.  
  284.   with (eval("document.all." + this.expandImageID)) {
  285.     src = PlusNormal.src;
  286.   }
  287. }
  288.  
  289. function showProviderList(cat, k, l)
  290. {
  291.   with (eval("document.all." + this.providerListID)) {
  292.  
  293.     if (innerHTML == "") {
  294.         innerHTML = assembleProviderListHTML(cat, k, l);
  295.     }
  296.     style.display = "block";
  297.     this.providerListShowing = true;
  298.   }
  299.  
  300.   with (eval("document.all." + this.expandImageID)) {
  301.     src = MinusNormal.src;
  302.   }
  303.  
  304.   if ((FS_WINDOW_TYPE == "SEARCH") || (FS_WINDOW_TYPE == "LINKS_LIST")) {
  305.     if (fscategories[cat].keywords[k].categoryWide)
  306.         scrollVertPanel("document.all." + fscategories[cat].keywords[k].globalID, "document.all." + this.providerListID);
  307.     else
  308.         scrollVertPanel("document.all." + this.globalID, "document.all." + this.providerListID);
  309.   }
  310. }
  311. //------------------------------------------------------------------
  312.  
  313.  
  314. //------------------------------------------------------------------
  315. // The provider object
  316. //------------------------------------------------------------------
  317. function FSProvider(tag, name, bFixed)
  318. {
  319.     this.tag = tag;
  320.     this.name = name;
  321.     this.bFixed = bFixed;
  322.  
  323.     /* display properties */
  324.     this.globalID;
  325.     this.URL;
  326.   
  327.     /* display functions */
  328.     this.initializeDisplayProperties = initializeProviderDisplayProperties; 
  329. }
  330.  
  331. function initializeProviderDisplayProperties(cat, k, l, p)
  332. {
  333.   this.globalID = setGlobalID("PROV");
  334.   this.URL = "flyswat:clickthrough2:" + assembleFSURL(cat, k, l, p);
  335. }
  336. //------------------------------------------------------------------
  337.  
  338.  
  339.  
  340. // The global provider hash
  341. function FSProviderHash()
  342. {
  343.     this.AddProviderList = fsprovhashAddProviderList;
  344.     this.LinkTypeArray = new Array();
  345.     this.ProviderListArray = new Array();
  346.     this.index = 0;
  347.     this.GetProviderList = fsGetProviderList;
  348. }
  349.  
  350. // Add provider list to provider hash
  351. function fsprovhashAddProviderList(linktype, providerList)
  352. {
  353.     this.LinkTypeArray[this.index] = linktype;
  354.     this.ProviderListArray[this.index] = providerList;
  355.     this.index++;
  356. }
  357.  
  358. // Get provider list from provider hash
  359. function fsGetProviderList(linktype)
  360. {
  361.     var providers = new Array();
  362.     for (var l in this.LinkTypeArray)
  363.     {
  364.  
  365.         if (this.LinkTypeArray[l] == linktype)
  366.         {
  367.             providers = this.ProviderListArray[l];
  368.             return providers;
  369.         }
  370.     }
  371.     return providers;
  372. }
  373.  
  374.  
  375.  
  376. ///////////////// END FLYOBJECTS ///////////////////////////////