home *** CD-ROM | disk | FTP | other *** search
- var maxResumeSession={};
- maxResumeSession.pageList=[];
- maxResumeSession.autoClose=false;
- $langDefaultSection="ResumeSession";
- maxResumeSession.init=function(){
- document.title=$lang("title");
- maxResumeSession.loadAutoClose();
- maxResumeSession.loadPageList();
- maxResumeSession.buildPageList();
- };
- maxResumeSession.loadAutoClose=function(){
- maxConfig.setActiveFile("$main");
- var _1=maxConfig.ini.getValue("Settings","ResumeAutoClose");
- _1=(_1!="1")?false:true;
- maxResumeSession.autoClose=_1;
- var _2=$id("auto_close");
- if(!_2){
- return;
- }
- _2.checked=_1;
- };
- maxResumeSession.toggleAutoClose=function(){
- var _3=$id("auto_close");
- if(_3.checked){
- maxResumeSession.autoClose=true;
- }else{
- maxResumeSession.autoClose=false;
- }
- maxConfig.setActiveFile("$main");
- maxConfig.ini.setValue("Settings","ResumeAutoClose",maxResumeSession.autoClose?"1":"0");
- maxConfig.save();
- };
- maxResumeSession.loadPageList=function(){
- maxConfig.setActiveFile("$session");
- var _4=maxConfig.ini.getArray("LastURL",false);
- for(var i=0;i<_4.length;i++){
- var _6={};
- _6.id=i;
- _6.url=_4[i][0];
- _6.title=_4[i][1];
- _6.enabled=true;
- _4[i]=_6;
- }
- maxResumeSession.pageList=_4;
- };
- maxResumeSession.buildPageList=function(){
- var _7=$id("pageList");
- if(!_7){
- alert("maxResumeSession.buildList : can not get obj 'pageList'");
- }
- var _8="";
- for(var i=0;i<maxResumeSession.pageList.length;i++){
- var _a=maxResumeSession.pageList[i];
- _8+="<div class=\"pageList-item\">"+"<img src=\"../_shared/images/btn_check_checked.png\" id=\"check_"+_a.id+"\" class=\"checkButton\" onclick=\"maxResumeSession.togglePageItem("+_a.id+");\" />"+" "+"<a id=\"link_"+_a.id+"\" href=\""+_a.url.$encodeHTML()+"\" target=\"_blank\" onclick=\"javascript:maxResumeSession.linkOpened('"+_a.id+"');\">"+_a.title.$cut(100).$encodeHTML()+"</a>"+"</div>";
- }
- _7.innerHTML=_8;
- };
- maxResumeSession.togglePageItem=function(id){
- if(!maxResumeSession.pageList[id]){
- alert("maxResumeSession.togglePageItem :: invalid id "+id);
- return;
- }
- var _c=maxResumeSession.pageList[id];
- _c.enabled=!_c.enabled;
- maxResumeSession.updatePageItemCheck(_c);
- };
- maxResumeSession.updatePageItemCheck=function(_d){
- var _e=$id("check_"+_d.id);
- if(!_e){
- alert("maxResumeSession.updatePageItemCheck : invalid id "+id);
- return;
- }
- if(_d.enabled){
- _e.src="../_shared/images/btn_check_checked.png";
- }else{
- _e.src="../_shared/images/btn_check.png";
- }
- };
- maxResumeSession.selectPages=function(_f){
- for(var i=0;i<maxResumeSession.pageList.length;i++){
- var _11=maxResumeSession.pageList[i];
- if(_f==1){
- _11.enabled=true;
- }else{
- if(_f==0){
- _11.enabled=false;
- }else{
- _11.enabled=!_11.enabled;
- }
- }
- maxResumeSession.updatePageItemCheck(_11);
- }
- };
- maxResumeSession.openPage=function(_12){
- try{
- external.max_newTab(max_security_id,_12.url);
- }
- catch(e){
- window.open(_12.url);
- }
- maxResumeSession.updatePageItemStatus(_12);
- };
- maxResumeSession.openPages=function(){
- for(var i=maxResumeSession.pageList.length-1;i>-1;i--){
- if(maxResumeSession.pageList[i].enabled){
- maxResumeSession.openPage(maxResumeSession.pageList[i]);
- }
- }
- if(maxResumeSession.autoClose){
- window.close();
- }
- };
- maxResumeSession.updatePageItemStatus=function(_14){
- var _15=$id("link_"+_14.id);
- if(!_15){
- alert("maxResumeSession.updatePageItemStatus : invalid id "+_14.id);
- return;
- }
- _15.className="openedPageLink";
- };
- maxResumeSession.linkOpened=function(id){
- if(!maxResumeSession.pageList[id]){
- alert("maxResumeSession.togglePageItem : invalid id "+id);
- return;
- }
- var _17=maxResumeSession.pageList[id];
- _17.enabled=false;
- _17.opened=true;
- maxResumeSession.updatePageItemCheck(_17);
- if(maxResumeSession.autoClose){
- var _18=0;
- for(var i=0;i<maxResumeSession.pageList.length;i++){
- if(maxResumeSession.pageList[i].opened){
- _18++;
- }
- }
- if(_18==maxResumeSession.pageList.length){
- window.close();
- }
- }
- };
-
-