Browse Source

update feed ext

pull/1/head
10sr 11 years ago
parent
commit
34504789d0
1 changed files with 30 additions and 12 deletions
  1. +30
    -12
      _keysnail.js

+ 30
- 12
_keysnail.js View File

@@ -523,6 +523,8 @@ ext.add("restart-firefox-add-menu", function(){
///////////////////////////////////////// /////////////////////////////////////////
// feed url // feed url
(function(){ (function(){
var feedhandler = "http://cloud.feedly.com/#subscription%2Ffeed%2F%s";

function getFeeds(){ function getFeeds(){
const doc = content.document; const doc = content.document;


@@ -535,14 +537,18 @@ ext.add("restart-firefox-add-menu", function(){
"$1"); "$1");
for (i = 0; i < feeds.length; i++) for (i = 0; i < feeds.length; i++)
if ( feeds[i][1].substr(0,1) == "/" ) feeds[i][1] = uh + feeds[i][1]; if ( feeds[i][1].substr(0,1) == "/" ) feeds[i][1] = uh + feeds[i][1];
feeds.unshift([window.content.document.title,
window.content.location.href]);
// feeds.unshift([window.content.document.title,
// window.content.location.href]);


return feeds; return feeds;
}; };


ext.add("copy-feed-url", function () { ext.add("copy-feed-url", function () {
var feeds = getFeeds(); var feeds = getFeeds();
if (! feeds.length) {
display.echoStatusBar("No feed found.");
return;
}
prompt.selector( prompt.selector(
{ {
message : "Select Feed", message : "Select Feed",
@@ -558,17 +564,29 @@ ext.add("restart-firefox-add-menu", function(){


ext.add("open-feed", function () { ext.add("open-feed", function () {
var feeds = getFeeds(); var feeds = getFeeds();
prompt.selector(
{
message : "Select Feed",
collection : feeds,
callback : function (i) {
if (i >= 0) {
window.openUILinkIn(feeds[i][1], "tab");
}
if (! feeds.length) {
display.echoStatusBar("No feed found.");
return;
}
prompt.selector({
message : "Select Feed",
collection : feeds,
callback : function (i) {
if (i < 0) {
return;
}

var feedurl = feeds[i][1];
if (feedhandler) {
window.openUILinkIn(
feedhandler.replace("%s", feedurl),
"tab"
);
} else {
window.openUILinkIn(feedurl, "tab");
} }
} }
);
});
}, "Copy url or feed url of current page"); }, "Copy url or feed url of current page");
})(); })();


@@ -717,7 +735,7 @@ key.suspendKey = "Not defined";




hook.setHook('KeyBoardQuit', function (aEvent) { hook.setHook('KeyBoardQuit', function (aEvent) {
ext.exec("hide-sidebar");
// ext.exec("hide-sidebar");
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
gBrowser.focus(); gBrowser.focus();
content.focus(); content.focus();


Loading…
Cancel
Save