try{
if(configure){
console_log("pkg_bookmark configure loaded.");}
}catch(e){
var path=APPLI_PATH+"0077777700140002/gadget/";
add_package_load_path("configure",path+"configure.js");
require("configure");}
var DEF_4K2K=configure.DEF_4K;
var DEF_TOOLTIP=configure.DEF_TOOLTIP;
var DEF_RECCOMEND=configure.DEF_RECCOMEND;
var DEF_SIDE_TV=configure.DEF_SIDE_TV;
var DEF_MULTI_USER=(DEF_SIDE_TV)?configure.DEF_MULTI_USER:false;
try{
var STREAM_TEXTURE_ENABLE=(platinum_transient_file!=null&&system.mdl_cfg.with_bp_transit_effect&&!DEF_4K2K)?true:false;}catch(e){
console_log("[platinum_transient_file] fail",e);
var STREAM_TEXTURE_ENABLE=false;}
if(!DEF_MULTI_USER){
var BOOKMARK_PARTS_ITEM_H=144;
var BOOKMARK_PARTS_ITEM_W=600;
var BOOKMARK_SCROLL_BTN_H=(DEF_SIDE_TV)?81:108;
var BOOKMARK_SELECT_ITEM_W=546;
var TV_MULTI_SPACE_H=0;
var MULTI_USER_H=0;
var MARGIN_H=0;}else{
var BOOKMARK_PARTS_ITEM_H=138;
var BOOKMARK_PARTS_ITEM_W=600;
var BOOKMARK_SCROLL_BTN_H=54;
var TV_MULTI_SPACE_H=4;
var MULTI_USER_H=77+1;var MARGIN_H=0;}
var bookmark_parts_item=function(param){
var self=this;
this.translate=param.translate;
this.enable=false;
this.url=null;
this.index=0;
this.tooltip_timer={};
this.components=[
this.item=new container({components:[
this.img=new gimage({src:PALTINUM_PATH_IMG+"apps_back_gradation.png",
rotation:[90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:BOOKMARK_PARTS_ITEM_H,height:BOOKMARK_PARTS_ITEM_W,draw_type:DIRECT}),
this.line=new gbox({translate:[0,-BOOKMARK_PARTS_ITEM_H/2,0],
width:BOOKMARK_PARTS_ITEM_W-40,height:2,color:system.fdp_color.BASE_SUB}),
this.img_prs=new gimage({}),
this.bookmark_title=new gtextbox({translate:[230/2-20,2,0],font_size:26,
width:230,height:110,margin:[5,10,10,10],margin_leading:2,color:system.fdp_color.TEXT_ONBASE}),
this.bookmark_frame=new gbox({translate:[-154,1,0],width:228,height:128,
color:system.fdp_color.ICON_ONBASE}),
this.img_bookmark=new gimage({translate:[-154,1,0],width:224,height:126,src:null,draw_type:DIRECT}),
this.img_bookmark_plus=new gimage({translate:[-162,1,0],width:78,height:78,
src:PALTINUM_PATH_IMG+"bookmark_2k.png",draw_type:DIRECT,
color:system.fdp_color.TEXT_ONBASE_A,visible_p:false}),
this.guide_bookmark=new gtextbox({translate:[85,1,0],font_size:20,
width:364,height:140,margin:[5,5,5,5],margin_leading:2,valign:MIDDLE,
color:system.fdp_color.TEXT_ONBASE_A,visible_p:false}),
this.img_act=new bookmark_focus(),
]}),
this.submenu_parts=new container({components:[
this.img_submenu=new gimage({translate:[243,0,0],
color:system.fdp_color.ICON_ONBASE,
src:PALTINUM_PATH_IMG+"BMsub_2k.png",
width:78,height:140,draw_type:DIRECT,visible_p:false}),
this.img_submenu_act=new bookmark_focus(),
]}),
this.select_box=new gbox({width:BOOKMARK_PARTS_ITEM_W-8,height:BOOKMARK_PARTS_ITEM_H-8,
round_enable:true,round_width:4,round_height:4,
color:system.fdp_color.TEXT_ONBASE_A,visible_p:false})
];
this.img_act.setSize(BOOKMARK_PARTS_ITEM_W-30,BOOKMARK_PARTS_ITEM_H-20);
this.img_act.setTranslate(0,0,0);
this.img_submenu_act.setSize(70,70);
this.img_submenu_act.setTranslate(243,0,0);
this.item.action=function(obj){
console_log("[bookmark_parts_item.item.action]");
self.action_func();};
this.item.mouseover=function(obj){
console_log("[bookmark_parts_item.item.mouseover]");
self.mouseover_func();};
this.item.mouseout=function(obj){
console_log("[bookmark_parts_item.item.mouseout]");
self.mouseout_func();};
this.item.right_mousedown=function(obj){
console_log("[bookmark_parts_item.item.right_mousedown]");
if(!self.enable)return;
self.img.visible_p=true;
self.img_act.visible_p=false;
self.img_prs.visible_p=false;
force_redraw();
self.submenu_action_func();};
this.submenu_parts.action=function(obj){
console_log("[bookmark_parts_item.submenu_parts.action]");
self.submenu_action_func();};
this.submenu_parts.mouseover=function(obj){
console_log("[bookmark_parts_item.submenu_parts.mouseover]");
self.submenu_mouseover_func();};
this.submenu_parts.mouseout=function(obj){
console_log("[bookmark_parts_item.submenu_parts.mouseout]");
self.submenu_mouseout_func();};
this.submenu_parts.right_mousedown=function(obj){
console_log("[bookmark_parts_item.submenu_parts.right_mousedown]");
self.submenu_action_func();};};
bookmark_parts_item.prototype=new container({});
bookmark_parts_item.prototype.action_func=function(obj){
console_log("[bookmark_parts_item.action_func]");
if(!this.enable)return;
this.img_prs.visible_p=true;
this.img_act.visible_p=false;
var self=this;
append_timer(self,300,function(obj,count){
delete_timer(obj);
this.img_act.visible_p=true;
this.img_prs.visible_p=false;
force_redraw();});
if(DEF_RECCOMEND){
brw_disp.appear(this.url,true);}else{
brw_disp.appear(this.url);}
force_redraw();};
bookmark_parts_item.prototype.mouseover_func=function(obj){
console_log("[bookmark_parts_item.mouseover_func]");
if(!this.enable)return;
this.img_act.visible_p=true;
this.img_prs.visible_p=false;
bookmark.set_cursor_position_from_side(this.index);
force_redraw();};
bookmark_parts_item.prototype.mouseout_func=function(obj){
console_log("[bookmark_parts_item.mouseout_func]");
if(!this.enable)return;
this.img.visible_p=true;
this.img_act.visible_p=false;
this.img_prs.visible_p=false;
force_redraw();};
bookmark_parts_item.prototype.submenu_action_func=function(obj){
console_log("[bookmark_parts_item.submenu_action_func]");
if(!this.enable)return;
this.img_submenu.visible_p=true;
this.img_submenu_act.visible_p=false;
this.img_submenu.color=system.fdp_color.FCS;
var self=this;
append_timer(self,300,function(obj,count){
delete_timer(obj);
this.img_submenu.color=system.fdp_color.ICON_ONBASE;
force_redraw();});
if(DEF_TOOLTIP){
tooltip_item.disappear();}
var mouse_pos_x=system.cursor_pointer.get_pos_x();
var mouse_pos_y=system.cursor_pointer.get_pos_y();
var id=SearchObj(mouse_pos_x,mouse_pos_y);
var display_mode=check_display_mode();
var base_id=((display_mode==DEF_NAGARA_4K2K)||
(display_mode==DEF_NAGARA_COMN_CHANGE))?13:12;
if(DEF_TOOLTIP)
base_id++;
if((id>=base_id)&&(id<=(base_id+BOOKMARK_DISP_MAX-1))){
id=id-(base_id-1);}else if((id>=(base_id+BOOKMARK_DISP_MAX-1))&&(id<=(base_id+BOOKMARK_DISP_MAX*2-1))){
id=id-(base_id+BOOKMARK_DISP_MAX-1);}else{
return;}
submenu.appear_from_side(id);};
bookmark_parts_item.prototype.submenu_mouseover_func=function(obj){
console_log("[bookmark_parts_item.submenu_mouseover_func]");
if(!this.enable)return;
this.img_submenu_act.visible_p=true;
this.img_submenu.color=system.fdp_color.ICON_ONBASE;
bookmark.set_cursor_position_from_side(this.index);
if(DEF_TOOLTIP){
delete_timer(this.tooltip_timer);
append_timer(this.tooltip_timer,200,function(obj,count){
console_log("[bookmark_parts_item.submenu_mouseover_func]end timer");
delete_timer(obj);
tooltip_item.appear({
translate:[system.cursor_pointer.get_pos_x(),system.cursor_pointer.get_pos_y(),0],
text:W_TEXT.WB_LT_BOOKMARK_SETTINGS
});
force_redraw();});}
force_redraw();};
bookmark_parts_item.prototype.submenu_mouseout_func=function(obj){
console_log("[bookmark_parts_item.submenu_mouseover_func]");
if(DEF_TOOLTIP)
delete_timer(this.tooltip_timer);
if(!this.enable)return;
this.img_submenu.visible_p=true;
this.img_submenu_act.visible_p=false;
this.img_submenu.color=system.fdp_color.ICON_ONBASE;
if(DEF_TOOLTIP){
tooltip_item.disappear();}
force_redraw();};
bookmark_parts_item.prototype.set_data=function(index){
console_log("[bookmark_parts_item.set_data] index : "+index);
setf_text(this.bookmark_title,"");
this.url=null;
this.enable=false;
this.index=index;
this.guide_bookmark.visible_p=false;
if((index<0)||(index>=side_window.bookmark_item_max)){
this.img_bookmark.src="";
this.bookmark_frame.visible_p=false;
this.img_submenu.visible_p=false;
this.img_submenu_act.visible_p=false;
if(DEF_TOOLTIP){
tooltip_item.disappear();}
this.img_bookmark_plus.visible_p=true;
if(index==side_window.bookmark_item_max){
setf_text(this.guide_bookmark,W_TEXT.WB_LT_BOOKMARK_GUIDE);
var text_wh=get_dimension_textbox(this.guide_bookmark);
var text_w=text_wh[0];
var text_h=text_wh[1];
this.guide_bookmark.width=text_w;
this.guide_bookmark.height=text_h;
this.guide_bookmark.visible_p=true;}
return;}
this.img_bookmark_plus.visible_p=false;
setf_text(this.bookmark_title,bookmark.data.bookmarkpanel[index].title);
this.img_bookmark.src=bookmark.ary_img[index];
this.url=bookmark.data.bookmarkpanel[index].url;
this.bookmark_frame.visible_p=true;
this.img_submenu.visible_p=true;
this.enable=true;
if(index==side_window.replace_old_id){
this.select_box.visible_p=true;}else{
this.select_box.visible_p=false;}
};
bookmark_parts_item.prototype.in_focus=function(){
console_log("[bookmark_parts_item.in_focus]");
if(!this.enable)return;
this.img_act.visible_p=true;
var self=this;
append_timer(self,300,function(obj,count){
delete_timer(obj);
this.img_act.visible_p=false;
this.img.visible_p=true;
force_redraw();});};
bookmark_parts_item.prototype.free=function(){
this.img.src="";
this.img_act.free();
this.img_prs.src="";
setf_text(this.bookmark_title,"");
this.img_bookmark.src="";
this.img_submenu.src="";
this.img_submenu_act.free()
if(this.guide_bookmark)
setf_text(this.guide_bookmark,"");
if(this.img_bookmark_plus.src)
this.img_bookmark_plus.src="";
this.bookmark_frame.visible_p=false;};
var bookmark_parts_box=function(param){
this.translate=param.translate;
this.height=param.height;
this.frame=new container({});
this.frame.move_to=MoveTo;
this.components.push(this.frame);
this.size_ary_item=BOOKMARK_DISP_MAX+2;
this.ary_item=[];
this.frame.components=[];
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i]=new bookmark_parts_item({
translate:[0,(this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H)-i*(BOOKMARK_PARTS_ITEM_H+MARGIN_H),0]});
this.frame.components.push(this.ary_item[i]);}
};
bookmark_parts_box.prototype=new container({});
bookmark_parts_box.prototype.init=function(){
console_log("[bookmark_parts_box.init]");
this.data_index_top=1;
this.data_index_btm=BOOKMARK_DISP_MAX;
this.state_move_to=false;
for(var i=1;i<this.size_ary_item;i++){
this.ary_item[i].set_data(i-1);}
};
bookmark_parts_box.prototype.reset_data=function(index){
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].set_data(i-1);
this.ary_item[i].translate[1]=(this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H)-i*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
this.frame.translate[1]=0;
this.data_index_top=1;
this.data_index_btm=BOOKMARK_DISP_MAX;
this.state_move_to=false;
side_window.btn_t.set_scroll_disable();
if(side_window.bookmark_item_max<=BOOKMARK_DISP_MAX){
side_window.btn_b.set_scroll_disable();}else{
side_window.btn_b.set_scroll_enable();}
};
bookmark_parts_box.prototype.update_data=function(){
console_log("[bookmark_parts_box.update_data]");
var self=this;
if(this.data_index_btm>side_window.bookmark_item_max){
if(this.data_index_top!=1){
if(this.data_index_btm-1==side_window.bookmark_item_max){
this.state_move_to=true;
this.frame.move_to({
x:this.frame.translate[0],
y:this.frame.translate[1]-BOOKMARK_PARTS_ITEM_H-MARGIN_H,
z:this.frame.translate[2],
end_func:function(obj){
self.state_move_to=false;},
rate:0.4
});
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-2+i)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
}
this.data_index_top=this.data_index_top-1;
this.data_index_btm=this.data_index_btm-1;}
}
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].set_data(this.data_index_top-2+i);}
if(side_window.bookmark_item_max<=BOOKMARK_DISP_MAX){
side_window.btn_t.set_scroll_disable();
side_window.btn_b.set_scroll_disable();}else{
if(this.data_index_top!=1){
side_window.btn_t.set_scroll_enable();}else{
side_window.btn_t.set_scroll_disable();}
if(this.data_index_btm!=side_window.bookmark_item_max){
side_window.btn_b.set_scroll_enable();}else{
side_window.btn_b.set_scroll_disable();}
}
};
bookmark_parts_box.prototype.add_bookmark=function(pos){
console_log("[bookmark_parts_box.add_bookmark] pos: "+pos);
var self=this;
var set_pos=pos+1;
if(set_pos<this.data_index_top){
this.state_move_to=true;
this.frame.move_to({
x:this.frame.translate[0],
y:this.frame.translate[1]+(-BOOKMARK_PARTS_ITEM_H-MARGIN_H)*(this.data_index_top-set_pos),
z:this.frame.translate[2],
end_func:function(obj){
self.ary_item[1].in_focus();
self.state_move_to=false;},
rate:0.4
});
this.data_index_top=set_pos;
this.data_index_btm=set_pos+3;
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-1+i)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
for(var j=0;j<this.size_ary_item;j++){
this.ary_item[j].set_data(this.data_index_top-2+j);}
}else if(set_pos>this.data_index_btm){
this.state_move_to=true;
this.frame.move_to({
x:this.frame.translate[0],
y:this.frame.translate[1]+(BOOKMARK_PARTS_ITEM_H+MARGIN_H)*(set_pos-this.data_index_btm),
z:this.frame.translate[2],
end_func:function(obj){
self.ary_item[BOOKMARK_DISP_MAX].in_focus();
self.state_move_to=false;},
rate:0.4
});
this.data_index_top=set_pos-(BOOKMARK_DISP_MAX-1);
this.data_index_btm=set_pos;
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-1+i)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
for(var j=0;j<this.size_ary_item;j++){
this.ary_item[j].set_data(this.data_index_top-2+j);}
}else{
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].set_data(this.data_index_top-2+i);}
this.ary_item[set_pos-(this.data_index_top-1)].in_focus();}
if(side_window.bookmark_item_max<=BOOKMARK_DISP_MAX){
side_window.btn_t.set_scroll_disable();
side_window.btn_b.set_scroll_disable();}else{
if(this.data_index_top!=1){
side_window.btn_t.set_scroll_enable();}else{
side_window.btn_t.set_scroll_disable();}
if(this.data_index_btm!=side_window.bookmark_item_max){
side_window.btn_b.set_scroll_enable();}else{
side_window.btn_b.set_scroll_disable();}
}
};
bookmark_parts_box.prototype.replace=function(old_pos,new_pos){
var old_tr=this.ary_item[old_pos].translate[1];
var new_tr=this.ary_item[new_pos].translate[1];
if((old_pos==0)||(old_pos==BOOKMARK_DISP_MAX+1)){
this.ary_item[old_pos].set_data(side_window.replace_old_id);}
if(old_pos<new_pos){
var old_diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)*(new_pos-old_pos)/8);
var new_diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)/8);
append_timer(this,80,function(obj){
obj.ary_item[old_pos].translate[1]-=old_diff;
for(var i=new_pos;i>old_pos;i--){
obj.ary_item[i].translate[1]+=new_diff;}
if(obj.ary_item[old_pos].translate[1]<=new_tr){
delete_timer(obj);
obj.ary_item[old_pos].translate[1]=old_tr;
for(var j=new_pos;j>old_pos;j--){
obj.ary_item[j].translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-1+j)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
obj.update_data();}
force_redraw();});}else if(old_pos>new_pos){
var old_diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)*(old_pos-new_pos)/8);
var new_diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)/8);
append_timer(this,80,function(obj){
obj.ary_item[old_pos].translate[1]+=old_diff;
for(var i=new_pos;i<old_pos;i++){
obj.ary_item[i].translate[1]-=new_diff;}
if(obj.ary_item[old_pos].translate[1]>=new_tr){
delete_timer(obj);
obj.ary_item[old_pos].translate[1]=old_tr;
for(var j=new_pos;j<old_pos;j++){
obj.ary_item[j].translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-1+j)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);}
obj.update_data();}
force_redraw();});}else{
if(side_window.replace_old_id<side_window.replace_new_id){
var diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)/8);
var new_frame_pos=this.frame.translate[1]-BOOKMARK_PARTS_ITEM_H+MARGIN_H;
append_timer(this,80,function(obj){
obj.frame.translate[1]-=diff;
if(obj.frame.translate[1]<=new_frame_pos){
delete_timer(obj);
obj.frame.translate[1]=new_frame_pos;
obj.data_index_top-=1;
obj.data_index_btm-=1;
obj.data_pop_unsh();
obj.update_data();}
force_redraw();});}else if(side_window.replace_old_id>side_window.replace_new_id){
var diff=Math.floor((BOOKMARK_PARTS_ITEM_H+MARGIN_H)/8);
var new_frame_pos=this.frame.translate[1]+BOOKMARK_PARTS_ITEM_H+MARGIN_H;
append_timer(this,80,function(obj){
obj.frame.translate[1]+=diff;
if(obj.frame.translate[1]>=new_frame_pos){
delete_timer(obj);
obj.frame.translate[1]=new_frame_pos;
obj.data_index_top+=1;
obj.data_index_btm+=1;
obj.data_sh_pu();
obj.update_data();}
force_redraw();});}
}
};
bookmark_parts_box.prototype.up_move=function(){
console_log("[bookmark_parts_box.up_move]");
var self=this;
this.state_move_to=true;
if(!side_window.replace_bookmark_mode){
var x=system.cursor_pointer.get_pos_x();
var y=system.cursor_pointer.get_pos_y();
var id=SearchObj(x,y);
var display_mode=check_display_mode();
var base_id=((display_mode==DEF_NAGARA_4K2K)||
(display_mode==DEF_NAGARA_COMN_CHANGE))?13:12;
if(DEF_TOOLTIP)
base_id++;
if((id>=base_id)&&(id<=(base_id+7))){
if(pointer_table[id].obj){
if(typeof pointer_table[id].obj.mouseout=="function"){
pointer_table[id].obj.mouseout(pointer_table[id].obj);}
}
}
}
this.frame.move_to({
x:this.frame.translate[0],
y:this.frame.translate[1]-BOOKMARK_PARTS_ITEM_H-MARGIN_H,
z:this.frame.translate[2],
end_func:function(obj){
if(!side_window.replace_bookmark_mode){
if(pointer_table[id].obj){
if(typeof pointer_table[id].obj.mouseover=="function"){
pointer_table[id].obj.mouseover(pointer_table[id].obj);}
}
}
self.state_move_to=false;},
rate:0.4
});
this.data_index_top--;
this.data_index_btm--;
console_log("this.data_index_top : "+this.data_index_top);
console_log("this.data_index_btm : "+this.data_index_btm);
this.data_pop_unsh();
side_window.btn_b.set_scroll_enable();
if(this.data_index_top-1<=0){
side_window.btn_t.set_scroll_disable();}
};
bookmark_parts_box.prototype.down_move=function(){
console_log("[bookmark_parts_box.down_move]");
var self=this;
this.state_move_to=true;
if(!side_window.replace_bookmark_mode){
var x=system.cursor_pointer.get_pos_x();
var y=system.cursor_pointer.get_pos_y();
var id=SearchObj(x,y);
var display_mode=check_display_mode();
var base_id=((display_mode==DEF_NAGARA_4K2K)||
(display_mode==DEF_NAGARA_COMN_CHANGE))?13:12;
if(DEF_TOOLTIP)
base_id++;
if((id>=base_id)&&(id<=(base_id+7))){
if(pointer_table[id].obj){
if(typeof pointer_table[id].obj.mouseout=="function"){
pointer_table[id].obj.mouseout(pointer_table[id].obj);}
}
}
}
this.frame.move_to({
x:this.frame.translate[0],
y:this.frame.translate[1]+BOOKMARK_PARTS_ITEM_H+MARGIN_H,
z:this.frame.translate[2],
end_func:function(obj){
if(!side_window.replace_bookmark_mode){
if(pointer_table[id].obj){
if(typeof pointer_table[id].obj.mouseover=="function"){
pointer_table[id].obj.mouseover(pointer_table[id].obj);}
}
}
self.state_move_to=false;},
rate:0.4
});
this.data_index_top++;
this.data_index_btm++;
console_log("this.data_index_top : "+this.data_index_top);
console_log("this.data_index_btm : "+this.data_index_btm);
this.data_sh_pu();
side_window.btn_t.set_scroll_enable();
if(this.data_index_btm>=side_window.bookmark_item_max){
side_window.btn_b.set_scroll_disable();}
};
bookmark_parts_box.prototype.data_pop_unsh=function(){
console_log("[bookmark_parts_box.data_pop_unsh]");
var tmp=this.ary_item.pop();
this.frame.components.pop();
tmp.set_data(this.data_index_top-2);
tmp.translate[1]=this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H
-(this.data_index_top-1)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);
console_log("tmp.translate[1] : "+tmp.translate[1]);
this.ary_item.unshift(tmp);
this.frame.components.unshift(tmp);
if(!side_window.replace_bookmark_mode){
var list=[];
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.ary_item[i+1].submenu_parts);}
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.ary_item[i+1].item);}
var display_mode=check_display_mode();
var base_id=((display_mode==DEF_NAGARA_4K2K)||
(display_mode==DEF_NAGARA_COMN_CHANGE))?13:12;
if(DEF_TOOLTIP)
base_id++;
set_pointer_obj(list,base_id);}
};
bookmark_parts_box.prototype.data_sh_pu=function(){
console_log("[bookmark_parts_box.data_sh_pu]");
var tmp=this.ary_item.shift();
this.frame.components.shift();
tmp.set_data(this.data_index_btm);
tmp.translate[1]=(this.height/2+BOOKMARK_PARTS_ITEM_H/2+MARGIN_H)
-(this.data_index_btm+1)*(BOOKMARK_PARTS_ITEM_H+MARGIN_H);
this.ary_item.push(tmp);
this.frame.components.push(tmp);
if(!side_window.replace_bookmark_mode){
var list=[];
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.ary_item[i+1].submenu_parts);}
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.ary_item[i+1].item);}
var display_mode=check_display_mode();
var base_id=((display_mode==DEF_NAGARA_4K2K)||
(display_mode==DEF_NAGARA_COMN_CHANGE))?13:12;
if(DEF_TOOLTIP)
base_id++;
set_pointer_obj(list,base_id);}
};
bookmark_parts_box.prototype.free=function(){
for(var i=0;i<this.size_ary_item;i++){
this.ary_item[i].free();}
};
var side_window_btn=function(param){
var self=this;
this.translate=param.translate;
this.direction=param.direction;
this.enable=false;
this.fg_scroll=false;
this.components=[
this.btn=new container({components:[
new gimage({src:PALTINUM_PATH_IMG+"apps_back_gradation.png",
rotation:[90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:BOOKMARK_SCROLL_BTN_H,height:BOOKMARK_PARTS_ITEM_W,draw_type:DIRECT}),
this.img=new gimage({src:PALTINUM_PATH_IMG+"BM_up_2k.png",
width:554,height:78,
draw_type:DIRECT,color:system.fdp_color.ICON_ONBASE}),
this.img_act1=new gimage({src:PALTINUM_PATH_IMG+"BM_up_2k.png",
width:554,height:78,
draw_type:DIRECT,color:system.fdp_color.ICON_ONBASE}),
this.img_act=new bookmark_focus(),
this.img_prs=new gimage({src:PALTINUM_PATH_IMG+"BM_up_2k.png",
width:554,height:78,
draw_type:DIRECT,color:system.fdp_color.ICON_ONBASE,visible_p:false}),
this.img_shdw=new gimage({src:PALTINUM_PATH_IMG+"BM_up_2k.png",
width:554,height:78,
draw_type:DIRECT,color:system.fdp_color.WIDGET_SUB,visible_p:false})
]})
];
this.img_act.setSize(BOOKMARK_PARTS_ITEM_W-30,BOOKMARK_SCROLL_BTN_H-20);
this.img_act.setTranslate(0,0,0);
if(this.direction=="down"){
this.img.src=PALTINUM_PATH_IMG+"BM_down_2k.png";
this.img_act1.src=PALTINUM_PATH_IMG+"BM_down_2k.png";
this.img_prs.src=PALTINUM_PATH_IMG+"BM_down_2k.png";
this.img_shdw.src=PALTINUM_PATH_IMG+"BM_down_2k.png";}
this.btn.action=function(obj){
console_log("[side_window_btn.btn.action]");
self.action_func();};
this.btn.mouseover=function(obj){
console_log("[side_window_btn.mouseover]");
self.mouseover_func();};
this.btn.mouseout=function(obj){
console_log("[side_window_btn.mouseout]");
self.mouseout_func();};};
side_window_btn.prototype=new container({});
side_window_btn.prototype.set_scroll_enable=function(mode){
this.fg_scroll=true;
this.img_shdw.visible_p=false;
this.img.visible_p=true;};
side_window_btn.prototype.set_scroll_disable=function(mode){
this.fg_scroll=false;
this.img_shdw.visible_p=true;
this.img_prs.visible_p=false;
this.img_act.visible_p=false;
this.img.visible_p=false;};
side_window_btn.prototype.action_func=function(obj){
console_log("[side_window_btn.action_func]");
if(!this.fg_scroll)return;
var self=this;
this.img_prs.visible_p=true;
this.img_act.visible_p=false;
this.img.visible_p=false;
append_timer(self,300,function(obj,count){
delete_timer(obj);
if(obj.fg_scroll){
obj.img_act.visible_p=true;
obj.img_prs.visible_p=false;
obj.img.visible_p=false;
force_redraw();}
});
force_redraw();
if(this.direction=="up"){
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.up_move();}else{
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.down_move();}
};
side_window_btn.prototype.mouseover_func=function(obj){
console_log("[side_window_btn.mouseover_func]");
if(this.fg_scroll){
this.enable=true;
this.img_act.visible_p=true;
this.img_prs.visible_p=false;
this.img.visible_p=false;
force_redraw();}
};
side_window_btn.prototype.mouseout_func=function(obj){
console_log("[side_window_btn.mouseout_func]");
if(this.fg_scroll){
this.enable=false;
this.img.visible_p=true;
this.img_act.visible_p=false;
this.img_prs.visible_p=false;
force_redraw();}
};
side_window_btn.prototype.free=function(){
this.img.src="";
this.img_act.src="";
if(this.img_act1)this.img_act1.src="";
this.img_prs.src="";
this.img_shdw.src="";};
if(DEF_SIDE_TV){
var TV_BG_IMG_WIDTH=590;
var TV_BG_IMG_HEIGHT=339;}else{
var TV_BG_IMG_WIDTH=0;
var TV_BG_IMG_HEIGHT=0;}
side_window=new container({translate:[-SCREEN_WIDTH/2+SIDE_WINDOW_WIDTH/2,0,0],visible_p:false});
side_window.create=function(){
console_log("[side_window.create]");
if(this.components.length!=0)return;
var bookmark_parts_h=SIDE_WINDOW_HEIGHT-BOOKMARK_SCROLL_BTN_H*2;
this.img_base=new gbox({
translate:[0,0,0],
width:SIDE_WINDOW_WIDTH,height:SIDE_WINDOW_HEIGHT,
color:system.fdp_color.BASE
});
if(DEF_SIDE_TV){
if(SHOW_TVINFO){
this.tv_parts=new container({
translate:[0,Math.floor(SIDE_WINDOW_HEIGHT/2-TV_BG_IMG_HEIGHT/2-1)-4,0.1],
components:[
this.img_tv_bg=new gimage({width:TV_BG_IMG_WIDTH,height:TV_BG_IMG_HEIGHT,
src:PALTINUM_PATH_IMG+"TV_waku.png",draw_type:DIRECT}),
this.tv_area=new tv_area({translate:[-1,4+15,0]}),
this.tv_info=new tv_info({translate:[-1,Math.floor(4-TV_HEIGHT/2),0]})
]
});
this.tv_info.update();}else {
this.tv_parts=new container({
translate:[0,Math.floor(SIDE_WINDOW_HEIGHT/2-TV_BG_IMG_HEIGHT/2-1)-4,0.1],
components:[
this.img_tv_bg=new gimage({width:TV_BG_IMG_WIDTH,height:TV_BG_IMG_HEIGHT,
src:PALTINUM_PATH_IMG+"TV_waku.png",draw_type:DIRECT}),
this.tv_area=new tv_area({translate:[-1,4,0]})
]
});}
}
if(DEF_MULTI_USER){
var pos_y=Math.floor(SIDE_WINDOW_HEIGHT/2-TV_BG_IMG_HEIGHT-TV_MULTI_SPACE_H-MULTI_USER_H/2);
this.multi_user_parts=new container({
translate:[0,pos_y,0.1],
components:[
this.img=new gimage({src:PALTINUM_PATH_IMG+"apps_back_gradation.png",
rotation:[90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:MULTI_USER_H-1,height:BOOKMARK_PARTS_ITEM_W,draw_type:DIRECT}),
this.line_t=new gbox({translate:[0,Math.floor(-MULTI_USER_H/2),0],
width:BOOKMARK_PARTS_ITEM_W-40,height:2,color:system.fdp_color.BASE_SUB}),
]
});
MultiUserSelection.create();
var current_user={};
current_user.id=USER_PROFILE_ID;
MultiUserSelection.setShow({
view:true,
translate:[-SCREEN_WIDTH/2+SIDE_WINDOW_WIDTH/2,pos_y,0],
current_user:current_user,
select_action:function(info,animation){
animation();
USER_PROFILE_ID=(info.id!=undefined)?info.id:-1;
bookmark.get_bookmark_req();
side_window.update_data();
side_window.reset_data();},
});}
bookmark_parts_h=BOOKMARK_PARTS_ITEM_H*BOOKMARK_DISP_MAX;
var mask_th=BOOKMARK_SCROLL_BTN_H+MULTI_USER_H+TV_MULTI_SPACE_H+TV_BG_IMG_HEIGHT;
var mask_translate_ty=BOOKMARK_PARTS_ITEM_H*(BOOKMARK_DISP_MAX/2)+mask_th/2;
var mask_translate_by=BOOKMARK_PARTS_ITEM_H*(BOOKMARK_DISP_MAX/2)+BOOKMARK_PARTS_ITEM_H/2;
var scroll_btn_y=BOOKMARK_PARTS_ITEM_H*(BOOKMARK_DISP_MAX/2)+BOOKMARK_SCROLL_BTN_H/2;
this.bookmark_parts=new container({
translate:[0,-(TV_BG_IMG_HEIGHT+MULTI_USER_H+TV_MULTI_SPACE_H)/2,0],
components:[
this.btn_bookmark=new bookmark_parts_box({translate:[0,0,0],height:bookmark_parts_h}),
this.mask_t=new gbox({translate:[0,mask_translate_ty,0.1],
width:SIDE_WINDOW_WIDTH,height:mask_th,color:system.fdp_color.BASE}),
this.mask_b=new gbox({translate:[0,-mask_translate_by,0.1],
width:SIDE_WINDOW_WIDTH,height:BOOKMARK_PARTS_ITEM_H,color:system.fdp_color.BASE}),
this.btn_t=new side_window_btn({translate:[0,scroll_btn_y,0.1],direction:"up"}),
this.btn_b=new side_window_btn({translate:[0,-scroll_btn_y,0.1],direction:"down"})
]
});
this.img_caret=new container({
translate:[0,0,0],
visible_p:false,
components:[
this.arrow_l=new gimage({translate:[-BOOKMARK_PARTS_ITEM_W/2+18/2,0,0],width:18,height:38,
src:PALTINUM_PATH_IMG+"focus_arrow.png",color:system.fdp_color.FCS}),
this.arrow_r=new gimage({translate:[BOOKMARK_PARTS_ITEM_W/2-18/2,0,0],width:18,height:38,
src:PALTINUM_PATH_IMG+"focus_arrow.png",color:system.fdp_color.FCS,
rotation:[180,0,0,1]}),
new gbox({translate:[0,0,0],width:BOOKMARK_PARTS_ITEM_W-18,height:4,
color:system.fdp_color.FCS})
]
});
this.components.push(this.img_base,this.bookmark_parts,this.img_caret);
if(DEF_SIDE_TV)this.components.push(this.tv_parts);
if(DEF_MULTI_USER)this.components.push(this.multi_user_parts);
this.moveTo=MoveTo;
this.move_area=[];
for(var i=0;i<BOOKMARK_DISP_MAX+1;i++){
this.move_area.push({});}
for(var i=0;i<BOOKMARK_DISP_MAX+1;i++){
this.move_area[i].index=i;
this.move_area[i].mouseover=function(){
console_log("[move_area.mouseover]"+this.index);
side_window.calc_replace_pos(this.index);
if(side_window.replace_new_id>=side_window.bookmark_item_max)
return;
side_window.img_caret.translate[1]=
-(TV_BG_IMG_HEIGHT/2+TV_MULTI_SPACE_H/2+MULTI_USER_H/2)
+(BOOKMARK_PARTS_ITEM_H+MARGIN_H)*BOOKMARK_DISP_MAX/2
-this.index*(BOOKMARK_PARTS_ITEM_H);
side_window.img_caret.visible_p=true;
force_redraw();};
this.move_area[i].mouseout=function(){
side_window.img_caret.visible_p=false;
force_redraw();};
this.move_area[i].action=function(){
console_log("[move_area.action]"+this.index);
if(!side_window.img_caret.visible_p)return;
side_window.calc_replace_pos(this.index);
side_window.replace_bookmark(this.index);};}
};
side_window.init=function(){
console_log("[side_window.init]");
this.bookmark_item_max=bookmark.data.bookmarkpanel.length;
console_log("bm_item_max : "+this.bookmark_item_max);
this.btn_t.set_scroll_disable();
if(this.bookmark_item_max<=BOOKMARK_DISP_MAX){
this.btn_b.set_scroll_disable();}else{
this.btn_b.set_scroll_enable();}
this.replace_bookmark_mode=false;
this.replace_old_id=-1;
this.replace_new_id=-1;
this.replace_old_pos=-1;
this.replace_new_pos=-1;
this.btn_bookmark.init();};
side_window.appear=function(){
console_log("[side_window.appear]");
if(this.visible_p)return;
this.reset_data();
this.visible_p=true;
if(DEF_SIDE_TV)
this.tv_area.connect_bplayer();};
side_window.disappear=function(){
console_log("[side_window.disappear]");
if(!this.visible_p)return;
this.visible_p=false;
if(DEF_SIDE_TV)
this.tv_area.disconnect_bplayer();};
side_window.reset_data=function(){
console_log("[side_window.reset_data]");
this.bookmark_item_max=bookmark.data.bookmarkpanel.length;
this.bookmark_parts.visible_p=false;
this.btn_bookmark.reset_data();
this.bookmark_parts.visible_p=true;};
side_window.update_data=function(){
console_log("[side_window.update_data]");
this.bookmark_item_max=bookmark.data.bookmarkpanel.length;
this.btn_bookmark.update_data();};
side_window.add_bookmark=function(pos){
console_log("[side_window.add_bookmark]");
this.bookmark_item_max=bookmark.data.bookmarkpanel.length;
this.btn_bookmark.add_bookmark(pos);};
side_window.show_common_popup=function(){
if(common_popup.visible_p)return;
var wording=W_TEXT.W_MOVE_BOOKMARK_GUIDE;
var btn_text=W_TEXT.W_CANCEL;
var param={
text:wording,
translate:[100,0,1],
width:800,
height:452,
appear_cb:function(){
enable_keyhook=true;},
focus_obj:Cursor,
focus_offset:[0.0,0,1],
offset_btn_y:-20
};
param.return_cb=this.replace_bookmark_cancel;
param.btn_cb=[this.replace_bookmark_cancel];
param.btn_text=[btn_text];
param.text_font_size=32;
param.title="";
param.cur_pos=0;
param.focus_force_set=true;
Cursor.set_mode(2);
function_bar.clear_drag_mode();
common_popup.appear(param);};
side_window.start_move_bookmark_mode=function(){
this.show_common_popup();
pointer_table=get_pointer_table("move_bookmark");
var obj_list=[
this.btn_t.btn,
this.btn_b.btn
];
for(var i=0;i<BOOKMARK_DISP_MAX+1;i++){
obj_list.push(this.move_area[i]);}
var list=common_popup.get_btn_obj();
var tmp_list=obj_list.concat(list);
set_pointer_obj(tmp_list,0);
this.replace_old_id=bookmark.get_index();
this.replace_bookmark_mode=true;
var sel_pos=this.replace_old_id-(this.btn_bookmark.data_index_top-1)+1;
this.btn_bookmark.ary_item[sel_pos].select_box.visible_p=true;
var mouse_pos_x=system.cursor_pointer.get_pos_x();
var mouse_pos_y=system.cursor_pointer.get_pos_y();
var id=SearchObj(mouse_pos_x,mouse_pos_y);
if((id!=null)&&(pointer_table[id].obj)){
if(typeof pointer_table[id].obj.mouseover=="function"){
pointer_table[id].obj.mouseover(pointer_table[id].obj);}
pointer_id=id;}
};
side_window.calc_replace_pos=function(index){
if((this.replace_old_id>=(this.btn_bookmark.data_index_top-1))&&
(this.replace_old_id<=(this.btn_bookmark.data_index_btm-1))){
this.replace_old_pos=this.replace_old_id-(this.btn_bookmark.data_index_top-1)+1;}else if(this.replace_old_id<(this.btn_bookmark.data_index_top-1)){
this.replace_old_pos=0;}else{
this.replace_old_pos=BOOKMARK_DISP_MAX+1;}
this.replace_new_pos=index;
if(this.replace_old_pos>index)this.replace_new_pos=index+1;
this.replace_new_id=this.replace_new_pos+this.btn_bookmark.data_index_top-2;};
side_window.replace_bookmark=function(index){
if(this.replace_old_id!=this.replace_new_id){
this.btn_bookmark.replace(this.replace_old_pos,this.replace_new_pos);
bookmark.replace_bookmark(this.replace_old_id,this.replace_new_id);
this.img_caret.visible_p=false;}
common_popup.disappear(this.replace_bookmark_cancel);};
side_window.replace_bookmark_cancel=function(){
var sel_pos=side_window.replace_old_id-(side_window.btn_bookmark.data_index_top-1)+1;
if((sel_pos>=0)&&(sel_pos<=BOOKMARK_DISP_MAX+1))
side_window.btn_bookmark.ary_item[sel_pos].select_box.visible_p=false;
side_window.replace_bookmark_mode=false;
side_window.replace_old_id=-1;
side_window.replace_new_id=-1;
side_window.replace_old_pos=-1;
side_window.replace_new_pos=-1;
side_window.img_caret.visible_p=false;
set_base_pointer_obj();};
side_window.is_disp=function(){
return this.visible_p;};
side_window.get_obj=function(){
var list=[
this.btn_t.btn,
this.btn_b.btn
];
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.btn_bookmark.ary_item[i+1].submenu_parts);}
for(var i=0;i<BOOKMARK_DISP_MAX;i++){
list.push(this.btn_bookmark.ary_item[i+1].item);}
if(DEF_MULTI_USER){
var tmp_list=MultiUserSelection.get_obj();
list=list.concat(tmp_list);}
return list;};
side_window.placeTo=function(param){
console_log("[side_window.placeTo]");
this.translate[0]=param.x;
this.translate[1]=param.y;
this.translate[2]=param.z;};
side_window.is_scroll_area=function(){
var x=system.cursor_pointer.get_pos_x();
var y=system.cursor_pointer.get_pos_y();
var width=this.btn_t.img.width;
var height=this.btn_bookmark.height+this.btn_t.img.height+this.btn_b.img.height+4;
if((x>=(this.translate[0]+this.bookmark_parts.translate[0]-width/2))
&&(x<=(this.translate[0]+this.bookmark_parts.translate[0]+width/2))
&&(y<=(this.translate[1]+this.bookmark_parts.translate[1]+height/2))
&&(y>=(this.translate[1]+this.bookmark_parts.translate[1]-height/2))){
return true;}
return false;};
side_window.mouse_hook=function(arguments){
console_log("[side_window.mouse_hook]");
var button=arguments[3];
var diff_z=arguments[6];
var diff_y=arguments[8];
var modifier1=(button&ebus.mouse.DOWN_MODIFIER1_BUTTON);
if(diff_z){
if(modifier1){
console_log("[side_window.mouse_hook]PINCH");}else{
console_log("[side_window.mouse_hook]WHEEL");
if(diff_z!=0){
if(diff_z>0){
if(side_window.btn_b.fg_scroll){
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.down_move();}
}else{
if(side_window.btn_t.fg_scroll){
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.up_move();}
}
}
}
}else{
if(modifier1){
console_log("[side_window.mouse_hook]SCROLL");
if(diff_y!=0){
if(diff_y>0){
if(side_window.btn_b.fg_scroll){
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.down_move();}
}else{
if(side_window.btn_t.fg_scroll){
if(!side_window.btn_bookmark.state_move_to)
side_window.btn_bookmark.up_move();}
}
}
}
}
return false;};
side_window.free=function(){
if(!this.components.length)return;
this.btn_bookmark.free();
this.btn_t.free();
this.btn_b.free();
if(DEF_SIDE_TV){
if(this.tv_info)this.tv_info.free();
this.img_tv_bg.src="";}
this.img_caret.src="";
this.components.length=0;
if(DEF_MULTI_USER){
MultiUserSelection.destroy();}
};
bookmark=new container({translate:[SCREEN_WIDTH/2,-FUNC_BAR_HEIGHT/2,BOOK_MARK_DISP_TR_Z],rotation:[0,0,1,0]});
bookmark.create=function(){
this.data=null;
this.all_data=null;
this.sort_data={};
this.sort_data.bookmark=[];
this.url=null;
this.ary_img=new Array();
this.ary_id=new Array();
this.index=0;
bookmark.nvram_rebuilding();
bookmark.get_bookmark_req();
if(DEF_RECCOMEND)
bookmark.read_use_history();
};
bookmark.get_database_profile_id=function(tmp){
var tmp_dt=tmp;
var ret_dt=eval(tmp_dt);
if(DEF_MULTI_USER){
var all_id=get_all_profile_id();
for(var i in ret_dt.bookmarkpanel){
ret_dt.bookmarkpanel[i].profile_id=[];
var url_dt="bookmark://"+ret_dt.bookmarkpanel[i].url;
var obj=system.mybutton.get_fav_content_usr_list(url_dt);
if(obj.length!=0){
if(obj[0]==-1)
obj.splice(0,1);
ret_dt.bookmarkpanel[i].profile_id=obj;}else{
ret_dt.bookmarkpanel[i].profile_id=["-1"];}
}
}
return ret_dt;};
bookmark.nvram_rebuilding=function(){
if(!DEF_MULTI_USER)return;
var all_id=get_all_profile_id();
var profile_name="Bookmark";
var tmp=null;
try{
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf(profile_name)!=-1)){
tmp=apps_nvram_file.read({"filename":profile_name,async:false,
finished:function(){},product_id:"home"});}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
this.all_data=eval(this.get_database_profile_id(tmp));}else{
return;}
}catch(e){
console_log("[nvram_rebuilding]nvram read fail ("+profile_name+"):"+e);}
var rebuild_flag=false;
var ret=false;
var id_data=[];
for(var i in this.all_data.bookmarkpanel){
if(this.all_data.bookmarkpanel[i].profile_id[0]==-1)
continue;
for(var j=0;j<this.all_data.bookmarkpanel[i].profile_id.length;j++){
ret=false;
for(var k in all_id){
if(all_id[k]==this.all_data.bookmarkpanel[i].profile_id[j]){
id_data.push(this.all_data.bookmarkpanel[i].profile_id[j]);
ret=true;
break;}
}
if(!ret){
var status1=system.mybutton.set_fav_status_by_profid(
12,"bookmark://"+this.all_data.bookmarkpanel[i].url,
Number(this.all_data.bookmarkpanel[i].profile_id[j]),
system.mybutton.UNREGIST);
this.all_data.bookmarkpanel[i].profile_id.splice(j--,1);
rebuild_flag=true;}
}
}
if(rebuild_flag)
bookmark.nvram_write_all_bookmark();

