Skip to content

Instantly share code, notes, and snippets.

@prwhite
Last active December 28, 2017 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prwhite/01c22f6b5e3824a8a668e560ab2bfcf4 to your computer and use it in GitHub Desktop.
Save prwhite/01c22f6b5e3824a8a668e560ab2bfcf4 to your computer and use it in GitHub Desktop.
Add keyboard shortcut ('t') to show the tag list dropdown for the active [floating] entry.
// ==UserScript==
// @name Feedly Open Tags Dropdown
// @namespace http://prw.prehiti.net/
// @version 0.9.14
// @description Show the Feedly tag entry dropdown with a keyboard shortcut. This functionality should be builtin!
// @author Payton R White
// @include http://feedly.com/*
// @include https://feedly.com/*
// @include http://*.feedly.com/*
// @include https://*.feedly.com/*
// @grant none
// @require http://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==
jQuery.noConflict();
console.log("loaded feedly open tags dropdown user script");
// https://stackoverflow.com/a/21696585/5305104
function isHidden(el) {
var style = window.getComputedStyle(el);
return (style.display === 'none');
}
function doSetup() {
console.log("OpenTagDropdown doSetup called");
var dropdown_key = 0x54; // "t"
jQuery(document).keydown(function(e) {
if ( e.which == dropdown_key && !(e.altKey || e.ctrlKey || e.metaKey) ) {
console.log("OpenTagDropdown got tag dropdown_key");
var ret = jQuery("#floatingEntry .icon-fx-star-save-ios-md-black:last"); // wish there was a less cheesy selector for the button
var focus = document.activeElement;
var inputFocus = focus instanceof HTMLInputElement;
if(ret.length === 1 && !inputFocus) {
button = ret[ 0 ];
console.log("OpenTagDropdown found the tag button!!!");
console.log("OpenTagDropdown button is: " + button);
button.click();
console.log("OpenTagDropdown synthesized a click in tag list button!");
e.preventDefault();
} else {
console.log("OpenTagDropdown tag dropdown couldn't find 1 dropdown button with selector");
}
}
});
}
jQuery(document).ready(function () {
doSetup();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment