function log(){return null;};
var console_log=log;
try{
if(configure){
console_log("pkg_browser 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_SIDE_WINDOW=configure.DEF_SIDE_WINDOW;var DEF_SIDE_TV=configure.DEF_SIDE_TV;var DEF_CHANGE_SCREEN=configure.DEF_CHANGE_SCREEN;var DEF_ASR=configure.DEF_ASR;
var DEF_DISABLE_FLASH=configure.DEF_DISABLE_FLASH;
var side_w_mode=DEF_SIDE_WINDOW;
var COORDINATE_CONV=(DEF_4K2K)?2:1;
var DEF_BROWSER_H=960;
var DEF_TOOLBAR_H=85;
var STREAM_TEXTURE_ENABLE=(system.mdl_cfg.with_bp_transit_effect&&!DEF_4K2K)?true:false;
var DEF_FOCUS_HEIGHT_MIN=14;
var DEF_FOCUS_ADJUSTMENT=3;
if(!DEF_CHANGE_SCREEN){
var DEF_BRW_NAGARA_TRANSLATE=[300,0,0];
var DEF_BRW_NAGARA_SCROLL_X=0;}else{
var DEF_BRW_NAGARA_TRANSLATE=[0,0,0];
var DEF_BRW_NAGARA_SCROLL_X=280;}
var DEF_BRW_NAGARA_W=1280;
var DEF_BRW_NAGARA_H=DEF_BROWSER_H;
var DEF_BRW_NAGARA_RS_W=1024;
var DEF_BRW_NAGARA_RS_H=768;
var DEF_BRW_NAGARA_OFFSET_X=600;
var DEF_BRW_FULL_TRANSLATE=[0,0,0];
var DEF_BRW_FULL_W=1884;
var DEF_BRW_FULL_H=DEF_BROWSER_H;
var DEF_BRW_FULL_RS_W=1256;
var DEF_BRW_FULL_RS_H=640;
var DEF_BRW_FULL_OFFSET_X=0;
if(!DEF_4K2K){
var DEF_BRW_FULL_SCROLL_X=0;
var DEF_BROWSER_SCROLL_OFFSET_Y=0;}else{
var DEF_BRW_FULL_SCROLL_X=-18;var DEF_BROWSER_SCROLL_OFFSET_Y=-25;}
var PALTINUM_PATH_IMG="file:///usr/local/application/0077777700140002/gadget/img/";
if(DEF_SIDE_WINDOW){
DEF_BROWSER_TRANSLATE=DEF_BRW_NAGARA_TRANSLATE;
DEF_BROWSER_WIDTH=DEF_BRW_NAGARA_W;DEF_BROWSER_HEIGHT=DEF_BRW_NAGARA_H;
DEF_BROWSER_RS_WIDTH=DEF_BRW_NAGARA_RS_W;DEF_BROWSER_RS_HEIGHT=DEF_BRW_NAGARA_RS_H;
DEF_BROWSER_PB_WIDTH=DEF_BRW_NAGARA_W*COORDINATE_CONV;DEF_BROWSER_PB_HEIGHT=DEF_BRW_NAGARA_H*COORDINATE_CONV;
DEF_BROWSER_NAGARA_OFFSET_X=DEF_BRW_NAGARA_OFFSET_X;
DEF_BROWSER_SCROLL_OFFSET_X=DEF_BRW_NAGARA_SCROLL_X;}else{
DEF_BROWSER_TRANSLATE=DEF_BRW_FULL_TRANSLATE;
DEF_BROWSER_WIDTH=DEF_BRW_FULL_W;DEF_BROWSER_HEIGHT=DEF_BRW_FULL_H;
DEF_BROWSER_RS_WIDTH=DEF_BRW_FULL_RS_W;DEF_BROWSER_RS_HEIGHT=DEF_BRW_FULL_RS_H;
DEF_BROWSER_PB_WIDTH=DEF_BRW_FULL_W*COORDINATE_CONV;DEF_BROWSER_PB_HEIGHT=DEF_BRW_FULL_H*COORDINATE_CONV;
DEF_BROWSER_NAGARA_OFFSET_X=DEF_BRW_FULL_OFFSET_X;
DEF_BROWSER_SCROLL_OFFSET_X=DEF_BRW_FULL_SCROLL_X;}
var DEF_RS_SIZE_W=DEF_BROWSER_WIDTH/DEF_BROWSER_RS_WIDTH;
var DEF_RS_SIZE_H=DEF_BROWSER_HEIGHT/DEF_BROWSER_RS_HEIGHT;
var DEF_BROWSER_FULLSCREEN=false;
var DEF_BROWSER_ENABLE_FOCUS_OUT=[0,0,0,0,1];var DEF_BROWSER_ENABLE_PAGEBACK=false;
var DEF_BROWSER_IGNORE_FOCUS_MV=[1,1];var DEF_BROWSER_FOCUS_IN_TABMOVE=1;
var DEF_SCROLL_TICK=Math.floor(160/2);
var DEF_BROWSER_RESIZE_X=0;
var BROWSER_TIMEOUT_COUNT=120;var BROWSER_DISCONNECTED=0;
var BROWSER_LAUNCHED=1;
var BROWSER_CONNECTED=2;
var BROWSER_LOADING=3;
var BROWSER_LOAD_FAILED=4;
var BROWSER_LOAD_FINISHED=5;
var brw_connection=BROWSER_DISCONNECTED;
var pb_version="0.0.0";
var ajax_version=system.player_version;
var position_x=Math.floor(DEF_BROWSER_WIDTH/2);
var position_y=Math.floor(DEF_BROWSER_HEIGHT/2);
var contents_w;
var contents_h;
var contents_org_w;
var contents_org_h;
var contents_zoom1_w=0;
var contents_zoom1_h=0;
var use_tts=false;
var TIMER_RESOLUTION=40;
if(DEF_4K2K){
var DEF_PIXMAP_DEF_W=960;
var DEF_PIXMAP_DEF_H=540;
var DEF_PIXMAP_DEF_H_MARGIN=4;
var DEF_PIXMAP_DEF_RF_W=1024;
var DEF_PIXMAP_DEF_RF_H=576;
var DEF_PIXMAP_BIG_W=1280;
var DEF_PIXMAP_BIG_H=945;
var DEF_PIXMAP_BIG_RF_W=1024;
var DEF_PIXMAP_BIG_RF_H=756;}else {
var DEF_PIXMAP_DEF_W=480;
var DEF_PIXMAP_DEF_H=270;
var DEF_PIXMAP_DEF_H_MARGIN=10;
var DEF_PIXMAP_DEF_RF_W=1024;
var DEF_PIXMAP_DEF_RF_H=576;
var DEF_PIXMAP_BIG_W=1280;
var DEF_PIXMAP_BIG_H=945;
var DEF_PIXMAP_BIG_RF_W=1024;
var DEF_PIXMAP_BIG_RF_H=756;}
var DEF_PIXMAP_4K_W=800;
var DEF_PIXMAP_4K_H=944;
var DEF_PIXMAP_4K_RF_W=1024;
var DEF_PIXMAP_4K_RF_H=1148;
BROWSER_ERROR_EV="error";
BROWSER_ALERT_EV="alert";
BROWSER_CONFIRM_EV="confirm";
BROWSER_INSECURE_EV="insecure";
BROWSER_CAN_NOT_PLAY_EV="can_not_play";
function animation(init){
this.superClass=container;
this.superClass(init);

this.count=0;
this.id=null;};
animation.prototype=new container({});
animation._anim_objs=new Array();
animation._anim_objs_len=0;
animation._anim_timer={};
animation._anim_INTERVAL=150.0;
animation._anim_id_seed=0;
animation.start_timer=function (){
animation._start_timer();};
animation.stop_timer=function (){
animation._stop_timer();};
animation.redraw=function (){
for(key in animation._anim_objs){
if(typeof animation._anim_objs[key].do_anim=="function"){
animation._anim_objs[key]._do_anim();}
}
if(animation._anim_objs_len>0)
force_redraw();};
animation._start_timer=function (){
if(animation._anim_objs_len==1){
delete_timer(animation._anim_timer);
append_timer(animation._anim_timer,animation._anim_INTERVAL,animation.redraw);}
};
animation._stop_timer=function (){
if(animation._anim_objs_len<=0){
delete_timer(animation._anim_timer);
force_redraw();}
};
animation.prototype.clear_param=function(){
this.count=0;
this.id=null;
animation._anim_objs=new Array();
animation._anim_objs_len=0;
delete_timer(animation._anim_timer);};
animation.prototype.anim_start=function (){
if(this.id==null){
this.count=0;
this.id=this._get_id();
animation._anim_objs[this.id]=this;
animation._anim_objs_len=animation._anim_objs_len+1;
animation._start_timer();}else {
this.count=0;}
};
animation.prototype.anim_finish=function (){
if(this.id!=null){
animation._anim_objs[this.id].move_to_end();
delete animation._anim_objs[this.id];
animation._anim_objs_len=animation._anim_objs_len-1;
this.id=null;
this.count=0;}
animation._stop_timer();};
animation.prototype._get_id=function (){
if(animation._anim_id_seed>10000){
animation._anim_id_seed=0;}else {
animation._anim_id_seed=animation._anim_id_seed+1;}
return ""+Date.parse(new Date())+animation._anim_id_seed;};
animation.prototype._do_anim=function (){
if(typeof this.do_anim=="function"){
this.do_anim(this.count);}
this.count=this.count+1;};
animation.prototype.do_anim=function (){

};
animation.prototype.move_to_end=function (){

};
animation.prototype.get_frame_rate=function (anim_speed){
return anim_speed/animation._anim_INTERVAL;};

var BRW_VER_COMP_VIDEOBOX="1.3.1";
var BRW_VER_FLASH_FULL="1.4.1";
var version_more_than=function(t_version,version){
var t_ver=t_version;
var p_ver=version;
t_ver=t_ver.split(".");
p_ver=p_ver.split(".");
for(var i=0;i<t_ver.length;i++){
if(parseInt(t_ver[i])<parseInt(p_ver[i])){
return true;}else if(parseInt(t_ver[i])>parseInt(p_ver[i])){
return false;}
}
return true;};
var check_pb_version=function (ver){
var ret=false;
ret=version_more_than(ver,pb_version);
return ret;};
function get_browser_cache_size(stage){
if(system.locale.country.indexOf("JP")==0){
if(stage==HOME){
return 0;}
else if(system.board.indexOf("PRO4")!=-1){
return 32*1024*1024;}
else {
return 8*1024*1024;}
}
else if(system.board.indexOf("PRO4")!=-1){
return 32*1024*1024;}
return 0;};
var AJAX_VER_SCROLL_POINTER="0.50.2";
var check_ajax_version=function (ver){
var ret=false;
ret=version_more_than(ver,ajax_version);
return ret;};
var calc_draw_pos=function(x,y,w,h){
var param={};
var zoom_info=brw_obj.zoom_info.get();
if(brw_obj.zoom_info.get_level()>1){
var tmp_x=Math.round((x/COORDINATE_CONV-zoom_info.x)*
zoom_info.size)-960+DEF_BROWSER_NAGARA_OFFSET_X;
var tmp_y=-(Math.round((y/COORDINATE_CONV-zoom_info.y)*
zoom_info.size)-540)-DEF_TOOLBAR_H;}else{
var tmp_x=Math.round(x/COORDINATE_CONV*zoom_info.size)-960+
DEF_BROWSER_NAGARA_OFFSET_X;
var tmp_y=-(Math.round(y/COORDINATE_CONV*zoom_info.size)-540)-DEF_TOOLBAR_H;}
param.w=Math.round(w/COORDINATE_CONV*zoom_info.size);
param.h=Math.round(h/COORDINATE_CONV*zoom_info.size);
param.x=tmp_x+param.w/2;
param.y=tmp_y-param.h/2;
param.y+=DEF_FOCUS_ADJUSTMENT;
return param;};
var calc_draw_pos_forFocus=function(x,y,w,h){
var param={};
var zoom_info=brw_obj.zoom_info.get();
if(brw_obj.zoom_info.get_level()>1){
var tmp_x=Math.round((x/COORDINATE_CONV-zoom_info.x)*
zoom_info.size)-960+DEF_BROWSER_NAGARA_OFFSET_X;
var tmp_y=-(Math.round((y/COORDINATE_CONV-zoom_info.y)*
zoom_info.size)-540)-DEF_TOOLBAR_H;}else{
var tmp_x=Math.round(x/COORDINATE_CONV*zoom_info.size)-960+DEF_BROWSER_NAGARA_OFFSET_X;
var tmp_y=-(Math.round(y/COORDINATE_CONV*zoom_info.size)-540)-DEF_TOOLBAR_H;}
param.w=Math.round(w/COORDINATE_CONV*zoom_info.size);
param.h=Math.round(h/COORDINATE_CONV*zoom_info.size);
param.x=tmp_x+param.w/2-DEF_BROWSER_TRANSLATE[0];
param.y=tmp_y-param.h/2;
param.y+=DEF_FOCUS_ADJUSTMENT;
return param;};
function progress_bar(param){
this.translate=param.translate;
this.visible_p=false;
this.components=[
this.bar=new gbox({width:0,height:6,translate:[Math.floor(-DEF_BROWSER_WIDTH/2),0,0.1],
color:[0,240,255,200],}),
];}
progress_bar.prototype=new container({});
progress_bar.prototype.appear=function (){
this.bar.width=0;
this.visible_p=true;
force_redraw();}
progress_bar.prototype.disappear=function (){
this.visible_p=false;
force_redraw();}
progress_bar.prototype.update=function (param){
var width=Math.floor(param/100*DEF_BROWSER_WIDTH);
this.bar.width=width;
this.bar.translate[0]=Math.floor(-DEF_BROWSER_WIDTH/2)+width/2+20;
force_redraw();}
function brw_focus(img_color){
this.superClass=container;
this.superClass({
visible_p:false,
translate:[0,0,100],
rotation:[0,0,1,0],
components:[]
});
var color=img_color?img_color:COL_FCS;
this.ary_loaded_img=[];
var img_l=brw_focus.prototype.IMG_PATH+"focus_line.png";
var img_a=brw_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:brw_focus.prototype.NULL_FUNCTION,}),
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[-180,0,0,1],color:color,
onload:brw_focus.prototype.NULL_FUNCTION,}),
new gimage({width:1920,height:16,src:img_l,
draw_type:DIRECT,rotation:[-90,0,0,1],color:color,
onload:brw_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:brw_focus.prototype.NULL_FUNCTION,}),
new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[90,0,0,1],color:color,
onload:brw_focus.prototype.NULL_FUNCTION,}),
new gimage({width:16,height:16,src:img_a,
draw_type:DIRECT,rotation:[180,0,0,1],color:color,
onload:brw_focus.prototype.NULL_FUNCTION,})
];};
brw_focus.prototype=new container({});

brw_focus.prototype.NULL_FUNCTION=function(){};
brw_focus.prototype.IMG_PATH=PALTINUM_PATH_IMG;
brw_focus.prototype.ary_loaded_img=[];brw_focus.prototype.onload=function(){
force_redraw();
return;};
brw_focus.prototype.width=0;
brw_focus.prototype.height=0;
brw_focus.prototype.color=[255,255,255,255];
brw_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;};
brw_focus.prototype.setTranslate=function(x,y,z){
this.translate[0]=x;
this.translate[1]=y;
this.translate[2]=z;};
brw_focus.prototype.setShow=function(b){
console_log("[brw_focus.setShow]"+b);
if((b)||(this.visible_p!=b)){
this.visible_p=b;
force_redraw();}
};
brw_focus.prototype.isShow=function(){
return this.visible_p;};
brw_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="";};

