使用Ubiquity將目前瀏覽網頁貼上推推王的命令如下。網址列會填入目前網頁的網址,選取的文字會填入「描述」欄位,命令的參數會形成標籤,若標籤為 tech則會自動轉換成「科技」,例如:funp Google Web2.0 tech。
| // V1.0.1 2008/09/01修改 CmdUtils.CreateCommand({ name: "funp", author: { name: "emisjerry"}, contributors: ["emisjerry"], license: "GPL", description: "選取好描述文字,把本篇文章貼上推推王", takes: {"輸入標籤名稱": noun_arb_text}, icon: "http://funp.com/favicon.ico", execute: function(directObject) { var _sSelection = CmdUtils.getSelection(); //window.alert(_sSelection + ':' + context.focusedWindow.location.href); var _aTags = directObject.text.split(" "); // 把輸入字串分成陣列 var _sTags = ""; for (var ele in _aTags) { _sTags += "&tags[]=" + encodeURIComponent(_aTags[ele]); } if (_sTags == "") _sTags = "&tags[]=科技"; // 未輸入標籤則預設為科技 else _sTags = _sTags.replace(/tech/, '科技'); // 把tech標籤換成科技, 加快輸入速度 Utils.openUrlInBrowser("http://funp.com/push/submit/?popup&url=" + encodeURIComponent(context.focusedWindow.location.href) + "&t="+encodeURIComponent(_sSelection)+_sTags); } }); |
你可以把上述命令直接貼入Ubiquity Command Editor,或瀏覽我的命令網頁再訂閱它。
##