home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
komunikace
/
kmeleon
/
K-Meleon1.1.3en-US.exe
/
chrome
/
embed.jar
/
kmprefs
/
content
/
pref-appearance.xul
< prev
next >
Wrap
Extensible Markup Language
|
2007-04-23
|
12KB
|
340 lines
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/"?>
<?xul-overlay href="chrome://kmprefs/content/kmprefs/ovrl-popups.xul"?>
<?xul-overlay href="chrome://kmprefs/content/kplugins/fullscreen.xul"?>
<!DOCTYPE page SYSTEM "chrome://kmprefs/locale/pref-appearance.dtd">
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prefAppearance" onload="init()">
<stringbundle id="pref_bundle" src="chrome://kmprefs/locale/pref.properties"/>
<script type="application/x-javascript" src="chrome://kmprefs/content/pref.js"/>
<script type="application/x-javascript">
<![CDATA[
var prefBndl = document.getElementById("pref_bundle");
var buttons = document.getElementsByTagName("button");
var txtboxs = document.getElementsByTagName("textbox");
function init() {
const bmp = "kmeleon.plugins.bmpmenu.load";
if(kPlugin.absent("bmpmenu")) {
var elem = document.getElementById(bmp);
elem.parentNode.removeChild(elem);
} else
initCheckbox(bmp);
initCheckbox("kmeleon.display.accelInMenus");
initTextbox("kmeleon.display.title",false);
kFullscreen.init();
if(kPlugin.absent("fullscreen")) {
var elem = document.getElementById("kmeleon.plugins.fullscreen.auto").parentNode;
elem.parentNode.removeChild(elem);
}
initFullscreenPlugin();
initThrobber();
for(var j=0,b=document.getElementById("popups.appearance").getElementsByTagName("checkbox");j<b.length;j++)
initCheckbox(b[j].id);
}
function initFullscreenPlugin() {
if(!kPlugin.absent("fullscreen"))
for(var j=3,r=document.getElementsByTagName("radio");j<6;j++) {
// r[j].disabled = !enabled;
// bug: Option "Never fullscreen at startup" doesn't work
r[j].disabled = (j==4) ? true : !kFullscreen.load;
}
initWindow(initMaximized(initFullscreen(kFullscreen.load)));
}
function initWindow(off) {
for(var j=1;j<5;j++) {
txtboxs[j].disabled = off;
txtboxs[j].setAttribute("readonly",true);
txtboxs[j].value = getIntUserPref(txtboxs[j].id,"");
}
buttons[0].label = prefBndl.getString("edit");
buttons[0].disabled = off;
buttons[1].disabled = off;
buttons[2].label = prefBndl.getString("edit");
buttons[2].disabled = off;
buttons[3].disabled = off;
buttons[4].disabled = off ? off : !((getIntUserPref(txtboxs[1].id,"")) && (getIntUserPref(txtboxs[2].id,"")));
}
function center() {
var w = parseInt(getIntUserPref(txtboxs[1].id,""));
var h = parseInt(getIntUserPref(txtboxs[2].id,""));
clear(3,4);
addToUserPrefs("user_pref(\""+txtboxs[4].id+"\", "+Math.floor((screen.height-h)/2).toString(10)+");");
addToUserPrefs("user_pref(\""+txtboxs[3].id+"\", "+Math.floor((screen.width-w)/2).toString(10)+");");
initFullscreenPlugin();
}
function clear(start,end) {
for(var j=start;j<end+1;j++)
removeFromFile(getFile(getFolder("ProfD"),UserPrefs),"user_pref[\\s]*\\([\\s]*."+txtboxs[j].id+".[\\s]*,[\\s]*[\\d]+[\\s]*\\)[\\s]*;");
}
function editSave(elem,start,end) {
for(var j=0;j<buttons.length;j++)
buttons[j].disabled = true;
if(elem.label == prefBndl.getString("save")) {
for(var j=start;j<end+1;j++)
txtboxs[j].setAttribute("readonly",true);
clear(start,end);
for(var j=end,val;j>start-1;j--) {
val = parseInt(txtboxs[j].value);
if(!isNaN(val))
addToUserPrefs("user_pref(\""+txtboxs[j].id+"\", "+val.toString(10)+");");
else
txtboxs[j].value = "";
}
initFullscreenPlugin();
} else {
for(var j=start;j<end+1;j++)
txtboxs[j].removeAttribute("readonly");
txtboxs[start].focus();
elem.label = prefBndl.getString("save");
buttons[start-1].disabled = false;
if(!kPlugin.absent("fullscreen")) document.getElementById("kmeleon.plugins.fullscreen.auto").disabled = true;
document.getElementById("kmeleon.display.maximized").disabled = true;
}
}
// handle Fullscreen
const fullscreenImport1 = "user_pref(\"kmeleon.plugins.fullscreen.auto\", ";
const fullscreenImport2 = ");";
const fullscreenRegExp1 = "user_pref[\\s]*\\([\\s]*.kmeleon.plugins.fullscreen.auto.[\\s]*,[\\s]*";
const fullscreenRegExp2 = "[\\s]*\\)[\\s]*;";
var fullscreenImport = new Array(fullscreenImport1+"false"+fullscreenImport2,fullscreenImport1+"true"+fullscreenImport2);
var fullscreenRegExp = new Array(fullscreenRegExp1+"false"+fullscreenRegExp2,fullscreenRegExp1+"true"+fullscreenRegExp2);
function initFullscreen(on) {
var txt = getFileContents(getFile(getFolder("ProfD"),UserPrefs));
var off = testMultiline(txt,fullscreenRegExp[1]);
if(!kPlugin.absent("fullscreen")) {
var grp = document.getElementById("kmeleon.plugins.fullscreen.auto");
if(off)
grp.selectedIndex = 0;
else
if(testMultiline(txt,fullscreenRegExp[0]))
grp.selectedIndex = 1;
else
grp.selectedIndex = 2;
}
return on && off;
}
function toggleFullscreen(elem) {
var fil = getFile(getFolder("ProfD"),UserPrefs);
removeFromFile(fil,fullscreenRegExp[0]);
removeFromFile(fil,fullscreenRegExp[1]);
if(elem.value)
addToUserPrefs(fullscreenImport1+elem.value+fullscreenImport2);
else
pref.setBoolPref(elem.id,false);
initFullscreenPlugin();
}
// handle Maximized
const maximizedImport1 = "user_pref(\"kmeleon.display.maximized\", ";
const maximizedImport2 = ");";
const maximizedRegExp1 = "user_pref[\\s]*\\([\\s]*.kmeleon.display.maximized.[\\s]*,[\\s]*";
const maximizedRegExp2 = "[\\s]*\\)[\\s]*;";
var maximizedImport = new Array(maximizedImport1+"false"+maximizedImport2,maximizedImport1+"true"+maximizedImport2);
var maximizedRegExp = new Array(maximizedRegExp1+"false"+maximizedRegExp2,maximizedRegExp1+"true"+maximizedRegExp2);
function initMaximized(on) {
var txt = getFileContents(getFile(getFolder("ProfD"),UserPrefs));
var grp = document.getElementById("kmeleon.display.maximized");
var off = testMultiline(txt,maximizedRegExp[1]);
if(off)
grp.selectedIndex = 0;
else
if(testMultiline(txt,maximizedRegExp[0]))
grp.selectedIndex = 1;
else
grp.selectedIndex = 2;
grp.disabled = on;
return on || off;
}
function toggleMaximized(elem) {
var fil = getFile(getFolder("ProfD"),UserPrefs);
removeFromFile(fil,maximizedRegExp[0]);
removeFromFile(fil,maximizedRegExp[1]);
if(elem.value) {
addToUserPrefs(maximizedImport1+elem.value+maximizedImport2);
} else
pref.setBoolPref(elem.id,false);
initFullscreenPlugin();
}
// handle Throbber
const throbberImport1 = "user_pref(\"kmeleon.toolband.Throbber.visibility\", ";
const throbberImport2 = ");";
const throbberRegExp1 = "user_pref[\\s]*\\([\\s]*.kmeleon.toolband.Throbber.visibility.[\\s]*,[\\s]*";
const throbberRegExp2 = "[\\s]*\\)[\\s]*;";
var throbberImport = new Array(throbberImport1+"false"+throbberImport2,throbberImport1+"true"+throbberImport2);
var throbberRegExp = new Array(throbberRegExp1+"false"+throbberRegExp2,throbberRegExp1+"true"+throbberRegExp2);
function initThrobber() {
var txt = getFileContents(getFile(getFolder("ProfD"),UserPrefs));
var box = document.getElementById("kmeleon.toolband.Throbber.visibility");
if(testMultiline(txt,throbberRegExp[0]))
box.checked = false;
else
if(testMultiline(txt,throbberRegExp[1]))
box.checked = true;
else
initCheckbox("kmeleon.toolband.Throbber.visibility");
}
function toggleThrobber(elem) {
var fil = getFile(getFolder("ProfD"),UserPrefs);
removeFromFile(fil,throbberRegExp[0]);
removeFromFile(fil,throbberRegExp[1]);
if(elem.checked) {
pref.setBoolPref(elem.id,true);
} else
addToUserPrefs(throbberImport[0]);
initThrobber();
}
]]>
</script>
<vbox flex="1" style="overflow:auto">
<dialogheader title="&appearance.header;"/>
<separator class="thin"/>
<tabcontrol flex="1">
<tabbox flex="1">
<tabs>
<tab label="&general;"/>
<tab label="&appearance.startup;" oncommand="initFullscreenPlugin()"/>
<tab label="&popups.label;"/>
</tabs>
<tabpanels flex="1">
<tabpanel flex="1" orient="vertical" style="overflow:auto">
<!-- General Appearance -->
<separator class="thin"/>
<checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.plugins.bmpmenu.load" label="&appearance.menuIcons;"/>
<checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.display.accelInMenus" label="&appearance.menuAccels;"/>
<separator class="thin"/>
<checkbox oncommand="toggleThrobber(this)" id="kmeleon.toolband.Throbber.visibility" label="&appearance.throbber;"/>
<separator class="thick"/>
<hbox align="center">
<label value="&appearance.windowTitle;" style="padding-left:1em"/>
<textbox id="kmeleon.display.title" flex="1" class="uri-element" oninput="setCharPref(this.id,this.value)"/>
</hbox>
<separator class="thick"/>
<vbox>
<groupbox id="kFullscreenDisplay" flex="1"/>
<separator class="thick"/>
</vbox>
<description>&restartNote1;</description>
<!-- General Appearance -->
</tabpanel>
<tabpanel flex="1" orient="vertical" style="overflow:auto">
<!-- Startup Appearance -->
<separator class="thin"/>
<groupbox>
<caption label="&window.size;"/>
<separator class="thin"/>
<hbox align="center">
<grid>
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row align="center">
<label value="&width;"/>
<textbox id="kmeleon.display.width" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
<label value="&pixels;"/>
</row>
<row align="center">
<label value="&height;"/>
<textbox id="kmeleon.display.height" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
<label value="&pixels;"/>
</row>
</rows>
</grid>
<hbox>
<button oncommand="editSave(this,1,2)"/>
<button label="&clear;" oncommand="clear(1,2);initFullscreenPlugin()"/>
<hbox flex="1"/>
</hbox>
</hbox>
<separator class="thin"/>
<hbox>
<groupbox>
<caption label="&maximized;"/>
<radiogroup id="kmeleon.display.maximized" oncommand="toggleMaximized(this)">
<radio value="true" label="&always;"/>
<radio value="false" label="&never;"/>
<radio value="" label="&asClosed;"/>
</radiogroup>
</groupbox>
<groupbox>
<caption label="&fullscreen;"/>
<radiogroup id="kmeleon.plugins.fullscreen.auto" oncommand="toggleFullscreen(this)">
<radio value="true" label="&always;"/>
<radio value="false" label="&never;"/>
<radio value="" label="&asClosed;"/>
</radiogroup>
</groupbox>
</hbox>
</groupbox>
<groupbox>
<caption label="&window.position;"/>
<separator class="thin"/>
<hbox align="center">
<grid>
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row align="center">
<label value="&left;"/>
<textbox id="kmeleon.display.XPos" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
<label value="&pixels;"/>
</row>
<row align="center">
<label value="⊤"/>
<textbox id="kmeleon.display.YPos" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
<label value="&pixels;"/>
</row>
</rows>
</grid>
<hbox>
<button oncommand="editSave(this,3,4)"/>
<button label="&clear;" oncommand="clear(3,4);initFullscreenPlugin()"/>
<hbox flex="1"/>
</hbox>
</hbox>
<separator class="thin"/>
<hbox>
<button label="¢er;" oncommand="center()"/>
<hbox flex="1"/>
</hbox>
</groupbox>
<separator class="thick"/>
<description>&restartNote1;</description>
<!-- Startup Appearance -->
</tabpanel>
<tabpanel flex="1" orient="vertical" style="overflow:auto">
<!-- Popup Appearance -->
<separator class="thin"/>
<groupbox id="popups.appearance"/>
<!-- Popup Appearance -->
</tabpanel>
</tabpanels>
</tabbox>
</tabcontrol>
</vbox>
</page>