Changeset 24377
- Timestamp:
- 11/20/08 04:05:19 (7 weeks ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/multi_requester.js
r24371 r24377 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 commandline.open(':', cmd, modes.EX); 193 let sel = $U.getSelectedString(); 194 if (sel.length) { 195 liberator.execute(cmd + sel); 196 } else { 197 commandline.open(':', cmd, 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 471 args = args.string; 472 472 var parsedArgs = this.parseArgs(args); 473 473 if (!parsedArgs || !parsedArgs.siteinfo || !parsedArgs.str) { return; } // do nothing … … 510 510 if (!args) return null; 511 511 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, ''); 512 var arguments = args.split(/ +/); 513 var sel = $U.getSelectedString(); 514 515 if ((sel && arguments.length < 1) || (!sel && arguments.length < 2)) return null; 516 517 var siteName = arguments.shift(); 518 var str = (arguments.length < 1 ? sel : arguments.join()).replace(/[\n\r]+/g, ''); 517 519 var siteinfo = this.getSite(siteName); 518 520
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)