home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 December
/
PCWorld_2007-12_cd.bin
/
komunikace
/
maxthon
/
mx_2.0.5.7845.exe
/
template
/
Options
/
maxOptions.js
< prev
Wrap
Text File
|
2007-11-01
|
4KB
|
148 lines
var maxOptions={};
$langDefaultSection="Options";
maxOptions.init=function(_1){
maxConfig.setActiveFile("$main");
document.title=$lang("maxthon_options");
maxOptions.adjustHeight();
window.onresize=maxOptions.adjustHeight;
if(!_1){
var _2=$cookies("activePage");
var _3=$parseQueryString();
if(_3["page"]){
if(maxOptions.pages[_3["page"]]){
_2=_3["page"];
}
}
if(maxOptions.pages[_2]){
maxOptions.activePage=_2;
}
maxOptions.ui.buildPageLinks();
}
maxOptions.action.activatePage(maxOptions.activePage);
};
maxOptions.destroy=function(){
};
maxOptions.adjustHeight=function(){
var _4=$id("sidebar");
var _5=document.documentElement.clientHeight-_4.offsetTop;
_4.style.height=_5;
var _4=$id("contentBlock");
_5=document.documentElement.clientHeight-_4.offsetTop-22;
$id("pageContent").style.height=_5;
};
maxOptions.action={};
maxOptions.action.activatePage=function(_6){
var _7=$id("pageLink_"+maxOptions.activePage);
if(_7){
_7.className="";
}
_7=$id("pageLink_"+_6);
if(_7){
_7.className="active";
}
maxOptions.ui.setPageHeader(_6);
maxOptions.ui.buildPage(_6);
try{
eval("maxOptions.pages."+maxOptions.activePage+".destroy()");
}
catch(e){
if(!((e.number&65535)==438)){
alert("maxOptions.pages."+_6+".destroy()\n"+(e.number&65535)+" : "+e.message);
throw (e);
}
}
try{
maxOptions.pages[_6].init();
}
catch(e){
if(!((e.number&65535)==438)){
alert("maxOptions.pages["+_6+"].init()\n"+(e.number&65535)+" : "+e.message);
throw (e);
}
}
maxOptions.activePage=_6;
$cookies("activePage",_6);
};
maxOptions.action.applyChanges=function(){
maxConfig.save();
external.max_Invoke("ReloadConfig");
maxOptions.ui.showMessage($lang("config_saved"),3000);
};
maxOptions.action.resetChanges=function(){
if(maxConfig.modified&&confirm("["+$lang("maxthon_options")+"]\n\n"+$lang("config_reset_confirm"))){
maxConfig.load();
maxOptions.action.activatePage(maxOptions.activePage);
maxOptions.ui.showMessage($lang("config_reset"),3000);
}
};
maxOptions.action.restoreDefault=function(){
if(confirm("["+$lang("maxthon_options")+"]\n\n"+$lang("confirm_restore_default"))){
external.max_Invoke("DefaultConfig","All");
maxOptions.init(true);
maxOptions.ui.showMessage($lang("config_reset"),3000);
}
};
maxOptions.action.close=function(_8){
if(maxConfig.files["$main"].modified&&confirm("["+$lang("maxthon_options")+"]\n\n"+$lang("config_not_saved_confirm"))){
maxOptions.action.applyChanges();
}else{
maxConfig.files["$main"].modified=false;
}
maxOptions.destroy();
if(!_8){
window.close();
}
};
maxOptions.ui={};
maxOptions.ui.showMessage=function(_9,_a){
var _b=$id("msgBox");
if(_b){
_b.innerHTML=_9;
_b.style.display="block";
window.setTimeout(maxOptions.ui.clearMessage,_a);
}
};
maxOptions.ui.clearMessage=function(){
var _c=$id("msgBox");
if(_c){
_c.innerHTML="";
_c.style.display="none";
}
};
maxOptions.ui.toggleSidebar=function(){
var _d=$id("sidebarWrapper");
var _e=$id("btnSidebar");
if($toggleElement("sidebar")){
_d.style.width="";
_e.src="../_shared/images/btn_hide_sidebar.png";
}else{
_d.style.width="8";
_e.src="../_shared/images/btn_show_sidebar.png";
}
};
maxOptions.ui.setPageHeader=function(_f){
var _10=$lang("page_"+_f);
$write(_10,"pageHeader",false);
};
maxOptions.ui.buildPageLinks=function(){
var _11="";
for(label in maxOptions.pages){
if(maxOptions.pages[label].type=="separator"){
_11+="<hr/>";
}else{
_11+="<a id=\"pageLink_"+label+"\" class=\"pageLink\" href=\"javascript:;\" "+"onclick=\"this.blur();maxOptions.action.activatePage('"+label+"');\">"+"<img src=\"images/page_"+label+".png\"/> "+$lang("page_"+label)+"</a>\n";
}
}
$write(_11,"pageLinks",false);
};
maxOptions.ui.buildPage=function(_12){
var obj=$id("pageContent");
if(!obj){
alert("maxOptions.ui.buildPage :: missing 'pageContent' object");
}
var _14=maxConfig.ui.buildItems(maxOptions.pages[_12].items);
_14+="<br/><br/><br/><br/><br/><br/>";
obj.innerHTML=_14;
};