• image 經常在看到想要分享到Plurk的網頁時,必須複製網址和說明文字,必須操作好幾次,乾脆再修改這個Ubiquity指令,在文字裡用 %l %link 替換當前網頁的網址。命令原始碼如下,訂閱方法請查看下方的相關主題。 範例:plurk shares-cn =>%l (The 150 Best Online Flash Games)

    • 原始碼:
    1. CmdUtils.CreateCommand({
    2. name: "plurk",
    3. takes: {status: noun_arb_text},
    4. homepage: "http://theunfocused.net/moz/ubiquity/verbs/",
    5. author: {name: "Blair McBride", homepage: "http://theunfocused.net/"},
    6. modifier: {name: "Jerry Chien"},
    7. license: "MPL",
    8. preview: function(previewBlock, statusText) {
    9. var previewTemplate = "將要發佈的內容如下: <br/>" +
    10. "<b>${status}</b><br /><br />" +
    11. " 總字數為: <b>${chars}</b>";
    12. var truncateTemplate = "<br />後面 <b>${truncate}</b> " +
    13. "個字將予以刪除!";
    14. var previewData = {
    15. status: statusText.text,
    16. chars: statusText.text.length
    17. };
    18. var previewHTML = CmdUtils.renderTemplate(previewTemplate,
    19. previewData);
    20. if(previewData.chars > 140) {
    21. var truncateData = {
    22. truncate: previewData.chars - 140
    23. };
    24. previewHTML += CmdUtils.renderTemplate(truncateTemplate,
    25. truncateData);
    26. }
    27. previewBlock.innerHTML = previewHTML;
    28. },
    29. execute: function(statusText) {
    30. if(statusText.text.length < 1) {
    31. displayMessage("Plurk 內容不可空白");
    32. return;
    33. }
    34. var _sQualifier = "says";
    35. var _sLang = "tr_ch"; // 預設為繁體中文
    36. var _sText = statusText.text;
    37. var _iIndex = _sText.indexOf(" ");
    38. var found = false;
    39. if (_iIndex > 0) {
    40. var _aQualifiers = ["loves","likes","shares","gives","hates","wants",
    41. "wishes","has","will","wonders","asks","was","feels","thinks","says","is"];
    42. var _sVerb = _sText.substring(0, _iIndex); // 要使用的qualifier
    43. var _iIndex2 = _sVerb.indexOf("-"); // loves, loves-tw, loves-cn, loves-en, 減號後面加語系
    44. if (_iIndex2 > 0) {
    45. var _sVerbLang = _sVerb.substring(_iIndex2+1).toLowerCase();
    46. if (_sVerbLang=="tw") _sLang = "tr_ch";
    47. else _sLang = _sVerbLang;
    48. // 未完 BlogBus不許存 S**T