Skip to content

Instantly share code, notes, and snippets.

@Qofar
Created November 15, 2014 02:54
Show Gist options
  • Save Qofar/602be030bff732d9d93b to your computer and use it in GitHub Desktop.
Save Qofar/602be030bff732d9d93b to your computer and use it in GitHub Desktop.
[NicoCache_nl] feedlyから;キーでfetch開始する
// ==UserScript==
// @name feedly_nicofetch
// @version 1.0
// @include http://feedly.com/*
// @include https://feedly.com/*
// @grant GM_xmlhttpRequest
// @require http://www.nicovideo.jp/local/nlMovieFetcher.js
// ==/UserScript==
(function(){
window.nlMovieFetcher.prototype.callAPI = function(param, callback) {
GM_xmlhttpRequest({
method: 'GET',
url: "http://www.nicovideo.jp/cache/fetch?"+param,
onload: callback
});
}
document.addEventListener('keydown', function(e) {
if (e.keyCode === 59 && //[;] key
!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey &&
!/^input|^textarea/i.test(e.target.tagName)) {
var item = document.querySelector(".u100Frame.selectedEntry");
if(!item) return;
var href = item.getAttribute("data-alternate-link");
if(href.indexOf("http://www.nicovideo.jp/watch/") !== 0) return;
var id = href.substring(href.lastIndexOf("/") + 1);
var div = document.createElement("div");
div.className = "headerInfo-links left";
var headerInfo = item.querySelector(".headerInfo.headerInfo-article");
headerInfo.appendChild(div);
nicofetch(div, id, 0);
}
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment