前往
大廳
主題

火狐-Firegestures 手勢:创建子菜单

—— | 2013-12-18 02:22:57 | 巴幣 0 | 人氣 379

FireGestures.generatePopup(event,[//创建弹出菜单
{label:"查看Google快照", oncommand: "GoogleCache();"},
{label:"打开115提取码", oncommand: "u115();"},
//{label:"视频独立播放", oncommand: "Extractor();"},
{label:"视频独立播放", oncommand: "Z();"},
{label:"在IE里打开当前页面", oncommand: "IE();"},
null,//分隔线
{label:"打开本地目录", id: "openLocal"},//openLocal与下面一致
]);
createSubmenu("openLocal",[//创建子菜单
{label:"打开扩展目录", oncommand: "OpenFile('.\\\\extensions');"},
{label:"打开CSS目录", oncommand: "OpenFile('.\\\\chrome\\\\css');"},
{label:"打开工具目录", oncommand: "OpenFile('.\\\\My_Tools');"}
]);

createSubmenu = function(id,arrs){
var menuitem = document.getElementById(id);
var menu = document.createElement("menu");
menu.setAttribute("label",menuitem.getAttribute("label"));
menuitem.parentNode.replaceChild(menu,menuitem);
var menupopup = document.createElement("menupopup");
menu.appendChild(menupopup);
for each (var arr in arrs){
  if(!arr)menuitem = document.createElement("menuseparator");
  else{
   menuitem = document.createElement("menuitem");
   for(var [name, val] in Iterator(arr)){
    menuitem.setAttribute(name, val);
   }
  }
  menupopup.appendChild(menuitem);
}
}

創作回應

更多創作