Feedly Background Tab Yo

Open link by background tab for Feedly

当前为 2019-09-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         Feedly Background Tab Yo
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Open link by background tab for Feedly
// @author       JackNUMBER
// @match        *://*.feedly.com/*
// @grant        GM_openInTab
// ==/UserScript==
// Original code come from Aaron Saray: https://chrome.google.com/webstore/detail/feedly-background-tab/gjlijkhcebalcchkhgaiflaooghmoegk

// code '59' is ';'
const _triggerKeyCode = 59;

(function() {
  'use strict';

  const selectors = [
    'div.selectedEntry a.title',			// title bar for active entry, collapsed or expanded
    '.selectedEntry a.visitWebsiteButton',	// the button square button on list view
    '.list-entries .selected a.visitWebsiteButton',	// the button square button on list view
    'a.visitWebsiteButton',					// the floating one for card view
    '.entry.selected a.title'				// title bar for active entry in React-based collapsed list view
  ];

  /**
  * Main feedlybackgroundtab constructor
  */
  const FBT = function() {

    /**
    * handler for key press - must be not in textarea or input and must be not altered
    * Then it sends extension request
    * @param e
    */
    this.keyPressHandler = function(e) {
      const tag = e.target.tagName.toLowerCase();
      if (tag != 'input' && tag != 'textarea') {
        if ((!e.altKey && !e.ctrlKey) && e.keyCode == _triggerKeyCode) {
          let url;
          for (var x in selectors) {
            url = document.querySelector(selectors[x]);
            if (url) {
              break;
            }
          }
          if (url) {
            GM_openInTab(url.href);
          } else {
            console.log("Could not find any selectors from: " + selectors.join());
          }
        }
      }
    }
  };

  if (window == top) {
    const fbt = new FBT();
    window.addEventListener('keypress', fbt.keyPressHandler, false);
  }
})();

QingJ © 2025

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