--- loncom/html/adm/jsMath/jsMath-controls.html 2006/03/27 19:32:07 1.1 +++ loncom/html/adm/jsMath/jsMath-controls.html 2006/05/17 22:19:27 1.2 @@ -33,16 +33,17 @@ while (!window.jsMath && !showWarning) { window.jsMath = window.parent.jsMath; if (!window.jsMath) {throw "no jsMath";} } catch (err) { - showWarning = 1; + showWarning = 1; pageDomain = ''; + try {pageDomain = document.domain} catch (err) {} // // MSIE on Mac can't change document.domain, and 'try' won't - // catch the error (Grrr!) so don't even try for it + // catch the error (Grrr!) so don't even attempt it. // - if (document.domain.match(/\..*\./) && + if (pageDomain.match(/\..*\./) && (navigator.appName != 'Microsoft Internet Explorer' || navigator.platform != 'MacPPC' || !navigator.userProfile || !document.all)) { try { - document.domain = document.domain.replace(/^[^.]*\./,''); + document.domain = pageDomain.replace(/^[^.]*\./,''); showWarning = 0; } catch(err) {} } @@ -58,20 +59,27 @@ function Warning () { } if (showWarning) {setTimeout("Warning()",1)} else { -debug = window.parent.debug; show = window.parent.show; +var debug = window.parent.debug; var show = window.parent.show; jsMath.Add(jsMath.Controls,{ loaded: 1, + mainLabels: { + print: 'Print', reload: 'Reload', local: 'Go Local', global: 'Go Global', + ctrls: 'Controls', opts: 'Options', done: 'Done' + }, + optionLabels: {back: 'Back', done: 'Done'}, + Close: function () { this.panel.style.display = "none"; jsMath.Element("button").style.display = (this.cookie.button ? "block" : "none"); - if (jsMath.document.location.protocol == 'file:') return; - for (var id in {scale:1, scaleImg:1, font:1, print:1, autofont:1, alpha:1, tex2math:1}) { - if (this.cookie[id] != this.oldCookie[id] && this.oldCookie[id] != null) { - this.loaded = 0; - jsMath.document.location.reload(); + if (jsMath.document.location.protocol == 'file:' && jsMath.Global.islocal) return; + for (var id in {scale:1, scaleImg:1, font:1, print:1, printwarn:1, + stayhires:1, autofont:1, alpha:1, tex2math:1, global:1}) { + if (this.cookie[id] && this.cookie[id] != this.oldCookie[id] && + this.oldCookie[id] != null) { + this.Reload(); return; } } @@ -103,14 +111,24 @@ jsMath.Add(jsMath.Controls,{ (this.cookie.font != 'image' && this.cookie.font != 'symbol')) {jsMath.Element("_resolution").disabled = true} - /* - * Seems to be a bug in Safari that messes up the button names - * when the page is reloaded after an option change - */ - if (jsMath.browser == 'Safari') { - jsMath.Element("_resolution").value = "Hi-Res Fonts for Printing"; - jsMath.Element("_opts").value = "Options"; - jsMath.Element("_done").value = "Done"; + if (jsMath.Global.isLocal) { + jsMath.Element("_ctrls").disabled = true; + } else { + this.cookie.hiddenGlobal = jsMath.Global.isHidden; + jsMath.Element("_global").style.display = "none"; + jsMath.Element("_local").style.display = ""; + if (!jsMath.Global.isHidden || jsMath.noShowGlobal) + {jsMath.Element("_ctrls").disabled = true} + } + if (jsMath.noChangeGlobal) { + for (var id in {global:1, local:1, ctrls: 1}) + {jsMath.Element('_'+id).disabled = true} + } + if (!window.print) {jsMath.Element("_print").disabled = true} + + if (jsMath.Browser.safariButtonBug) { + for (var id in this.mainLabels) + {jsMath.Element('_'+id).value = this.mainLabels[id]} } this.panel.style.display = "block"; @@ -126,8 +144,9 @@ jsMath.Add(jsMath.Controls,{ } jsMath.Element("_scale").value = this.cookie.scale; jsMath.Element("_keep").value = this.cookie.keep; - for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1, - progress:1, asynch:1, blank:1, tex2math:1}) { + jsMath.Element("_global").value = this.cookie.global; + for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1, + stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) { if (this.cookie[id]) {jsMath.Element('_'+id).checked = true} } var font = jsMath.document.getElementsByName("jsMath__font"); @@ -135,30 +154,33 @@ jsMath.Add(jsMath.Controls,{ if ((font[i].value == 'tex' && jsMath.nofonts) || ((font[i].value == 'symbol' || font[i].value == 'image') && jsMath.noImgFonts)) { - jsMath.Element('_'+font[i].value+"Text").style.color = "#888888"; + jsMath.Element('_'+font[i].value+"Text").className = "disabled"; font[i].disabled = true; } else if (this.cookie.font == font[i].value) {font[i].checked = true} } if (jsMath.noImgFonts) { - jsMath.Element("_alphaText").style.color = "#888888"; - jsMath.Element("_alpha").disabled = true; - jsMath.Element("_scaleImg").disabled = true; + for (var id in {alpha:1, printwarn:1, stayhires:1}) { + var obj = jsMath.Element("_"+id); + obj.disabled = true; + obj.parentNode.className = "disabled"; + } } else if (jsMath.Browser.imgScale != 1) { - jsMath.Element("_alphaText").style.color = "#888888"; + jsMath.Element("_alphaText").className = "disabled"; jsMath.Element("_alpha").disabled = true; } if (jsMath.tex2math.Convert) { + jsMath.Element("_separator").style.display = ''; jsMath.Element("_tex2mathRow").style.display = ''; } + if (jsMath.noChangeGlobal) { + jsMath.Element("_globalText").className = "disabled"; + jsMath.Element("_global").disabled = true; + } - /* - * Seems to be a bug in Safari that messes up the button names - * when the page is reloaded after an option change - */ - if (jsMath.isSafari) { - jsMath.Element("_back").value = "Back"; - jsMath.Element("_done").value = "Done"; + if (jsMath.Browser.safariButtonBug) { + for (var id in this.optionLabels) + {jsMath.Element('_'+id).value = this.optionLabels[id]} } this.panel.style.display = "block"; @@ -169,13 +191,15 @@ jsMath.Add(jsMath.Controls,{ var font = jsMath.document.getElementsByName("jsMath__font"); for (var i = 0; i < font.length; i++) {if (font[i].checked) {this.cookie.font = font[i].value}} - for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1, - progress:1, asynch:1, blank:1, tex2math:1}) { + for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1, + stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) { if (this.cookie[id] != null) { this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0; } } this.cookie.keep = jsMath.Element("_keep").value; + this.cookie.global = jsMath.Element("_global").value; + this.cookie.print = this.cookie.stayhires; this.SetCookie(1); if (close) {this.Close()} else {this.Main()} }, @@ -186,6 +210,22 @@ jsMath.Add(jsMath.Controls,{ this.Close(); }, + Print: function () { + this.Close(); + jsMath.window.print(); + }, + + GoGlobal: function () { + this.cookie.global = "always"; + jsMath.Global.GoGlobal(this.SetCookie(2)); + }, + GoLocal: function () {jsMath.Global.GoLocal()}, + + ShowControls: function () { + this.Close(); + jsMath.Global.Show(); + }, + CheckVersion: function () { jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js'); }, @@ -200,51 +240,71 @@ jsMath.Add(jsMath.Controls,{
+
|