Skip to content

Instantly share code, notes, and snippets.

@rmetzler
Created November 22, 2009 19:04
Show Gist options
  • Save rmetzler/240664 to your computer and use it in GitHub Desktop.
Save rmetzler/240664 to your computer and use it in GitHub Desktop.
this code is available as a bookmarklet at http://jsbin.com/aqiku
var s = document.createElement('script');
s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');
document.body.appendChild(s);
s.onload=function(){
function urlencode(str) {
return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}
var span = $('.tab_content span[rel=\'owl:sameAs\']');
var href = span.attr('href');
var jsonhref = href.replace('http://dbpedia.org/resource/','http://dbpedia.org/data/') + '.json';
span.html('<a href=\'' + jsonhref + '\' >' + href +'</a>');
$.ajax({
dataType: 'jsonp',
url: 'http://jsonp.appspot.com/?url=' + jsonhref,
success: function (json, textStatus) {
var abstr = json[href]['http://dbpedia.org/property/abstract'][0]['value'];
span.html('<p>' + abstr + '</p>');
}
});
};
void(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment