Created
November 22, 2009 19:04
-
-
Save rmetzler/240664 to your computer and use it in GitHub Desktop.
this code is available as a bookmarklet at http://jsbin.com/aqiku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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