Changeset 24375
- Timestamp:
- 11/20/08 03:24:25 (7 weeks ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/branches/1.2/multi_requester.js
r24359 r24375 5 5 * @description-ja リクエストの結果をバッファに出力する。 6 6 * @author suVene suvene@zeromemory.info 7 * @version 0.2. 17 * @version 0.2.2 8 8 * @minVersion 1.2 9 9 * @maxVersion 1.2 … … 11 11 * 12 12 * Usage: 13 * command[!] subcommand [ANY_TEXT | -s]13 * command[!] subcommand [ANY_TEXT] 14 14 * 15 15 * ! create new tab. 16 16 * ANY_TEXT your input text 17 * FLAGS: 18 * -s use selected text 19 * 20 * :mr alc ANY_TEXT -> request by the input text, and display to the buffer. 21 * :mr! goo -s -> request by the selected text, and display to the new tab. 17 * 18 * :mr alc ANY_TEXT -> request by the input text, and display to the buffer. 19 * :mr! goo {window.selection} -> request by the selected text, and display to the new tab. 22 20 * 23 21 * … … 54 52 * [',ml', 'ex'], // == :mr ex 55 53 * [',mg', 'goo', '!'], // == :mr! goo 56 * [',ma', 'alc', , 'args'], // == :mr alc args (however, it uses a selected_text with precedence.)54 * [',ma', 'alc', , 'args'], // == :mr alc args 57 55 * ]; 58 56 * EOM … … 190 188 "user defined mapping", 191 189 function() { 192 var str = $U.getSelectedString() || args || ''; 193 if (str.length) { 194 liberator.execute(cmd + str); 190 if (args) { 191 liberator.execute(cmd + args); 195 192 } else { 196 liberator.commandline.open(':', cmd, liberator.modes.EX); 193 let sel = $U.getSelectedString(); 194 if (sel.length) { 195 liberator.execute(cmd + sel); 196 } else { 197 liberator.commandline.open(':', cmd, liberator.modes.EX); 198 } 197 199 } 198 200 }, … … 465 467 name: DataAccess.getCommand(), 466 468 description: 'request, and display to the buffer', 467 cmdOptions: [468 [['-s'], liberator.OPTION_NOARG]469 ],470 469 cmdAction: function(args, special, count) { 471 470 … … 483 482 .getService(Components.interfaces.nsITextToSubURI); 484 483 url = url.replace(/%s/g, ttbu.ConvertAndEscape(urlEncode, parsedArgs.str)); 485 $U.log(url );484 $U.log(url + '::' + siteinfo.xpath); 486 485 487 486 if (special) { … … 510 509 if (!args) return null; 511 510 512 var isOptS = args.hasOwnProperty('-s'); 513 if ((isOptS && args.arguments.length < 1) || (!isOptS && args.arguments.length < 2)) return null; 514 515 var siteName = args.arguments.shift(); 516 var str = (isOptS ? $U.getSelectedString() : args.arguments.join()).replace(/[\n\r]+/g, ''); 511 var arguments = args.split(/ +/); 512 var sel = $U.getSelectedString(); 513 514 if ((sel && arguments.length < 1) || (!sel && arguments.length < 2)) return null; 515 516 var siteName = arguments.shift(); 517 var str = (arguments.length < 1 ? sel : arguments.join()).replace(/[\n\r]+/g, ''); 517 518 var siteinfo = this.getSite(siteName); 518 519 … … 545 546 (new XMLSerializer()).serializeToString(doc).replace(/<[^>]+>/g, function(all) all.toLowerCase()) + 546 547 '</div>'; 547 $U.echo(new XMLList(html));548 try { $U.echo(new XMLList(html)); } catch (e) { $U.echo(html); } 548 549 549 550 } catch (e) {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)