Changeset 18895 for lang/javascript/vimperator-plugins/trunk
- Timestamp:
- 09/05/08 17:39:22 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/googlekanji.js
r16415 r18895 14 14 // すると、クリップボードにその漢字がコピーされます。 15 15 16 (function () { try {16 (function () { try { 17 17 18 18 var copycompl = []; … … 21 21 var re = /[一-龠]+/g; 22 22 var ignore = /検索|関連/; 23 var spaces = /^\s+$/;24 23 var req = new XMLHttpRequest(); 25 24 var word = encodeURIComponent(word); … … 28 27 var f = function () { 29 28 var cnt = {}; 30 for each ( varit in req.responseText.match(re)) {31 if ( !it.match || it.match(ignore))29 for each (let it in req.responseText.match(re)) { 30 if (ignore.test(it)) 32 31 continue; 33 32 if (cnt[it]) … … 37 36 } 38 37 var cnta = []; 39 for ( vari in cnt) {38 for (let i in cnt) { 40 39 if (cnt[i] < 3) 41 40 continue; … … 45 44 copycompl = cnta; 46 45 liberator.commandline.open(":", "gkcopy ", liberator.modes.EX); 47 }; 46 }; 48 47 req.onreadystatechange = function (aEvt) { 49 if (req.readyState == 4) { 50 if(req.status == 200) { 51 f(); 52 } 48 if (req.readyState == 4 && req.status == 200) { 49 f(); 53 50 } 54 51 }; 55 req.send(null); 52 req.send(null); 56 53 } 57 54 58 55 liberator.commands.addUserCommand( 59 56 ['gkanji', 'googlekanji'], 60 'google kanji', 61 function (word) { 62 getKanji(word); 63 } 57 'Google kanji', 58 getKanji 64 59 ); 65 60 66 61 function copyToClipboard (copytext) { 67 const supstr = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);68 const trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);69 const clipid = Ci.nsIClipboard;70 const clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);71 62 const supstr = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); 63 const trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable); 64 const clipid = Ci.nsIClipboard; 65 const clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid); 66 72 67 supstr.data = copytext; 73 68 trans.addDataFlavor("text/unicode"); … … 79 74 liberator.commands.addUserCommand( 80 75 ['gkcopy'], 81 'google kanji', 82 function (word) { 83 copyToClipboard(word); 84 }, 85 { 86 completer: function (args) { 87 return [0, copycompl]; 88 } 89 } 76 'Google kanji', 77 copyToClipboard, 78 { completer: function (args) [0, copycompl] } 90 79 ); 91 80 92 81 93 } catch(e){liberator.log(e)}})();82 } catch (e) { liberator.log(e) } })();
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)