home *** CD-ROM | disk | FTP | other *** search
- window.onerror = HandleError;
-
- var g_strUrl; //the currently selected url
- var g_rgUrlsToSynch = new Array(0); //list of urls to synch on close, urls are used as indices
- var g_fSubscriptionsEnabled;
- var g_dxEllipses = 0;
- var g_dxEllipsesBold = 0;
-
- function callHelp(elm)
- {
- if (null != elm.helpid)
- {
- window.showHelp(elm.helpfile, "" + parseInt(elm.helpid), "popup");
- }
- else
- {
- if ("BODY" != elm.tagName)
- {
- callHelp(elm.parentElement);
- }
- }
- }
- document.onhelp = new Function("callHelp(window.event.srcElement)");
-
-
- function documentMouseUp()
- {
- // displays popup help when right mouse button clicked
-
- if (window.event.button == 2)
- {
- callHelp(window.event.srcElement);
- }
- }
-
- //document.onmouseup = new Function("documentMouseUp()");
-
- //+-------------------------------------------------------------------
- //
- // Synopsis: Turns off error messages in dialogs
- //
- // Arguments: none
- //
- // returns: true (tells browser not to handle message)
- //
- //--------------------------------------------------------------------
- function HandleError(message, url, line)
- {
- //#ifdef IE5_40989
- var str = L_Dialog_ErrorMessage + "\n\n"
- + L_ErrorNumber_Text + line + "\n"
- + message;
-
- alert(str);
- window.close();
- //#endif
- return true;
- }
-
- function BodyOnKeyPress(nCode)
- {
- if (nCode == 27) //ESC
- {
- window.close();
- return;
- }
- }
-
- function MeasureText(strText, fBold, widthMaximum)
- {
- // if text is not clipped, do nothing
- // get the width of the ellipses
- // get the ratio of width of div to length of text to determine initial cutoff point
- // from cutoff point, cut off up to 30 additional chars one char at a time
-
- var oSpanToUse = (fBold ? spanMeasureBold : spanMeasure);
-
- if (oSpanToUse.offsetWidth < widthMaximum)
- return strText;
-
- var dxEllipses = (fBold ? g_dxEllipsesBold : g_dxEllipses);
- var iCutoff = strText.length * (widthMaximum / (oSpanToUse.offsetWidth + dxEllipses));
-
- oSpanToUse.innerText = strText.substring(0, iCutoff - 1) + L_Ellipses_Text;
-
- if (fBold)
- {
- iCutoff += 3;
- }
- // else iCutoff... ?
-
- for (cExtraCutoff = 1; (oSpanToUse.offsetWidth > widthMaximum) && (cExtraCutoff < 30); cExtraCutoff++)
- {
- oSpanToUse.innerText = spanMeasure.innerText.substring(0, iCutoff-cExtraCutoff) + L_Ellipses_Text;
- }
-
- return oSpanToUse.innerText;
- }
-
- function OnSelectionChange(cItems, hItem, strName, strUrl, cVisits, strDate, fAvailableOffline)
- {
- //hack to get escape from nsc
- if (cItems == -1)
- {
- BodyOnKeyPress(27);
- return;
- }
-
- //nothing selected
- if (cItems == 0)
- {
- textProperties.innerHTML = "";
- return;
- }
-
- g_strUrl = strUrl;
-
- if (g_dxEllipses == 0)
- {
- spanMeasure.innerText = L_Ellipses_Text;
- g_dxEllipses = spanMeasure.offsetWidth;
- spanMeasureBold.innerText = L_Ellipses_Text;
- g_dxEllipsesBold = spanMeasureBold.offsetWidth;
- }
-
- spanMeasureBold.innerText = strName;
- strNameShort = MeasureText(spanMeasureBold.innerText, true, textProperties.offsetWidth - 4);
-
- spanMeasure.innerText = strUrl;
- strUrlShort = MeasureText(spanMeasure.innerText, false, textProperties.offsetWidth - 4);
-
- //so the span doesn't take up space and make the dialog scrollable
- spanMeasure.innerText = "";
-
- //if it is not a folder
- if (cVisits != -1)
- {
- var strOffline = "";
-
- if (g_fSubscriptionsEnabled && (strUrl.substring(0,4) == "http") )
- {
- strOffline = "<br><input type=checkbox align=";
- if(document.dir == "rtl")
- {
- strOffline +="right";
- }
- else
- {
- strOffline +="left";
- }
- strOffline +=" TABINDEX=2 ACCESSKEY=" + L_MakeAvailableOfflineAccesskey_Text + " id=chkOffline "
- if (fAvailableOffline != 0)
- strOffline += "CHECKED"
- strOffline += " onclick='ToggleOffline(this)' helpid=50486 helpfile='iexplore.hlp'><LABEL FOR=chkOffline TABINDEX=-1>" + L_MakeAvailableOffline_Text + "</LABEL>";
- strOffline += "<SPAN> </SPAN><BUTTON id=btnProperties TABINDEX=3 style='width: 7.5em; height: 2.3em; visibility: "
- if (fAvailableOffline != 0)
- strOffline += "visible"
- else
- strOffline += "hidden"
-
- strOffline += "' class=button ACCESSKEY=" + L_PropertiesAccesskey_Text + " onclick='Properties()' helpid=50489 helpfile='iexplore.hlp'>" + L_Properties_Text + "</BUTTON><BR>";
- }
-
- //hack so that single quotes don't confuse innerHTML
- var strTemp = strName + "\n" + strUrl;
- var re = /'/g;
- strTemp = strTemp.replace(re, "┬┤");
-
- var oA = document.createElement("A");
- var oName = document.createElement("B");
- var oBR1 = document.createElement("BR");
- var oUrl = document.createElement("SPAN");
- var oBR2 = document.createElement("BR");
- var oTV = document.createElement("SPAN");
- var oLV = document.createElement("SPAN");
- var oBR3 = document.createElement("BR");
- var oBR4 = document.createElement("BR");
- var oSP = document.createElement("SPAN");
-
- if (oA && oName && oUrl && oBR1 && oBR2 && oBR3 && oBR4 && oTV && oLV && oSP)
- {
- textProperties.innerHTML = "";
-
- oA.Title = strTemp;
-
- oName.innerText = strNameShort;
- oA.appendChild(oName);
- oA.appendChild(oBR1);
-
- oUrl.innerText = strUrlShort;
- oA.appendChild(oUrl);
-
- textProperties.appendChild(oA);
- textProperties.appendChild(oBR2);
-
- oTV.innerText = L_TimesVisited_Text + cVisits;
- textProperties.appendChild(oTV);
-
- oSP.innerHTML=" ";
- textProperties.appendChild(oSP);
-
- if (L_LastVisitedNeedsLineBreak_Text == "")
- {
- oLV.innerText = L_LastVisited_Text + strDate;
- textProperties.appendChild(oLV);
- textProperties.appendChild(oBR4);
- }
- else
- {
- var oBR5 = document.createElement("BR");
- var oLV2 = document.createElement("SPAN");
-
- if (oBR5 && oLV2)
- {
- oLV.innerText = L_LastVisited_Text;
- oLV2.innerText = strDate;
- textProperties.appendChild(oLV);
- textProperties.appendChild(oBR5);
- textProperties.appendChild(oLV2);
- textProperties.appendChild(oBR4);
- }
- }
-
- // strOffline is all constant stuff. putting in untrusted input is a security badness
- // here, unless you switch it to be innerText stuff like above.
- textProperties.innerHTML += strOffline;
- }
- }
- else
- {
- var oName = document.createElement("B");
- var oBR1 = document.createElement("BR");
- var oFldr = document.createElement("SPAN");
- var oBR2 = document.createElement("BR");
- var oBR3 = document.createElement("BR");
- var oMod = document.createElement("B");
- var oBR4 = document.createElement("BR");
- var oDate = document.createElement("SPAN");
-
- if (oName && oBR1 && oFldr && oBR2 && oBR3 && oMod && oBR4 && oDate)
- {
- textProperties.innerHTML = "";
-
- oName.innerText = strNameShort;
- textProperties.appendChild(oName);
- textProperties.appendChild(oBR1);
-
- oFldr.innerText = L_FavoritesFolder_Text;
- textProperties.appendChild(oFldr);
- textProperties.appendChild(oBR2);
- textProperties.appendChild(oBR3);
-
- oMod.innerText = L_ModifiedColon_Text;
- textProperties.appendChild(oMod);
- textProperties.appendChild(oBR4);
-
- oDate.innerText = strDate;
- textProperties.appendChild(oDate);
- }
- }
-
- //do this here so the default size is correct
- tdProperties.noWrap=true;
- textProperties.noWrap=true;
- }
-
- function ToggleOffline(chkOffline)
- {
- if (chkOffline.checked)
- {
- //if it fails to create a subscription, clear the check box
- if (!nsc.CreateSubscriptionForSelection())
- chkOffline.checked = false;
- else
- {
- g_rgUrlsToSynch[g_strUrl] = true;
- }
- }
- else
- {
- if (!nsc.DeleteSubscriptionForSelection())
- chkOffline.checked = true;
- else
- delete g_rgUrlsToSynch[g_strUrl];
- }
- btnProperties.style.visibility = (chkOffline.checked ? "visible" : "hidden");
- }
-
- function Properties()
- {
- nsc.InvokeContextMenuCommand("properties");
- }
-
- function OnResize()
- {
- //HACK until trident fixes dynamic properties
- document.recalc(true);
- }
-
- function TdNscHeight()
- {
- return Math.max(100, document.body.offsetHeight - tdNsc.offsetTop - rowProperties.offsetHeight - rowButtons.offsetHeight
- - rowHR.offsetHeight - rowDone.offsetHeight - tableMain.border - 24); // 24 is for two 12 pixel space rows below
-
- }
-
- function EnableButtons()
- {
- g_fSubscriptionsEnabled = false; // = nsc.SubscriptionsEnabled;
-
- var pszInitialDir = window.dialogArguments;
-
- if (pszInitialDir && (pszInitialDir.length > 0))
- {
- nsc.SetRoot(pszInitialDir);
- }
-
- tdNsc.blur();
- tdNewFolder.focus();
- }
-
- function BuildSynchList()
- {
- window.returnValue = "";
-
- for (strUrl in g_rgUrlsToSynch)
- {
- window.returnValue += strUrl + "\0";
- }
- }
-
-