var id_data=id_data.filter(function (x,i,self){
return self.indexOf(x)===i;});
profile_name="Bookmark_sort";
tmp=null;
try{
if((nvram_file_list)&&(nvram_file_list.indexOf(profile_name)!=-1)){
tmp=apps_nvram_file.read({"filename":profile_name,async:false,
finished:function(){},product_id:"home"});}
}catch(e){
console_log("[nvram_rebuilding]nvram read fail ("+profile_name+"):"+e);}
var data=null;
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
this.sort_data=eval(tmp);}else{
this.sort_data={};
this.sort_data.bookmark=[];
var sdt=[];
for(var i in this.all_data.bookmarkpanel){
sdt.push(this.all_data.bookmarkpanel[i].times);}
this.sort_data.bookmark.push({"id":-1,"times":[].concat(sdt)});
this.nvram_write_sort_bookmark();
return;}
rebuild_flag=false;
for(var i=0;i<this.sort_data.bookmark.length;i++){
if(this.sort_data.bookmark[i].id==-1)
continue;
ret=false;
for(var j in id_data){
if(this.sort_data.bookmark[i].id==id_data[j]){
ret=true;}
}
if(!ret){
this.sort_data.bookmark.splice(i--,1);
rebuild_flag=true;}
}
if(rebuild_flag)
this.nvram_write_sort_bookmark();};
bookmark.nvram_write_bookmark=function(){
var ret=false;
try{
apps_nvram_file.write({"filename":"Bookmark_bk","data":this.data.toSource(),
async:false,finished:function(){},product_id:"home"});
apps_nvram_file.rename({"from":"Bookmark_bk","to":"Bookmark",product_id:"home"});
ret=true;}catch(e){
console.log("[nvram_write_bookmark]nvram wite fail (Bookmark):"+e);}
return ret;};
bookmark.nvram_write_all_bookmark=function(){
var ret=false;
try{
apps_nvram_file.write({"filename":"Bookmark_bk","data":this.all_data.toSource(),
async:false,finished:function(){},product_id:"home"});
apps_nvram_file.rename({"from":"Bookmark_bk","to":"Bookmark",product_id:"home"});
ret=true;}catch(e){
console.log("[nvram_write_all_bookmark]nvram wite fail (Bookmark):"+e);}
return ret;};
bookmark.nvram_write_sort_bookmark=function(){
var ret=false;
try{
apps_nvram_file.write({"filename":"Bookmark_bk","data":this.sort_data.toSource(),
async:false,finished:function(){},product_id:"home"});
apps_nvram_file.rename({"from":"Bookmark_bk","to":"Bookmark_sort",product_id:"home"});
ret=true;}catch(e){
console_log("[nvram_write_sort_bookmark]nvram wite fail (Bookmark_sort):"+e);}
return ret;};
bookmark.search_bookmark_data=function(index){
var ret=index;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
var times=this.all_data.bookmarkpanel[index].times;
for(var i in this.data.bookmarkpanel){
if(this.data.bookmarkpanel[i].times==times){
ret=i;
break;}
}
}
return ret;};
bookmark.read_all_data=function(){
if(DEF_MULTI_USER)return;
var tmp=null;
try{
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf("Bookmark")!=-1)){
tmp=apps_nvram_file.read({"filename":"Bookmark",async:false,
finished:function(){},product_id:"home"});}
}catch(e){
console_log("[get_bookmark_req]nvram read fail (Bookmark):"+e);}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
this.all_data=eval(tmp);}
};
bookmark.delete_bookmark_data=function(index){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
var times=this.data.bookmarkpanel[index].times;
for(var i in this.all_data.bookmarkpanel){
if(times==this.all_data.bookmarkpanel[i].times){
this.all_data.bookmarkpanel.splice(i,1);
ret=this.nvram_write_all_bookmark();
break;}
}
this.data.bookmarkpanel.splice(index,1);
this.replace_bookmark_data();}else{
if(DEF_MULTI_USER&&USER_PROFILE_ID==-1)
this.all_data.bookmarkpanel.splice(index,1);
this.data.bookmarkpanel.splice(index,1);
ret=this.nvram_write_bookmark();
this.replace_bookmark_data();}
this.read_all_data();
return ret;};
bookmark.replace_bookmark_data=function(){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
var sdt=[];
for(var i in this.data.bookmarkpanel){
sdt.push(this.data.bookmarkpanel[i].times);}
for(var i in this.sort_data.bookmark){
if(this.sort_data.bookmark[i].id==USER_PROFILE_ID){
this.sort_data.bookmark[i].times=[].concat(sdt);
ret=true;
break;}
}
if(!ret&&sdt.length!=0){
this.sort_data.bookmark.push({"id":USER_PROFILE_ID,"times":[].concat(sdt)});}
ret=this.nvram_write_sort_bookmark();}else{
if(DEF_MULTI_USER&&USER_PROFILE_ID==-1){
this.sort_data.bookmark[0].times.length=0;
for(var i in this.data.bookmarkpanel){
this.sort_data.bookmark[0].times.push(this.data.bookmarkpanel[i].times);}
ret=this.nvram_write_sort_bookmark();}
ret=this.nvram_write_bookmark();}
return ret;}
bookmark.replace_bookmark_all_data=function(index,pid){
var ret=false;
if(DEF_MULTI_USER&&pid!=-1){
var sdt=[];
for(var i in this.data.bookmarkpanel){
sdt.push(this.data.bookmarkpanel[i].times);}
for(var i in this.sort_data.bookmark){
if(this.sort_data.bookmark[i].id==USER_PROFILE_ID){
this.sort_data.bookmark[i].times=[].concat(sdt);
ret=true;
break;}
}
if(!ret&&sdt.length!=0){
this.sort_data.bookmark.push({"id":USER_PROFILE_ID,"times":[].concat(sdt)});}
ret=this.nvram_write_sort_bookmark();}else{
if(DEF_MULTI_USER&&USER_PROFILE_ID==-1){
this.sort_data.bookmark[0].times.length=0;
for(var i in this.data.bookmarkpanel){
this.sort_data.bookmark[0].times.push(this.data.bookmarkpanel[i].times);}
ret=this.nvram_write_sort_bookmark();}
ret=this.nvram_write_bookmark();}
return ret;}
bookmark.add_acc_count_data=function(index){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
for(var i in this.all_data.bookmarkpanel){
if(this.all_data.bookmarkpanel[i].times==this.data.bookmarkpanel[index].times){
this.all_data.bookmarkpanel[i].acc_count=this.data.bookmarkpanel[index].acc_count;
ret=this.nvram_write_all_bookmark();
break;}
}
}else{
ret=this.nvram_write_bookmark();}
return ret;};
bookmark.add_bookmark_data=function(index){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
this.all_data.bookmarkpanel.push(this.data.bookmarkpanel[index]);
ret=this.nvram_write_all_bookmark();
this.replace_bookmark_data();
this.sort_data.bookmark[0].times.push(this.data.bookmarkpanel[index].times);
ret=this.nvram_write_sort_bookmark();}else{
if(DEF_MULTI_USER&&USER_PROFILE_ID==-1){
this.all_data.bookmarkpanel.push(this.data.bookmarkpanel[index]);
this.sort_data.bookmark[0].times.push(this.data.bookmarkpanel[index].times);
ret=this.nvram_write_sort_bookmark();}
ret=this.nvram_write_bookmark();}
this.read_all_data();
return ret;};
bookmark.add_bookmark_all_data=function(index){
var ret=false;
if(DEF_MULTI_USER){
this.sort_data.bookmark[0].times.push(this.all_data.bookmarkpanel[index].times);
ret=this.nvram_write_sort_bookmark();
var pid=this.all_data.bookmarkpanel[index].profile_id[0];
var i;
for(i=0;i<this.sort_data.bookmark.length;i++){
if(this.sort_data.bookmark[i].id==pid){
break;}
}
if(i<this.sort_data.bookmark.length){
this.sort_data.bookmark[i].times.push(
this.all_data.bookmarkpanel[index].times);}else{
this.sort_data.bookmark.push({"id":pid,
"times":[].concat(this.all_data.bookmarkpanel[index].times)});}
ret=this.nvram_write_sort_bookmark();}
ret=this.nvram_write_all_bookmark();
return ret;};
bookmark.get_diff_profile_id=function(pid1,pid2){
var ret=false;
var base_pid=[].concat(pid1);
var check_pid=[].concat(pid2);
var diff_pid=new Array();
for(var i in base_pid){
ret=false;
for(var j in check_pid){
if(base_pid[i]==check_pid[j]){
ret=true;
break;}
}
if(!ret)
diff_pid.push(base_pid[i]);}
return diff_pid;};
bookmark.sub_sort_data=function(times,pid){
for(var i in pid){
if(pid[i]==-1)
continue;
for(var j=0;j<this.sort_data.bookmark.length;j++){
if(pid[i]==this.sort_data.bookmark[j].id){
for(var k=0;k<this.sort_data.bookmark[j].times.length;k++){
if(times==this.sort_data.bookmark[j].times[k]){
this.sort_data.bookmark[j].times.splice(k--,1);
if(this.sort_data.bookmark[j].times.length==0){
this.sort_data.bookmark.splice(j--,1);
break;}
}
}
}
}
}
};
bookmark.add_sort_data=function(times,pid){
if(pid[0]==-1){
for(var j=0;j<this.sort_data.bookmark.length;j++){
if(this.sort_data.bookmark[j].id==-1)
continue;
for(var k=0;k<this.sort_data.bookmark[j].times.length;k++){
if(times==this.sort_data.bookmark[j].times[k]){
this.sort_data.bookmark[j].times.splice(k--,1);
if(this.sort_data.bookmark[j].times.length==0){
this.sort_data.bookmark.splice(j--,1);
break;}
}
}
}
}else{
for(var i in pid){
ret=false;
for(var j in this.sort_data.bookmark){
if(pid[i]==this.sort_data.bookmark[j].id){
this.sort_data.bookmark[j].times.push(times);
ret=true;
break;}
}
if(!ret)
this.sort_data.bookmark.push({"id":pid[i],"times":[times]});}
}
};
bookmark.update_all_data=function(key,pid,reg){
var pid=(pid.length==0)?[-1]:pid;
var index;
for(index=0;index<this.all_data.bookmarkpanel.length;index++){
if(this.all_data.bookmarkpanel[index].url==key){
break;}
}
if(index>=this.all_data.bookmarkpanel.length)
return false;
var sub_pid=this.get_diff_profile_id(
this.all_data.bookmarkpanel[index].profile_id,pid);
var add_pid=this.get_diff_profile_id(
pid,this.all_data.bookmarkpanel[index].profile_id);
this.sub_sort_data(this.all_data.bookmarkpanel[index].times,sub_pid);
this.add_sort_data(this.all_data.bookmarkpanel[index].times,add_pid);
ret=this.nvram_write_sort_bookmark();
this.all_data.bookmarkpanel[index].profile_id=pid;
if(USER_PROFILE_ID==pid[0]){
if(reg==system.mybutton.REGIST){
for(var i=0;i<this.data.bookmarkpanel.length;i++){
if(this.data.bookmarkpanel[i].url==key){
break;}
}
if(i<this.data.bookmarkpanel.length){
this.data.bookmarkpanel[i].profile_id=add_pid;}else{
this.data.bookmarkpanel.push(this.all_data.bookmarkpanel[index]);}
}else{
for(var i=0;i<this.data.bookmarkpanel.length;i++){
if(this.data.bookmarkpanel[i].url==key){
this.data.bookmarkpanel[i].profile_id=add_pid;
break;}
}
}
}
ret=this.nvram_write_all_bookmark();};
bookmark.update_profile_id=function(index,profile_id){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
if(index==-1){
var index=bookmark.get_index_all_from_url();
var pid=this.all_data.bookmarkpanel[index].profile_id[0];
var i;
for(i=0;i<this.sort_data.bookmark.length;i++){
if(this.sort_data.bookmark[i].id==pid){
break;}
}
if(i<this.sort_data.bookmark.length){
this.sort_data.bookmark[i].times.push(
this.all_data.bookmarkpanel[index].times);}else{
this.sort_data.bookmark.push({"id":pid,
"times":[].concat(this.all_data.bookmarkpanel[index].times)});}
ret=this.nvram_write_sort_bookmark();}else{
var times=this.data.bookmarkpanel[index].times;
this.update_sort_data(index,profile_id);
ret=this.nvram_write_sort_bookmark();
for(var i in this.all_data.bookmarkpanel){
if(this.all_data.bookmarkpanel[i].times==times){
this.all_data.bookmarkpanel[i].profile_id=profile_id;
ret=this.nvram_write_all_bookmark();
break;}
}
}
}else{
if(DEF_MULTI_USER&&USER_PROFILE_ID==-1){
this.update_sort_data(index,profile_id);
ret=this.nvram_write_sort_bookmark();}
this.data.bookmarkpanel[index].profile_id=profile_id;
ret=this.nvram_write_bookmark();}
return ret;};
bookmark.update_sort_data=function(index,pid){
var ret=false;
var sub_pid=this.get_diff_profile_id(
this.data.bookmarkpanel[index].profile_id,pid);
var add_pid=this.get_diff_profile_id(
pid,this.data.bookmarkpanel[index].profile_id);
this.sub_sort_data(this.data.bookmarkpanel[index].times,sub_pid);
this.add_sort_data(this.data.bookmarkpanel[index].times,add_pid);
ret=this.nvram_write_sort_bookmark();
var url="bookmark://"+this.data.bookmarkpanel[index].url;
for(var i in sub_pid){
if(sub_pid[i]==-1)
continue;
var status1=system.mybutton.set_fav_status_by_profid(
12,url,Number(sub_pid[i]),system.mybutton.UNREGIST);}
if(add_pid[0]==-1){
var all_id=get_all_profile_id();
for(var i in all_id){
var status2=system.mybutton.set_fav_status_by_profid(
12,url,Number(all_id[0]),system.mybutton.UNREGIST);}
}else{
for(var i in add_pid){
if(add_pid[i]!=-1)
var status3=system.mybutton.set_fav_status_by_profid(
12,url,Number(add_pid[i]),system.mybutton.REGIST);}
}
};
bookmark.set_profile_id=function(index){
if(this.all_data.bookmarkpanel[index].profile_id instanceof Array){
if(this.all_data.bookmarkpanel[index].profile_id[0]==-1){
this.all_data.bookmarkpanel[index].profile_id.length=0;
this.all_data.bookmarkpanel[index].profile_id.push(USER_PROFILE_ID+"");}else{
for(var i=0;i<this.all_data.bookmarkpanel[index].profile_id.length;i++){
if(this.all_data.bookmarkpanel[index].profile_id[i]==USER_PROFILE_ID){
this.all_data.bookmarkpanel[index].profile_id.splice(i,1);
i--;}
}
this.all_data.bookmarkpanel[index].profile_id.push(USER_PROFILE_ID+"");}
}else{
this.all_data.bookmarkpanel[index].profile_id=[USER_PROFILE_ID+""];}
var status1=system.mybutton.set_fav_status_by_profid(
12,"bookmark://"+this.all_data.bookmarkpanel[index].url,
Number(USER_PROFILE_ID),system.mybutton.REGIST);};
bookmark.update_bookmark_data=function(index){
var ret=false;
if(DEF_MULTI_USER&&USER_PROFILE_ID!=-1){
var times=this.data.bookmarkpanel[index].times;
var update_time=this.data.bookmarkpanel[index].update_time;
for(var i in this.all_data.bookmarkpanel){
if(this.all_data.bookmarkpanel[i].times==times){
this.all_data.bookmarkpanel[i].update_time=update_time;
this.set_profile_id(i);
ret=this.nvram_write_all_bookmark();
break;}
}
}else{
ret=this.nvram_write_bookmark();}
return ret;};
bookmark.convert_profile_id=function(){
if(!DEF_MULTI_USER)return;
var ret=false;
for(var i in this.all_data.bookmarkpanel){
if(!(this.all_data.bookmarkpanel[i].profile_id instanceof Array)){
var pid=this.all_data.bookmarkpanel[i].profile_id;
if((pid<0)||(pid>127)){
pid=-1;}
this.all_data.bookmarkpanel[i].profile_id=[pid+""];
ret=true;}
}
if(ret){
this.nvram_write_all_bookmark();}
for(var i in this.data.bookmarkpanel){
if(!(this.data.bookmarkpanel[i].profile_id instanceof Array)){
var pid=this.data.bookmarkpanel[i].profile_id;
if((pid<0)||(pid>127)){
pid=-1;}
this.data.bookmarkpanel[i].profile_id=[pid+""];}
}
};
bookmark.delete_profile_id=function(id){
};
bookmark.delete_bookmark_file=function(id){
if(id<0)return;
var profile_name="Bookmark"+id;
try{
apps_nvram_file.remove({"filename":profile_name,
async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[delete_bookmark_file]nvram read fail ("+profile_name+"):"+e);}
};
bookmark.profile_sort=function(){
if(!DEF_MULTI_USER)return;
if(USER_PROFILE_ID==null)return;
var profile_name="Bookmark_sort";
var tmp=null;
try{
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf(profile_name)!=-1)){
tmp=apps_nvram_file.read({"filename":profile_name,async:false,
finished:function(){},product_id:"home"});}
}catch(e){
console_log("[profile_sort]nvram read fail ("+profile_name+"):"+e);}
var sdt=[];
if(!tmp){
this.sort_data={};
this.sort_data.bookmark=[];
for(var i in this.all_data.bookmarkpanel){
sdt.push(this.all_data.bookmarkpanel[i].times);}
this.sort_data.bookmark.push({"id":-1,"times":[].concat(sdt)});
this.nvram_write_sort_bookmark();}else{
tmp=sysutil.tconv.binary_to_string(tmp);
this.sort_data=eval(tmp);}
this.tmp_data={};
this.tmp_data.bookmarkpanel=[];
sdt.length=0;
for(var i in this.sort_data.bookmark){
if(this.sort_data.bookmark[i].id==USER_PROFILE_ID){
sdt=[].concat(this.sort_data.bookmark[i].times);
break;}
}
for(var i in sdt){
for(var j in this.data.bookmarkpanel){
if(sdt[i]==this.data.bookmarkpanel[j].times){
this.tmp_data.bookmarkpanel.push(this.data.bookmarkpanel[j]);
break;}
}
}
this.data.bookmarkpanel.length=0;
for(var i in this.tmp_data.bookmarkpanel){
this.data.bookmarkpanel.push(this.tmp_data.bookmarkpanel[i]);}
};
bookmark.get_bookmark_req=function(){
console_log("[START][bookmark.get_bookmark_req]");
this.ary_img.splice(0,this.ary_img.length);
var tmp=null;
try{
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf("Bookmark")!=-1)){
tmp=apps_nvram_file.read({"filename":"Bookmark",async:false,
finished:function(){},product_id:"home"});}
}catch(e){
console_log("[get_bookmark_req]nvram read fail (Bookmark):"+e);}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
var dt=this.get_database_profile_id(tmp);
this.data=dt;
this.all_data=JSON.parse(JSON.stringify(dt))
this.profile_sort();
for(var i=0,max=this.data.bookmarkpanel.length;i<max;i++){
try{
this.ary_img.push(apps_nvram_file.read({"filename":this.data.bookmarkpanel[i].times+"",
async:false,finished:function(){},product_id:"home"}));}catch(e){
console_log("[ROOT][bookmark.get_bookmark_req]");
this.ary_img.push(PALTINUM_PATH_IMG+"default_bookmark_img.png");}
}
this.ary_id.splice(0,this.ary_id.length);
for(var j=0,max=this.data.bookmarkpanel.length;j<max;j++){
this.ary_id.push(this.data.bookmarkpanel[j].id);}
}else{
console_log("No Data");
this.data={};
this.data.bookmarkpanel=[];}
tmp=null;
try{
if((nvram_file_list)&&(nvram_file_list.indexOf("History")!=-1)){
tmp=apps_nvram_file.read({"filename":"History",async:false,finished:function(){},product_id:"home"});}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
console_log("History:"+tmp);
this.hist_data=eval(tmp);}else{
console_log("History null");
this.hist_data=[];}
}catch(e){
this.hist_data=[];}
console_log("[get_bookmark_req]img_list length:"+this.ary_img.length);};
bookmark.delete_bookmark=function(index){
console_log("[START][bookmark][delete_bookmark] index = "+index);
console_log("[START][bookmark][delete_bookmark] length = "+this.data.bookmarkpanel.length);
if(index<this.data.bookmarkpanel.length){
console_log("[ROOT][bookmark][delete_bookmark]");
try{
apps_nvram_file.remove({"filename":this.data.bookmarkpanel[index].times+"",
async:false,finished:function(){},product_id:"home"});
if(STREAM_TEXTURE_ENABLE){
platinum_transient_file.remove({"filename":this.data.bookmarkpanel[index].times+"_platinum",
async:false,finished:function(){}});}
if(DEF_4K2K){
apps_nvram_file.remove({"filename":this.data.bookmarkpanel[index].times+"_4k",
async:false,finished:function(){},product_id:"home"});}
}catch(e){
}
if(DEF_MULTI_USER){
for(var i in this.data.bookmarkpanel[index].profile_id){
var status1=system.mybutton.set_fav_status_by_profid(
12,"bookmark://"+this.data.bookmarkpanel[index].url,
Number(this.data.bookmarkpanel[index].profile_id[i]),
system.mybutton.UNREGIST);}
}
if(DEF_RECCOMEND)
this.delete_use_history(this.data.bookmarkpanel[index].url);
this.ary_img.splice(index,1);
console_log("[delete_bookmark]img_list length:"+this.ary_img.length);
this.delete_bookmark_data(index);
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
var del_file_list=[];
if(nvram_file_list){
for(var k=0;k<nvram_file_list.length;k++){
if((nvram_file_list[k].length==13)
&&(!isNaN(nvram_file_list[k]))
&&(nvram_file_list[k].indexOf(".")<0)){
var j=0;
for(j=0;j<this.all_data.bookmarkpanel.length;j++){
if(nvram_file_list[k]==this.all_data.bookmarkpanel[j].times+"")break;}
if(j==this.all_data.bookmarkpanel.length){
del_file_list.push(nvram_file_list[k]);}
}
}
if(del_file_list.length!=0){
for(var l=0;l<del_file_list.length;l++){
try{
apps_nvram_file.remove({"filename":del_file_list[l],
async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[delete_bookmark]nvram remove fail:"+e);}
}
}
}
if(STREAM_TEXTURE_ENABLE){
var transit_file_list=platinum_transient_file.list({});
var del_file_list_t=[];
if(transit_file_list){
for(var m=0;m<transit_file_list.length;m++){
if(transit_file_list[m].length==22){
if(transit_file_list[m].slice(13)=="_platinum"){
var tmp_file_name=transit_file_list[m].slice(0,13);
if((!isNaN(tmp_file_name))&&(tmp_file_name.indexOf(".")<0)){
var j=0;
for(j=0;j<this.all_data.bookmarkpanel.length;j++){
if(tmp_file_name==this.all_data.bookmarkpanel[j].times+"")break;}
if(j==this.all_data.bookmarkpanel.length){
del_file_list_t.push(transit_file_list[m]);}
}
}
}
}
if(del_file_list_t.length!=0){
for(var n=0;n<del_file_list_t.length;n++){
try{
platinum_transient_file.remove({"filename":del_file_list_t[n],
async:false,finished:function(){}});}catch(e){
console_log("[delete_bookmark]nvram remove fail(transit):"+e);}
}
}
}
}
if(DEF_4K2K){
var thumb4k_file_list=apps_nvram_file.list({product_id:"home"});
var del_file_list_4k=[];
if(thumb4k_file_list){
for(var i=0;i<thumb4k_file_list.length;i++){
if(thumb4k_file_list[i].length==16){
if(thumb4k_file_list[i].slice(13)=="_4k"){
var tmp_file_name=thumb4k_file_list[i].slice(0,13);
if((!isNaN(tmp_file_name))&&(tmp_file_name.indexOf(".")<0)){
var j=0;
for(j=0;j<this.all_data.bookmarkpanel.length;j++){
if(tmp_file_name==this.all_data.bookmarkpanel[j].times+"")break;}
if(j==this.all_data.bookmarkpanel.length){
del_file_list_4k.push(thumb4k_file_list[i]);}
}
}
}
}
if(del_file_list_4k.length!=0){
for(var i=0;i<del_file_list_4k.length;i++){
try{
apps_nvram_file.remove({"filename":del_file_list_4k[i],
async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[delete_bookmark]nvram remove fail(4k):"+e);}
}
}
}
}
this.ary_id.splice(index,1);}
console_log("[END][bookmark][delete_bookmark]");};
bookmark.replace_bookmark=function(old_id,new_id){
if((old_id<this.data.bookmarkpanel.length)&&(new_id<this.data.bookmarkpanel.length)){
var tmp=eval(this.data.bookmarkpanel[old_id].toSource());
this.data.bookmarkpanel.splice(old_id,1);
this.data.bookmarkpanel.splice(new_id,0,tmp);
var tmp_img=this.ary_img[old_id];
this.ary_img.splice(old_id,1);
this.ary_img.splice(new_id,0,tmp_img);
this.replace_bookmark_data();}
};
bookmark.add_acc_count=function(index){
console_log("[END][bookmark][add_acc_count] "+this.data.bookmarkpanel[index].acc_count);
this.data.bookmarkpanel[index].acc_count=(Number(this.data.bookmarkpanel[index].acc_count)+1)+"";
this.add_acc_count_data(index);};
bookmark.get_weblink_uniq_id=function(url){
console_log("[START][bookmark.get_weblink_uniq_id] url: "+url);
var id_4digit=1;var id_list=[];var weblink_data=null;var tmp=null;
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf("Weblink_table")!=-1)){
tmp=apps_nvram_file.read({"filename":"Weblink_table",async:false,
finished:function(){},product_id:"home"});}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
weblink_data=eval(tmp);
for(var i=0,max_i=weblink_data.weblink_table.length;i<max_i;i++){
if(url==weblink_data.weblink_table[i].url){
return weblink_data.weblink_table[i].id;}
}
}else{
weblink_data={};
weblink_data.weblink_table=[];}
for(var j=0,max_j=this.all_data.bookmarkpanel.length;j<max_j;j++){
id_list.push(parseInt(this.all_data.bookmarkpanel[j].id,10));}
for(var k=0,max_k=weblink_data.weblink_table.length;k<max_k;k++){
id_list.push(parseInt(weblink_data.weblink_table[k].id,10));}
if(id_list.length!=0){
for(var m=1;m<10000;m++){
if(id_list.indexOf(m)==-1){
id_4digit=m;
break;}
}
}
return (("000"+id_4digit.toString()).slice(-4));};
bookmark.set_bookmark=function(param){
console_log("[START][bookmark][set_bookmark]");
var title=param.title?param.title:"";
var url=param.url?param.url:"";
var thumbnail_path=param.thumbnail_path?param.thumbnail_path:"";
var thumb_big=param.thumb_big?param.thumb_big:"";
var thumb_4k=param.thumb_4k?param.thumb_4k:"";
var success=param.result?param.result:false;
var profile_id=param.profile_id?param.profile_id:-1;
if(mybutton_profile_id!=-99)
profile_id=mybutton_profile_id;
else
profile_id=USER_PROFILE_ID;
mybutton_profile_id=-99;
var check=0;
var i=0;
if(url=="")return;
for(var max=this.data.bookmarkpanel.length;i<max;i++){
if(this.data.bookmarkpanel[i].url==url){
check=1;
break;}
}
if(DEF_MULTI_USER){
if(check==0){
for(var j in this.all_data.bookmarkpanel){
if(this.all_data.bookmarkpanel[j].url==url){
if(function_bar.favorite_plus_action){
i=this.data.bookmarkpanel.push(this.all_data.bookmarkpanel[j])-1;
this.replace_bookmark_data();
check=1;
break;}else{
return;}
}
}
}
}
if(check==0){
if(!success)return;
var id=this.get_weblink_uniq_id(url);
var filename=(new Date()).getTime()+"";
var update_time=(new Date()).getTime()+"";
var tmp={"title":title,
"id":id,
"type":"item",
"url":url,
"times":filename,
"update_time":update_time,
"acc_count":"0",
"favicon":"FILENAME",
"profile_id":[profile_id+""]};
console_log("[ROOT][bookmark.set_bookmark]url:"+param.url);
if(USER_PROFILE_ID==profile_id){
this.data.bookmarkpanel.push(tmp);
if(!this.add_bookmark_data(this.data.bookmarkpanel.length-1)){
function_bar.favorite_plus_action=false;
return;}
}else{
if(USER_PROFILE_ID==-1)
this.data.bookmarkpanel.push(tmp);
this.all_data.bookmarkpanel.push(tmp);
if(!this.add_bookmark_all_data(this.all_data.bookmarkpanel.length-1)){
function_bar.favorite_plus_action=false;
return;}
}
if(DEF_MULTI_USER){
if(profile_id!=-1)
var status1=system.mybutton.set_fav_status_by_profid(
12,"bookmark://"+url,Number(profile_id),system.mybutton.REGIST);}
try{
apps_nvram_file.write({"filename":filename,
"data":thumbnail_path,async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[set_bookmark]nvram write fail (capture image):"+e);
}
try{
this.ary_img.push(apps_nvram_file.read({"filename":filename,
async:false,finished:function(){},product_id:"home"}));}catch(e){
console_log("[set_bookmark]nvram read fail (capture image):"+e);
this.ary_img.push(PALTINUM_PATH_IMG+"default_bookmark_img.png");
}
try{
if(STREAM_TEXTURE_ENABLE)
platinum_transient_file.write({"filename":filename+"_platinum",
"data":thumb_big,async:false,finished:function(){}});}catch(e){
console_log("[set_bookmark]nvram write fail (transit capture image):"+e);
}
try{
if(DEF_4K2K)
apps_nvram_file.write({"filename":filename+"_4k",
"data":thumb_4k,async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[set_bookmark]nvram write fail (4k capture image):"+e);
}
this.ary_id.push(id);
if(function_bar.favorite_plus_action){
function_bar.favorite_plus_action=false;
if(side_window.is_disp()){
side_window.add_bookmark(this.data.bookmarkpanel.length-1);}
}
if(DEF_RECCOMEND)
this.set_use_history(filename);}else{
console_log("[ROOT][bookmark.set_bookmark]same url:"+this.data.bookmarkpanel[i].url);
console_log("[ROOT][bookmark.set_bookmark]same url:"+this.data.bookmarkpanel[i].times);
this.data.bookmarkpanel[i].update_time=(new Date()).getTime()+"";
if(!this.update_bookmark_data(i)){
function_bar.favorite_plus_action=false;
return;}
if(success){
try{
apps_nvram_file.write({"filename":this.data.bookmarkpanel[i].times+"",
"data":thumbnail_path,async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[set_bookmark]nvram write fail (capture image):"+e);
}
try{
this.ary_img[i]=apps_nvram_file.read({"filename":this.data.bookmarkpanel[i].times+"",
async:false,finished:function(){},product_id:"home"});}catch(e){
console_log("[set_bookmark]nvram read fail (capture image):"+e);
this.ary_img[i]=PALTINUM_PATH_IMG+"default_bookmark_img.png";
}
try{
if((STREAM_TEXTURE_ENABLE)&&(platinum_transient_file.write)){
platinum_transient_file.write({"filename":this.data.bookmarkpanel[i].times+"_platinum",
"data":thumb_big,async:false,finished:function(){}});}
}catch(e){
console_log("[set_bookmark]nvram write fail (transit capture image):"+e);
}
try{
if(DEF_4K2K){
apps_nvram_file.write({"filename":this.data.bookmarkpanel[i].times+"_4k",
"data":thumb_4k,async:false,finished:function(){},product_id:"home"});}
}catch(e){
console_log("[set_bookmark]nvram write fail (4k capture image):"+e);
}
}
if(function_bar.favorite_plus_action){
function_bar.favorite_plus_action=false;
if(side_window.is_disp()){
side_window.add_bookmark(i);}
}
}
console_log("[END][bookmark][set_bookmark]");};
bookmark.set_cursor_position_from_side=function(index){
console_log("[START][bookmark.set_cursor_position_from_side] index : "+index);
this.index=index;};
bookmark.get_index=function(){
console_log("[bookmark][get_index] index = "+this.index);
return this.index;};
bookmark.get_index_all_from_url=function(){
var index;
for(index=0;index<this.all_data.bookmarkpanel.length;index++){
if(this.all_data.bookmarkpanel[index].url==URL_STR){
return index;}
}
return -1;};
bookmark.get_index_from_url=function(){
var index;
for(index=0;index<this.data.bookmarkpanel.length;index++){
if(this.data.bookmarkpanel[index].url==URL_STR){
return index;}
}
return -1;};
bookmark.read_use_history=function(){
console_log("[START][bookmark.read_use_history]");
var tmp=null;
var nvram_file_list=apps_nvram_file.list({product_id:"home"});
if((nvram_file_list)&&(nvram_file_list.indexOf("Bookmark_use_history")!=-1)){
try{
tmp=apps_nvram_file.read({"filename":"Bookmark_use_history",async:false,
finished:function(){},product_id:"home"});}catch(e){
console_log("[read_use_history]nvram read fail (Bookmark_use_history):"+e);}
}
if(tmp){
tmp=sysutil.tconv.binary_to_string(tmp);
try{
this.use_history=eval(tmp);}catch(e){
console_log("[read_use_history]eval fail (Bookmark_use_history):"+e);
this.use_history={};
this.use_history.bookmark_use_history=[];}
}else{
this.use_history={};
this.use_history.bookmark_use_history=[];}
};
bookmark.write_use_history=function(){
try{
apps_nvram_file.write({"filename":"Bookmark_use_history_bk",
"data":this.use_history.toSource(),
async:false,finished:function(){},product_id:"home"});
apps_nvram_file.rename({"from":"Bookmark_use_history_bk",
"to":"Bookmark_use_history",product_id:"home"});}catch(e){
console_log("[write_use_history]nvram wite fail (Bookmark_use_history):"+e);}
};
bookmark.push_use_history=function(tm,dt,id){
var tmp={"times":tm,
"date":dt,
"profile_id":id,
"use_count":"1"};
this.use_history.bookmark_use_history.push(tmp);
this.write_use_history();};
bookmark.get_profile_id=function(){
return USER_PROFILE_ID+"";};
bookmark.get_today=function(){
var toDay=new Date();
var dt=(new Date(toDay.getFullYear(),toDay.getMonth(),toDay.getDate())).getTime()+"";
return dt;}
bookmark.set_use_history=function(tm){
var dt=this.get_today();
var id=this.get_profile_id();
this.push_use_history(tm,dt,id);};
bookmark.count_use_history=function(url){
var tm=null;
for(var i in this.data.bookmarkpanel){
if(this.data.bookmarkpanel[i].url==url){
tm=this.data.bookmarkpanel[i].times;
break;}
}
if(tm){
var dt=this.get_today();
var id=this.get_profile_id();
var ret=false;
for(var i in this.use_history.bookmark_use_history){
if((this.use_history.bookmark_use_history[i].times==tm)&&
(this.use_history.bookmark_use_history[i].date==dt)&&
(this.use_history.bookmark_use_history[i].profile_id==id)){
this.use_history.bookmark_use_history[i].use_count=
(Number(this.use_history.bookmark_use_history[i].use_count)+1)+"";
this.write_use_history();
ret=true;
break;}
}
if(!ret){
this.push_use_history(tm,dt,id);}
}
this.update_use_history();};
bookmark.delete_use_history=function(url){
var tm=null;
for(var i in this.data.bookmarkpanel){
if(this.data.bookmarkpanel[i].url==url){
tm=this.data.bookmarkpanel[i].times;
break;}
}
if(tm){
var len=this.use_history.bookmark_use_history.length;
for(var i=0;i<this.use_history.bookmark_use_history.length;i++){
if(this.use_history.bookmark_use_history[i].times==tm){
this.use_history.bookmark_use_history.splice(i,1);
i--;}
}
if(len>this.use_history.bookmark_use_history.length)
this.write_use_history();}
};
bookmark.update_use_history=function(){
var toDay=new Date();
var oldYear=toDay.getFullYear();
var oldMonth=toDay.getMonth()-1;
var oldDate=toDay.getDate();
var endDate=(new Date(toDay.getFullYear(),toDay.getMonth(),0)).getDate();
if(endDate<toDay.getDate()){
oldYear=toDay.getFullYear();
oldMonth=toDay.getMonth();
oldDate=1;}else{
if(oldMonth<0){
oldYear--;
oldMonth=11;}
}
var oldDay=new Date(oldYear,oldMonth,oldDate);
var od=oldDay.getTime();
var len=this.use_history.bookmark_use_history.length;
for(var i=0;i<this.use_history.bookmark_use_history.length;i++){
if(Number(this.use_history.bookmark_use_history[i].date)<od){
this.use_history.bookmark_use_history.splice(i,1);
i--;}
}
if(len>this.use_history.bookmark_use_history.length)
this.write_use_history();};
bookmark.free=function(){
side_window.free();};
function bookmark_focus(img_line,img_angle){
this.superClass=container;
this.superClass({
visible_p:false,
translate:[0,0,100],
rotation:[0,0,1,0],
components:[]
});
var color=system.fdp_color.FCS;
this.ary_loaded_img=[];
var img_l=img_line?img_line:bookmark_focus.prototype.IMG_PATH+"focus_line.png";
var img_a=img_angle?img_angle:bookmark_focus.prototype.IMG_PATH+"focus_angle.png";

this.components=[
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[0,0,0,1],color:color,
onload:this.onload,onerror:this.onload}),
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[90,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,}),
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[180,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,}),
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[-90,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,}),

new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[-90,0,0,1],color:color,
onload:this.onload,onerror:this.onload}),
new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[0,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,}),
new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[90,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,}),
new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[180,0,0,1],color:color,
onload:bookmark_focus.prototype.NULL_FUNCTION,})
];};
bookmark_focus.prototype=new container({});
bookmark_focus.prototype.NULL_FUNCTION=function(){};
bookmark_focus.prototype.IMG_PATH=PALTINUM_PATH_IMG;
bookmark_focus.prototype.ary_loaded_img=[];bookmark_focus.prototype.onload=function(){
force_redraw();
return;};
bookmark_focus.prototype.width=0;
bookmark_focus.prototype.height=0;
bookmark_focus.prototype.color=[255,255,255,255];
bookmark_focus.prototype.setSize=function(w,h){
w=Math.floor(w);
h=Math.floor(h);
this.width=w;
this.height=h;
this.components[0].width=w-8;
this.components[2].width=w-8;
this.components[1].width=h-8;
this.components[3].width=h-8;
this.components[0].translate[1]=h/2+4;
this.components[2].translate[1]=-h/2-4;
this.components[1].translate[0]=-w/2-4;
this.components[3].translate[0]=w/2+4;
this.components[0+4].translate[1]=h/2+4;
this.components[2+4].translate[1]=-h/2-4;
this.components[1+4].translate[0]=-w/2-4;
this.components[3+4].translate[0]=w/2+4;
this.components[0+4].translate[0]=w/2+4;
this.components[2+4].translate[0]=-w/2-4;
this.components[1+4].translate[1]=h/2+4;
this.components[3+4].translate[1]=-h/2-4;};
bookmark_focus.prototype.setTranslate=function(x,y,z){
this.translate[0]=x;
this.translate[1]=y;
this.translate[2]=z;};
bookmark_focus.prototype.setShow=function(b){
console_log("[bookmark_focus.setShow]"+b);
if((b)||(this.visible_p!=b)){
this.visible_p=b;
force_redraw();}
};
bookmark_focus.prototype.isShow=function(){
return this.visible_p;};
bookmark_focus.prototype.setColor=function(color){
for(var i in this.components){
this.components[i].color=color;}
};
bookmark_focus.prototype.free=function(){
this.components[0].src="";
this.components[1].src="";
this.components[2].src="";
this.components[3].src="";
this.components[4].src="";
this.components[5].src="";
this.components[6].src="";
this.components[7].src="";};
var set_cursor=function(o_obj,cobj){
common_key.set_cursor(o_obj,cobj);};
var MUS_settings={
WIDTH:1920,HEIGHT:1080,
DEFAULT_ICON_WIDTH:36,DEFAULT_ICON_HEIGHT:36,
CURRENT_ICON_WIDTH:48,CURRENT_ICON_HEIGHT:48,
TOP_POS_Y:9,
FONT_SIZE:20,
LIST_MAX_COUNT:6,
EXPAN_SCALE:0.33,SCALE_UNIT:10,
APPEAR_ALPHA:85,VANISH_ALPHA:51,
png_path:PALTINUM_PATH_IMG,
NAME_MAX_WIDTH:160,
PROFILE_ALL:W_TEXT.WB_LT_BOOKMARK_ALL_USERS,
ICON_SPACE:16,
};
var MUS_FREE=function(){
if(!this.components||this.components.length==0)
return;
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gtext||this.components[i] instanceof gtextbox)
setf_text(this.components[i],"");
else if(this.components[i] instanceof gimage)
this.components[i].src="";
else if(typeof this.components[i].free=="function")
this.components[i].free();}
this.components.splice(0,this.components.length);};
var MUS_user_icon=function(param){
this.select_action=null;
this.return_action=null;
this.user_info=param.info||{};
this.components=[
this.frame=new gimage({
width:MUS_settings.CURRENT_ICON_WIDTH+4,
height:MUS_settings.CURRENT_ICON_HEIGHT+4,
draw_type:DIRECT,
src:MUS_settings.png_path+"cyan_circle.png",
}),
this.focus=new gimage({
width:param.width||MUS_settings.DEFAULT_ICON_WIDTH,
height:param.height||MUS_settings.DEFAULT_ICON_HEIGHT,
draw_type:DIRECT,
src:param.focus_icon||"",
color:[255,255,255,0],
visible_p:false,blend:true
}),
this.user_icon=new gimage({
width:param.width||MUS_settings.DEFAULT_ICON_WIDTH,
height:param.height||MUS_settings.DEFAULT_ICON_HEIGHT,
draw_type:DIRECT,blend:true,
src:param.icon||MUS_settings.png_path+"cyan_circle.png",
}),
this.name=new gtext({
width:MUS_settings.DEFAULT_ICON_WIDTH,
align:CENTER,font_size:MUS_settings.FONT_SIZE,
omitter:"...",
text:param.name||"",
})
];};
MUS_user_icon.prototype=new container({});
MUS_user_icon.prototype.free=MUS_FREE;
MUS_user_icon.prototype.mouseover=function(obj){
this.onFocus();};
MUS_user_icon.prototype.mouseout=function(obj){
this.offFocus();};
MUS_user_icon.prototype.action=function(obj){
MultiUserSelection.set_index(this.index);
this.select_action(this.user_info);};
MUS_user_icon.prototype.set_pos=function(pos){
this.translate=pos||[0,0,0];};
MUS_user_icon.prototype.setData=function(param){
this.index=(param.index!=null)?param.index:-1;
this.name.width=param.name_width;
this.name.translate=param.name_pos||[0,0,0];
this.name.font_size=param.name_size||20;
setf_text(this.name,this.name.text);
this.name.color=param.name_color.slice();
this.name.color[3]=0;
this.user_icon.width=param.icon_w||MUS_settings.DEFAULT_ICON_WIDTH;
this.user_icon.height=param.icon_h||MUS_settings.DEFAULT_ICON_HEIGHT;
this.user_icon.color=param.icon_color.slice();
this.frame.width=param.frame_w||this.user_icon.width+6;
this.frame.height=param.frame_h||this.user_icon.height+6;
var frame_view=param.frame_view||false;
if(frame_view){
this.focus.width=param.focus_width||
this.frame.width+Math.floor(this.frame.width*MUS_settings.EXPAN_SCALE);
this.focus.height=param.focus_height||
this.frame.height+Math.floor(this.frame.height*MUS_settings.EXPAN_SCALE);}else {
this.focus.width=param.focus_width||
this.user_icon.width+Math.floor(this.user_icon.width*MUS_settings.EXPAN_SCALE);
this.focus.height=param.focus_height||
this.user_icon.height+Math.floor(this.user_icon.height*MUS_settings.EXPAN_SCALE);}
this.frame_view(frame_view);
this.select_action=param.select_action||function(){};
this.return_action=param.return_action||function(){};};
MUS_user_icon.prototype.frame_view=function(bool){
this.frame.visible_p=bool;};
MUS_user_icon.prototype.zoom_focus=function(){
if(this.frame.visible_p){
this.focus.width=this.frame.width
+Math.floor(this.frame.width*MUS_settings.EXPAN_SCALE);
this.focus.height=this.frame.height
+Math.floor(this.frame.height*MUS_settings.EXPAN_SCALE);}else {
this.focus.width=this.user_icon.width
+Math.floor(this.user_icon.width*MUS_settings.EXPAN_SCALE);
this.focus.height=this.user_icon.height
+Math.floor(this.user_icon.height*MUS_settings.EXPAN_SCALE);}
};
MUS_user_icon.prototype.reduce_focus=function(){
this.focus.width=this.user_icon.width
+Math.floor(this.user_icon.width*MUS_settings.EXPAN_SCALE);
this.focus.height=this.user_icon.height
+Math.floor(this.user_icon.height*MUS_settings.EXPAN_SCALE);};
MUS_user_icon.prototype.onFocus=function(){
this.focus.visible_p=true;
delete_timer(this);
this.name.color[0]=COL_TEXT_ONBASE[0];
this.name.color[1]=COL_TEXT_ONBASE[1];
this.name.color[2]=COL_TEXT_ONBASE[2];
append_timer(this,40,function(obj,count){
obj.focus.color[3]+=MUS_settings.APPEAR_ALPHA;
obj.name.color[3]+=MUS_settings.APPEAR_ALPHA;
if(obj.focus.color[3]>=255){
obj.focus.color[3]=255;
obj.name.color[3]=255;
delete_timer(obj);}
force_redraw();});};
MUS_user_icon.prototype.offFocus=function(){
delete_timer(this);
this.name.color[0]=COL_TEXT_ONBASE[0];
this.name.color[1]=COL_TEXT_ONBASE[1];
this.name.color[2]=COL_TEXT_ONBASE[2];
append_timer(this,40,function(obj,count){
obj.focus.color[3]-=MUS_settings.VANISH_ALPHA;
obj.name.color[3]-=MUS_settings.VANISH_ALPHA;
if(obj.focus.color[3]<=0){
obj.focus.color[3]=0;
obj.name.color[3]=0;
delete_timer(obj);}
force_redraw();});};
MUS_user_icon.prototype.select=function(w,h){
var self=this;
delete_timer(this.user_icon);
append_timer(this.user_icon,40,function(obj,count){
obj.width+=Math.floor((obj.width-MUS_settings.SCALE_UNIT)/8);
obj.height+=Math.floor((obj.height-MUS_settings.SCALE_UNIT)/8);
self.zoom_focus();
if(obj.width>=w||obj.height>=h){
obj.width=w;
obj.height=h;
self.frame_view(true);
self.zoom_focus();
delete_timer(obj);}
force_redraw();});};
MUS_user_icon.prototype.un_select=function(w,h){
var self=this;
this.frame_view(false);
delete_timer(this.user_icon);
append_timer(this.user_icon,40,function(obj,count){
obj.width-=Math.floor((obj.width-MUS_settings.SCALE_UNIT)/8);
obj.height-=Math.floor((obj.height-MUS_settings.SCALE_UNIT)/8);
if(obj.width<=w||obj.height<=h){
obj.width=w;
obj.height=h;
self.reduce_focus();
delete_timer(obj);}
force_redraw();});};
var get_all_profile_id=function(){
var all_id=[];
try{
var profile=system.user_profile.get({});
if(profile&&profile.mhc&&profile.mhc.all){
all_id=profile.mhc.all;}
}catch(e){
console.log(e);}
return all_id;}
var get_all_user_info=function(){
if(!system.user_profile||!system.user_profile.supported)return;
var user_list=[];
var all_id=get_all_profile_id();
try{
for(var i=0;i<all_id.length;i++){
if(isNumber(all_id[i])){
var profile=system.user_profile.get({mhc:{id:all_id[i]}});
if(profile&&profile.mhc)user_list.push(profile.mhc);}
}
}catch(e){
console.log(e);}
return user_list;};
MultiUserSelection=new container({});
MultiUserSelection.create=function(){
this.visible_p=false;
this.index=0;
this.current=-1;
this.icon_list=new container({});
this.components=[
this.icon_list,
];
this.user_list=this.get_all_user_info();
this.ary_item=[];
for(var i=0;i<this.user_list.length;i++){
this.icon_list.components.push(
this.ary_item[i]=
new MUS_user_icon({
info:this.user_list[i],
focus_icon:MUS_settings.png_path+"focus.png",
icon:this.user_list[i].icon,
width:MUS_settings.DEFAULT_ICON_WIDTH,
height:MUS_settings.DEFAULT_ICON_HEIGHT,
name:this.user_list[i].name,
})
);};
var icon_png=(DEF_4K2K)?"user_all_4k.png":"user_all_2k.png";
this.icon_list.components.push(
this.ary_item[this.ary_item.length]=
new MUS_user_icon({
info:null,
focus_icon:MUS_settings.png_path+"focus.png",
icon:MUS_settings.png_path+icon_png,
width:MUS_settings.DEFAULT_ICON_WIDTH,
height:MUS_settings.DEFAULT_ICON_HEIGHT,
name:MUS_settings.PROFILE_ALL,
})
);
};
MultiUserSelection.destroy=function(){
this.list_free();
this.free();};
MultiUserSelection.free=MUS_FREE;
MultiUserSelection.list_free=function(){
for(var i=0;i<this.icon_list.components.length;i++){
this.icon_list.components[i].free();}
};
MultiUserSelection.get_all_profile_id=function(){
return get_all_profile_id();};
MultiUserSelection.get_all_user_info=function(){
return get_all_user_info();};
MultiUserSelection.get_length=function(){
return this.user_list.length;};
MultiUserSelection.set_visible=function(visible){
if(!DEF_MULTI_USER)return;
if(visible!=this.visible_p)this.visible_p=visible;};
MultiUserSelection.is_visible=function(){
return this.visible_p;};
MultiUserSelection.setShow=function(param){
if(!param)return;
var view=param.view||false;
if(view){
var self=this;
this.translate=(param.translate)?param.translate:[0,0,0];
var select_action=param.select_action||function(){};
var return_action=param.return_action||function(){};
var setting_action=param.setting_action||function(){return false};
var current_user=param.current_user||null;
var user_count=this.user_list.length;
var name_color=COL_TEXT_ONBASE;
var setting_icon_color=param.setting_icon_color||COL_ICON_ONBASE;
for(var i=0;i<user_count;i++){
var icon_w=MUS_settings.DEFAULT_ICON_WIDTH;
var icon_h=MUS_settings.DEFAULT_ICON_HEIGHT;
var frame_view=false;
if(current_user&&
isNumber(current_user.id)&&
current_user.id==this.user_list[i].id){
icon_w=MUS_settings.CURRENT_ICON_WIDTH;
icon_h=MUS_settings.CURRENT_ICON_HEIGHT;
frame_view=true;
this.current=i;};
this.icon_list.components[i].setData({
name_width:param.name_width||MUS_settings.NAME_MAX_WIDTH,
name_pos:[0,-35,0],name_color:name_color,
icon_w:icon_w,icon_h:icon_h,icon_color:[255,255,255,255],
frame_w:MUS_settings.CURRENT_ICON_WIDTH+6,
frame_h:MUS_settings.CURRENT_ICON_HEIGHT+6,
frame_view:frame_view,
select_action:function(info){
if(self.index==self.current)return;
select_action(info,function(){self.icon_select()});},
return_action:return_action,
index:i,
});}
if(current_user&&
isNumber(current_user.id)&&
current_user.id==-1){
icon_w=MUS_settings.CURRENT_ICON_WIDTH;
icon_h=MUS_settings.CURRENT_ICON_HEIGHT;
frame_view=true;
this.current=user_count;}else{
icon_w=MUS_settings.DEFAULT_ICON_WIDTH;
icon_h=MUS_settings.DEFAULT_ICON_HEIGHT;
var frame_view=false;}
this.icon_list.components[user_count].setData({
name_width:param.name_width||MUS_settings.NAME_MAX_WIDTH,
name_pos:[0,-35,0],name_color:name_color,
icon_w:icon_w,icon_h:icon_h,icon_color:[255,255,255,255],
frame_w:MUS_settings.CURRENT_ICON_WIDTH+6,
frame_h:MUS_settings.CURRENT_ICON_HEIGHT+6,
frame_view:frame_view,
select_action:function(info){
if(self.index==self.current)return;
select_action(info,function(){self.icon_select()});},
return_action:return_action,
index:user_count,
});
var icon_len=this.icon_list.components.length;
var align_left=
-(MUS_settings.CURRENT_ICON_WIDTH*icon_len+(icon_len-1)*MUS_settings.ICON_SPACE)/2;
for(var i=0;i<this.icon_list.components.length;i++){
var pos_x=align_left
+MUS_settings.CURRENT_ICON_WIDTH/2
+MUS_settings.CURRENT_ICON_WIDTH*i
+MUS_settings.ICON_SPACE*i;
this.icon_list.components[i].set_pos([pos_x,MUS_settings.TOP_POS_Y,0]);};
var set_icon_pos=this.icon_list.components[icon_len-1].translate;
this.visible_p=true;
}else {
this.visible_p=false;}
};
MultiUserSelection.set_index=function(index){
this.index=index;};
MultiUserSelection.icon_select=function(){
if(this.current>=0){
var reduce_w=MUS_settings.DEFAULT_ICON_WIDTH;
var reduce_h=MUS_settings.DEFAULT_ICON_HEIGHT;
this.icon_list.components[this.current].un_select(reduce_w,reduce_h);}
var zoom_w=MUS_settings.CURRENT_ICON_WIDTH;
var zoom_h=MUS_settings.CURRENT_ICON_HEIGHT;
this.icon_list.components[this.index].select(zoom_w,zoom_h);
this.current=this.index;};
MultiUserSelection.enter_focus=function(){
};
MultiUserSelection.leave_focus=function(){
focus.setShow(true);
set_cursor(this,null);};
MultiUserSelection.get_obj=function(){
var list=[];
for(var i=0;i<this.ary_item.length;i++){
list.push(this.ary_item[i]);}
return list;};
var MUF_settings={
BASE_HEIGHT:110,
BASE_MAX_WIDTH:406,
ICON_WIDTH:46,ICON_HEIGHT:46,
TOP_POS_Y:22,
FONT_SIZE:20,
LIST_MAX_COUNT:6,
APPEAR_ALPHA:85,VANISH_ALPHA:51,
png_path:PALTINUM_PATH_IMG,
NAME_MAX_WIDTH:94,
ICON_SPACE:16,ICON_MARGIN:25,
CHECKBOX_WIDTH:20,CHECKBOX_HEIGHT:20,
CHECKBOX_POS_Y:-58,
GUIDE_HEIGHT:110,
GUIDE_MAX_WIDTH:500,
GUIDE_TEXT:W_TEXT.WB_LT_TIPS_SELECT_PROFILE,
GUIDE_TEXT_MARGIN:25,
};
var MUF_FREE=function(){
if(!this.components||this.components.length==0)
return;
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gtext||this.components[i] instanceof gtextbox)
setf_text(this.components[i],"");
else if(this.components[i] instanceof gimage)
this.components[i].src="";
else if(typeof this.components[i].free=="function")
this.components[i].free();}
this.components.splice(0,this.components.length);};
var MUF_user_icon=function(param){
this.return_action=null;
this.user_info=param.info||{};
this.components=[
this.frame=new gimage({
width:MUF_settings.ICON_WIDTH+4,
height:MUF_settings.ICON_HEIGHT+4,
draw_type:DIRECT,
src:MUF_settings.png_path+"cyan_circle.png",
}),
this.user_icon=new gimage({
width:MUF_settings.ICON_WIDTH,
height:MUF_settings.ICON_HEIGHT,
draw_type:DIRECT,blend:true,
src:param.icon||MUF_settings.png_path+"cyan_circle.png",
}),
this.name=new gtext({
width:MUF_settings.NAME_MAX_WIDTH,
align:CENTER,font_size:MUF_settings.FONT_SIZE,
omitter:"...",
text:param.name||"",
}),
this.checkbox=new container({}),
this.focus=new bookmark_focus(),
];
this.checkbox.components=[
this.checkbox.btn_normal=new gbox({
color:system.fdp_color.ICON_ONBASE,
width:MUF_settings.CHECKBOX_WIDTH,height:MUF_settings.CHECKBOX_HEIGHT,
}),
this.checkbox.img_act=new gbox({
color:system.fdp_color.ICON_ONPOINT,
width:MUF_settings.CHECKBOX_WIDTH,height:MUF_settings.CHECKBOX_HEIGHT,
visible_p:false,
}),
this.checkbox.check=new gimage({
src:PALTINUM_PATH_IMG+"check.png",
width:MUF_settings.CHECKBOX_WIDTH,height:MUF_settings.CHECKBOX_HEIGHT,
onload:this.onload_func,
visible_p:false,
}),
];
this.focus.setSize(MUF_settings.CHECKBOX_WIDTH-6,MUF_settings.CHECKBOX_HEIGHT-6);
this.focus.setTranslate(0,0,0);};
MUF_user_icon.prototype=new container({});
MUF_user_icon.prototype.free=MUF_FREE;
MUF_user_icon.prototype.mouseover=function(obj){
this.onFocus();};
MUF_user_icon.prototype.mouseout=function(obj){
this.offFocus();};
MUF_user_icon.prototype.action=function(obj){
this.checkbox.check.visible_p=!this.checkbox.check.visible_p;
force_redraw();};
MUF_user_icon.prototype.set_pos=function(pos){
this.translate=pos||[0,0,0];};
MUF_user_icon.prototype.setData=function(param){
this.index=(param.index!=null)?param.index:-1;
this.name.width=param.name_width;
this.name.translate=param.name_pos||[0,0,0];
this.name.font_size=param.name_size||MUF_settings.FONT_SIZE;
setf_text(this.name,this.name.text);
this.name.color=param.name_color.slice();
this.name.color[3]=0;
this.user_icon.width=param.icon_w||MUF_settings.ICON_WIDTH;
this.user_icon.height=param.icon_h||MUF_settings.ICON_HEIGHT;
this.user_icon.color=param.icon_color.slice();
this.frame.width=param.frame_w||this.user_icon.width+6;
this.frame.height=param.frame_h||this.user_icon.height+6;
this.frame.visible_p=false;
this.focus.translate=[0,MUF_settings.CHECKBOX_POS_Y,0];
this.checkbox.translate=[0,MUF_settings.CHECKBOX_POS_Y,0];
this.checkbox.check.visible_p=param.check_visible;
this.return_action=param.return_action||function(){};};
MUF_user_icon.prototype.onFocus=function(){
this.focus.visible_p=true;
delete_timer(this);
append_timer(this,40,function(obj,count){
var color=[];
color[0]=obj.focus.components[0].color[0];
color[1]=obj.focus.components[0].color[1];
color[2]=obj.focus.components[0].color[2];
color[3]=obj.focus.components[0].color[3]+MUF_settings.APPEAR_ALPHA;
obj.focus.setColor(color);
obj.name.color[3]+=MUF_settings.APPEAR_ALPHA;
if(color[3]>=255){
color[3]=255;
obj.focus.setColor(color);
obj.name.color[3]=255;
delete_timer(obj);}
force_redraw();});};
MUF_user_icon.prototype.offFocus=function(){
delete_timer(this);
append_timer(this,40,function(obj,count){
var color=[];
color[0]=obj.focus.components[0].color[0];
color[1]=obj.focus.components[0].color[1];
color[2]=obj.focus.components[0].color[2];
color[3]=obj.focus.components[0].color[3]-MUF_settings.VANISH_ALPHA;
obj.focus.setColor(color);
obj.name.color[3]-=MUF_settings.VANISH_ALPHA;
if(color[3]<=0){
color[3]=0;
obj.focus.setColor(color);
obj.name.color[3]=0;
delete_timer(obj);}
force_redraw();});};
MultiUserFavorite=new container({});
MultiUserFavorite.create=function(){
this.visible_p=false;
this.index=0;
this.current=-1;
this.icon_list=new container({});
this.components=[
this.icon_base=new gbox({
width:MUF_settings.BASE_MAX_WIDTH,
height:MUF_settings.BASE_HEIGHT,
color:system.fdp_color.POP,
visible_p:false
}),
this.guide=new container({components:[
this.guide_base=new gbox({
width:MUF_settings.GUIDE_MAX_WIDTH,
height:MUF_settings.GUIDE_HEIGHT,
color:system.fdp_color.POP,
visible_p:false
}),
this.guide_text=new gtextbox({
width:MUF_settings.GUIDE_MAX_WIDTH,
height:MUF_settings.GUIDE_HEIGHT,
color:system.fdp_color.TEXT_ONBASE,
text:MUF_settings.GUIDE_TEXT,
align:LEFT,
valign:MIDDLE,
visible_p:false
}),
]}),
this.icon_list,
];
this.user_list=this.get_all_user_info();
this.ary_item=[];
if(this.user_list.length>0){
for(var i=0;i<this.user_list.length;i++){
this.icon_list.components.push(
this.ary_item[i]=
new MUF_user_icon({
info:this.user_list[i],
icon:this.user_list[i].icon,
name:this.user_list[i].name,
})
);}
}
};
MultiUserFavorite.destroy=function(){
this.list_free();
this.free();};
MultiUserFavorite.free=MUF_FREE;
MultiUserFavorite.list_free=function(){
if(this.icon_list==null)return;
for(var i=0;i<this.icon_list.components.length;i++){
this.icon_list.components[i].free();}
};
MultiUserFavorite.get_all_profile_id=function(){
return get_all_profile_id();};
MultiUserFavorite.get_all_user_info=function(){
return get_all_user_info();};
MultiUserFavorite.set_visible=function(visible){
if(!DEF_MULTI_USER)return;
if(visible!=this.visible_p)this.visible_p=visible;};
MultiUserFavorite.is_visible=function(){
return this.visible_p;};
MultiUserFavorite.setShow=function(param){
if(!param)return;
var view=param.view||false;
if(view){
var self=this;
this.translate=(param.translate)?param.translate:[0,0,0];
this.translate[1]+=MUF_settings.BASE_HEIGHT/2
var submenu_index=param.submenu_index||0;
var bookmark_index=param.bookmark_index||0;
this.return_action=param.return_action||function(){};
var user_count=this.user_list.length;
var name_color=COL_TEXT_ONBASE;
if(user_count>0){
this.icon_base.width=MUF_settings.ICON_WIDTH*user_count
+MUF_settings.ICON_SPACE*(user_count-1)+MUF_settings.ICON_MARGIN*2;
this.icon_base.visible_p=true;
var text_width=get_text_width(this.guide_text,this.guide_text.text);
if(text_width>MUF_settings.GUIDE_MAX_WIDTH){
this.guide_text.font_size=
getFontSizeOfText(this.guide_text,this.guide_text.text,20);}else{
this.guide_text.width=text_width;}
setf_text(this.guide_text,this.guide_text.text);
this.guide_text.visible_p=true;
this.guide_base.width=text_width+MUF_settings.GUIDE_TEXT_MARGIN*2;
this.guide_base.visible_p=true;
this.guide.translate[0]=(this.icon_base.width/2+this.guide_base.width/2)+1;
this.translate[0]+=this.icon_base.width/2;
var profile_id=bookmark.data.bookmarkpanel[bookmark_index].profile_id;
for(var i=0;i<user_count;i++){
var check_visible=false;
if(profile_id instanceof Array){
for(var j in profile_id){
if(this.icon_list.components[i].user_info.id==profile_id[j]){
check_visible=true;
break;}
}
}else{
if(this.icon_list.components[i].user_info.id==profile_id){
check_visible=true;
break;}
}
this.icon_list.components[i].setData({
name_width:param.name_width||MUF_settings.NAME_MAX_WIDTH,
name_pos:[0,-32,0],name_color:name_color,
icon_w:MUF_settings.ICON_WIDTH,
icon_h:MUF_settings.ICON_HEIGHT,
icon_color:[255,255,255,255],
frame_w:MUF_settings.ICON_WIDTH+6,
frame_h:MUF_settings.ICON_HEIGHT+6,
check_visible:check_visible,
return_action:this.return_action,
index:i,
});}
var icon_len=this.icon_list.components.length;
var align_left=
-(MUF_settings.ICON_WIDTH*icon_len+(icon_len-1)*MUF_settings.ICON_SPACE)/2;
for(var i=0;i<this.icon_list.components.length;i++){
var pos_x=align_left
+MUF_settings.ICON_WIDTH/2
+MUF_settings.ICON_WIDTH*i
+MUF_settings.ICON_SPACE*i;
this.icon_list.components[i].set_pos([pos_x,MUF_settings.TOP_POS_Y,0]);};
pointer_table=get_pointer_table("submenu_user"+submenu_index);
pointer_table.length=this.ary_item.length;
set_pointer_obj(this.ary_item,0);
set_cursor(submenu,this);
set_cursor(this,this.ary_item);}
this.visible_p=true;}else {
this.visible_p=false;}
};
MultiUserFavorite.enter_focus=function(){
};
MultiUserFavorite.leave_focus=function(){
var profile_id=["-1"];
for(var i=0,j=0;i<this.icon_list.components.length;i++){
if(this.icon_list.components[i].checkbox.check.visible_p){
profile_id[j++]=this.icon_list.components[i].user_info.id+"";}
}
set_cursor(this,null);
this.destroy();
this.return_action(profile_id);};
provide("pkg_bookmark");
