XMLterm changes only.
Fix for XMLterm user level/icons mode selection (workaround for bug 53448).
This commit is contained in:
svn%xmlterm.org 2000-09-25 14:57:27 +00:00
Родитель 7f2239a2c4
Коммит 3e579f3b56
3 изменённых файлов: 154 добавлений и 51 удалений

Просмотреть файл

@ -3163,7 +3163,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
imgElement->SetAttribute(attName, attValue);
attName.AssignWithConversion("src");
attValue.AssignWithConversion("chrome://xmlterm/skin/wheel.gif");
attValue.AssignWithConversion("chrome://xmlterm/content/wheel.gif");
imgElement->SetAttribute(attName, attValue);
attName.AssignWithConversion("align");

Просмотреть файл

@ -9,6 +9,8 @@
// Global variables
var AltWin; // Alternate (browser) window
var gStyleRuleNames;
var Tips = new Array(); // Usage tip strings
var TipNames = new Array(); // Usage tip names
var TipCount = 0; // No. of tips
@ -237,56 +239,69 @@ function FormBlur() {
return false;
}
// Set user level
function UpdateSettings() {
// Set user level, icons mode etc.
function UpdateSettings(selectName) {
var oldUserLevel = window.userLevel;
window.userLevel = document.xmltform1.level.options[document.xmltform1.level.selectedIndex].value;
dump("UpdateSettings: "+selectName+"\n");
var oldShowIcons = window.showIcons;
window.showIcons = document.xmltform1.icons.options[document.xmltform1.icons.selectedIndex].value;
switch(selectName) {
case "level":
// Change icon display style in the style sheet
var oldUserLevel = window.userLevel;
window.userLevel = document.xmltform1.level.options[document.xmltform1.level.selectedIndex].value;
window.windowsMode = document.xmltform1.windows.options[document.xmltform1.windows.selectedIndex].value;
if (window.userLevel != oldUserLevel) {
dump("UpdateSettings: userLevel="+window.userLevel+"\n");
dump("UpdateSettings: userLevel="+window.userLevel+"\n");
dump("UpdateSettings: windowsMode="+window.windowsMode+"\n");
dump("UpdateSettings: showIcons="+window.showIcons+"\n");
if (window.userLevel == "advanced") {
AlterStyle("DIV.beginner", "display", "none");
AlterStyle("DIV.intermediate", "display", "none");
} else if (window.userLevel == "intermediate") {
AlterStyle("DIV.intermediate", "display", "block");
AlterStyle("DIV.beginner", "display", "none");
} else {
AlterStyle("DIV.beginner", "display", "block");
AlterStyle("DIV.intermediate", "display", "block");
}
}
break;
if (window.userLevel != oldUserLevel) {
// Change icon display style in the style sheet
case "icons":
var oldShowIcons = window.showIcons;
window.showIcons = document.xmltform1.icons.options[document.xmltform1.icons.selectedIndex].value;
if (window.userLevel == "advanced") {
AlterStyle("DIV.beginner", "display", "none");
AlterStyle("DIV.intermediate", "display", "none");
if (window.showIcons != oldShowIcons) {
dump("UpdateSettings: showIcons="+window.showIcons+"\n");
if (window.showIcons == "on") {
AlterStyle("SPAN.noicons", "display", "none");
AlterStyle("SPAN.icons", "display", "inline");
AlterStyle("IMG.icons", "display", "inline");
AlterStyle("TR.icons", "display", "table-row");
} else if (window.userLevel == "intermediate") {
AlterStyle("DIV.intermediate", "display", "block");
AlterStyle("DIV.beginner", "display", "none");
} else {
AlterStyle("SPAN.noicons", "display", "inline");
AlterStyle("SPAN.icons", "display", "none");
AlterStyle("IMG.icons", "display", "none");
AlterStyle("TR.icons", "display", "none");
}
}
break;
} else {
AlterStyle("DIV.beginner", "display", "block");
AlterStyle("DIV.intermediate", "display", "block");
}
}
case "windows":
// Change icon display style in the style sheet
window.windowsMode = document.xmltform1.windows.options[document.xmltform1.windows.selectedIndex].value;
dump("UpdateSettings: windowsMode="+window.windowsMode+"\n");
break;
if (window.showIcons != oldShowIcons) {
// Change icon display style in the style sheet
default:
dump("UpdateSettings: Unknown selectName "+selectName+"\n");
break;
}
if (window.showIcons == "on") {
AlterStyle("SPAN.noicons", "display", "none");
AlterStyle("SPAN.icons", "display", "inline");
AlterStyle("IMG.icons", "display", "inline");
AlterStyle("TR.icons", "display", "table-row");
} else {
AlterStyle("SPAN.noicons", "display", "inline");
AlterStyle("SPAN.icons", "display", "none");
AlterStyle("IMG.icons", "display", "none");
AlterStyle("TR.icons", "display", "none");
}
}
return false;
return false;
}
// Alter style in stylesheet of specified document doc, or current document
@ -302,11 +317,14 @@ function AlterStyle(ruleName, propertyName, propertyValue, doc) {
var r;
for (r = 0; r < sheet.cssRules.length; r++) {
//dump("selectorText["+r+"]="+sheet.cssRules[r].selectorText+"\n");
//dump("cssText["+r+"]="+sheet.cssRules[r].cssText+"\n");
if (sheet.cssRules[r].selectorText == ruleName) {
//if (sheet.cssRules[r].selectorText == ruleName) {
// Ugly workaround for accessing rules until bug 53448 is fixed
if (gStyleRuleNames[r] == ruleName) {
dump("cssText["+r+"]="+sheet.cssRules[r].cssText+"\n");
var style = sheet.cssRules[r].style;
//dump("style="+style.getPropertyValue(propertyName)+"\n");
dump("style="+style.getPropertyValue(propertyName)+"\n");
style.setProperty(propertyName,propertyValue,"");
}
@ -642,8 +660,20 @@ function AboutXMLTerm() {
function LoadHandler() {
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
// Ugly workaround for accessing rules in stylesheet until bug 53448 is fixed
var sheet = document.styleSheets[0];
dump("sheet.cssRules.length="+sheet.cssRules.length+"\n");
var styleElement = (document.getElementsByTagName("style"))[0];
var styleText = styleElement.firstChild.data;
gStyleRuleNames = styleText.match(/\b[\w-.]+(?=\s*\{)/g);
dump("gStyleRuleNames.length="+gStyleRuleNames.length+"\n");
// Update settings
UpdateSettings();
UpdateSettings('level');
UpdateSettings('icons');
UpdateSettings('windows');
NewTip();

Просмотреть файл

@ -4,11 +4,84 @@
<title>xmlterm page</title>
<!--
NOTE: Put all the skin stuff in the content directory for the moment
(Otherwise every Mozilla skin will need to provide an xmlterm skin!)
-->
<link title="defaultstyle" rel="stylesheet" type="text/css"
href="chrome://xmlterm/content/xmltpage.css">
-->
<!--
NOTE: Ugly workaround for modifying CSS rules until bug 53448 is fixed
Put all the CSS stuff inline
-->
<style type="text/css">
/* xmltpage.css: default style sheet for xmlterm.html */
BODY { font-family: monaco, courier, elite, monospace;
background-color: #FFFFFF;
}
DIV { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN { margin: 0; padding-top: 0; padding-bottom: 0 }
PRE { margin: 0; padding-top: 0; padding-bottom: 0;
font-family: monaco;
line-height: 120% }
/* Input components */
SPAN.prompt { color: blue }
SPAN.command { color: blue }
/* Error messages */
DIV.errmsg { color: red }
/* Explicit hyperlinks (underlined) */
DIV.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
SPAN.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
/* Imlicit hyperlinks (highlighted) */
SPAN.highlight { font-family: monaco; color: blue; cursor: hand }
SPAN.directory { font-family: monaco; color: blue; cursor: hand }
SPAN.executable { font-family: monaco; color: blue; cursor: hand }
SPAN.plainfile { font-family: monaco; color: blue; cursor: hand }
SPAN.imagefile { font-family: monaco; color: blue; cursor: hand }
SPAN.urlfile { font-family: monaco; color: blue; cursor: hand }
/* Screen display */
PRE.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.boldstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.underlinestyle { text-decoration: underline; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.blinkstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.inversestyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
/* Forms */
FORM { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.formhead { font-family: sans-serif; font-weight: bold }
/* Tips */
SPAN.tipdata { font-family: sans-serif; background-color: #DDDDDD }
TABLE.tiptable { background-color: #DDDDDD }
DIV.tipelement { font-family: sans-serif }
/* Help links */
SPAN.helphighlight { font-family: sans-serif; color: green; cursor: hand }
SPAN.helplink { font-family: sans-serif; color: blue; cursor: hand;
text-decoration: underline }
/* Level style */
DIV.intermediate {display: block}
DIV.beginner {display: none}
/* Icons style */
SPAN.noicons {display: inline}
SPAN.icons {display: none}
IMG.icons {display: none}
TR.icons {display: none}
</style>
<script language="JavaScript" src="XMLTermCommands.js">
</script>
@ -28,7 +101,7 @@ NOTE: Put all the skin stuff in the content directory for the moment
<span class="helplink" onclick="return ExplainTip('level');">
Level:</span>
<select name="level" size=1 onchange="return UpdateSettings();">
<select name="level" size=1 onchange="return UpdateSettings('level');">
<option value="beginner">beginner</option>
<option value="intermediate" selected>intermediate</option>
<option value="advanced">advanced</option>
@ -37,7 +110,7 @@ NOTE: Put all the skin stuff in the content directory for the moment
&nbsp;
<span class="helplink" onclick="return ExplainTip('icons');">
Icons:</span>
<select name="icons" size=1 onchange="return UpdateSettings();">
<select name="icons" size=1 onchange="return UpdateSettings('icons');">
<option value="off" selected>off</option>
<option value="on">on</option>
</select>
@ -45,7 +118,7 @@ NOTE: Put all the skin stuff in the content directory for the moment
&nbsp;
<span class="helplink" onclick="return ExplainTip('windows');">
Windows:</span>
<select name="windows" size=1 onchange="return UpdateSettings();">
<select name="windows" size=1 onchange="return UpdateSettings('windows');">
<option value="off" selected>off</option>
<option value="on">on</option>
</select>