Skip to content

Commit

Permalink
增加 onshowing 说明
Browse files Browse the repository at this point in the history
  • Loading branch information
ywzhaiqi committed Nov 6, 2014
1 parent 6ee2097 commit f1682b3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions addmenuPlus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ addMenuPlus 是一个非常强大的定制菜单的 uc 脚本。通过配置文
id 标签的ID(我新增的,修改原菜单用)
position/insertBefore/insertAfter: 位置的设置(3选1),position: 1, insertBefore: "id", insertAfter: "id"
clone false 为不克隆,直接改在原菜单上,还原必须重启生效或打开新窗口
onshowing 新增的,当页面右键显示时会执行该函数,可用于动态更改标签标题,详见下面的示例。

参考链接:

Expand Down Expand Up @@ -884,6 +885,19 @@ pagesub([
},
})

示例:动态显示标签标题,详见 [怎么样用addmenuplus实现一个这样的菜单项](http://bbs.kafan.cn/forum.php?mod=viewthread&tid=1784671)

page({
label: '复制: ...',
text: '%SEL%',
onshowing: function(menuitem) {
var sel = getBrowserSelection(16);
if (sel && sel.length > 15)
sel = sel.substr(0,15) + "...";
this.label = '复制: ' + sel;
},
})

### 特殊的示例

示例:"字符编码" 移动到 "web开发者" 的位置
Expand Down

0 comments on commit f1682b3

Please sign in to comment.