function switch_screen_size(){
if(side_w_mode){
DEF_BROWSER_TRANSLATE=DEF_BRW_NAGARA_TRANSLATE;
DEF_BROWSER_WIDTH=DEF_BRW_NAGARA_W;
DEF_BROWSER_HEIGHT=DEF_BRW_NAGARA_H;
DEF_BROWSER_RS_WIDTH=DEF_BRW_NAGARA_RS_W;
DEF_BROWSER_RS_HEIGHT=DEF_BRW_NAGARA_RS_H;
DEF_BROWSER_PB_WIDTH=DEF_BRW_NAGARA_W*COORDINATE_CONV;
DEF_BROWSER_PB_HEIGHT=DEF_BRW_NAGARA_H*COORDINATE_CONV;
DEF_BROWSER_NAGARA_OFFSET_X=DEF_BRW_NAGARA_OFFSET_X;
DEF_BROWSER_SCROLL_OFFSET_X=DEF_BRW_NAGARA_SCROLL_X;}else {
DEF_BROWSER_TRANSLATE=DEF_BRW_FULL_TRANSLATE;
DEF_BROWSER_WIDTH=DEF_BRW_FULL_W;
DEF_BROWSER_HEIGHT=DEF_BRW_FULL_H;
DEF_BROWSER_RS_WIDTH=DEF_BRW_FULL_RS_W;
DEF_BROWSER_RS_HEIGHT=DEF_BRW_FULL_RS_H;
DEF_BROWSER_PB_WIDTH=DEF_BRW_FULL_W*COORDINATE_CONV;
DEF_BROWSER_PB_HEIGHT=DEF_BRW_FULL_H*COORDINATE_CONV;
DEF_BROWSER_NAGARA_OFFSET_X=DEF_BRW_FULL_OFFSET_X;
DEF_BROWSER_SCROLL_OFFSET_X=DEF_BRW_FULL_SCROLL_X;}
DEF_RS_SIZE_W=DEF_BROWSER_WIDTH/DEF_BROWSER_RS_WIDTH;
DEF_RS_SIZE_H=DEF_BROWSER_HEIGHT/DEF_BROWSER_RS_HEIGHT;};
var brw_obj=new container({});
brw_obj.create=function (param){
if(this.components.length>0)return 0;
this.pb={};
this.page_info={};
this.page_info.history_list=[];
this.focus_info=new focus_mgr();
this.point_info=new point_mgr();
this.pinch_status={};
this.wheel_obj={};
this.url_init="";
this.load_first_time=true;
this.drag_mode=false;
this.fg_loading=false;
this.fg_clickable=false;
this.in_wheel_mode=false;
this.in_drag_scroll_mode=false;
this.scrollbar_area="no_area";
this.in_busy=false;
this.move_distance=0;
this.focus_status=false;
this.text_tts="";
this.id_tts=0;
this.clip_type="default";
this.tmp_img="";
this.tmp_big="";
this.fg_capture=false;
this.asr_fg_link=false;
this.asr_list_link_info=null;
this.asr_link_id=-1;
this.asr_ary_focus=[];
this.asr_pos_current=0;
this.fg_full=false;
this.stage=param.stage?param.stage:null;
if(DEF_SIDE_WINDOW)side_w_mode=true;
switch_screen_size();
this.width=param.width?param.width:DEF_BROWSER_WIDTH;
if(this.width<=0)this.width=DEF_BROWSER_WIDTH;
this.height=param.height?param.height:DEF_BROWSER_HEIGHT;
if(this.height<=0)this.height=DEF_BROWSER_HEIGHT;
this.translate=param.translate?param.translate:DEF_BROWSER_TRANSLATE;
if(!DEF_CHANGE_SCREEN){
this.brw=new gwindow({width:this.width,height:this.height,translate:[-20,-30,0],rotation:[0,0,0,1]});}
else {
this.brw=new gwindow({width:1920,height:1080,translate:[0,0,0],rotation:[0,0,0,1]});}
if(DEF_SIDE_WINDOW)
if(!DEF_CHANGE_SCREEN){
this.full_brw=new gwindow({width:1920,height:1080,translate:[-300,0,0],visible_p:false});}
else {
this.full_brw=new gwindow({width:1920,height:1080,translate:[0,0,0],visible_p:false});}
this.components.push(
this.video_box=new video_ctrl({translate:[0,0,0]}),
this.brw,
this.asr_focus_obj=new container({}),
this.focus_obj=new brw_focus([0,240,255,200]),
this.cover=new gbox({width:this.width,height:this.height,translate:[-20,-30,0],visible_p:false}),
this.progress_bar=new progress_bar({translate:[-40,DEF_BROWSER_HEIGHT/2-30-3,0],}),
this.scroll_bar=new scroll_bar_obj({})
);
this.progress_bar.translate[1]=DEF_BROWSER_HEIGHT/2-28;
if(DEF_SIDE_WINDOW)
this.components.push(this.full_brw);
this.scroll_obj=new BrowserScroll({scroll_cb:brw_obj.scroll_done});
this.vbox_new =false;
this.video_box.init();
this.zoom_info=new zoom_mgr();
this.dclick_obj=new dclick_obj({parent:this});
this.dclick_obj.init();
this.pinch_status.count=0;
this.flash_full=false;
this.scroll_info=new scroll_mgr();
this.brw.action=function(){
};
this.brw.mouseover=function(){
console_log("[brw.mouseover]");};
this.brw.mouseout=function(){
console_log("[brw.mouseout]");
brw_obj.focus_obj.setShow(false);
brw_obj.tts_stop();
if(brw_obj.fg_clickable){
brw_obj.fg_clickable=false;
brw_obj.update_cursor_img();}
};
this.private_browsing=null;
this.get_private_browsing();
this.do_not_tracking=null;
this.get_do_not_tracking();
this.restart_browsing=false;
return 0;};
brw_obj.set_cb=function (param){
if(param==null)return;
if(param.connect_cb!=null)this.connect_cb=param.connect_cb;
if(param.loaded_cb!=null)this.loaded_cb=param.loaded_cb;
if(param.load_started_cb!=null)this.load_started_cb=param.load_started_cb;
if(param.page_info_cb!=null)this.page_info_cb=param.page_info_cb;
if(param.get_pixmap_cb!=null)this.get_pixmap_cb=param.get_pixmap_cb;
if(param.return_cb!=null)this.return_cb=param.return_cb;
if(param.discard_cb!=null)this.discard_cb=param.discard_cb;
if(param.disconnect_cb!=null)this.disconnect_cb=param.disconnect_cb;
if(param.load_failed_cb!=null)this.load_failed_cb=param.load_failed_cb;
if(param.show_popup_cb!=null)this.show_popup_cb=param.show_popup_cb;
if(param.prompt_cb!=null)this.prompt_cb=param.prompt_cb;
if(param.change_cursor_cb!=null)this.change_cursor_cb=param.change_cursor_cb;
if(param.move_textarea_cb!=null)this.move_textarea_cb=param.move_textarea_cb;
if(param.move_up_position_cb!=null)this.move_up_position_cb=param.move_up_position_cb;
if(param.move_down_position_cb!=null)this.move_down_position_cb=param.move_down_position_cb;
if(param.authentication_cb!=null)this.authentication_cb=param.authentication_cb;
if(param.change_status_cb!=null)this.change_status_cb=param.change_status_cb;
if(param.scroll_start_cb!=null)this.scroll_start_cb=param.scroll_start_cb;
if(param.scroll_end_cb!=null)this.scroll_end_cb=param.scroll_end_cb;
if((DEF_SIDE_WINDOW)&&(param.full_screen_cb!=null))this.full_screen_cb=param.full_screen_cb;
if(param.change_asr_mode_cb!=null)this.change_asr_mode_cb=param.change_asr_mode_cb;};
brw_obj.reset_cb=function (){
if(this.connect_cb!=null)this.connect_cb=null;
if(this.loaded_cb!=null)this.loaded_cb=null;
if(this.load_started_cb!=null)this.load_started_cb=null;
if(this.page_info_cb!=null)this.page_info_cb=null;
if(this.get_pixmap_cb!=null)this.get_pixmap_cb=null;
if(this.return_cb!=null)this.return_cb=null;
if(this.discard_cb!=null)this.discard_cb=null;
if(this.disconnect_cb!=null)this.disconnect_cb=null;
if(this.load_failed_cb!=null)this.load_failed_cb=null;
if(this.show_popup_cb!=null)this.show_popup_cb=null;
if(this.prompt_cb!=null)this.prompt_cb=null;
if(this.change_cursor_cb!=null)this.change_cursor_cb=null;
if(this.move_textarea_cb!=null)this.move_textarea_cb=null;
if(this.move_up_position_cb!=null)this.move_up_position_cb=null;
if(this.move_down_position_cb!=null)this.move_down_position_cb=null;
if(this.authentication_cb!=null)this.authentication_cb=null;
if(this.change_status_cb!=null)this.change_status_cb=null;
if(this.scroll_start_cb!=null)this.scroll_start_cb=null;
if(this.scroll_end_cb!=null)this.scroll_end_cb=null;
if((DEF_SIDE_WINDOW)&&(this.full_screen_cb!=null))this.full_screen_cb=null;
if(this.change_asr_mode_cb!=null)this.change_asr_mode_cb=null;};
brw_obj.set_bkmk_url_list=function (param){
if(param==null)return;
this.bookmark_url_list_count=param.count;
this.ary_bookmark=[];
if(param.count>0){
for(var i=0;i<param.count;i++){
this.ary_bookmark[i]=param.list[i];}
}
}
brw_obj.set_skb_func=function (param){
if(param==null)return;
if(param.skb_appear!=null)this.skb_appear=param.skb_appear;
if(param.skb_disappear!=null)this.skb_disappear=param.skb_disappear;
if(param.skb_is_disp!=null)this.skb_is_disp=param.skb_is_disp;};
brw_obj.reset_skb_func=function (){
if(this.skb_appear!=null)this.skb_appear=null;
if(this.skb_disappear!=null)this.skb_disappear=null;
if(this.skb_is_disp!=null)this.skb_is_disp=null;};
brw_obj.free=function (){
this.components.splice(0,this.components.length);

};
brw_obj.move_up_position=function(distance){
console_log("[brw_obj.move_up_position] distance: "+distance);
console_log("[brw_obj.move_up_position] move_distance: "+this.move_distance);
if(!this.visible_p){
return;}
if((distance==0)||((this.move_distance==0)&&(distance<0)))
return;
if((this.move_distance+distance)<0){
distance=-this.move_distance;
this.move_distance=0;}else{
this.move_distance+=distance;}

this.video_box.translate[1]+=distance;
this.brw.translate[1]+=distance;
this.cover.translate[1]+=distance;
this.progress_bar.translate[1]+=distance;
this.scroll_bar.translate[1]+=distance;
brw_obj.move_up_position_cb(distance)
if(!brw_obj.focus_obj.isShow()){
var param=calc_draw_pos_forFocus(brw_obj.point_info.x,brw_obj.point_info.y,
brw_obj.point_info.w,brw_obj.point_info.h);
brw_obj.focus_obj.setSize(param.w,param.h);
brw_obj.focus_obj.setTranslate(param.x,param.y+distance,0);
brw_obj.focus_obj.setShow(true);}else{
var param={x:brw_obj.focus_obj.translate[0],y:brw_obj.focus_obj.translate[1],
w:brw_obj.focus_obj.width,h:brw_obj.focus_obj.height};
brw_obj.focus_obj.setTranslate(param.x,param.y+distance,0);}
};
brw_obj.move_down_position=function(){
console_log("[brw_obj.move_down_position] this.move_distance: "+this.move_distance);
if(this.move_distance>0){
this.video_box.translate[1]-=this.move_distance;
this.brw.translate[1]-=this.move_distance;
this.cover.translate[1]-=this.move_distance;
this.progress_bar.translate[1]-=this.move_distance;
this.scroll_bar.translate[1]-=this.move_distance;
brw_obj.move_down_position_cb(this.move_distance)
}
this.move_distance=0;};
brw_obj.appear=function (param){
console_log("[START][brw_obj.appear]");
var ret=this.create(param);
if(ret<0){
return;}
this.update_param(param);
if(this.stage!=HOME)full_screen_obj.free(this.stage);
var connected_ev_before_launch=PLATINUM_CONNECTED_EV;
if(DEF_CHANGE_SCREEN){
if(BROWSER.owner){
ebus.pbrowser[0].discard_appli();}
ret=ebus.pbrowser[0].launch({width:1920*COORDINATE_CONV,height:1080*COORDINATE_CONV,
is_fullscreen_available:false,private_browsing:this.get_private_browsing()});}else{
ret=ebus.pbrowser[0].launch({width:this.pb_width,height:this.pb_height,
is_fullscreen_available:false,private_browsing:this.get_private_browsing()});}
console_log("[ROOT][brw_obj.appear]"+ret);
if(ret<0){

console_log("[ROOT][brw_obj.appear]BROWSER_DISCONNECTED");
brw_connection=BROWSER_DISCONNECTED;
return ret;}
else if(ret==1){

if(PLATINUM_CONNECTED_EV==1){

PLATINUM_CONNECTED_EV=0;
brw_obj.connected_ev(ebus.pbrowser[0]);}
else if(brw_connection!=BROWSER_LAUNCHED){
console_log("[ROOT][brw_obj.appear]CONNECTED "+brw_connection);
if(ebus.pbrowser[0].get_status()==2){try{
ebus.pbrowser[0].request(true,this.get_enum_hook,ebus.pbrowser[0].GET_ENUM,"brw_obj.pb");
if(DEF_CHANGE_SCREEN){
this.set_resize_init();
ebus.pbrowser[0].request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,
600*COORDINATE_CONV,DEF_TOOLBAR_H*COORDINATE_CONV,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
ebus.pbrowser[0].request(false,null,this.pb.RESIZE,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
this.zoom_info.init();
if(DEF_4K2K){
var now_level=apps_nvram.read("ZOOM_LEVEL","home");
if(now_level==null)
now_level=this.zoom_info.get_level();}else{
var now_level=this.zoom_info.get_level();}
this.zoom_info.set_level(now_level);
this.zoom_info.zoom_action();}
ebus.pbrowser[0].request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,DEF_BROWSER_RS_HEIGHT);
if(system.locale.country.indexOf("JP")==0){

var cache_size=get_browser_cache_size(this.stage);
console_log("SET_CACHE_POLICY: cache_size = "+cache_size);
ebus.pbrowser[0].request(false,null,this.pb.SET_CACHE_POLICY,
0,cache_size,cache_size,0,0);}
if(this.stage==HOME){
ebus.pbrowser[0].request(false,null,this.pb.SET_HIDDEN,true);}else{
ebus.pbrowser[0].request(false,null,this.pb.SET_HIDDEN,false);}
this.cover.visible_p=true;
this.clear_history();}catch(e){
console_log("[ROOT][brw_obj.appear]CONNECTED -> DISCONNECTED");
brw_connection=BROWSER_DISCONNECTED;
return -1;}
return ret;}
else {console_log("[ROOT][brw_obj.appear]CONNECTED -> DISCONNECTED");
brw_connection=BROWSER_DISCONNECTED;
return -1;}
}
}
else{

console_log("[ROOT][brw_obj.appear]LAUNCHED");
if(connected_ev_before_launch==0&&PLATINUM_CONNECTED_EV==1){

PLATINUM_CONNECTED_EV=0;
brw_obj.connected_ev(ebus.pbrowser[0]);

}
else {

brw_connection=BROWSER_LAUNCHED;}
this.brw.src=ebus.pbrowser[0].pixmap;
force_redraw();}
return ret;
console_log("[END][brw_obj.appear]");};
brw_obj.disappear=function (){
this.release();
if(brw_connection==BROWSER_DISCONNECTED){
return;}
ebus.pbrowser[0].discard();};
brw_obj.enter_focus=function (){
console_log("[START][brw_obj.enter_focus]");
ebus.pbrowser[0].request(false,null,this.pb.FOCUS_IN);
brw_obj.focus_status=true;
};
brw_obj.leave_focus=function (){
console_log("[START][brw_obj.leave_focus]");
ebus.pbrowser[0].request(false,null,this.pb.FOCUS_OUT);
brw_obj.focus_status=false;
}
brw_obj.is_window_area=function (x,y){
x=system.cursor_pointer.get_pos_x();
y=system.cursor_pointer.get_pos_y();
if((x>=(this.translate[0]+DEF_BROWSER_SCROLL_OFFSET_X+this.brw.translate[0]-this.width/2))
&&(x<=(this.translate[0]+DEF_BROWSER_SCROLL_OFFSET_X+this.brw.translate[0]+this.width/2))
&&(y<=(this.translate[1]+DEF_BROWSER_SCROLL_OFFSET_Y+this.brw.translate[1]+this.height/2))
&&(y>=(this.translate[1]+DEF_BROWSER_SCROLL_OFFSET_Y+this.brw.translate[1]-this.height/2))){
return true;}
return false;}
brw_obj.is_brw_scroll_area=function(){
var x=system.cursor_pointer.get_pos_x();
var y=system.cursor_pointer.get_pos_y();
if((x>=(this.translate[0]+DEF_BROWSER_SCROLL_OFFSET_X+this.brw.translate[0]-this.width/2))
&&(x<=(this.translate[0]+DEF_BROWSER_SCROLL_OFFSET_X+this.brw.translate[0]+this.width/2+40))
&&(y<=(this.translate[1]+DEF_BROWSER_SCROLL_OFFSET_Y+this.brw.translate[1]+this.height/2+DEF_TOOLBAR_H))
&&(y>=(this.translate[1]+DEF_BROWSER_SCROLL_OFFSET_Y+this.brw.translate[1]-this.height/2-40))){
return true;}
return false;};
brw_obj.set_drag_scroll_mode=function(mode){
if(mode){
this.in_drag_scroll_mode=true;}else{
this.in_drag_scroll_mode=false;
this.set_scrollbar_area("no_area");}
};
brw_obj.get_drag_scroll_mode=function(){
return this.in_drag_scroll_mode;};
brw_obj.set_scrollbar_area=function(area){
this.scrollbar_area=area;};
brw_obj.get_scrollbar_area=function(){
return this.scrollbar_area;};
brw_obj.is_scrollbar_area=function (){
var x=system.cursor_pointer.get_pos_x();
var y=system.cursor_pointer.get_pos_y();
var bar_h_x1=922;
var bar_h_x2=962;
var bar_h_y1=brw_obj.scroll_bar.bar_h.img_bar_c.translate[1]-30
+brw_obj.scroll_bar.bar_h.img_bar_c.height/2+20;
var bar_h_y2=brw_obj.scroll_bar.bar_h.img_bar_c.translate[1]-30
-brw_obj.scroll_bar.bar_h.img_bar_c.height/2-20;
var bar_w_x1=brw_obj.scroll_bar.bar_w.img_bar_c.translate[0]-20
-brw_obj.scroll_bar.bar_w.img_bar_c.height/2-20+DEF_BROWSER_TRANSLATE[0]+DEF_BROWSER_SCROLL_OFFSET_X;
var bar_w_x2=brw_obj.scroll_bar.bar_w.img_bar_c.translate[0]-20
+brw_obj.scroll_bar.bar_w.img_bar_c.height/2+20+DEF_BROWSER_TRANSLATE[0]+DEF_BROWSER_SCROLL_OFFSET_X;
var bar_w_y1=-502;
var bar_w_y2=-542;
if(brw_obj.scroll_bar.bar_h.img_bar_c.visible_p){
if((x>=bar_h_x1)&&(x<=bar_h_x2)&&(y<=bar_h_y1)&&(y>=bar_h_y2)){
this.set_scrollbar_area("right");
return true;}
}
if(brw_obj.scroll_bar.bar_w.img_bar_c.visible_p){
if((x>=bar_w_x1)&&(x<=bar_w_x2)&&(y<=bar_w_y1)&&(y>=bar_w_y2)){
this.set_scrollbar_area("bottom");
return true;}
}
this.set_scrollbar_area("no_area");
return false;};
brw_obj.clear_param=function (){
console_log("[brw_obj.clear_param]start");
this.page_info=null;
this.point_info=null;
this.pinch_status=null;
this.wheel_obj=null;
this.url_init="";
this.width=DEF_BROWSER_WIDTH;
this.height=DEF_BROWSER_HEIGHT;
this.translate=DEF_BROWSER_TRANSLATE;
this.load_first_time=true;
this.load_first_time=true;
this.drag_mode=false;
this.fg_loading=false;
this.fg_clickable=false;
this.in_wheel_mode=false;
this.in_drag_scroll_mode=false;
this.scrollbar_area="no_area";
this.in_busy=false;
this.move_distance=0;
if(this.progress_bar){
this.progress_bar.translate=[-40,DEF_BROWSER_HEIGHT/2-28,0];}
if(this.scroll_bar)
this.scroll_bar.translate=[0,0,0];
this.focus_status=false;
this.text_tts="";
this.id_tts=0;
use_tts=false;
this.stage=null;
this.scroll_info=null;
this.stop_capture=false;
if(!this.is_disp()){
this.fg_capture=false;
this.clip_type="default";}
this.asr_fg_link=false;
this.asr_list_link_info=null;
this.asr_link_id=-1;
this.asr_ary_focus=[];
this.asr_pos_current=0;
this.fg_full=false;
this.pb_width=this.width*COORDINATE_CONV;
this.pb_height=this.height*COORDINATE_CONV;
this.reset_cb();
this.reset_skb_func();
if(this.scroll_obj)this.scroll_obj.init();
console_log("[brw_obj.clear_param]end");};
brw_obj.update_param=function (param){
console_log("[brw_obj.update_param]start");
this.clear_param();
this.pb={};
this.page_info={};
this.page_info.history_list=[];
this.focus_info=new focus_mgr();
this.point_info=new point_mgr();
this.video_box.init();
this.zoom_info=new zoom_mgr();
this.dclick_obj.init();
this.pinch_status={};
this.wheel_obj={};
this.scroll_info=new scroll_mgr();
this.pinch_status.count=0;
this.stage=param.stage?param.stage:null;
this.url_init=param.url?param.url:"";
this.width=param.width?param.width:DEF_BROWSER_WIDTH;
if(this.width<=0)this.width=DEF_BROWSER_WIDTH;
this.height=param.height?param.height:DEF_BROWSER_HEIGHT;
if(this.height<=0)this.height=DEF_BROWSER_HEIGHT;
this.translate=param.translate?param.translate:DEF_BROWSER_TRANSLATE;
this.pb_width=param.pb_width?param.pb_width:DEF_BROWSER_PB_WIDTH;
if(this.pb_width<=0)this.pb_width=DEF_BROWSER_PB_WIDTH;
this.pb_height=param.pb_height?param.pb_height:DEF_BROWSER_PB_HEIGHT;
if(this.pb_height<=0)this.pb_height=DEF_BROWSER_PB_HEIGHT;
this.set_cb(param);
this.set_skb_func(param);
use_tts=param.use_tts?param.use_tts:false;
this.stage.add_event_hook(ebus.pbrowser[0],this.event_hook);
console_log("[brw_obj.update_param]end");};

