// ==UserScript== // @name Endless Summer on dsbd // @namespace http://www.tumblr.com/ // @description random next link on tumblr dashboard // @include http://www.tumblr.com/dashboard/1000 // @include http://www.tumblr.com/show/*/1000 // @require http://gist.github.com/3242.txt // @require http://gist.github.com/198443.txt // @version 0.0.3.9.9.9.9.9.9.9.9.9 // ==/UserScript== // requires AutoPagerize http://userscripts.org/scripts/show/8551 by swdyh // using $X() http://gist.github.com/3242 by os0x // using createDocumentFromString http://gist.github.com/198443 by os0x // notice: put this script ABOVE AutoPagerize // endlesSummeRize fire on http://www.tumblr.com/dashboard/1000 or http://www.tumblr.com/show/photos/by/everyone/1000 or ... (function(){ var dsbd = 'http://www.tumblr.com/dashboard'; var siteinfo = {}; siteinfo.nextLink = 'id("next_page_link")/self::a'; function getId(info){ var opt = { method: 'GET', url: dsbd, headers : { }, onload: function(res) { var d = createDocumentFromString(res.responseText); var i = $X(info.nextLink, d); if(i.length){ i = i[0]; } else return; GM_setValue('postno', i.href.match(/.*\/\d+\/(\d+)/)[1].toString()); }, } GM_xmlhttpRequest(opt); } function endlessSummer(doc, url, info){ var a = $X(info.nextLink, doc); if (a.length){ a = a[0]; } else return; a.href = location.pathname + '?offset=' + Math.floor(Math.random() * GM_getValue('postno', 377777777)); a.textContent = 'Searching for The Endless Summer \u2192 '; a.style.background='none repeat scroll 0 0 #4AADF0' } getId(siteinfo); endlessSummer(document, location.href, siteinfo); setTimeout(function(){ if (window.AutoPagerize && window.AutoPagerize.addDocumentFilter) window.AutoPagerize.addDocumentFilter(endlessSummer); },0); })();