Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4e9e58a888
Fetching contributors…

Cannot retrieve contributors at this time

98 lines (79 sloc) 3.45 kb
---
title: Mislav's reading list
layout: default
permalink: /instapaper/
styles: |
ol { margin-top: 3em }
ol li { margin-top: 1em }
li h2 { text-shadow: none; font-size: 1.2em; border: none; font-weight: normal; margin: 0; padding: 0 }
li p { margin: .4em 0 0 }
li time:before { content: "· "; line-height: 1 }
.instapaper_iframe {
display: inline-block; margin-left: .8em;
position: relative; top: .3em;
}
---
<h1>{{ page.title }}</h1>
<p>
These are articles from places on the Web that I read and liked.<br>
You can use <a href="http://www.instapaper.com/">Instapaper</a> to
<a href="http://www.instapaper.com/user/friendfinder?q=mislav.marohnic%40gmail.com">subscribe to my liked items</a>.
</p>
<nav><a class="home" href="/">← home</a></nav>
<ol id="instapaper"></ol>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
<script type="text/javascript">
var cachedPipe = (function() {
var performCaching = window.localStorage && window.JSON && JSON.parse
var jsonp = function(id, callback) {
document.body.appendChild(new Element('script', {
src: 'http://pipes.yahoo.com/pipes/pipe.run?_id=' + id + '&_render=json&_callback=' + callback
}))
}
var jsonpCached = function(id, callback, hours) {
var key = 'cachedPipe-' + id + '-' + callback,
delta = hours * 60 * 60 * 1000,
now = new Date,
found = localStorage[key] && JSON.parse(localStorage[key])
if (found && (now - new Date(found.usec)) < delta) {
window[callback](found.payload)
} else {
var cachedCallback = callback + 'Cached'
window[cachedCallback] = function(payload) {
window[callback](payload)
localStorage[key] = Object.toJSON({ usec: now.getTime(), payload: payload })
}
jsonp(id, cachedCallback)
}
}
return performCaching ? jsonpCached : jsonp
})()
var instapaperTemplate = new Template('<li><h2><a href="#{link}">#{title}</a></h2><p>#{description} <time>#{pubDate}</time></p></li>')
function displayInstapaper(data) {
var container = $('instapaper').update()
data.value.items.each(function(item) {
item.pubDate = item.pubDate.replace(/ \d{2}:.+/, '')
container.insert(instapaperTemplate.evaluate(item))
var iframe = makeInstapaperIFrame(item.title, item.link, item.description)
container.select('li > h2').last().insert(iframe)
})
}
function makeInstapaperIFrame(title, url, description) {
var iframe = document.createElement('iframe');
iframe.setAttribute('src',
'http://www.instapaper.com/e2?url=' + encodeURIComponent(url) +
'&title=' + encodeURIComponent(title) +
'&description=' + encodeURIComponent((description || '').replace(/(<([^>]+)>)/ig, ''))
);
iframe.setAttribute('border', '0');
iframe.setAttribute('scrolling', 'no');
iframe.setAttribute('width', '78');
iframe.setAttribute('height', '17');
iframe.setAttribute('allowTransparency', 'true');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('class', 'instapaper_iframe');
iframe.setAttribute('style', 'margin-bottom: 3px; z-index: 1338; border: 0; background-color: transparent; overflow: hidden;');
return iframe;
}
cachedPipe('f533cde31f71a803b9a1061e3bb63af2', 'displayInstapaper', 24)
</script>
Jump to Line
Something went wrong with that request. Please try again.