Feedly - Open entry in background

Adds 'h' as a hotkey to open selected entry in background tab

  1. // ==UserScript==
  2. // @name Feedly - Open entry in background
  3. // @description Adds 'h' as a hotkey to open selected entry in background tab
  4. // @namespace userscripts.org/users/Lyk
  5. // @author Lyk
  6. // @include http://feedly.com/*
  7. // @include https://feedly.com/*
  8. // @include http://*.feedly.com/*
  9. // @include https://*.feedly.com/*
  10. // @grant GM_openInTab
  11. // @version 1.0.1
  12. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
  13. // ==/UserScript==
  14.  
  15.  
  16. jQuery.noConflict();
  17.  
  18. (function() {
  19. var background_key = 72;
  20. /* 72 is for the 'h'-key
  21. ** you can change this to any key you want (until I include a script command for that :)
  22. ** pick the corresponding number from here: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
  23. */
  24. /*
  25. May add this infuture version
  26.  
  27. var orig_button = jQuery('#floatingPageActionCustomize'); //#pageActionLayouts
  28.  
  29. var new_button = orig_button.clone();
  30.  
  31. // init new button
  32. new_button.attr('id', 'open-in-background')
  33. .find('.pageAction')
  34. .text('Open in background');
  35.  
  36. // insert new button
  37. orig_button.after(new_button);
  38. */
  39.  
  40.  
  41. var open_entry = function() {
  42. var cur = jQuery('.selectedEntry');
  43. if (cur.length) {
  44. console.log("FeedlyOpenEntryInBackgroundTab: GM_openInTab now");
  45. GM_openInTab(cur.find('a.title').attr('href'), true);
  46. return true;
  47. } else {
  48. return false;
  49. }
  50. };
  51.  
  52.  
  53. // new_button.click(open_entry);
  54.  
  55. // bind key-handler
  56. jQuery(document).keydown(function(e) {
  57. if ( e.which == background_key && !(e.altKey || e.ctrlKey || e.metaKey) ) {
  58. var el = document.activeElement;
  59.  
  60. // if in textfield, do nothing
  61. if (el && (el.tagName.toLowerCase() == 'input' && el.type == 'text' ||
  62. el.tagName.toLowerCase() == 'textarea')) {
  63. return true;
  64. }
  65. return !open_entry(); // To supress default behavior of the event
  66. // Added for those who have "search as I type" features enabled, etc
  67. }
  68. });
  69. })();
  70.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址