brw_obj.open_url=function (url){
try{
this.brw.visible_p=true;
this.scroll_bar.appear_bar_w();
this.scroll_bar.appear_bar_h();
brw_connection=BROWSER_LOADING;
ebus.pbrowser[0].request(false,null,this.pb.LOAD_URL,url);
}catch(e){
console_log("[brw_obj.open_url]can not load");}
};
brw_obj.set_initial_url=function (url){
this.url_init=url;};
brw_obj.show=function (){
this.visible_p=true;
this.scroll_bar.appear_bar_w();
this.scroll_bar.appear_bar_h();
force_redraw();};
brw_obj.release=function (){
this.visible_p=false;
this.free();
this.reset_cb();
this.reset_skb_func();
force_redraw();};
brw_obj.is_alived=function (){
var ret=false;
if(brw_connection!=BROWSER_DISCONNECTED){
ret=true;}
return ret;};
brw_obj.is_connect=function(){
if(brw_connection>=BROWSER_CONNECTED){
return true;}
return false;}
brw_obj.is_disp=function(){
if((brw_connection==BROWSER_LOAD_FINISHED)||
(brw_connection==BROWSER_LOAD_FAILED)){
return true;}
return false;}
brw_obj.is_loading=function (){
var ret=false;
if(brw_connection==BROWSER_LOADING){
ret=true;}
return ret;}
brw_obj.is_loaded=function(){
if(brw_connection==BROWSER_LOAD_FINISHED){
return true;}
return false;}
brw_obj.get_stage=function(){
return this.stage;};
brw_obj.get_capture_update_time=function(){
var caput_interval=24*60*60*1000;return caput_interval;};
brw_obj.is_fullscreen=function(){
return this.fg_full;};
brw_obj.cancel_text=function (){
full_screen_obj.obj=null;};
brw_obj.get_cursor_info=function(){
var param=null;
if(this.focus_obj.isShow()){
param={x:brw_obj.focus_obj.translate[0],y:brw_obj.focus_obj.translate[1],
w:brw_obj.focus_obj.width,h:brw_obj.focus_obj.height};}else{
param=calc_draw_pos_forFocus(brw_obj.point_info.x,brw_obj.point_info.y,
brw_obj.point_info.w,brw_obj.point_info.h);}
return param;};
brw_obj.set_drag_mode=function (mode){
if(this.fullscreen_mode)return;
this.drag_mode=mode;
if(mode){
if(this.is_window_area())
ebus.pbrowser[0].request(false,null,this.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.pb.LeftButton,this.pb.MouseEventPressed,1);}else{
ebus.pbrowser[0].request(false,null,this.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,this.pb.LeftButton,this.pb.MouseEventReleased,1);}
}
brw_obj.load_stop_req=function (){
if(brw_connection!=BROWSER_LOAD_FAILED)
brw_connection=BROWSER_LOAD_FINISHED;};
brw_obj.prompt_req=function (value,res){
console_log("[brw_obj.prompt_req]value:"+value+" res:"+res);
ebus.pbrowser[0].request(false,null,this.pb.PROMPT,res,value);};
brw_obj.authentication_req=function (url,user,pw,res){
console_log("[brw_obj.authentication_req]url:"+" user:"+user+" pw:"+pw+" res"+res);
ebus.pbrowser[0].request(false,null,this.pb.AUTHENTICATION,res,url,user,pw);};
brw_obj.insecure_req=function (res){
console_log("[brw_obj.insecure_req]");
ebus.pbrowser[0].request(false,null,this.pb.INSECURE,false);};
brw_obj.get_page_back=function (){
return this.page_info.back_count;};
brw_obj.get_page_foward=function (){
return this.page_info.forward_count;};
brw_obj.get_zoom_level=function (){
return this.zoom_info.get_level();};
brw_obj.enlarge_action=function(){
if(this.fg_full)return;
var level=this.zoom_info.get_level();
if(level>=4)return;
this.zoom_info.set_level(++level);
this.zoom_info.zoom_action();
if(use_tts&&this.get_tts_supported()&&this.pb.TTS_REQ_TEXT){
this.focus_obj.setShow(false);}
this.clear_asr_link("all");}
brw_obj.reduction_action=function(){
if(this.fg_full)return;
var level=this.zoom_info.get_level();
if(DEF_4K2K){
if(level<1)return;}else{
if(level<=1)return;}
this.zoom_info.set_level(--level);
this.zoom_info.zoom_action();
if(use_tts&&this.get_tts_supported()&&this.pb.TTS_REQ_TEXT){
this.focus_obj.setShow(false);}
this.clear_asr_link("all");}
brw_obj.back_action=function(){
if(this.fg_full){
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,this.pb.VKEY_ESCAPE,0);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.KeyUp,this.pb.VKEY_ESCAPE,0);}else{
ebus.pbrowser[0].request(false,null,this.pb.HISTORY_BACK);}
}
brw_obj.next_action=function(){
ebus.pbrowser[0].request(false,null,this.pb.HISTORY_FORWARD);}
brw_obj.submenu_action=function(){
if(this.is_window_area()){
ebus.pbrowser[0].request(false,null,this.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.pb.RightButton,this.pb.MouseEventPressed,1);
ebus.pbrowser[0].request(false,null,this.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.pb.RightButton,this.pb.MouseEventReleased,1);}
}
brw_obj.clear_history=function(){
console_log("[brw_obj.clear_history]");
ebus.pbrowser[0].request(false,null,this.pb.CLEAR_HISTORY);
this.page_info.back_count=0;
this.page_info.forward_count=0;
this.page_info.history_list=[];
this.load_first_time=true;}
brw_obj.reload_action=function(){
ebus.pbrowser[0].request(false,null,this.pb.RELOAD);}
brw_obj.get_private_browsing=function(){
if(this.private_browsing==null){
this.private_browsing=apps_nvram.read("PRIVATE_BROWSING","home");
if(this.private_browsing==null){
apps_nvram.write("PRIVATE_BROWSING",false,"home");
this.private_browsing=false;}
}
return this.private_browsing;}
brw_obj.private_browsing_action=function(param){
this.private_browsing=param;
apps_nvram.write("PRIVATE_BROWSING",param,"home");
this.restart_browsing=true;
ebus.pbrowser[0].discard();
}
brw_obj.get_do_not_tracking=function(){
if(this.do_not_tracking==null){
this.do_not_tracking=apps_nvram.read("DO_NOT_TRACKING","home");
if(this.do_not_tracking==null){
apps_nvram.write("DO_NOT_TRACKING",false,"home");
this.do_not_tracking=false;}
}
return this.do_not_tracking;}
brw_obj.do_not_tracking_action=function(param){
this.do_not_tracking=param;
apps_nvram.write("DO_NOT_TRACKING",param,"home");
ebus.pbrowser[0].request(false,null,this.pb.SET_DO_NOT_TRACK,param);}
brw_obj.all_clear_cookie=function(){
console_log("[START][brw_obj][all_clear_cookie]");
ebus.pbrowser[0].request(false,null,this.pb.CLEAR_COOKIE);
console_log("[END][brw_obj][all_clear_cookie]");}
brw_obj.alert_req=function(){
console_log("[brw_obj.alert_req]");
ebus.pbrowser[0].request(false,null,this.pb.ALERT);}
brw_obj.confirm_req=function(ret){
console_log("[brw_obj.confirm_req]"+ret);
ebus.pbrowser[0].request(false,null,this.pb.CONFIRM,ret);}
brw_obj.get_pixmap=function(){
console_log("[START][brw_obj][get_pixmap]");
this.fg_capture=true;
if(this.clip_type=="big"){
this.clip_paint(DEF_PIXMAP_BIG_W,DEF_PIXMAP_BIG_H+7,DEF_PIXMAP_BIG_RF_W,DEF_PIXMAP_BIG_RF_H);}else if(this.clip_type=="4k"){
this.clip_paint(DEF_PIXMAP_4K_W,DEF_PIXMAP_4K_H,DEF_PIXMAP_4K_RF_W,DEF_PIXMAP_4K_RF_H);}else{
this.clip_paint(DEF_PIXMAP_DEF_W,DEF_PIXMAP_DEF_H+DEF_PIXMAP_DEF_H_MARGIN,DEF_PIXMAP_DEF_RF_W,DEF_PIXMAP_DEF_RF_H);}
console_log("[END][brw_obj][get_pixmap]");};
brw_obj.stop_capture_req=function(){
if(this.fg_capture)
this.stop_capture=true;};
brw_obj.restart_capture=function(){
this.clip_type="default";
this.stop_capture=false;
this.fg_capture=false;
this.get_pixmap();};
brw_obj.clip_paint=function(w,h,rs_w,rs_h){
console_log("[START][brw_obj][clip_paint]");
var fbno=ebus.pbrowser[0].alloc_clip_pixmap({width:w,height:h});
ebus.pbrowser[0].request(false,null,this.pb.CLIP_PAINT,fbno,rs_w,rs_h,0,0,rs_w,rs_h);
console_log("[END][brw_obj][clip_paint]",fbno,ebus.pbrowser[0].clip_pixmap);};
brw_obj.clip_paint_cb=function(){
if(this.stop_capture){
this.restart_capture();
return;}
var w=DEF_PIXMAP_DEF_W;
var h=DEF_PIXMAP_DEF_H;
if(this.clip_type=="big"){
w=DEF_PIXMAP_BIG_W;
h=DEF_PIXMAP_BIG_H;}else if(this.clip_type=="4k"){
w=DEF_PIXMAP_4K_W;
h=DEF_PIXMAP_4K_H;}
var pid=pixmap_capture.get({
"pixmap":ebus.pbrowser[0].clip_pixmap,
"width":w,
"height":h,
"hook":function (){
var ev_obj=arguments[1];
var ev=arguments[2];
var id=arguments[3];
console_log(ev_obj,id,ev);
ebus.pbrowser[0].free_clip_pixmap();
if(brw_obj.stop_capture){
brw_obj.clip_type="default";
brw_obj.tmp_img="";
brw_obj.tmp_big="";
brw_obj.restart_capture();
return;}
if(ev==ev_obj.EV_SUCCESS){
var img=arguments[4];
console.log("capture success!!!",id,pid);
if(DEF_4K2K){
if(brw_obj.clip_type=="default"){
brw_obj.tmp_img=img;
if(STREAM_TEXTURE_ENABLE){
brw_obj.clip_type="big";
brw_obj.get_pixmap();}else{
brw_obj.clip_type="4k";
brw_obj.get_pixmap();}
}else if(brw_obj.clip_type=="big"){
brw_obj.tmp_big=img;
brw_obj.clip_type="4k";
brw_obj.get_pixmap();}else{
if(STREAM_TEXTURE_ENABLE){
brw_obj.get_pixmap_cb({img:brw_obj.tmp_img,img_big:brw_obj.tmp_big,img_4k:img,result:true});}else{
brw_obj.get_pixmap_cb({img:brw_obj.tmp_img,img_4k:img,result:true});}
brw_obj.clip_type="default";
brw_obj.capture_state=false;
brw_obj.tmp_img="";
brw_obj.tmp_big="";}
return;}
if(STREAM_TEXTURE_ENABLE){
if(brw_obj.clip_type!="big"){
brw_obj.tmp_img=img;
brw_obj.clip_type="big";
brw_obj.get_pixmap();}else{
brw_obj.get_pixmap_cb({img:brw_obj.tmp_img,img_big:img,result:true});
brw_obj.clip_type="default";
brw_obj.fg_capture=false;
brw_obj.tmp_img="";}
}else{
brw_obj.get_pixmap_cb({img:img,result:true});
brw_obj.fg_capture=false;
img.length=0;}
}else{
var err=arguments[4];
console.log("captured fail!!!",id,pid,err);
brw_obj.get_pixmap_cb({err:err,result:false});}
}
});};
brw_obj.set_resize_init=function(){
DEF_BROWSER_RESIZE_X=0;
if(DEF_SIDE_WINDOW){
switch_screen_size();}else{
DEF_BROWSER_WIDTH=DEF_BRW_FULL_W;
DEF_BROWSER_HEIGHT=DEF_BRW_FULL_H;
DEF_BROWSER_RS_WIDTH=DEF_BRW_FULL_RS_W;
DEF_BROWSER_RS_HEIGHT=DEF_BRW_FULL_RS_H;}
DEF_RS_SIZE_W=DEF_BROWSER_WIDTH/DEF_BROWSER_RS_WIDTH;
DEF_RS_SIZE_H=DEF_BROWSER_HEIGHT/DEF_BROWSER_RS_HEIGHT;
if(DEF_4K2K&&this.zoom_info.get_level()==1){
contents_org_w=contents_zoom1_w;
contents_org_h=contents_zoom1_h;}
contents_w=Math.floor(contents_org_w*DEF_RS_SIZE_W);
contents_h=Math.floor(contents_org_h*DEF_RS_SIZE_H);};
brw_obj.set_resize=function(param){
ebus.pbrowser[0].request(false,null,this.pb.SET_SUPPRESS_UPDATE,true);
ebus.pbrowser[0].request(false,null,this.pb.RESIZE,DEF_BROWSER_PB_WIDTH,DEF_BROWSER_PB_HEIGHT);
ebus.pbrowser[0].request(false,null,this.pb.RENDERING_SIZE,param.rs_width,param.rs_height);
ebus.pbrowser[0].request(false,null,this.pb.SET_SUPPRESS_UPDATE,false);
DEF_BROWSER_RESIZE_X=param.x;
this.width=DEF_BROWSER_WIDTH=param.width;
this.height=DEF_BROWSER_HEIGHT=param.height;
DEF_BROWSER_RS_WIDTH=param.rs_width;
DEF_BROWSER_RS_HEIGHT=param.rs_height;
DEF_RS_SIZE_W=DEF_BROWSER_WIDTH/DEF_BROWSER_RS_WIDTH;
DEF_RS_SIZE_H=DEF_BROWSER_HEIGHT/DEF_BROWSER_RS_HEIGHT;
if(DEF_4K2K&&this.zoom_info.get_level()==1){
contents_org_w=contents_zoom1_w;
contents_org_h=contents_zoom1_h;}
contents_w=Math.floor(contents_org_w*DEF_RS_SIZE_W);
contents_h=Math.floor(contents_org_h*DEF_RS_SIZE_H);};
fadein_obj={};
brw_obj.switch_screen=function(mode){
if((DEF_CHANGE_SCREEN)&&(side_w_mode!=mode)){
if(DEF_4K2K){var fade_in_time=(brw_obj.video_box.visible_p)?4000:2000;
delete_timer(fadein_obj);
append_timer(fadein_obj,fade_in_time,function (obj,count){
delete_timer(obj);
enable_keyhook=true;
system.effect.fade(system.effect.FADE_IN);});
common_effect_out(TXK_RED);}
side_w_mode=mode;
switch_screen_size();
this.translate=DEF_BROWSER_TRANSLATE;
this.width=DEF_BROWSER_WIDTH;
this.height=DEF_BROWSER_HEIGHT;
this.pb_width=DEF_BROWSER_PB_WIDTH;
this.pb_height=DEF_BROWSER_PB_HEIGHT;

ebus.pbrowser[0].request(false,null,this.pb.SET_SUPPRESS_UPDATE,true);
if(side_w_mode){
ebus.pbrowser[0].request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,
600*COORDINATE_CONV,DEF_TOOLBAR_H*COORDINATE_CONV,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
ebus.pbrowser[0].request(false,null,this.pb.RESIZE,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
ebus.pbrowser[0].request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,DEF_BROWSER_RS_HEIGHT);}
else {
ebus.pbrowser[0].request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,
0,DEF_TOOLBAR_H*COORDINATE_CONV,1884*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
ebus.pbrowser[0].request(false,null,this.pb.RESIZE,1884*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
ebus.pbrowser[0].request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,DEF_BROWSER_RS_HEIGHT);}
ebus.pbrowser[0].request(false,null,this.pb.SET_SUPPRESS_UPDATE,false);
this.scroll_bar.set_position();

var now_level=this.zoom_info.get_level();
this.zoom_info.init();
this.zoom_info.set_level(now_level);
this.zoom_info.zoom_action();
}
};

