Google Reader Search Current Feed Button

Add a new button next search button, to search current feed.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           Google Reader Search Current Feed Button
// @namespace      http://qixinglu.com
// @description    Add a new button next search button, to search current feed.
// @include        http://www.google.com/reader/view/*
// @include        https://www.google.com/reader/view/*
// @version 0.0.1.20140517140356
// ==/UserScript==

var search_current_feed = function() {
    var url, search_string, replace_string, reg;
    url = window.location.href;
    search_string = document.getElementById("search-input").value;
    if (search_string === "") {
        return;
    }
    replace_string = "#search/" + search_string + "/";
    if (url.indexOf("#stream") !== -1) {
        window.location.href = url.replace("#stream",replace_string);
    } else if (url.indexOf("#search") != -1) {
        reg = new RegExp("#search/[^/]\+/");
        window.location.href = url.replace(reg,replace_string);
    }
}

var search_button = document.getElementById("gbqfb")
var new_search_button = search_button.cloneNode(true);
new_search_button.id = "gbqfb_new";
new_search_button.style.marginLeft = '8px';

new_search_button.addEventListener("click", search_current_feed, false);
new_search_button.addEventListener("mouseover", function() {
    this.classList.add('jfk-button-hover');
}, false);
new_search_button.addEventListener("mouseout", function() {
    this.classList.remove('jfk-button-hover');
}, false);

search_button.parentNode.appendChild(new_search_button);