
var kbd_img_path=COMMON_PATH+"keyboard/img/";
var size_rate="MEDIUM";
var size_rate_list={"LARGE":1.25,"MEDIUM":1.00,"SMALL":0.75};
var skin_color="WHITE";
var BASE_SKIN={
common:{
ime_padding_w:20,ymargin:8
},
bg_frame:{
frame_size:50,round:4,padding_w:15,padding_h:20,
list:{
tl:"bg_frame_tl.png",t:"bg_frame_t.png",tr:"bg_frame_tr.png",
l:"bg_frame_l.png",r:"bg_frame_r.png",
bl:"bg_frame_bl.png",b:"bg_frame_b.png",br:"bg_frame_br.png"
}
},
converter:{},
pointer:{
size:64,icon:"pointer.png"
},
round_item:{
item_w:200,item_h:80,neon_w:300,neon_h:120,neon_bg:"round_item_bg.png",
arrow_w:22,arrow_h:20
},
round_guide:{
round_bg_size:200,round_bg:"round_bg_circle.png",pull_h:130
},
round_menu:{
bg_w:540,bg_h:360
},
keytop:{
width:112,height:58,color_padding_w:4,color_padding_h:4,round:3
},
soft_kbd:{
margin_w:0,margin_h:0,zhcn_bg_w:340,zhcn_bg_h:236,zhcn_bg_r:10,
key_border:"key_border.png"
},
tbox_bg:{
height:50,bg_side_w:10,color_padding_w:0,color_padding_h:0,round:2,
bg:{
c:"textbox_bg_c.png",l:"textbox_bg_l.png",r:"textbox_bg_r.png"
}
},
tbox:{},
sel_bar_keytop:{
height:50,neon_side_w:20,
neon:{
c:"select_bar_keytop_neon_c.png",s:"select_bar_keytop_neon_s.png"
}
},
sel_bar_btn:{
btn_w:64,btn_h:62,arrow_w:15,arrow_h:26,padding:4,round:2,
btn:"select_bar_btn.png",btn_arrow:"select_bar_btn_arrow.png"
},
sel_bar:{
height:56,btn_space:10,bg_padding:2,bg_side_w:30,bg_round:2,
bg:{
c:"select_bar_c.png",l:"select_bar_l.png",r:"select_bar_r.png"
}
},
ctrl_keytop:{
width:112,height:62,narrow_w:84,wide_w:224,color_padding_w:4,color_padding_h:4,round:3,
arrow_w:22,arrow_h:12,color_bar_w:92,color_bar_h:7,color_bar_side_w:10,
color_bar_bg_round:1,arrow_round:"arrow_round.png"
},
ctrl_key:{
margin_w:0,margin_h:0,round:4,
key_edge:"key_edge.png",key_edge_n:"key_edge_n.png",key_edge_w:"key_edge_w.png",
backspace:"backspace.png",lf:"lf.png",allclear:"allclear.png",setting:"setting.png",
arrow:{
u:"arrow_up.png",d:"arrow_down.png",l:"arrow_left.png",r:"arrow_right.png"
},
color_bar:{
c:"color_bar_c.png",l:"color_bar_l.png",r:"color_bar_r.png"
}
},
stg_menubase:{
line_size:40,bg_round:4,bg_padding:14,
line_t:"menu_line_t.png",line_b:"menu_line_b.png",
line_l:"menu_line_l.png",line_r:"menu_line_r.png",
angle_tl:"menu_angle_tl.png",angle_tr:"menu_angle_tr.png",
angle_bl:"menu_angle_bl.png",angle_br:"menu_angle_br.png"
},
menu_item:{},
scr_btn:{
width:40,height:22,stencil_w:180,stencil_h:30,trans_y:150,
arrow:"scroll_btn_arrow.png"
},
stg_menubody:{
pitch:50,line_side_w:30,line_h:3,cursor_side_w:30,
line:{
c:"menu_item_line_c.png",s:"menu_item_line_s.png"
},
cursor:{
c:"menu_item_cursor_c.png",s:"menu_item_cursor_s.png"
}
},
stg_menu:{}
};
var COLOR_SKIN={
WHITE:{
name:"WHITE",
common:{},
bg_frame:{
bg_c:[255,255,255,192]
},
converter:{
base_c:[0,0,0,204],input_l_c:[0,0,0,255],input_r_c:[255,255,255,204],
bg_l_c:[255,255,255,255],u_bar_l_c:[255,255,255,255],u_bar_r_c:[255,255,255,255]
},
pointer:{},
round_item:{
text_c:[33,33,33,255],neon_c:[32,213,255,192]
},
round_guide:{},
round_menu:{
kbd_bg_c:[255,255,255,192]
},
keytop:{
def_c:[240,240,240,192],sel_c:[32,213,255,192],text_c:[33,33,33,255]
},
soft_kbd:{
zhcn_bg_out_c:[90,140,220,255],zhcn_bg_in_c:[255,255,255,255]
},
tbox_bg:{
def_c:[60,60,60,255],sel_c:[32,213,255,192]
},
tbox:{
text_c:[255,255,255,255],bg_c:[0,0,0,0],bg_ime_c:[0,0,0,204],cursor_c:[255,255,255,255],
cursor_text_c:[0,0,0,255],ubar_c:[255,255,255,255],end_cursor_c:[255,255,255,255]
},
sel_bar_keytop:{
text_c:[33,33,33,255],neon_c:[32,213,255,192]
},
sel_bar_btn:{
btn_def_c:[240,240,240,192],btn_sel_c:[32,213,255,192],
btn_arrow_c:[33,33,33,255],btn_arrow_gray_c:[200,200,200,255]
},
sel_bar:{
bg_c:[255,255,255,192]
},
ctrl_keytop:{
def_c:[240,240,240,192],sel_c:[32,213,255,192],text_c:[33,33,33,255],
gray_c:[200,200,200,255]
},
ctrl_key:{},
stg_menubase:{
bg_c:[255,255,255,192]
},
menu_item:{
text_c:[33,33,33,255]
},
scr_btn:{
neon_c:[32,213,255,192],on_c:[33,33,33,255],off_c:[100,100,100,255]
},
stg_menubody:{
cursor_c:[32,213,255,192]
},
stg_menu:{
key_c:[166,238,255,255]
}
},
BLACK:{
name:"BLACK",
common:{},
bg_frame:{
bg_c:[0,0,0,127]
},
converter:{
base_c:[0,0,0,204],input_l_c:[0,0,0,255],input_r_c:[255,255,255,204],
bg_l_c:[255,255,255,255],u_bar_l_c:[255,255,255,255],u_bar_r_c:[255,255,255,255]
},
pointer:{},
round_item:{
text_c:[255,255,255,255],neon_c:[32,213,255,255]
},
round_guide:{},
round_menu:{
kbd_bg_c:[0,0,0,210]
},
keytop:{
def_c:[16,18,20,192],sel_c:[32,213,255,192],text_c:[255,255,255,255]
},
soft_kbd:{
zhcn_bg_out_c:[90,140,220,255],zhcn_bg_in_c:[191,191,191,255]
},
tbox_bg:{
def_c:[100,100,100,255],sel_c:[32,213,255,255]
},
tbox:{
text_c:[255,255,255,255],bg_c:[0,0,0,0],bg_ime_c:[0,0,0,204],cursor_c:[255,255,255,255],
cursor_text_c:[0,0,0,255],ubar_c:[255,255,255,255],end_cursor_c:[255,255,255,255]
},
sel_bar_keytop:{
text_c:[255,255,255,255],neon_c:[32,213,255,192]
},
sel_bar_btn:{
btn_def_c:[0,0,0,192],btn_sel_c:[32,213,255,192],
btn_arrow_c:[255,255,255,255],btn_arrow_gray_c:[33,33,33,255]
},
sel_bar:{
bg_c:[33,33,33,255]
},
ctrl_keytop:{
def_c:[0,0,0,192],sel_c:[32,213,255,192],text_c:[255,255,255,255],
gray_c:[33,33,33,255]
},
ctrl_key:{},
stg_menubase:{
bg_c:[33,33,33,255]
},
menu_item:{
text_c:[255,255,255,255]
},
scr_btn:{
neon_c:[32,213,255,192],on_c:[255,255,255,255],off_c:[100,100,100,255]
},
stg_menubody:{
cursor_c:[32,213,255,192]
},
stg_menu:{
key_c:[146,218,255,100]
}
}
};
var calc_rate=function(size){
return Math.ceil(size*size_rate_list[size_rate]);};
var set_skin_info=function(info){
if(info.color)
_set_color(info.color);
if(info.size)
_set_size_rate(info.size);};
var get_skin=function(){
var skin=[];
skin.push(_merge_skin());
return skin.slice()[0];};
var set_kbd_img_path=function(path){
kbd_img_path=path;};
var _set_color=function(color){
if(!color)return;
if(COLOR_SKIN[color]){
skin_color=color;}
};
var _set_size_rate=function(rate){
if(!rate)return;
if(size_rate_list[rate]){
size_rate=rate;}
};
var _gen_base_skin=function(){
var base_skin={};
var set_path_func=function(base,obj){
for(var key in obj){
if(typeof obj[key]=="object"){
base[key]={};
set_path_func(base[key],obj[key]);}else if(typeof obj[key]=="string"){
base[key]=kbd_img_path+obj[key];}else {
base[key]=obj[key];}
}
};
set_path_func(base_skin,BASE_SKIN);
return base_skin;};
var _merge_skin=function(){
var base_skin=_gen_base_skin();
var color_skin=COLOR_SKIN[skin_color];
var set_color_func=function(base,color){
for(var key in color){
if(typeof color[key]=="object"){
if(color[key].length==undefined){set_color_func(base[key],color[key]);}else {base[key]=color[key].slice();}
}
}
};
set_color_func(base_skin,color_skin);
return base_skin;};
provide("pkg_keyboard_skin");