brw_obj.get_enum_hook=function (stg,bw,event,ver1,ver2,data){
console_log(">>>>>> [brw_obj.get_enum_hook]");
eval(data);
brw_obj.debug=[];
for(var i in brw_obj.pb)
if(i.indexOf("_EV")!=-1)
brw_obj.debug[brw_obj.pb[i]]=i;
pb_version=ver1;};
brw_obj.key_hook=function(up_down,key){
if(this.asr_fg_link){
switch(key){
case TXK_UP:
case TXK_LEFT:
case TXK_SCROLL_UP:
if(up_down==KEY_UP){
if(this.asr_pos_current<1)return false;
this.asr_pos_current--;
this.move_asr_link_focus(this.asr_list_link_info.result[this.asr_pos_current]);}
return true;
break;
case TXK_DOWN:
case TXK_RIGHT:
case TXK_SCROLL_DOWN:
if(up_down==KEY_UP){
if(this.asr_pos_current>=this.asr_list_link_info.result.length-1)return false;
this.asr_pos_current++;
this.move_asr_link_focus(this.asr_list_link_info.result[this.asr_pos_current]);}
return true;
break;
case TXK_ENTER:
if(up_down==KEY_UP){
this.jump_asr_link();}
return true;
break;
case TXK_RETURN:
if(up_down==KEY_UP){
this.clear_asr_link("all");}
return true;
break;
default:
this.clear_asr_link("all");
break;}
}
return false
};
var obutton=0;
var oposition_x=0;
var oposition_y=0;
var mouse_pos_x=960;
var mouse_pos_y=540;
var release_judge={};
var RELEASE_TIME=300;
brw_obj.mouse_hook=function (arguments){
var self=brw_obj;
var obj=arguments[1];
var ev=arguments[2];
var button=arguments[3];
var pos_x=arguments[4];
var pos_y=arguments[5];
var diff_z=arguments[6];
var diff_x=arguments[7];
var diff_y=arguments[8];
var diff_z_h=arguments[9];
var modifier1=(button&ebus.mouse.DOWN_MODIFIER1_BUTTON);

if(ev!=obj.LOW_EV)
return;
var asr_ret=self.mouse_hook_asr(pos_x,pos_y,button);
if(diff_z){
if(modifier1){
console_log("[brw_obj.mouse_hook]ZOOM diff:"+diff_z);
self.smapho_zoom(diff_z);}else {
console_log("[brw_obj.mouse_hook]SEND_WHEELEVENT:"+DEF_SCROLL_TICK);
if(self.is_brw_scroll_area())
self.touchpad_scroll(diff_z);}
}
if(diff_z_h){
if(self.is_brw_scroll_area())
self.touchpad_scroll(diff_z_h,1);}
pos_x=system.cursor_pointer.get_pos_x();
pos_y=system.cursor_pointer.get_pos_y();
mouse_pos_x=pos_x+960-DEF_BROWSER_NAGARA_OFFSET_X;
mouse_pos_y=-pos_y+540-DEF_TOOLBAR_H;
if(button!=obutton){
brw_obj.focus_obj.setShow(false);
brw_obj.tts_stop();}
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
mouse_pos_x=Math.round(zoom_info.x+mouse_pos_x/zoom_info.size);
mouse_pos_y=Math.round(zoom_info.y+mouse_pos_y/zoom_info.size);
if(mouse_pos_y==0)mouse_pos_y=1;
}
if(!asr_ret){
if(modifier1){
self.dclick_obj.init();
if(self.pinch_status.count==0){
if(self.is_brw_scroll_area()){
if(diff_x!=0){
self.smapho_scroll_w(diff_x);}
if(diff_y!=0){
self.smapho_scroll_h(diff_y);}
}
}
}else{
if((self.is_window_area())&&!(self.get_drag_scroll_mode())){
if((self.drag_mode)||(self.dclick_obj.get_mode())){
if((button&ebus.mouse.DOWN_LEFT_BUTTON)
==(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if((mouse_pos_x!=oposition_x)||(mouse_pos_y!=oposition_y)){
if((!self.drag_mode)&&(!self.dclick_obj.get_move_state())){
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
self.pb.LeftButton,self.pb.MouseEventPressed,1);}
console_log("[brw_obj.mouse_hook]force MOVE_POINTER LeftButton");
ebus.pbrowser[0].request(false,null,self.pb.MOVE_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,self.pb.LeftButton);
if(self.dclick_obj.get_mode())self.dclick_obj.extend();}
}
}else{
if((button&ebus.mouse.DOWN_LEFT_BUTTON)
&&(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
console_log("[brw_obj.mouse_hook]MOVE_POINTER LeftButton");
ebus.pbrowser[0].request(false,null,self.pb.MOVE_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,self.pb.LeftButton);}else{
ebus.pbrowser[0].request(false,null,self.pb.MOVE_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,self.pb.NoButton);}
if((button&ebus.mouse.DOWN_LEFT_BUTTON)
!=(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if(button&ebus.mouse.DOWN_LEFT_BUTTON){
self.dclick_obj.check();
}else{
if(self.dclick_obj.get_check_state()){
self.dclick_obj.enable();}else{
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
self.pb.LeftButton,self.pb.MouseEventReleased,1);
self.check_textarea();}
}
}else{
if(use_tts&&self.get_tts_supported()&&self.pb.TTS_REQ_TEXT){
delete_timer(release_judge);
append_timer(release_judge,RELEASE_TIME,function(obj){
console_log("**********TTS_REQ_TEXT");
delete_timer(obj);
console_log("[mouse_hook]x:"+mouse_pos_x+" y:"+mouse_pos_y);
ebus.pbrowser[0].request(false,null,self.pb.TTS_REQ_TEXT,
self.pb.TTS_REQ_TYPE_MOUSE_POINTER,mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV);});}
}
}
}
if((self.scroll_info.cnt_cancel_rev_move>0)
&&(mouse_pos_x==oposition_x||mouse_pos_y==oposition_y)){
self.scroll_info.cnt_cancel_rev_move--;}else{
if(!(button&ebus.mouse.DOWN_LEFT_BUTTON)
&&!(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if((pos_y>=539)&&(pos_x>=(-960+DEF_BROWSER_NAGARA_OFFSET_X))){
self.scroll_info.edge_scroll("up","anim",-5);}
if((pos_y<=-540)&&(pos_x>=(-960+DEF_BROWSER_NAGARA_OFFSET_X))){
self.scroll_info.edge_scroll("down","anim",5);}
if(pos_x<=-960){
self.scroll_info.edge_scroll("left","anim",-5);}
if(pos_x>=959){
self.scroll_info.edge_scroll("right","anim",5);}
if(!self.scroll_info.in_edge_scroll_mode){
self.scroll_info.stop_edge_scroll();}
if(self.scroll_info.direction){
delete_timer(self.scroll_info.edge_scroll_wait);
append_timer(self.scroll_info.edge_scroll_wait,DEF_4K2K?300:150,function(obj,count){
delete_timer(obj);
brw_obj.scroll_info.stop_edge_scroll();});}
}else{
self.scroll_info.stop_edge_scroll();}
}
if((button&ebus.mouse.DOWN_LEFT_BUTTON)
&&(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if(self.get_drag_scroll_mode()){
var scrollbar_area=self.get_scrollbar_area();
if(scrollbar_area=="right"){
self.drag_scroll("VERTICAL",diff_y);}else if(scrollbar_area=="bottom"){
self.drag_scroll("HORIZONAL",diff_x);}else{}
}
}else if((button&ebus.mouse.DOWN_LEFT_BUTTON)
&&!(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if(self.is_scrollbar_area())self.set_drag_scroll_mode(true);}
}
if(self.is_window_area()){
if((button&ebus.mouse.DOWN_RIGHT_BUTTON)
!=(obutton&ebus.mouse.DOWN_RIGHT_BUTTON)){
if(button&ebus.mouse.DOWN_RIGHT_BUTTON){
self.dclick_obj.init();
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
self.pb.RightButton,self.pb.MouseEventPressed,1);}else
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
self.pb.RightButton,self.pb.MouseEventReleased,1);}
}
}
obutton=button;
oposition_x=mouse_pos_x;
oposition_y=mouse_pos_y;}
brw_obj.mouse_hook_fullscreen=function (arguments){
var self=brw_obj;
var obj=arguments[1];
var ev=arguments[2];
var button=arguments[3];
var pos_x=arguments[4];
var pos_y=arguments[5];
var diff_z=arguments[6];
var diff_x=arguments[7];
var diff_y=arguments[8];

if(ev!=obj.LOW_EV)
return;
pos_x=system.cursor_pointer.get_pos_x();
pos_y=system.cursor_pointer.get_pos_y();
mouse_pos_x=pos_x+960-DEF_BRW_FULL_OFFSET_X;
mouse_pos_y=-pos_y+540;
pos_x=pos_x+960;
pos_y=-pos_y+540;
if((button&ebus.mouse.DOWN_LEFT_BUTTON)
!=(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if(button&ebus.mouse.DOWN_LEFT_BUTTON){
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
pos_x*COORDINATE_CONV,pos_y*COORDINATE_CONV,
self.pb.LeftButton,self.pb.MouseEventPressed,1);}else{
ebus.pbrowser[0].request(false,null,self.pb.CLICK_POINTER,
pos_x*COORDINATE_CONV,pos_y*COORDINATE_CONV,
self.pb.LeftButton,self.pb.MouseEventReleased,1);}
}else{
if(!(button&ebus.mouse.DOWN_LEFT_BUTTON)){
ebus.pbrowser[0].request(false,null,self.pb.MOVE_POINTER,
pos_x*COORDINATE_CONV,pos_y*COORDINATE_CONV,self.pb.NoButton);}
else {
ebus.pbrowser[0].request(false,null,self.pb.MOVE_POINTER,
pos_x*COORDINATE_CONV,pos_y*COORDINATE_CONV,self.pb.LeftButton);}
}
obutton=button;};
brw_obj.smapho_zoom=function (val){
if(this.pinch_status.count==0){
console_log("[brw_obj.smapho_zoom]zoom pinch:"+this.pinch_status.count);
if(val<0){
this.enlarge_action();}else{
this.reduction_action();}
this.pinch_status.count++;
append_timer(this.pinch_status,1000,function(obj,count){
delete_timer(obj);
obj.count=0;});}
};
brw_obj.smapho_scroll_w=function (val){
this.in_wheel_mode=true;
this.update_cursor_img();
delete_timer(this.wheel_obj);
append_timer(this.wheel_obj,TIMER_RESOLUTION*10,
function (obj,count){
brw_obj.in_wheel_mode=false;
delete_timer(obj);
brw_obj.update_cursor_img();});
this.scroll_action_hook("left","anim",val);};
brw_obj.smapho_scroll_h=function (val){
this.in_wheel_mode=true;
this.update_cursor_img();
delete_timer(this.wheel_obj);
append_timer(this.wheel_obj,TIMER_RESOLUTION*10,
function (obj,count){
brw_obj.in_wheel_mode=false;
delete_timer(obj);
brw_obj.update_cursor_img();});
brw_obj.scroll_action_hook("up","anim",val);};
brw_obj.touchpad_scroll=function (val,dir){
if(dir)
this.scroll_action_hook("left","anim",val*DEF_SCROLL_TICK);
else
this.scroll_action_hook("up","anim",val*DEF_SCROLL_TICK);
this.in_wheel_mode=true;
this.update_cursor_img();
delete_timer(this.wheel_obj);
append_timer(this.wheel_obj,TIMER_RESOLUTION*10,
function (obj,count){
brw_obj.in_wheel_mode=false;
delete_timer(obj);
brw_obj.update_cursor_img();});};
brw_obj.drag_scroll=function (direction,val){
if(direction=="VERTICAL"){
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
val=Math.round(val*(contents_h/zoom_info.h));}else{
val=Math.round(val*(contents_h/(DEF_BROWSER_HEIGHT-72)));}
val=Math.round(val*(DEF_BROWSER_RS_HEIGHT/DEF_BROWSER_HEIGHT));
brw_obj.scroll_action_hook("up","no_anim",-val);}else{
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
val=Math.round(val*(contents_w/zoom_info.w));}else{
val=Math.round(val*(contents_w/(DEF_BROWSER_WIDTH-72)));}
val=Math.round(val*(DEF_BROWSER_RS_WIDTH/DEF_BROWSER_WIDTH));
brw_obj.scroll_action_hook("left","no_anim",val);}
};
var scroll_mgr=function(){
this.edge_scroll_exe={};
this.edge_scroll_wait={};
this.edge_obj={};
this.pointer=check_ajax_version(AJAX_VER_SCROLL_POINTER);
this.init();};
scroll_mgr.prototype.init=function(){
this.x=0;
this.y=0;
this.direction="";
this.cnt_cancel_rev_move=3;
this.in_edge_scroll_mode=false;};
scroll_mgr.prototype.decide_edge_scroll=function(pox_x,pos_y){
console.log("[scroll_mgr.prototype.decide_edge_scroll][BEGIN]");
if((pos_y>=539)&&(pos_x>=(-960+DEF_BROWSER_NAGARA_OFFSET_X))){
this.edge_scroll("up","anim",-5);}
if((pos_y<=-540)&&(pos_x>=(-960+DEF_BROWSER_NAGARA_OFFSET_X))){
this.edge_scroll("down","anim",5);}
if(pos_x<=-960){
this.edge_scroll("left","anim",-5);}
if(pos_x>=959){
this.edge_scroll("right","anim",5);}
if(!this.in_edge_scroll_mode){
this.stop_edge_scroll();}
if(this.direction){
var self=this;
delete_timer(this.edge_scroll_wait);
append_timer(this.edge_scroll_wait,DEF_4K2K?300:150,function(obj,count){
delete_timer(obj);
self.stop_edge_scroll();});}
console.log("[scroll_mgr.prototype.decide_edge_scroll][END]");};
scroll_mgr.prototype.edge_scroll=function (direction,act,val){
brw_obj.clear_asr_link("all");
if(!this.scroll_check(direction)){
delete_timer(this.edge_scroll_exe);
return;}
this.in_edge_scroll_mode=true;
brw_obj.scroll_start_cb();
var self=this;
delete_timer(this.edge_obj);
append_timer(this.edge_obj,TIMER_RESOLUTION*14,function(obj){
self.in_edge_scroll_mode=false;
delete_timer(obj);
brw_obj.update_cursor_img();
brw_obj.scroll_end_cb();});
this.start_edge_scroll(direction,act,val);
brw_obj.update_cursor_img();};
scroll_mgr.prototype.start_edge_scroll=function (direction,act,val){
if(this.direction!=direction){
this.direction=direction;
var scroll_val=val;
delete_timer(this.edge_scroll_exe);
var scroll_count=0;
var add_val=0;
var self=this;
append_timer(this.edge_scroll_exe,DEF_4K2K?200:100,function(obj,count){
if(!self.scroll_check(self.direction)){
self.stop_edge_scroll();
return;}
if(scroll_count<13){
scroll_count++;
add_val+=5;
if(scroll_val>0){
scroll_val+=add_val;}else{
scroll_val-=add_val;}
}
if((self.direction=="up")||(self.direction=="down")){
brw_obj.scroll_obj.move(0,scroll_val);}else{
brw_obj.scroll_obj.move(scroll_val,0);}
});}
};
scroll_mgr.prototype.stop_edge_scroll=function(){
delete_timer(this.edge_scroll_exe);
this.direction="";
this.cnt_cancel_rev_move=3;};
brw_obj.scroll_action_hook=function (direction,act,val){
if(act=="anim"){
this.scroll_obj.adjust_move(direction,val);}else{
if((direction=="up")||(direction=="down")){
this.scroll_obj.move_no_anim(0,val);}else{
this.scroll_obj.move_no_anim(val,0);}
}
};
scroll_mgr.prototype.scroll_check=function(direction){
if(direction=="up"){
if((this.y==0)&&(brw_obj.zoom_info.upper_space==0)){
return false;}
}else if(direction=="down"){
if((this.y>=(contents_h-DEF_BROWSER_HEIGHT))&&(brw_obj.zoom_info.lower_space==0)){
return false;}
}else if(direction=="left"){
if((this.x==0)&&(brw_obj.zoom_info.left_space==0)){
return false;}
}else{
if((this.x>=(contents_w-DEF_BROWSER_WIDTH))&&(brw_obj.zoom_info.right_space==0)){
return false;}
}
return true;};
brw_obj.scroll_done=function (delta_x,delta_y){
if(delta_y<0){
brw_obj.scroll_up(-delta_y);
brw_obj.scroll_bar.appear_bar_h();}else if(delta_y>0){
brw_obj.scroll_down(delta_y);
brw_obj.scroll_bar.appear_bar_h();}
if(delta_x<0){
brw_obj.scroll_left(-delta_x);
brw_obj.scroll_bar.appear_bar_w();}else if(delta_x>0){
brw_obj.scroll_right(delta_x);
brw_obj.scroll_bar.appear_bar_w();}
if(brw_obj.video_box.is_exist())
brw_obj.video_box.update();
brw_obj.scroll_bar.update();};
brw_obj.scroll_up=function(val){
var zoom_info=this.zoom_info.get();
var delta=Math.floor(val/zoom_info.size);
if(!this.zoom_info.is_top()){
console_log("[TXK_UP]Scroll in zoom delta:"+delta);
if(zoom_info.y-delta<0)
zoom_info.y=0;
else
zoom_info.y-=delta;
ebus.pbrowser[0].request(false,null,this.pb.ZOOM,zoom_info.x*COORDINATE_CONV,
zoom_info.y*COORDINATE_CONV,zoom_info.w*COORDINATE_CONV,
zoom_info.h*COORDINATE_CONV);
console_log("[TXK_UP]Scroll x:"+zoom_info.x+" y:"+zoom_info.y+" w:"+zoom_info.w+" h:"+zoom_info.h);
this.zoom_info.set(zoom_info);
this.zoom_info.set_space_h();}else{
ebus.pbrowser[0].request(false,null,this.pb.SCROLL_DELTA,0,-delta);}
this.focus_obj.setShow(false);
this.clear_asr_link("all");};
brw_obj.scroll_down=function(val){
var zoom_info=this.zoom_info.get();
var delta=Math.floor(val/zoom_info.size);
if(!this.zoom_info.is_bottom()){
if((zoom_info.y+zoom_info.h+delta)<DEF_BROWSER_HEIGHT)
zoom_info.y+=delta;
else
zoom_info.y=DEF_BROWSER_HEIGHT-zoom_info.h;
ebus.pbrowser[0].request(false,null,this.pb.ZOOM,zoom_info.x*COORDINATE_CONV,
zoom_info.y*COORDINATE_CONV,zoom_info.w*COORDINATE_CONV,
zoom_info.h*COORDINATE_CONV);
console_log("[TXK_DOWN]Scroll x:"+zoom_info.x+" y:"+zoom_info.y+
" w:"+zoom_info.w+" h:"+zoom_info.h);
this.zoom_info.set(zoom_info);
this.zoom_info.set_space_h();}else{
ebus.pbrowser[0].request(false,null,this.pb.SCROLL_DELTA,0,delta);}
this.focus_obj.setShow(false);
this.clear_asr_link("all");};
brw_obj.scroll_left=function(val){
var zoom_info=this.zoom_info.get();
var delta=Math.floor(val/zoom_info.size);
if(!this.zoom_info.is_left()){
console_log("[TXK_LEFT]Scroll in zoom delta:"+delta);
if(zoom_info.x-delta<0)
zoom_info.x=0;
else
zoom_info.x-=delta;
ebus.pbrowser[0].request(false,null,this.pb.ZOOM,zoom_info.x*COORDINATE_CONV,
zoom_info.y*COORDINATE_CONV,zoom_info.w*COORDINATE_CONV,
zoom_info.h*COORDINATE_CONV);
console_log("[TXK_LEFT]Scroll x:"+zoom_info.x+" y:"+zoom_info.y+
" w:"+zoom_info.w+" h:"+zoom_info.h);
this.zoom_info.set(zoom_info);
this.zoom_info.set_space_w();}else{
console_log("[TXK_LEFT]Scroll delta:"+delta);
ebus.pbrowser[0].request(false,null,this.pb.SCROLL_DELTA,-delta,0);}
this.focus_obj.setShow(false);
this.clear_asr_link("all");};
brw_obj.scroll_right=function(val){
var zoom_info=this.zoom_info.get();
var delta=Math.floor(val/zoom_info.size);
if(!this.zoom_info.is_right()){
console_log("[TXK_RIGHT]Scroll in zoom delta:"+delta);
if((zoom_info.x+zoom_info.w+delta)<DEF_BROWSER_WIDTH)
zoom_info.x+=delta;
else
zoom_info.x=DEF_BROWSER_WIDTH-zoom_info.w;
ebus.pbrowser[0].request(false,null,this.pb.ZOOM,zoom_info.x*COORDINATE_CONV,
zoom_info.y*COORDINATE_CONV,zoom_info.w*COORDINATE_CONV,
zoom_info.h*COORDINATE_CONV);
console_log("[TXK_RIGHT]Scroll x:"+zoom_info.x+" y:"+zoom_info.y+
" w:"+zoom_info.w+" h:"+zoom_info.h);
this.zoom_info.set(zoom_info);
this.zoom_info.set_space_w();}else{
console_log("[TXK_RIGHT]Scroll delta:"+delta);
ebus.pbrowser[0].request(false,null,this.pb.SCROLL_DELTA,delta,0);}
this.focus_obj.setShow(false);
this.clear_asr_link("all");};
brw_obj.apply_keyboard=function (value,mode){
console_log("[START][apply_keyboard]text:"+value);
if(this.skb_appear){
return this.skb_appear({text:value,mode:mode});}
return false;
console_log("[END][apply_keyboard]");};
brw_obj.insecure_chk=function (url){
if(!this.page_info.load_url)return true;
var end_pos1=0;
var end_pos2=0;
var insecure_url="";
var load_url="";
end_pos1=url.indexOf("://",0);
if(end_pos1>0){
insecure_url=url.substring(end_pos1+3);}else{
insecure_url=url;}
end_pos1=insecure_url.indexOf("/",8);
end_pos2=insecure_url.indexOf(":",8);
if((end_pos2>0)&&((end_pos1>0)||(end_pos1>end_pos2))){
insecure_url=insecure_url.substring(0,end_pos2);}else{
if(end_pos1>0){
insecure_url=insecure_url.substring(0,end_pos1);}
}
end_pos1=this.page_info.load_url.indexOf("://",0);
if(end_pos1>0){
load_url=this.page_info.load_url.substring(end_pos1+3);}else{
load_url=this.page_info.load_url;}
end_pos1=load_url.indexOf("/",8);
end_pos2=load_url.indexOf(":",8);
if((end_pos2>0)&&((end_pos1>0)||(end_pos1>end_pos2))){
load_url=load_url.substring(0,end_pos2);}else{
if(end_pos1>0){
load_url=load_url.substring(0,end_pos1);}
}
console_log("[brw_obj.insecure_chk]load:"+load_url);
console_log("[brw_obj.insecure_chk]insecure:"+insecure_url);
if(insecure_url==load_url){
return true;}else{
return false;}
}
brw_obj.insecure_same_chk=function (url){
var end_pos1=0;
var end_pos2=0;
var old_url="";
var new_url="";
end_pos1=url.indexOf("://",0);
if(end_pos1>0){
new_url=url.substring(end_pos1+3);}else{
new_url=url;}
end_pos1=new_url.indexOf("/",8);
end_pos2=new_url.indexOf(":",8);
if((end_pos2>0)&&((end_pos1>0)||(end_pos1>end_pos2))){
new_url=new_url.substring(0,end_pos2);}else{
if(end_pos1>0){
new_url=new_url.substring(0,end_pos1);}
}
end_pos1=this.page_info.insecure_url.indexOf("://",0);
if(end_pos1>0){
old_url=this.page_info.insecure_url.substring(end_pos1+3);}else{
old_url=this.page_info.insecure_url;}
end_pos1=old_url.indexOf("/",8);
end_pos2=old_url.indexOf(":",8);
if((end_pos2>0)&&((end_pos1>0)||(end_pos1>end_pos2))){
old_url=old_url.substring(0,end_pos2);}else{
if(end_pos1>0){
old_url=old_url.substring(0,end_pos1);}
}
console_log("[brw_obj.insecure_same_chk]old_url:"+old_url);
console_log("[brw_obj.insecure_same_chk]new_url:"+new_url);
if(new_url==old_url){
return true;}else{
this.page_info.insecure_url=new_url;
return false;}
}
brw_obj.update_cursor_img=function (){
if(this.stage==HOME)return;
if(this.in_wheel_mode){
system.cursor_pointer.set_current_index(4);}else if(this.scroll_info&&this.scroll_info.in_edge_scroll_mode){
console_log("[brw_obj.update_cursor_img]scroll");
if(this.scroll_info.direction=="up"){
system.cursor_pointer.set_current_index(9);}else if(this.scroll_info.direction=="down"){
system.cursor_pointer.set_current_index(10);}else if(this.scroll_info.direction=="left"){
system.cursor_pointer.set_current_index(11);}else{
system.cursor_pointer.set_current_index(12);}

}else if(this.in_busy){
system.cursor_pointer.set_current_index(3);}else {
if(this.fg_clickable){
if(this.fg_loading){
system.cursor_pointer.set_current_index(2);}else{
system.cursor_pointer.set_current_index(1);}
}else{
if(this.fg_loading){
system.cursor_pointer.set_current_index(2);}else{
system.cursor_pointer.set_current_index(0);}
}
}
};
brw_obj.connected_ev=function (bw){
bw.set_auto_redraw(true);
bw.request(true,this.get_enum_hook,bw.GET_ENUM,"brw_obj.pb");
if(!this.restart_browsing){
if(DEF_CHANGE_SCREEN){
this.set_resize_init();
bw.request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,600*COORDINATE_CONV,DEF_TOOLBAR_H*COORDINATE_CONV,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RESIZE,1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,DEF_BROWSER_RS_HEIGHT);
this.zoom_info.init();
if(DEF_4K2K){
var now_level=apps_nvram.read("ZOOM_LEVEL","home");
if(now_level==null)
now_level=this.zoom_info.get_level();}else{
var now_level=this.zoom_info.get_level();}
this.zoom_info.set_level(now_level);
this.zoom_info.zoom_action();}
}else{
switch_screen_size();
this.translate=DEF_BROWSER_TRANSLATE;
this.width=DEF_BROWSER_WIDTH;
this.height=DEF_BROWSER_HEIGHT;
this.pb_width=DEF_BROWSER_PB_WIDTH;
this.pb_height=DEF_BROWSER_PB_HEIGHT;
bw.request(false,null,this.pb.SET_SUPPRESS_UPDATE,true);
if(side_w_mode){
bw.request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,
600*COORDINATE_CONV,DEF_TOOLBAR_H*COORDINATE_CONV,
1280*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RESIZE,1280*COORDINATE_CONV,
DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,
DEF_BROWSER_RS_HEIGHT);}else{
bw.request(false,null,this.pb.SET_ACTIVE_PAINTING_AREA,
0,DEF_TOOLBAR_H*COORDINATE_CONV,
1884*COORDINATE_CONV,DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RESIZE,1884*COORDINATE_CONV,
DEF_BROWSER_H*COORDINATE_CONV);
bw.request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,
DEF_BROWSER_RS_HEIGHT);}
bw.request(false,null,this.pb.SET_SUPPRESS_UPDATE,false);
this.scroll_bar.set_position();
var now_level=this.zoom_info.get_level();
this.zoom_info.init();
this.zoom_info.set_level(1);
this.zoom_info.zoom_action();
if(now_level!=1){
this.zoom_info.set_level(now_level);
this.zoom_info.zoom_action();}
}
if(check_pb_version(BRW_VER_COMP_VIDEOBOX)){
this.vbox_new =true;}else{
this.vbox_new =false;}
if(check_pb_version(BRW_VER_FLASH_FULL)){
this.flash_full=true;}else{
this.flash_full=false;}
var cache_size=get_browser_cache_size(this.stage);
if(cache_size>0||system.locale.country.indexOf("JP")==0){
console_log("SET_CACHE_POLICY: cache_size = "+cache_size);
bw.request(false,null,this.pb.SET_CACHE_POLICY,
0,cache_size,cache_size,0,0);}
if(this.stage==HOME){
bw.request(false,null,this.pb.SET_HIDDEN,true);}else{
bw.request(false,null,this.pb.SET_HIDDEN,false);}
bw.request(false,null,this.pb.SET_CONFIG_DIR,"platinum");
if(this.pb.SET_CA_CERT){
bw.request(false,null,this.pb.SET_CA_CERT,"webbrowser_cacert.pem");}
bw.request(false,null,this.pb.SET_CUSTOM_SCROLLBAR_ENABLED,true);
if(use_tts&&brw_obj.get_tts_supported()){
bw.request(false,null,this.pb.SET_VOICE_NAVI_ENABLED,true);}
try{
if(this.pb.SET_WAIT_FOR_RESPONSE_ENABLED){
bw.request(false,null,this.pb.SET_WAIT_FOR_RESPONSE_ENABLED,
this.pb.ENABLE_ALERT|this.pb.ENABLE_CONFIRM|this.pb.ENABLE_PROMPT
|this.pb.ENABLE_AUTHENTICATION|this.pb.ENABLE_INSECURE);
console_log("[brw_obj.connected_ev]SET ENABLE_AUTHENTICATION");}else{
bw.request(false,null,this.pb.SET_JS_POPUP_BOXES_ENABLED,true);}
}catch(e){
}
bw.request(false,null,this.pb.SET_CUSTOM_FOCUS_RING_ENABLED,true);
bw.request(false,null,this.pb.SET_FOCUS_RING_STYLE,128,230,255,0);if(this.pb.default_useragent){
var ua=this.pb.default_useragent.replace("FreeBSD","X11; FreeBSD");
bw.request(false,null,this.pb.SET_USERAGENT,ua);}
if(!DEF_CHANGE_SCREEN){
bw.request(false,null,this.pb.RENDERING_SIZE,DEF_BROWSER_RS_WIDTH,DEF_BROWSER_RS_HEIGHT);}
if(system.locale.country.indexOf("JP")==0){
bw.request(false,null,this.pb.SET_URL_FILTERING_ENABLED,true);}
if(this.pb.SET_NSPLUGIN_ENABLED&&!DEF_DISABLE_FLASH)
bw.request(false,null,this.pb.SET_NSPLUGIN_ENABLED,true);
if((DEF_SIDE_WINDOW)&&(this.pb.SET_RUNTIMEFEATURES))
bw.request(false,null,this.pb.SET_RUNTIMEFEATURES,"FullScreen",true);
if((DEF_SIDE_TV)&&(this.pb.SET_VIDEOBOX_DISPLAY))
bw.request(false,null,this.pb.SET_VIDEOBOX_DISPLAY,1);
brw_connection=BROWSER_CONNECTED;
if(!this.restart_browsing){
if(this.connect_cb)this.connect_cb(this.url_init);}else{
this.restart_browsing=false;
if(this.connect_cb)this.connect_cb(BRW_INFO.url);}
this.url_init="";
this.do_not_tracking_action(this.get_do_not_tracking());}
brw_obj.load_started_ev=function (bw){
this.fg_loading=true;
this.in_busy=true;
brw_connection=BROWSER_LOADING;
if(this.fg_full){
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,this.pb.VKEY_ESCAPE,0);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.KeyUp,this.pb.VKEY_ESCAPE,0);}
if(this.load_started_cb)this.load_started_cb();
this.update_cursor_img();
this.page_info.load_url="";
this.page_info.insecure_url="";
this.text_tts="";
delete_timer(bw);
append_timer(bw,1000,function (obj,count){
if(count>BROWSER_TIMEOUT_COUNT){
delete_timer(obj);
}
brw_obj.scroll_bar.appear_bar_w();
brw_obj.scroll_bar.appear_bar_h();});}
var is_default_search_engine=function(){
try{
var ret=apps_nvram_file.read({"filename":"SEARCH_DATA",
sync:false,finished:function(){},product_id:"home"});
if(ret!=null){
var tmp=sysutil.tconv.binary_to_string(ret);
var search_data=eval(tmp);
if("default_search_engine" in search_data){
return true;}
}
}catch(e){
}
return false;};
brw_obj.load_finished_ev=function (bw){
if(brw_connection==BROWSER_LOAD_FAILED)return;
brw_connection=BROWSER_LOAD_FINISHED;
delete_timer(bw);
delete_timer(this);
append_timer(bw,TIMER_RESOLUTION*4,function (obj){
delete_timer(obj);
if(use_tts&&!brw_obj.focus_status){
if(brw_obj.get_tts_supported()&&brw_obj.pb.TTS_REQ_TEXT)
console_log(">>>>>>>>>> TTS_REQ_TEXT3");
ebus.pbrowser[0].request(false,null,brw_obj.pb.TTS_REQ_TEXT,
brw_obj.pb.TTS_REQ_TYPE_MOUSE_POINTER,mouse_pos_x,mouse_pos_y);}
brw_obj.brw.visible_p=true;
brw_obj.loaded_cb();
brw_obj.progress_bar.disappear();
brw_obj.scroll_bar.update();
brw_obj.fg_loading=false;
brw_obj.in_busy=false;
brw_obj.fg_clickable=false;
brw_obj.update_cursor_img();
brw_obj.load_first_time=false;});}
brw_obj.load_failed_ev=function (bw,data1,data2){
brw_connection=BROWSER_LOAD_FAILED;
this.progress_bar.disappear();
this.fg_loading=false;
this.in_busy=false;
this.fg_clickable=false;
this.update_cursor_img();
delete_timer(bw);
delete_timer(this);
if(!this.load_first_time)this.load_stop_req();
if(this.load_failed_cb)this.load_failed_cb(data2);}
brw_obj.popup_ev=function (bw){
brw_connection=BROWSER_LOAD_FINISHED;
this.progress_bar.disappear();
delete_timer(bw);
delete_timer(this);
this.fg_loading=false;
this.in_busy=false;
this.update_cursor_img();
this.clear_asr_link("all");};
brw_obj.event_hook=function (stg,bw,event,ev,data1,data2,data3){
var self=brw_obj;
switch(event){
case bw.CONNECTED_EV:
console_log("CONNECTED_EV");
brw_obj.connected_ev(bw);
break;
case bw.BROWSER_EV:
switch(ev){
case self.pb.CLIP_PAINT_EV:
console_log("CLIP_PAINT_EV");
brw_obj.clip_paint_cb();
break;
case self.pb.LOAD_STARTED_EV:
console_log("[LOAD_STARTED_EV]");
self.clear_asr_link("all");
brw_obj.load_started_ev(bw);
break;
case self.pb.LOAD_PROGRESS_EV:
console_log("[LOAD_PROGRESS_EV]progress:"+arguments[4]);
if((!self.progress_bar.visible_p)&&(arguments[4]!=100)){
self.progress_bar.appear();}
if(arguments[4]>=40){
self.in_busy=false;
self.update_cursor_img();
if(arguments[4]>=50){
self.focus_obj.setShow(false);}
if(arguments[4]>=80){
self.cover.visible_p=false;}
}
self.progress_bar.update(arguments[4]);
break;
case self.pb.START_PAINTING_EV:
console_log("<START_PAINTING_EV>:url",arguments[4]);
self.cover.visible_p=false;
break;
case self.pb.LOAD_FINISHED_EV:
console_log("[LOAD_FINISHED_EV]");
brw_obj.load_finished_ev(bw);
break;
case self.pb.LOAD_FAILED_EV:
console_log("[LOAD_FAILED_EV]");
self.clear_asr_link("all");
brw_obj.load_failed_ev(bw,data1,data2);
break;
case self.pb.SCROLL_POSITION_EV:
console_log("scroll_position("+arguments[4]+", "+arguments[5]+")");
var tmp_x=arguments[4]*DEF_RS_SIZE_W;
var tmp_y=arguments[5]*DEF_RS_SIZE_H;
if((self.scroll_info.x!=tmp_x)||(self.scroll_info.y!=tmp_y)){
if(self.scroll_info.x!=tmp_x){
self.scroll_info.x=Math.floor(tmp_x);
self.scroll_bar.appear_bar_w();}
if(self.scroll_info.y!=tmp_y){
self.scroll_info.y=Math.floor(tmp_y);
self.scroll_bar.appear_bar_h();}
if(self.video_box.visible_p)brw_obj.video_box.update();
brw_obj.scroll_bar.update();}
break;
case self.pb.CONTENTS_SIZE_EV:
console_log("contents_size("+arguments[4]+", "+arguments[5]+")");
contents_org_w=arguments[4];
contents_org_h=arguments[5];
if(DEF_4K2K&&brw_obj.zoom_info.get_level()==1){
contents_zoom1_w=arguments[4];
contents_zoom1_h=arguments[5];}
contents_w=Math.floor(arguments[4]*DEF_RS_SIZE_W);
contents_h=Math.floor(arguments[5]*DEF_RS_SIZE_H);
self.scroll_bar.appear_bar_w();
self.scroll_bar.appear_bar_h();
self.scroll_bar.update();
break;
case self.pb.FOCUSED_NODE_EV:
console_log("[FOCUSED_NODE_EV]");
self.focus_info.set(self,arguments);
break;
case self.pb.INVOKE_SOFTKEYBOARD_EV:console_log("[INVOKE_SOFTKEYBOARD_EV]",arguments[4],arguments[5],arguments[6],arguments[7]);
self.point_info.x=arguments[4];
self.point_info.y=arguments[5];
self.point_info.w=arguments[6];
self.point_info.h=arguments[7];
if(self.apply_keyboard("","")){
if(!self.focus_obj.isShow()){
var param=calc_draw_pos_forFocus(arguments[4],arguments[5],
arguments[6],arguments[7]);
self.focus_obj.setSize(param.w,param.h);
self.focus_obj.setTranslate(param.x,param.y,0);
self.focus_obj.setShow(true);}
}
break;
case self.pb.DISMISS_SOFTKEYBOARD_EV:console_log("[DISMISS_SOFTKEYBOARD_EV]");
if(self.skb_disappear)self.skb_disappear();
break;
case self.pb.TTS_RES_TEXT_EV:
console_log("[TTS_RES_TEXT_EV]id:"+arguments[5]+"\n"+arguments[4]);
console_log("[TTS_RES_TEXT_EV]"+arguments[6]+" "+arguments[7]+" "+arguments[8]+" "+arguments[9]);
if(!self.get_tts_mode())break;
self.set_tts_str(arguments[4],arguments[5]);
if(!self.asr_fg_link){
if(arguments[6]<=-10){
self.focus_obj.setShow(false);}else{
var param=calc_draw_pos_forFocus(arguments[6],arguments[7],
arguments[8],arguments[9]);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
self.focus_obj.setSize(param.w,param.h);
self.focus_obj.setTranslate(param.x,param.y,0);
self.focus_obj.setShow(true);}
}
break;
case self.pb.TTS_RES_ELEMENT_RECT_EV:
console_log("[event_hook][TTS_RES_ELEMENT_RECT_EV]",arguments[4],arguments[5],arguments[6],arguments[7]);
if(!self.get_tts_mode())break;
var param=calc_draw_pos_forFocus(arguments[4],arguments[5],
arguments[6],arguments[7]);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
self.focus_obj.setSize(param.w,param.h);
self.focus_obj.setTranslate(param.x,param.y,0);
self.focus_obj.setShow(true);
break;
case self.pb.ASR_RES_LINK_EV:
console_log("[event_hook][ASR_RES_LINK_EV]"+arguments[4]);
if(!DEF_ASR)break;
var tmp_arg=eval("("+arguments[4]+")");
if(tmp_arg.result&&(tmp_arg.result!=null)){
self.asr_list_link_info=tmp_arg;
self.set_asr_link_focus();}
break;
case self.pb.TAKE_FOCUS_EV:
console_log("[TAKE_FOCUS_EV]");
break;
case self.pb.PAGE_INFORMATION_EV:
console_log("[event_hook][PAGE_INFORMATION_EV]uri:"+data1);
console_log("[event_hook][PAGE_INFORMATION_EV]title:"+data2);
console_log("[event_hook][PAGE_INFORMATION_EV]favicon_uri:"+data3);
self.page_info.uri=data1;
self.page_info.load_url=data1;
self.page_info.title=data2;
self.page_info.favicon_uri=data3;
if(self.page_info_cb)self.page_info_cb(self.page_info);
break;
case self.pb.EDIT_TEXT_EV:
console_log("[event_hook][EDIT_TEXT_EV]");
self.focus_info.edit_text_cb(self,arguments);
break;
case self.pb.SHOW_POPUP_MENU_EV:
console_log("[event_hook][SHOW_POPUP_MENU_EV]");
bw.request(false,null,self.pb.SELECT_POPUP_MENU_ITEM,arguments[8]);
break;
case self.pb.HIDE_POPUP_MENU_EV:
break;
case self.pb.VIDEOBOX_EV:
if(brw_obj.video_box.check_update(
arguments[4],arguments[5],arguments[6],arguments[7])){
var bplayer=new BroadcastPlayer();
if(arguments[6]&&arguments[7]){
brw_obj.video_box.update({x:arguments[4],y:arguments[5],
w:arguments[6],h:arguments[7]});
if((DEF_SIDE_TV)&&(self.stage!=HOME)&&(!self.video_box.visible_p))
bplayer.set_browser_mode(BR_SRC_TV_VS);
self.video_box.visible_p=true;}else {
if((DEF_SIDE_TV)&&(self.stage!=HOME)&&(self.video_box.visible_p))
bplayer.set_browser_mode(BR_SRC_TVS_V);
self.video_box.init();}
}
if(!enable_keyhook){
enable_keyhook=true;
system.effect.fade(system.effect.FADE_IN);}
break;
case self.pb.RESIZE_FAILED_EV:
if(self.pb_resize_count>0){
self.pb_width=Math.floor(self.pb_width*0.9);
self.pb_height=Math.floor(self.pb_height*0.9);
bw.request(false,null,self.pb.RESIZE,self.pb_width,self.pb_height);
self.pb_resize_count--;}else {
ebus.pbrowser[0].discard();}
break;
case self.pb.SET_CURSOR_EV:
try{
if(arguments[4]=="pointer"){
self.fg_clickable=false;
self.update_cursor_img();
}else if(arguments[4]=="hand"){
self.fg_clickable=true;
self.update_cursor_img();
}else if(arguments[4]=="custom"){
console_log("[SET_CURSOR_EV] cursor:",arguments[4],",format:",arguments[6],",endian:",arguments[7],",width:",arguments[8],",height:",arguments[9],",hotspot_x:",arguments[10],",hotspot_y:",arguments[11]);
var index=16;
system.cursor_pointer.set_image({index:index,
type:system.cursor_pointer.IMG_FMT_BITMAP,
data:arguments[5],
img_width:arguments[6],
img_height:arguments[7],
host_spot_x:arguments[8],
host_spot_y:arguments[9],
draw_width:100,
draw_height:100});
system.cursor_pointer.set_current_index(index);
force_redraw();}
}catch(e){
}
break;
case self.pb.ALERT_EV:
console_log("[ALERT_EV]");
self.clear_asr_link("all");
self.show_popup_cb({type:BROWSER_ALERT_EV,msg:arguments[4]});
break;
case self.pb.CONFIRM_EV:
console_log("[CONFIRM_EV]text:"+arguments[4]);
self.clear_asr_link("all");
self.show_popup_cb({type:BROWSER_CONFIRM_EV,msg:arguments[4]});
break;
case self.pb.PROMPT_EV:
console_log("[PROMPT_EV]message:",arguments[4]," default:",arguments[5]);
self.clear_asr_link("all");
self.prompt_cb(arguments);
break;
case self.pb.AUTHENTICATION_EV:
console_log("[AUTHENTICATION_EV]:url:"+arguments[4]+" realm:"+arguments[5]);
self.dclick_obj.init();
self.popup_ev(bw);
self.authentication_cb(arguments);
break;
case self.pb.INSECURE_EV:
console_log("[INSECURE_EV]url:",arguments[4]);
if(self.insecure_same_chk(arguments[4])){
self.insecure_req(false);}else{
if(self.insecure_chk(arguments[4])){
self.popup_ev(bw);
self.show_popup_cb({type:BROWSER_INSECURE_EV});}else{
self.insecure_req(true);}
}
break;
case self.pb.NO_BACK_HISTORY_EV:
console_log("[NO_BACK_HISTORY_EV]");
self.return_cb(self.page_info);
break;
case self.pb.BACKFORWARD_COUNT_EV:
console_log("[BACKFORWARD_COUNT_EV]back:"+arguments[4]+", forward:"+arguments[5]);
self.page_info.back_count=arguments[4];
self.page_info.forward_count=arguments[5];
if(self.change_status_cb)self.change_status_cb();
break;
case self.pb.ENTER_FULLSCREEN_EV:
console_log("[ENTER_FULLSCREEN_EV]");
if(!DEF_SIDE_WINDOW)
break;
self.fg_full=true;
if((DEF_SIDE_TV)&&(self.stage!=HOME)){
var bplayer=new BroadcastPlayer();
bplayer.set_browser_mode(BR_SRC_TV_FULL);
bplayer.disconnect();}
self.full_brw.src=ebus.pbrowser[0].fullscreen_pixmap;
self.full_brw.visible_p=true;
self.brw.visible_p=false;
self.full_screen_cb(true);
force_redraw();
var pos_x=system.cursor_pointer.get_pos_x();
var pos_y=system.cursor_pointer.get_pos_y();
mouse_pos_x=pos_x+960-DEF_BRW_FULL_OFFSET_X;
mouse_pos_y=-pos_y+540;
brw_obj.set_drag_mode(brw_obj.drag_mode);
break;
case self.pb.EXIT_FULLSCREEN_EV:
console_log("[EXIT_FULLSCREEN_EV]");
if(!DEF_SIDE_WINDOW)
break;
self.fg_full=false;
if((DEF_SIDE_TV)&&(self.stage!=HOME)){
var bplayer=new BroadcastPlayer();
bplayer.connect(VideoDev,AudioDev);
if(self.video_box.visible_p){
bplayer.set_browser_mode(BR_SRC_TV_VS);}else{
bplayer.set_browser_mode(BR_SRC_TVS_V);}
}
self.full_screen_cb(false);
self.brw.visible_p=true;
self.full_brw.visible_p=false;
self.full_brw.src="";
self.video_box.visible_p=false;
if(self.url_init){
self.open_url(self.url_init);
self.url_init="";}
var pos_x=system.cursor_pointer.get_pos_x();
var pos_y=system.cursor_pointer.get_pos_y();
mouse_pos_x=pos_x+960-DEF_BROWSER_NAGARA_OFFSET_X;
mouse_pos_y=-pos_y+540-DEF_TOOLBAR_H;
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
mouse_pos_x=Math.round(zoom_info.x+mouse_pos_x/zoom_info.size);
mouse_pos_y=Math.round(zoom_info.y+mouse_pos_y/zoom_info.size);
if(mouse_pos_y==0)mouse_pos_y=1;}
brw_obj.set_drag_mode(brw_obj.drag_mode);
break;
case self.pb.VDECODE_4K_EV:
console_log("[VDECODE_4K_EV] : "+arguments[4]);
if((DEF_SIDE_TV)&&(self.stage!=HOME)){
var bplayer=new BroadcastPlayer();
bplayer.set_vdecode_4k(arguments[4],arguments[5],arguments[6]);
if(arguments[4]==0){
if(!self.fg_full&&!brw_disp.full.visible_p){
bplayer.connect(VideoDev,AudioDev);}
}else{
if(!self.fg_full&&!brw_disp.full.visible_p){
bplayer.disconnect();}
}
force_redraw();}
break;
case self.pb.VIDEO_4K_STOP_IN_REC_EV:
console_log("[VIDEO_4K_STOP_IN_REC_EV]");
self.clear_asr_link("all");
self.show_popup_cb({type:BROWSER_CAN_NOT_PLAY_EV});
break;
default:
break;}
break;
case bw.EXIT_EV:
console_log("[event_hook][EXIT_EV]");
if(!self.restart_browsing){
brw_connection=BROWSER_DISCONNECTED;
self.url_init="";
var status=bw.get_status();
var code=bw.get_exit_code();
console_log("[event_hook][EXIT_EV] DISCONNECTED status:"+status+" code:"+code);
if((status==4)&&(code[0]==2)){
if(self.disconnect_cb)self.disconnect_cb(9999);}else{
if(self.disconnect_cb)self.disconnect_cb();}
self.clear_asr_link("all");}
else {
if(DEF_CHANGE_SCREEN){
ebus.pbrowser[0].launch({width:1920*COORDINATE_CONV,
height:1080*COORDINATE_CONV,is_fullscreen_available:false,
private_browsing:self.get_private_browsing()});}else{
ebus.pbrowser[0].launch({width:self.pb_width,height:self.pb_height,
is_fullscreen_available:false,private_browsing:self.get_private_browsing()});}
}
break;
default:
}
};
brw_obj.asr_action_pkg=function (id,val){
console_log("[brw_obj.asr_action_pkg]id:"+id+" val:"+val);
switch(id){
case 20:
brw_obj.scroll_done(0,-DEF_BROWSER_RS_HEIGHT);
brw_obj.scroll_bar.update();
break;
case 21:
brw_obj.scroll_done(0,DEF_BROWSER_RS_HEIGHT);
brw_obj.scroll_bar.update();
break;
case 22:
brw_obj.scroll_done(-DEF_BROWSER_RS_WIDTH,0);
brw_obj.scroll_bar.update();
break;
case 23:
brw_obj.scroll_done(DEF_BROWSER_RS_WIDTH,0);
brw_obj.scroll_bar.update();
break;
case 50:
if(this.pb.ASR_SEARCH_LINK){
console_log("[BROWSER]: call ASR_ENTER_LINK : ",val);
ebus.pbrowser[0].request(false,null,this.pb.SET_ASR_FOCUS_RING_STYLE,
255,0,0,4);ebus.pbrowser[0].request(false,null,this.pb.ASR_SEARCH_LINK,val);}
break;};};
brw_obj.set_asr_link_focus=function(){
var list=this.asr_list_link_info;
if(list.result.length==0)return;
this.focus_obj.setShow(false);
if(list.result.length==1){
var param=calc_draw_pos_forFocus(list.result[0].x,list.result[0].y,
list.result[0].w,list.result[0].h);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
this.focus_obj.setSize(param.w,param.h);
this.focus_obj.setTranslate(param.x,param.y,0);
this.focus_obj.setShow(true);
if(list.result[0].url){
ebus.pbrowser[0].request(false,null,this.pb.LOAD_URL,list.result[0].url);}
}else if(list.result.length>1){
this.asr_fg_link=true;
var num=list.result.length>30?30:list.result.length;
var i=0;
var j=1;
var temp;
var exchange=false;
while(i<num){while(j<num){
if(list.result[j].y<list.result[i].y){
exchange=true;}else if(list.result[j].y==list.result[i].y){
if(list.result[j].x<list.result[i].x){
exchange=true;}
}
if(exchange){
temp=list.result[i];
list.result[i]=list.result[j];
list.result[j]=temp;
exchange=false;}
j++;}
i++;
j=i+1;}
for(var i=0;i<num;i++){
this.asr_focus_obj.components.push(new brw_focus());
var param=calc_draw_pos(list.result[i].x,list.result[i].y,
list.result[i].w,list.result[i].h);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
this.asr_focus_obj.components[i].setSize(param.w,param.h);
this.asr_focus_obj.components[i].setTranslate(param.x-DEF_BROWSER_TRANSLATE[0],param.y,0);
this.asr_focus_obj.components[i].setShow(true);
this.asr_ary_focus.push({x1:param.x-param.w/2-2,y1:param.y+param.h/2+2,
x2:param.x+param.w/2+2,y2:param.y-param.h/2-2});}

var param=calc_draw_pos_forFocus(list.result[0].x,list.result[0].y,
list.result[0].w,list.result[0].h);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
this.focus_obj.setSize(param.w,param.h);
this.focus_obj.setTranslate(param.x,param.y,0);
this.focus_obj.setShow(true);
this.asr_pos_current=0;
this.change_asr_mode_cb(true);}
force_redraw();};
brw_obj.clear_asr_link=function(type){
console_log("[brw_obj.clear_asr_link]"+type);
if(!this.asr_fg_link)return;
if(type=="all"){
this.focus_obj.setShow(false);}
this.asr_link_id=-1;
this.asr_ary_focus=[];
for(var i=0;i<this.asr_focus_obj.components.length;i++){
this.asr_focus_obj.components[i].free();}
this.asr_focus_obj.components.splice(0,this.asr_focus_obj.components.length);
this.asr_fg_link=false;
this.change_asr_mode_cb(false);};
brw_obj.move_asr_link_focus=function(data){
var param=calc_draw_pos_forFocus(data.x,
data.y,
data.w,
data.h);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
this.focus_obj.setSize(param.w,param.h);
this.focus_obj.setTranslate(param.x,param.y,0);
this.focus_obj.setShow(true);};
brw_obj.jump_asr_link=function(){
this.clear_asr_link("link");
ebus.pbrowser[0].request(false,null,this.pb.LOAD_URL,
this.asr_list_link_info.result[this.asr_pos_current].url);};
brw_obj.check_asr_link_pos=function(x,y){
var max=this.asr_ary_focus.length;
var i=0;
for(i=0;i<max;i++){
if(((x>=this.asr_ary_focus[i].x1)&&(x<=this.asr_ary_focus[i].x2))&&
((y>=this.asr_ary_focus[i].y2)&&(y<=this.asr_ary_focus[i].y1))){
break;}
}
return i;};
brw_obj.mouse_hook_asr=function(x,y,button){
if(!this.asr_fg_link)return;
var max=this.asr_ary_focus.length;
var pos=this.check_asr_link_pos(x,y);
if(pos<max){
if((!button&&!obutton)&&(this.asr_link_id!=pos)){
var param=calc_draw_pos_forFocus(this.asr_list_link_info.result[pos].x,this.asr_list_link_info.result[pos].y,
this.asr_list_link_info.result[pos].w,this.asr_list_link_info.result[pos].h);
if(param.h<DEF_FOCUS_HEIGHT_MIN)param.h=DEF_FOCUS_HEIGHT_MIN;
this.focus_obj.setSize(param.w,param.h);
this.focus_obj.setTranslate(param.x,param.y,0);
this.focus_obj.setShow(true);
if((this.get_tts_supported())&&(this.get_tts_mode())){
ebus.tts.play({"text":this.asr_list_link_info.result[pos].link_text,"force":true});}
}
if((button&ebus.mouse.DOWN_LEFT_BUTTON)&&(!(obutton&ebus.mouse.DOWN_LEFT_BUTTON))){
this.clear_asr_link("link");
ebus.pbrowser[0].request(false,null,this.pb.LOAD_URL,this.asr_list_link_info.result[pos].url);
return true;}
}else{
if(this.asr_link_id!=-1){
this.focus_obj.setShow(false);
this.asr_link_id=-1;}
}
this.asr_link_id=pos;
if(button||obutton){
this.clear_asr_link("all");}else{
}
return false;};
brw_obj.set_tts_str=function (text,id){
console_log("[brw_obj.set_tts_str]");
if(id!=this.id_tts){
if(this.fg_clickable){
console_log("[brw_obj.set_tts_str] root 1 text: "+text);
ebus.tts.play({"text":text+". Link","force":true});
}else{
console_log("[brw_obj.set_tts_str] root 2 text: "+text);
ebus.tts.play({"text":text,"force":true});
}
this.id_tts=id;}
};
brw_obj.tts_stop=function(){
this.id_tts=0;
if(ebus.tts&&ebus.tts.supported)ebus.tts.stop();};
brw_obj.get_tts_supported=function(){
if(ebus.tts.supported)return true;
return false;};
brw_obj.get_tts_mode=function(){
if(ebus.tts.browser_mode==ebus.tts.TTS_ON)
return true;
return false;};

