Skip to content

Instantly share code, notes, and snippets.

@matthiaskern
Last active June 30, 2017 02:27
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save matthiaskern/2b57de135bf11b62f67b to your computer and use it in GitHub Desktop.
Save matthiaskern/2b57de135bf11b62f67b to your computer and use it in GitHub Desktop.
Small script to fetch saved for later items from feedly as JSON. Based on https://gist.github.com/bradcrawford/7288411
if(!(window.jQuery)) {
var script = document.createElement("script");
script.setAttribute("src", "https://code.jquery.com/jquery-2.2.1.min.js");
script.setAttribute("type", "text/javascript");
script.onload = logItems;
document.getElementsByTagName("head")[0].appendChild(script);
} else {
logItems();
}
var json;
function logItems(){
var map = $("#timeline").children().map(function(){
if($(this).hasClass("section")){
return;
}
else{
var elements = $(this).children();
var links = elements.map(function(){
var el = $(this);
return {
title: el.data("title"),
url: el.data("alternate-link")
};
}).get();
return links;
}
}).get();
json = JSON.stringify(map, undefined, 2);
console.log(json);
}
// type copy(json)
@vlakoff
Copy link

vlakoff commented Aug 15, 2016

As of today, looks like the $ global name is already used by something else than jQuery.

Also, maybe you should add a note that the content has to be fully scrolled before executing the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment