Changeset 36957
- Timestamp:
- 03/08/10 03:13:37 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/feedSomeKeys_3.js
r36950 r36957 40 40 <description>feed some defined key events into the Web content</description> 41 41 <description lang="ja">キーイベントをWebコンテンツ側に送る</description> 42 <version>1.7. 0</version>42 <version>1.7.1</version> 43 43 <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> 44 44 <license>new BSD License (Please read the source code comments of this plugin)</license> … … 331 331 332 332 function or (list, func) 333 let ([head, tail] = list) 334 ((func || v)(head) || (tail && or(tail, func))); 333 (list.length && let ([head,] = list) (func(head) || or(list.slice(1), func))); 335 334 336 335 function getFrames () { … … 339 338 340 339 function get (content) 341 (bodyCheck(content) && result.push(content), Array.slice(content.frames).forEach(get)) 340 (bodyCheck(content) && result.push(content), Array.slice(content.frames).forEach(get)); 342 341 343 342 let result = []; … … 398 397 try { 399 398 RegExp(expr); 399 return true; 400 } catch (e) {} 401 return false; 402 } 403 404 function xpathValidator (expr) { 405 try { 406 document.evaluate(expr, document, null, null, null); 400 407 return true; 401 408 } catch (e) {} … … 495 502 } 496 503 504 function frameCompleter (context, args) { 505 return [ 506 [i, frame.document.location] 507 for each ([i, frame] in Iterator(getFrames())) 508 ]; 509 } 510 497 511 498 512 … … 517 531 let win = document.commandDispatcher.focusedWindow; 518 532 let frames = getFrames(); 533 519 534 let elem = body(win); 520 535 … … 524 539 } 525 540 526 if (args['-xpath']) 527 elem = or(frames, function (f) fromXPath(f, args['-xpath'])) || elem; 541 if (args['-xpath']) { 542 elem = or(frames, function (f) fromXPath(f.document, args['-xpath'])) || elem; 543 } 528 544 529 545 feed(rhs, args['-events'] || ['keypress'], elem); … … 566 582 [['-urls', '-u'], commands.OPTION_STRING, regexpValidator, urlCompleter({currentURL: true})], 567 583 [['-desc', '-description'], commands.OPTION_STRING], 568 [['-frame', '-f'], commands.OPTION_INT], 584 [['-frame', '-f'], commands.OPTION_INT, null, frameCompleter], 585 [['-xpath', '-x'], commands.OPTION_STRING, xpathValidator], 569 586 [ 570 587 ['-events', '-e'],
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)