var focus_mgr=function (){
this.init();};
focus_mgr.prototype.init=function (){
this.obj=null;
this.rect=[];
this.type=null;
this.value=null;};
focus_mgr.prototype.set=function (obj,arg){
this.init();
if(arg[4]){
this.obj=arg[4];
this.rect=[arg[5],arg[6],arg[7],arg[8]];
if(arg.length>9){
this.type=arg[9];
this.value=arg[10];
if(brw_obj.skb_is_disp()){
if(this.is_focus_textbox()){
if(arg[6]!=undefined){
brw_obj.move_down_position();
var param=calc_draw_pos_forFocus(this.rect[0],this.rect[1],
this.rect[2],this.rect[3]);
brw_obj.move_textarea_cb(param);
param.y+=brw_obj.move_distance;
brw_obj.focus_obj.setSize(param.w,param.h);
brw_obj.focus_obj.setTranslate(param.x,param.y,0);
brw_obj.focus_obj.setShow(true);}
}
}
}
}else {
this.obj="unfocus";}
};
focus_mgr.prototype.edit_text_cb=function(obj,arg){
this.set_focus_text_info(obj,arg);
brw_obj.apply_keyboard(this.value,this.type);};
focus_mgr.prototype.set_focus_text_info=function (obj,arg){
this.value=arg[4];
this.start_pos=arg[5];
this.end_pos=arg[6];};
focus_mgr.prototype.is_focus_textbox=function (){
console_log("[START][focus_mgr.is_focus_textbox]");
if((this.obj==null)||(this.obj=="unfocus")||(this.type==null))
return false;
console_log("[ROOT][focus_mgr.is_focus_textbox]obj:"+this.obj+" type:"+this.type);
return true;};
focus_mgr.prototype.is_chkbx_or_radio=function (){
if((this.obj==null)||(this.obj=="unfocus")||
(this.type==null)){
return false;}
if(((this.obj=="input")||(this.obj=="div"))&&
((this.type=="checkbox")||(this.type=="radio"))){
return true;}
return false;};
var point_mgr=function(){
this.init();};
point_mgr.prototype.init=function (){
this.tag=null;
this.type=null;
this.value=null;
this.x=0;
this.y=0;
this.w=0;
this.h=0;
this.writable=false;};
point_mgr.prototype.get_hittest_cb=function (){
this.init();
this.set(arguments);
if(this.is_point_textbox()){
if(brw_obj.apply_keyboard(this.value,this.type)){
if(arguments[6]!=undefined){
if(!brw_obj.focus_obj.isShow()){
var param=calc_draw_pos_forFocus(this.x,this.y,
this.w,this.h);
brw_obj.focus_obj.setSize(param.w,param.h);
brw_obj.focus_obj.setTranslate(param.x,param.y,0);
brw_obj.focus_obj.setShow(true);}
}
}
}
};
point_mgr.prototype.set=function (arguments){
console_log("[point_mgr.set]x:"+arguments[6]+" y:"+arguments[7]+" w:"+arguments[8]+" h:"+arguments[9]);
this.init();
this.tag=arguments[3];
if(arguments[4])
this.type=arguments[4];
if(arguments[5]){
this.value=arguments[5];}else{
this.value="";}
if(arguments[6]){
this.x=arguments[6];}
if(arguments[7]){
this.y=arguments[7];}
if(arguments[8]){
this.w=arguments[8];}
if(arguments[9]){
this.h=arguments[9];}
if((arguments[10]==undefined)||(arguments[10])){
this.writable=true;}
};
point_mgr.prototype.is_point_textbox=function (){
if((!this.x)||(!this.y)
||(!this.w)||(!this.h)
||(!this.writable)){
return false;}
return true;};
brw_obj.check_textarea=function(){
if(this.pb.GET_HITTEST_RESULT){
var point=this.point_info;
ebus.pbrowser[0].request(true,
function (){
point.get_hittest_cb.apply(point,arguments);},
this.pb.GET_HITTEST_RESULT,mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV);}
};
function dclick_obj(param){
this.parent=param.parent;};
dclick_obj.prototype=new container({});
dclick_obj.prototype.init=function (){
delete_timer(this);
this.mode=false;
this.move_state=false;
this.check_state=false;};
dclick_obj.prototype.check=function (){
delete_timer(this);
this.check_state=true;
this.mode=false;
this.move_state=false;
append_timer(this,100,this.check_end);}
dclick_obj.prototype.check_end=function (){
delete_timer(this);
this.check_state=false;
ebus.pbrowser[0].request(false,null,this.parent.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.parent.pb.LeftButton,this.parent.pb.MouseEventPressed,1);}
dclick_obj.prototype.enable=function (){
delete_timer(this);
this.mode=true;
this.move_state=false;
this.check_state=false;
append_timer(this,300,this.disable);};
dclick_obj.prototype.disable=function (){
delete_timer(this);
if(this.mode){
this.mode=false;
if(!(obutton&ebus.mouse.DOWN_LEFT_BUTTON)){
if(!this.move_state){
ebus.pbrowser[0].request(false,null,this.parent.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.parent.pb.LeftButton,this.parent.pb.MouseEventPressed,1);}
ebus.pbrowser[0].request(false,null,this.parent.pb.CLICK_POINTER,
mouse_pos_x*COORDINATE_CONV,mouse_pos_y*COORDINATE_CONV,
this.parent.pb.LeftButton,this.parent.pb.MouseEventReleased,1);
if(!this.move_state)this.parent.check_textarea();}
}
this.move_state=false;};
dclick_obj.prototype.extend=function (){
delete_timer(this);
append_timer(this,300,this.disable);
this.move_state=true;};
dclick_obj.prototype.get_mode=function (){
return this.mode;};
dclick_obj.prototype.get_check_state=function (){
return this.check_state;};
dclick_obj.prototype.get_move_state=function (){
return this.move_state;};
var zoom_mgr=function(){
this.init();};
zoom_mgr.prototype.init=function(){
this.level=1;
this.width=0;
this.height=0;
this.base_pos_x=Math.floor(DEF_BROWSER_WIDTH/2);
this.base_pos_y=Math.floor(DEF_BROWSER_HEIGHT/2);
this.old_level=1;
this.upper_space=0;
this.lower_space=0;
this.left_space=0;
this.right_space=0;
this.zoom_w=Math.floor(DEF_BROWSER_WIDTH/4);
this.zoom_h=Math.floor(DEF_BROWSER_HEIGHT/4);
var size0=(DEF_4K2K)?4/4:0;
this.size=[
{size:size0,w:DEF_BROWSER_WIDTH,h:DEF_BROWSER_HEIGHT},
{size:1,w:DEF_BROWSER_WIDTH,h:DEF_BROWSER_HEIGHT},
{size:4/3,w:this.zoom_w*3,h:this.zoom_h*3},
{size:2,w:this.zoom_w*2,h:this.zoom_h*2},
{size:4,w:this.zoom_w,h:this.zoom_h}
];};
zoom_mgr.prototype.zoom_action=function()
{
console_log("[zoom_mgr.zoom_action]4:"+this.level+" old_level:"+this.old_level);
console_log("[zoom_mgr.zoom_action]mouse_pos_x:"+mouse_pos_x+" mouse_pos_y:"+mouse_pos_y);
console_log("[zoom_action] <start> width = ",this.width,", height = ",this.height,", base_pos_x = ",this.base_pos_x,", base_pos_y = ",this.base_pos_y);
var center_x=Math.floor(this.base_pos_x+this.width/2);
var center_y=Math.floor(this.base_pos_y+this.height/2);
this.width=this.size[this.level].w;
this.height=this.size[this.level].h;
var pos_x=Math.floor(center_x-this.width/2);
var pos_y=Math.floor(center_y-this.height/2);
if((pos_x<0)||(pos_x+this.width>DEF_BROWSER_WIDTH)){
if(pos_x<0){
console_log("[zoom_mgr.zoom_action]Left");
pos_x=0;}
if(pos_x>DEF_BROWSER_WIDTH-this.width){
console_log("[zoom_mgr.zoom_action]Right");
pos_x=DEF_BROWSER_WIDTH-this.width;}
}
if((pos_y<0)||(pos_y+this.height>DEF_BROWSER_HEIGHT)){
if(pos_y<0){
console_log("[zoom_mgr.zoom_action]Up");
pos_y=0;}
if(pos_y>DEF_BROWSER_HEIGHT-this.height){
console_log("[zoom_mgr.zoom_action]Down");
pos_y=DEF_BROWSER_HEIGHT-this.height;}
}
if(DEF_4K2K){
if(this.level==0){
pos_x=pos_y=0;
brw_obj.set_resize_init();
brw_obj.set_resize({x:0,y:0,
width:DEF_BROWSER_PB_WIDTH/COORDINATE_CONV,
height:DEF_BROWSER_PB_HEIGHT/COORDINATE_CONV,
rs_width:DEF_BROWSER_PB_WIDTH,
rs_height:DEF_BROWSER_PB_HEIGHT});}else if(this.level==1){
pos_x=pos_y=0;
brw_obj.set_resize_init();
brw_obj.set_resize({x:0,y:0,
width:DEF_BROWSER_PB_WIDTH/COORDINATE_CONV,
height:DEF_BROWSER_PB_HEIGHT/COORDINATE_CONV,
rs_width:DEF_BROWSER_RS_WIDTH,
rs_height:DEF_BROWSER_RS_HEIGHT});}
}
ebus.pbrowser[0].request(false,null,brw_obj.pb.ZOOM,pos_x*COORDINATE_CONV,
pos_y*COORDINATE_CONV,this.width*COORDINATE_CONV,this.height*COORDINATE_CONV);
console_log("[zoom_mgr.zoom_action]width:"+this.width+" height:"+this.height);
this.base_pos_x=pos_x;
this.base_pos_y=pos_y;
this.set_space_h();
this.set_space_w();
console_log("[zoom_mgr.zoom_action]base_pos_x:"+this.base_pos_x+" base_pos_y:"+this.base_pos_y);

if(brw_obj.video_box.is_exist())brw_obj.video_box.update();
brw_obj.scroll_bar.update();
brw_obj.scroll_bar.appear_bar_h();
brw_obj.scroll_bar.appear_bar_w();
if(brw_obj.change_status_cb)brw_obj.change_status_cb();};
zoom_mgr.prototype.get_level=function(){
return this.level;};
zoom_mgr.prototype.set_level=function(new_level){
this.old_level=this.level;
this.level=new_level;
if(DEF_4K2K)
apps_nvram.write("ZOOM_LEVEL",new_level,"home");};
zoom_mgr.prototype.set_space_w=function()
{
this.left_space=this.base_pos_x;
this.right_space=DEF_BROWSER_WIDTH-this.left_space-this.width;};
zoom_mgr.prototype.set_space_h=function()
{
this.upper_space=this.base_pos_y;
this.lower_space=DEF_BROWSER_HEIGHT-this.upper_space-this.height;};
zoom_mgr.prototype.get=function(){
return {
size:this.size[this.level].size,
x:this.base_pos_x,y:this.base_pos_y,
w:this.width,h:this.height
};};
zoom_mgr.prototype.set=function(param){
this.size[this.level].size=param.size;
this.base_pos_x=param.x;
this.base_pos_y=param.y;
this.width=param.w;
this.height=param.h;};
zoom_mgr.prototype.is_top=function(){
if(this.upper_space>0){
return false;}else{
return true;}
};
zoom_mgr.prototype.is_bottom=function(){
if(this.lower_space>0){
return false;}else{
return true;}
};
zoom_mgr.prototype.is_left=function(){
if(this.left_space>0){
return false;}else{
return true;}
};
zoom_mgr.prototype.is_right=function(){
if(this.right_space>0){
return false;}else{
return true;}
};
brw_obj.do_confirm_composition=function(text){
console_log("[brw_obj][do_confirm_composition]");
ebus.pbrowser[0].request(false,null,this.pb.CONFIRM_COMPOSITION,text);};
brw_obj.do_set_composition=function(convert_info){
console_log("[brw_obj][do_set_composition]");
var info_array=[];
info_array[0]=false;
info_array[1]=null;
info_array[2]=this.pb.SET_COMPOSITION;
info_array[3]=convert_info[0];
info_array[4]=convert_info[1].h;
info_array[5]=convert_info[1].t;
info_array[6]=convert_info[2];
for(var i=0;i<info_array[6];i++){
info_array.push(convert_info[3+i].h)
info_array.push(convert_info[3+i].t)
if(i==0){
info_array.push(true)
}else{
info_array.push(false)
}
}
for(var j=0,max=info_array.length;j<max;j++){
console_log(">>>>>>> info_array : "+info_array[j]);}

ebus.pbrowser[0].request.apply(ebus.pbrowser[0],info_array);};
brw_obj.do_cancel_composition=function(){
console_log("[brw_obj][do_cancel_composition]");
ebus.pbrowser[0].request(false,null,this.pb.CANCEL_COMPOSITION);};
brw_obj.do_move_caret=function(key){
console_log("[brw_obj][do_move_caret]");
var move_caret=this.pb.VKEY_RIGHT;
switch(key){
case TXK_UP:
move_caret=this.pb.VKEY_UP;
break;
case TXK_DOWN:
move_caret=this.pb.VKEY_DOWN;
break;
case TXK_LEFT:
move_caret=this.pb.VKEY_LEFT;
break;
case TXK_RIGHT:
move_caret=this.pb.VKEY_RIGHT;
break;
default:
break;}
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,move_caret,0);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.KeyUp,move_caret,0);};
brw_obj.do_enter_backspace=function(){
console_log("[brw_obj][do_enter_backspace]");
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,this.pb.VKEY_BACK,0);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.KeyUp,this.pb.VKEY_BACK,0);};
brw_obj.do_enter_linefeed=function(){
console_log("[brw_obj][do_enter_linefeed]");
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,this.pb.VKEY_RETURN,0,"\r");
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.Char,this.pb.VKEY_RETURN,0,"\r");};
brw_obj.do_enter_delall=function(){
console_log("[brw_obj][do_enter_delall]");
ebus.pbrowser[0].request(false,null,this.pb.SELECT_ALL_TEXT);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.RawKeyDown,this.pb.VKEY_BACK,0);
ebus.pbrowser[0].request(false,null,this.pb.SEND_KEYCODE,this.pb.KeyUp,this.pb.VKEY_BACK,0);};
brw_obj.is_singleline=function(){
console_log("[brw_obj][is_singleline]");
if(this.point_info.tag=="textarea"){
return false;}else{
return true;}
};
brw_obj.get_scrollbar_obj=function(){
return this.scroll_bar.get_obj();};
brw_obj.get_brw_obj=function(){
return this.brw;};
function scroll_btn(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:[
this.img=new gimage({src:PALTINUM_PATH_IMG+"btn_arrow.png",
rotation:[-90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:21,height:21,draw_type:DIRECT}),
this.img_act=new gimage({src:PALTINUM_PATH_IMG+"btn_arrow.png",
rotation:[-90,0,0,1],color:system.fdp_color.FCS,
width:21,height:21,draw_type:DIRECT,
visible_p:false}),
this.img_prs=new gimage({src:PALTINUM_PATH_IMG+"btn_arrow.png",
rotation:[-90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:21,height:21,draw_type:DIRECT,
visible_p:false}),
this.img_shdw=new gimage({src:PALTINUM_PATH_IMG+"btn_arrow.png",
rotation:[-90,0,0,1],color:system.fdp_color.ICON_ONBASE,
width:21,height:21,draw_type:DIRECT,
visible_p:false})
]}),
];
if(this.direction=="down"){
this.img.rotation=[90,0,0,1];
this.img_act.rotation=[90,0,0,1];
this.img_prs.rotation=[90,0,0,1];
this.img_shdw.rotation=[90,0,0,1];}else if(this.direction=="left"){
this.img.rotation=[0,0,0,1];
this.img_act.rotation=[0,0,0,1];
this.img_prs.rotation=[0,0,0,1];
this.img_shdw.rotation=[0,0,0,1];}else if(this.direction=="right"){
this.img.rotation=[180,0,0,1];
this.img_act.rotation=[180,0,0,1];
this.img_prs.rotation=[180,0,0,1];
this.img_shdw.rotation=[180,0,0,1];}
this.btn.action=function(obj){
self.action_func();};
this.btn.mouseover=function(obj){
self.mouseover_func();};
this.btn.mouseout=function(obj){
self.mouseout_func();};};
scroll_btn.prototype=new container({});
scroll_btn.prototype.set_scroll_enable=function(mode){
this.fg_scroll=true;
this.img_shdw.visible_p=false;
this.img.visible_p=true;}
scroll_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;}
scroll_btn.prototype.action_func=function(obj){
this.img_prs.visible_p=true;
this.img_act.visible_p=false;
this.img.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;
this.img.visible_p=false;
force_redraw();});
force_redraw();
if(this.direction=="up"){
brw_obj.scroll_action_hook("up","anim",-80);}else if(this.direction=="down"){
brw_obj.scroll_action_hook("down","anim",80);}else if(this.direction=="left"){
brw_obj.scroll_action_hook("left","anim",-80);}else if(this.direction=="right"){
brw_obj.scroll_action_hook("right","anim",80);}
};
scroll_btn.prototype.mouseover_func=function(obj){
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();}
};
scroll_btn.prototype.mouseout_func=function(obj){
this.enable=false;
this.img.visible_p=true;
this.img_act.visible_p=false;
this.img_prs.visible_p=false;
force_redraw();};
scroll_btn.prototype.get_btn_obj=function(){
return this.btn;};
scroll_btn.prototype.free=function(){
this.img.src="";
this.img_act.src="";
this.img_prs.src="";
this.img_shdw.src="";};
function scroll_bar(param){
var self=this;
var parent=param.parent;

this.translate=param.translate;

this.direction=param.direction;
this.enable=false;
if(this.direction=="VERTICAL"){
this.components=[
this.img_base=new gbox({width:1920-(DEF_BROWSER_WIDTH+DEF_BROWSER_NAGARA_OFFSET_X),
height:DEF_BROWSER_HEIGHT,color:system.fdp_color.BASE}),
this.img_bar_t=new gimage({}),
this.img_bar_c=new gbox({width:21,height:0,color:system.fdp_color.ICON_ONBASE,visible_p:false}),
this.img_bar_b=new gimage({}),
this.btn_t=new scroll_btn({translate:[0,DEF_BROWSER_HEIGHT/2-18,0],
direction:"up"}),
this.btn_b=new scroll_btn({translate:[0,-DEF_BROWSER_HEIGHT/2+18,0],
direction:"down",}),
];}else{
this.components=[
this.img_base=new gbox({width:1080-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)+1,
height:DEF_BROWSER_WIDTH+DEF_BROWSER_NAGARA_OFFSET_X,color:system.fdp_color.BASE,
rotation:[90,0,0,1]}),
this.img_bar_t=new gimage({}),
this.img_bar_c=new gbox({width:21,height:0,color:system.fdp_color.ICON_ONBASE,
rotation:[90,0,0,1],visible_p:false}),
this.img_bar_b=new gimage({}),
this.btn_t=new scroll_btn({translate:[Math.floor(-DEF_BROWSER_WIDTH/2)+20,0,0],
direction:"left",}),
this.btn_b=new scroll_btn({translate:[Math.floor(DEF_BROWSER_WIDTH/2)-20,0,0],
direction:"right",}),
];}
this.img_base.action=function(obj){
if(self.direction=="VERTICAL"){
var pos_y=system.cursor_pointer.get_pos_y()+30;
if(pos_y>self.img_bar_c.translate[1]){
brw_obj.scroll_action_hook("up","no_anim",-DEF_BROWSER_RS_HEIGHT);}else{
brw_obj.scroll_action_hook("down","no_anim",DEF_BROWSER_RS_HEIGHT);}
}else{
var pos_x=system.cursor_pointer.get_pos_x()+20-DEF_BROWSER_TRANSLATE[0];
if(pos_x<self.img_bar_c.translate[0]){
brw_obj.scroll_action_hook("left","no_anim",-DEF_BROWSER_RS_WIDTH);}else{
brw_obj.scroll_action_hook("right","no_anim",DEF_BROWSER_RS_WIDTH);}
}
parent.update();};};
scroll_bar.prototype=new container({});
scroll_bar.prototype.set_enable=function(){
this.enable=true;
this.img_bar_t.visible_p=true;
this.img_bar_c.visible_p=true;
this.img_bar_b.visible_p=true;
this.btn_t.set_scroll_enable();
this.btn_b.set_scroll_enable();};
scroll_bar.prototype.set_disable=function(){
this.enable=false;
this.img_bar_t.visible_p=false;
this.img_bar_c.visible_p=false;
this.img_bar_b.visible_p=false;
this.btn_t.set_scroll_disable();
this.btn_b.set_scroll_disable();};
scroll_bar.prototype.set_size=function(pos,length){
this.img_bar_c.height=length;
if(this.direction=="VERTICAL"){
this.img_bar_t.translate[1]=pos+(length-40)/2+10;
this.img_bar_c.translate[1]=pos;
this.img_bar_b.translate[1]=pos-(length-40)/2-10;}else{
this.img_bar_c.translate[0]=pos;
this.img_bar_t.translate[0]=pos-(length-40)/2-10;
this.img_bar_b.translate[0]=pos+(length-40)/2+10;}
};
scroll_bar.prototype.get_obj=function(){
var obj={};
obj.btn_t=this.btn_t.get_btn_obj();
obj.btn_b=this.btn_b.get_btn_obj();
obj.img_base=this.img_base;
return obj;};
scroll_bar.prototype.free=function(){
this.img_base.src="";
this.img_bar_t.src="";
this.img_bar_c.src="";
this.img_bar_b.src="";
this.btn_t.free();
this.btn_b.free();};
scroll_bar.prototype.set_position=function(param){
this.translate=param.translate;
if(this.direction=="VERTICAL"){
this.img_base.height=DEF_BROWSER_HEIGHT;
this.btn_t.translate[1]=DEF_BROWSER_HEIGHT/2-18;
this.btn_b.translate[1]=-DEF_BROWSER_HEIGHT/2+18;
this.img_base.width=1920-(DEF_BROWSER_WIDTH+DEF_BROWSER_NAGARA_OFFSET_X);}else{
this.img_base.height=DEF_BROWSER_WIDTH;
this.btn_t.translate[0]=Math.floor(-DEF_BROWSER_WIDTH/2)+20;
this.btn_b.translate[0]=Math.floor(DEF_BROWSER_WIDTH/2)-20;
this.img_base.width=1080-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT);
if(side_w_mode){
this.img_base.width++;}else{
this.img_base.height+=4;}
}
};
function scroll_bar_obj(param){
if(!DEF_CHANGE_SCREEN){
this.components=[
this.img_corner=new gbox({translate:[Math.floor(DEF_BROWSER_WIDTH/2),
Math.floor(-DEF_BROWSER_HEIGHT/2)-50+1,0],
color:system.fdp_color.BASE,width:40,height:40}),
this.bar_w=new scroll_bar({translate:[-20,Math.floor(-DEF_BROWSER_HEIGHT/2)-45+1,0],
direction:"HORIZONAL",parent:this,}),
this.bar_h=new scroll_bar({translate:[Math.floor(DEF_BROWSER_WIDTH/2),-30,0],
direction:"VERTICAL",parent:this,})
];}else{
this.components=[
this.img_corner=new gbox({translate:[(DEF_BROWSER_NAGARA_OFFSET_X+DEF_BROWSER_WIDTH)/2,
-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)/2,0],
color:system.fdp_color.BASE,
width:1920-(DEF_BROWSER_WIDTH+DEF_BROWSER_NAGARA_OFFSET_X),
height:1080-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)}),
this.bar_w=new scroll_bar({translate:[-20+DEF_BROWSER_NAGARA_OFFSET_X/2,
-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)/2,0],
direction:"HORIZONAL",parent:this,}),
this.bar_h=new scroll_bar({translate:[(DEF_BROWSER_NAGARA_OFFSET_X+DEF_BROWSER_WIDTH)/2,-25,0],
direction:"VERTICAL",parent:this,})
];}
};
scroll_bar_obj.prototype=new container({});
scroll_bar_obj.prototype.set_position=function(){
if(!DEF_CHANGE_SCREEN){
this.img_corner.translate=[Math.floor(DEF_BROWSER_WIDTH/2),Math.floor(-DEF_BROWSER_HEIGHT/2)-50+1,0];
this.bar_w.set_position({translate:[-20,Math.floor(-DEF_BROWSER_HEIGHT/2)-50+1,0]});
this.bar_h.set_position({translate:[Math.floor(DEF_BROWSER_WIDTH/2),-30,0]});}else{
this.img_corner.translate=[(DEF_BROWSER_NAGARA_OFFSET_X+DEF_BROWSER_WIDTH)/2,
-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)/2,0];
this.img_corner.width=1920-(DEF_BROWSER_WIDTH+DEF_BROWSER_NAGARA_OFFSET_X);
this.bar_w.set_position({translate:[-20+DEF_BROWSER_NAGARA_OFFSET_X/2,
-(DEF_TOOLBAR_H+DEF_BROWSER_HEIGHT)/2,0]});
this.bar_h.set_position({translate:[(DEF_BROWSER_NAGARA_OFFSET_X+DEF_BROWSER_WIDTH)/2,-25,0]});}
};
scroll_bar_obj.prototype.appear_bar_w=function()
{
if(DEF_BROWSER_WIDTH<contents_w*brw_obj.zoom_info.get().size){
delete_timer(this.bar_w);
this.bar_w.visible_p=true;
this.bar_w.set_enable();

}else{
this.bar_w.visible_p=true;
this.bar_w.set_disable();}
};
scroll_bar_obj.prototype.appear_bar_h=function()
{
if(DEF_BROWSER_HEIGHT<contents_h*brw_obj.zoom_info.get().size){
delete_timer(this.bar_h);
this.bar_h.visible_p=true;
this.bar_h.set_enable();

}else{
this.bar_h.visible_p=true;
this.bar_h.set_disable();}
};
scroll_bar_obj.prototype.update=function()
{
var bar_w;
var bar_h;
var bar_x;
var bar_y;
var scroll_x=brw_obj.scroll_info.x;
var scroll_y=brw_obj.scroll_info.y;
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
var zoom_start_x=scroll_x+zoom_info.x;
var zoom_start_y=scroll_y+zoom_info.y;
bar_w=Math.round((DEF_BROWSER_WIDTH-72)*(zoom_info.w/contents_w));
bar_h=Math.round((DEF_BROWSER_HEIGHT-72)*(zoom_info.h/contents_h));
if(bar_w<41){
bar_w=41;
bar_x=Math.floor(zoom_start_x*((DEF_BROWSER_WIDTH-72-28)/contents_w));}else{
bar_x=Math.floor(zoom_start_x*((DEF_BROWSER_WIDTH-72)/contents_w));}
if(bar_h<41){
bar_h=41;
bar_y=Math.round(zoom_start_y*((DEF_BROWSER_HEIGHT-72-6-8*brw_obj.zoom_info.get_level())/contents_h));}else{
bar_y=Math.round(zoom_start_y*((DEF_BROWSER_HEIGHT-72)/contents_h));}
}else{
bar_w=Math.round((DEF_BROWSER_WIDTH-72)*(DEF_BROWSER_WIDTH/contents_w));
bar_h=Math.round((DEF_BROWSER_HEIGHT-72)*(DEF_BROWSER_HEIGHT/contents_h));
if(bar_w<41){
var tmp=41-bar_w;
bar_w=41;
bar_x=Math.round(scroll_x*((DEF_BROWSER_WIDTH-72-tmp)/contents_w));}else{
bar_x=Math.round(scroll_x*((DEF_BROWSER_WIDTH-72)/contents_w));}
if(bar_h<41){
var tmp=41-bar_h;
bar_h=41;
bar_y=Math.round(scroll_y*((DEF_BROWSER_HEIGHT-72-tmp)/contents_h));}else{
bar_y=Math.round(scroll_y*((DEF_BROWSER_HEIGHT-72)/contents_h));}
}
var bar_center_x=Math.round(bar_x+bar_w/2);
var bar_center_y=Math.round(bar_y+bar_h/2);
this.bar_w.set_size(bar_center_x-Math.floor(DEF_BROWSER_WIDTH/2)+36,bar_w);
this.bar_h.set_size(Math.floor(DEF_BROWSER_HEIGHT/2)-bar_center_y-36,bar_h);
force_redraw();};
scroll_bar_obj.prototype.get_obj=function(){
var obj={};
var scrollbar_obj=this.bar_h.get_obj();
obj.bar_h_btn_top=scrollbar_obj.btn_t;
obj.bar_h_btn_btm=scrollbar_obj.btn_b;
obj.bar_h_base=scrollbar_obj.img_base;
scrollbar_obj=this.bar_w.get_obj();
obj.bar_w_btn_left=scrollbar_obj.btn_t;
obj.bar_w_btn_right=scrollbar_obj.btn_b;
obj.bar_w_base=scrollbar_obj.img_base;
return obj;};
scroll_bar_obj.prototype.free=function(){
this.img_corner.src="";
this.bar_w.free();
this.bar_h.free();};
function BrowserScroll(init){
this.superClass=animation;
this.superClass(init);
if(init.scroll_cb)this.scroll_cb=init.scroll_cb;
this.init();};
BrowserScroll.prototype=new animation({});
BrowserScroll.prototype.init=function (){
this.clear_param();
this.target_pos_x=0;
this.current_pos_x=0;
this.last_draw_pos_x=0;
this.target_pos_y=0;
this.current_pos_y=0;
this.last_draw_pos_y=0;
this.move_count=0;
this.add_val=0;
this.continuation={};};
BrowserScroll.prototype.move=function (delta_x,delta_y){
this.target_pos_x=this.target_pos_x+delta_x;
this.target_pos_y=this.target_pos_y+delta_y;
this.anim_start();};
BrowserScroll.prototype.do_anim=function (){
var spring_constant=3.0;
var frame_rate=this.get_frame_rate(75.0);
var delta_x=((this.target_pos_x-this.current_pos_x)/spring_constant)/frame_rate;
this.current_pos_x=this.current_pos_x+delta_x;
var delta_y=((this.target_pos_y-this.current_pos_y)/spring_constant)/frame_rate;
this.current_pos_y=this.current_pos_y+delta_y;
if(Math.abs(delta_x)<0.2)
this.current_pos_x=this.target_pos_x;
if(Math.abs(delta_y)<0.2)
this.current_pos_y=this.target_pos_y;
if(Math.abs(delta_x)<0.2&&Math.abs(delta_y)<0.2)
this.anim_finish();
this.force_redraw();};
BrowserScroll.prototype.move_to_end=function (){
this.current_pos_x=this.target_pos_x;
this.current_pos_y=this.target_pos_y;
this.force_redraw();};
BrowserScroll.prototype.move_no_anim=function (delta_x,delta_y){
this.target_pos_x=this.target_pos_x+delta_x;
this.target_pos_y=this.target_pos_y+delta_y;
this.current_pos_x=this.target_pos_x;
this.current_pos_y=this.target_pos_y;
this.force_redraw();};
BrowserScroll.prototype.force_redraw=function (){
var delta_x=Math.floor(this.current_pos_x-this.last_draw_pos_x);
this.last_draw_pos_x=this.current_pos_x;
var delta_y=Math.floor(this.current_pos_y-this.last_draw_pos_y);
this.last_draw_pos_y=this.current_pos_y;
if(this.scroll_cb)this.scroll_cb(delta_x,delta_y);};
BrowserScroll.prototype.adjust_move=function(direction,val){
var self=this;
delete_timer(this.continuation);
append_timer(this.continuation,200,function(obj){
self.move_count=0;
self.add_val=0;});
if(this.direction==direction){
this.move_count++;}else{
this.move_count=0;
this.add_val=0;}
this.direction=direction;
if((this.move_count!=0)&&((parseInt(this.move_count)%6)==0)){
if(val>0){
this.add_val+=30;}else{
this.add_val-=30;}
}
val+=this.add_val;
if(val>120)val=120;
if(val<-120)val=-120;
if((direction=="up")||(direction=="down")){
this.move(0,val);}else{
this.move(val,0);}
};
function video_ctrl(param){
this.translate=param.translate;
this.visible_p=false;
this.components=[
this.video_box=new videobox({draw_type:DIRECT,color:[255,255,255,0],
source:(side_w_mode&&DEF_SIDE_TV)?1:0}),
];}
video_ctrl.prototype=new container({});
video_ctrl.prototype.init=function()
{
this.video_x=0;
this.video_y=0;
this.video_w=0;
this.video_h=0;
if(DEF_SIDE_WINDOW){
this.video_act_x=0;
this.video_act_y=0;
this.video_act_w=0;
this.video_act_h=0;}
this.visible_p=false;};
video_ctrl.prototype.check_update=function(x,y,w,h){
if((x/COORDINATE_CONV!=this.video_x)||(y/COORDINATE_CONV!=this.video_y)||
(w/COORDINATE_CONV!=this.video_w)||(h/COORDINATE_CONV!=this.video_h)){
return true;}
return false;};
video_ctrl.prototype.is_exist=function(){
if(this.video_w&&this.video_h){
return true;}else{
return false;}
};
video_ctrl.prototype.update=function(param)
{
if(param){
this.video_x=param.x/COORDINATE_CONV;
this.video_y=param.y/COORDINATE_CONV;
this.video_w=param.w/COORDINATE_CONV;
this.video_h=param.h/COORDINATE_CONV;}
var offset_x=0;
var offset_y=0;
if(!brw_obj.vbox_new){
offset_x=brw_obj.scroll_info.x;
offset_y=brw_obj.scroll_info.y;}
if(brw_obj.fg_full){
this.video_box.width=this.video_w;
this.video_box.height=this.video_h;
this.translate[0]=-DEF_BROWSER_TRANSLATE[0];
this.translate[1]=0;
this.video_box.active_area[0]=0;
this.video_box.active_area[1]=0;
this.video_box.active_area[2]=1.0;
this.video_box.active_area[3]=1.0;}else{
if(brw_obj.zoom_info.get_level()>1){
var zoom_info=brw_obj.zoom_info.get();
this.video_box.width=Math.floor(this.video_w*zoom_info.size);
this.video_box.height=Math.floor(this.video_h*zoom_info.size);
this.translate[0]=Math.floor((this.video_x-zoom_info.x+offset_x)
*zoom_info.size-960+DEF_BROWSER_NAGARA_OFFSET_X-DEF_BROWSER_TRANSLATE[0]+this.video_box.width/2);
this.translate[1]=Math.floor(540
-(this.video_y-zoom_info.y-offset_y)*zoom_info.size
-this.video_box.height/2-DEF_TOOLBAR_H);
if(DEF_SIDE_WINDOW){
this.video_act_x=(this.video_x-zoom_info.x+offset_x)*zoom_info.size;
this.video_act_y=(this.video_y-zoom_info.y-offset_y)*zoom_info.size;
this.video_act_w=this.video_w*zoom_info.size;
this.video_act_h=this.video_h*zoom_info.size;
if(this.video_act_x<0){
this.video_act_w+=this.video_act_x;
this.video_act_x=0;}
if(this.video_act_y<0){
this.video_act_h+=this.video_act_y;
this.video_act_y=0;}
if(this.video_act_x+this.video_act_w>DEF_BROWSER_WIDTH)
this.video_act_w=DEF_BROWSER_WIDTH-this.video_act_x;
if(this.video_act_y+this.video_act_h>DEF_BROWSER_HEIGHT)
this.video_act_h=DEF_BROWSER_HEIGHT-this.video_act_y;
this.video_box.active_area[0]=(this.video_act_x-((this.video_x-zoom_info.x+offset_x)*zoom_info.size))
/(this.video_w*zoom_info.size);
this.video_box.active_area[1]=(this.video_act_y-((this.video_y-zoom_info.y-offset_y)*zoom_info.size))
/(this.video_h*zoom_info.size);
this.video_box.active_area[2]=this.video_act_w/(this.video_w*zoom_info.size);
this.video_box.active_area[3]=this.video_act_h/(this.video_h*zoom_info.size);}
}else{
this.video_box.width=this.video_w;
this.video_box.height=this.video_h;
this.translate[0]=this.video_x-960+DEF_BROWSER_NAGARA_OFFSET_X-DEF_BROWSER_TRANSLATE[0]+this.video_box.width/2+offset_x;
this.translate[1]=540-this.video_y-this.video_box.height/2+offset_y-DEF_TOOLBAR_H;
if(DEF_SIDE_WINDOW){
this.video_act_x=this.video_x;
this.video_act_y=this.video_y;
this.video_act_w=this.video_w;
this.video_act_h=this.video_h;
if(this.video_act_x<0){
this.video_act_w+=this.video_act_x;
this.video_act_x=0;}
if(this.video_act_y<0){
this.video_act_h+=this.video_act_y;
this.video_act_y=0;}
if(this.video_act_x+this.video_act_w>DEF_BROWSER_WIDTH)
this.video_act_w=DEF_BROWSER_WIDTH-this.video_act_x;
if(this.video_act_y+this.video_act_h>DEF_BROWSER_HEIGHT)
this.video_act_h=DEF_BROWSER_HEIGHT-this.video_act_y;
this.video_box.active_area[0]=(this.video_act_x-this.video_x)/this.video_w;
this.video_box.active_area[1]=(this.video_act_y-this.video_y)/this.video_h;
this.video_box.active_area[2]=this.video_act_w/this.video_w;
this.video_box.active_area[3]=this.video_act_h/this.video_h;}
this.video_box.visible_p=true;
}
}
}
var full_screen_obj=new container({visible_p:false});
full_screen_obj.create=function (param){
if(!ebus.pbrowser[0].plugin)return;
if(this.components.length>0)return;
this.obj=null;
this.sym={};
this.stage=param.stage?param.stage:null;
this.connect_cb=param.connect_cb;
this.disconnect_cb=param.disconnect_cb;
this.full_screen_cb=param.full_screen_cb;
this.windowless_cb=param.windowless_cb;
this.ary_index=[];
this.components=[
this.video_win=new container({translate:[0,0,0],components:[
this.video_box=new videobox({color:[255,255,255,0],source:(DEF_SIDE_TV)?1:0}),
]}),
this.screen=new gwindow({width:1920,height:1080,translate:[0,0,0]})
];
this.stage.add_event_hook(ebus.pbrowser[0].plugin,this.plugin_event_hook);
};
full_screen_obj.free=function(stage){
if(!ebus.pbrowser[0].plugin)return;
if(this.screen)this.screen.src=null;
this.components.splice(0,this.components.length);
this.visible_p=false;
if((!this.stage)&&(!stage))return;
if(!this.stage)this.stage=stage;
if((this.ary_index)&&(this.ary_index.length>0)){
for(var i=0;i<this.ary_index.length;i++){
if(ebus.pbrowser[0].plugin[this.ary_index[i]])
this.stage.del_event_hook(ebus.pbrowser[0].plugin[this.ary_index[i]]);}
this.ary_index=[];}
this.stage.del_event_hook(ebus.pbrowser[0].plugin);};
full_screen_obj.plugin_event_hook=function(stg,obj,ev)
{
var self=full_screen_obj;
switch(ev){
case obj.CONNECTED_EV:
self.ary_index.push(arguments[3]);
console_log("[PLUGIN CONNECTED_EV]"+arguments[3]);
self.stage.add_event_hook(ebus.pbrowser[0].plugin[self.ary_index[self.ary_index.length-1]],
self.flash_event_hook);
break;
case obj.DISCONNECTED_EV:
var idx=arguments[3];
console_log("[PLUGIN DISCONNECTED_EV]"+arguments[3]);
for(var i=0;i<self.ary_index.length;i++){
if(self.ary_index[i]==idx){
self.stage.del_event_hook(ebus.pbrowser[0].plugin[idx]);
self.ary_index.splice(i,1);
if(ebus.pbrowser[0].plugin[idx]==self.obj){
if((DEF_SIDE_TV)&&(self.stage!=HOME)){
var bplayer=new BroadcastPlayer();
if(brw_obj.video_box.visible_p){
bplayer.set_browser_mode(BR_SRC_TV_VS);}else{
bplayer.set_browser_mode(BR_SRC_TVS_V);}
}
self.disconnect_cb();
self.screen.src=null;
self.obj=null;}
break;}
}
break;
default:
console_log("unknown plugin_event");
break;}
};
full_screen_obj.flash_event_hook=function(stg,obj,ev)
{
var self=full_screen_obj;
var bplayer=new BroadcastPlayer();
switch(ev){
case obj.AVAILABLE_EV:
console_log("[AVAILABLE_EV]");
var eval_str="self.sym = "+obj.get_plugin_info();
eval(eval_str);
break;
case obj.FULLSCREEN_MODE_EV:
console_log("[FULLSCREEN_MODE_EV]");
if((!DEF_SIDE_TV)&&(self.stage!=HOME))
system.key_control.escape=true;if((DEF_SIDE_TV)&&(self.stage!=HOME)){
bplayer.set_browser_mode(BR_SRC_TV_FULL);
bplayer.disconnect();}
self.screen.src=obj.fullscreen_pixmap;
self.obj=obj;
self.full_screen_cb();
force_redraw();
break;
case obj.WINDOWLESS_MODE_EV:
console_log("[WINDOWLESS_MODE_EV]");
if((!DEF_SIDE_TV)&&(self.stage!=HOME))
system.key_control.escape=false;self.windowless_cb();
if((DEF_SIDE_TV)&&(self.stage!=HOME)){
bplayer.connect(VideoDev,AudioDev);
if(brw_obj.video_box.visible_p){
bplayer.set_browser_mode(BR_SRC_TV_VS);}else{
bplayer.set_browser_mode(BR_SRC_TVS_V);}
}
self.screen.src=null;
self.obj=null;
force_redraw();
break;
case obj.FULLSCREEN_VIDEOBOX_EV:
console_log("[FULLSCREEN_VIDEOBOX_EV]",arguments[4],arguments[5],arguments[6],arguments[7]);
var x=arguments[4];
var y=arguments[5];
var w=arguments[6];
var h=arguments[7];
self.video_box.width=w;
self.video_box.height=h;
self.video_win.translate[0]=x-960+w/2;
self.video_win.translate[1]=540-y-h/2;
force_redraw();
break;
case obj.PLUGIN_FLASH_EV:var tag=arguments[3];
switch(tag){
case self.sym.INVOKE_SOFTKEYBOARD_EV:
console_log("[INVOKE_SOFTKEYBOARD_EV]",arguments[4],arguments[5],arguments[6]
,arguments[7]);
if(brw_obj.apply_keyboard("","")){
var param=calc_draw_pos_forFocus(arguments[4],arguments[5],
arguments[6],arguments[7]);
brw_obj.focus_obj.setSize(param.w,param.h);
brw_obj.focus_obj.setTranslate(param.x,param.y,0);
brw_obj.focus_obj.setShow(true);
self.obj=obj;}
break;
case self.sym.DISMISS_SOFTKEYBOARD_EV:
console_log("[DISMISS_SOFTKEYBOARD_EV]");
if(brw_obj.skb_disappear)brw_obj.skb_disappear();
break;
default:
break;}
default:
console_log("unknown plugin_event");
break;}
};
full_screen_obj.key_hook=function(up_down,key_sym)
{
var self=full_screen_obj;
var flash_up_down=self.sym.KeyDown;
var flash_key_sym=self.sym.KEY_ESCAPE;
if(key_sym==TXK_RETURN){
flash_key_sym=self.sym.KEY_ESCAPE;}else{
return false;}
if(up_down==KEY_UP){
flash_up_down=self.sym.KeyUp;}else if(up_down==KEY_DOWN){
flash_up_down=self.sym.KeyDown;}else {
return true;}
self.obj.request(self.sym.SEND_KEYCODE,flash_up_down,flash_key_sym,1,0);
return true;};
full_screen_obj.mouse_hook=function(arguments)
{
var self=full_screen_obj;
var ev=arguments[2];
var button=arguments[3];
var pos_x=arguments[4];
var pos_y=arguments[5];
var wheel=arguments[6];
pos_x=(pos_x+960)*COORDINATE_CONV;
pos_y=(540-pos_y)*COORDINATE_CONV;
self.obj.request(self.sym.SEND_MOUSE,button,pos_x,pos_y,wheel);};
full_screen_obj.kbd_hook=function(up_down,key_sym)
{
var self=full_screen_obj;
var flash_up_down=self.sym.KeyDown;
var flash_key_sym=self.sym.KEY_ESCAPE;
if(up_down==KBD_DOWN)
flash_up_down=self.sym.KeyDown;
else
flash_up_down=self.sym.KeyUp;
if(key_sym==TXKB_Escape)
flash_key_sym=self.sym.KEY_ESCAPE;
else
return;
self.obj.request(self.sym.SEND_KEYCODE,flash_up_down,flash_key_sym,1,0);};
var usb_kbd={
dead_key:TXKB_VoidSymbol
};
usb_kbd.key_hook=function (arguments){
var event=arguments[2];
if(event!=ebus.kbd.KEYSYM_EV)
return;
if(full_screen_obj.visible_p){
full_screen_obj.kbd_hook(arguments[3],arguments[4]);
return;}
};

provide("pkg_browser");

