• Welcome to Dragon Realms Reborn.

News:

Dragon Realms lives again!

Main Menu

Reable bookmarklet

Started by Hornwitser, January 20, 2017, 06:34:38 PM

Previous topic - Next topic

Hornwitser

So the idea behind this is that when reading topics there's a lot of clutter that distracts from the reading experience.  As well as there being certain important details that are hard to spot or infer from the way the information is presented.  And that removing all off the clutter will lead to a better experience reading.

Whether that is true or not, I don't really know.  I love this bookmarklet I made though.  It makes reading up on long threads much better.  And my favorite thing from this bookmarklet is that it tells the flow of time in a thread by inserting text saying how much later the next post was made, with the size of that text depending on how long period passed.  This is trivial for a computer to calculate and display, but quite hard for humans to infer from post dates.  Yet for some reason I've never seen any forum does this.

Save the text bellow (use the [select] button to select it all) as the location for a bookmark, then click on the bookmark when in a thread to transform it.

Note: Be careful about bookmarklets, they run code as you and could impersonate you on the site you run them on.  This one is harmless, but you only really have my word for it.

javascript:(function()%20{function%20keep(url)%20{if%20(url.substr(-6)%20===%20"hs.css"%20||%20url.substr(-6)%20===%20"am.css")%20{return%20true;}%20else%20{return%20false;}}var%20nodes%20=%20document.getElementsByTagName('link');for%20(var%20i=0;%20i%20<%20nodes.length;%20i++)%20{var%20n%20=%20nodes.item(i);if%20(n.getAttribute('rel')%20===%20'stylesheet'%20&&%20!keep(n.getAttribute('href')))%20{n.setAttribute('rel',%20'disabled_stylesheet');}}var%20style%20=%20document.createElement('style');style.innerHTML%20=%20'#header,%20#forumheader,%20#moderationbuttons,%20#quickreplybox,#display_jump_to,%20#footer_section,%20#forumposts%20>%20div:first-child%20>%20h3%20>%20img,#forumposts%20>%20div:first-child%20>%20h3%20>%20span:first-of-type,%20.navigate_section,.pagesection,%20hr.post_separator{display:%20none;}html%20{font:%201.2em/130%%20Helvetica,%20sans-serif;}@media%20(min-width:%2048em)%20{html%20{background:%20linear-gradient(to%20right,%20#6DA1C0,%20#446B89,%20#6DA1C0);}body%20{padding:%202em;background:%20white;width:%2035em;margin:%200%20auto;box-shadow:%200%200%201.2em%20#3E6598;border:%200.25em%20solid%20#9AC4ED;border-top:%20none;border-bottom:%20none;}}@media%20(max-width:%2047.99em)%20{body%20{margin:%200.6em;}}#wrapper%20{width:%20100%%20!important;}#poll%20{background:%20#EBF5EC;padding:%200%201em%201em;margin:%200;overflow:%20auto;}#pollmoderation%20{margin-bottom:%206em;}#forumposts%20>%20div%20>%20h3%20{font-size:%20140%;line-height:%20125%;text-align:%20center;margin-top:%200;}form%20>%20div%20>%20div%20{position:%20relative;}div.poster%20>%20h4%20{position:%20absolute;left:%204em;top:%20-0.5em;}h4.no-avatar%20{left:%200%20!important;}div.poster%20>%20h4%20>%20a%20{color:%20black;}div.poster%20>%20ul%20{padding:%200;margin:%200;}div.poster%20>%20ul%20>%20li.avatar%20{display:%20table-cell;height:%203em;width:%203em;vertical-align:%20middle;text-align:%20right;}div.poster%20>%20ul%20>%20li.avatar%20>%20a%20>%20img.avatar%20{max-width:%203em;max-height:%203em;vertical-align:%20middle;}div.poster%20>%20ul%20{height:%203em;}div.keyinfo%20>%20h5%20{position:%20absolute;right:%200;top:%20-1em;}div.keyinfo%20>%20h5%20>%20a%20{color:%20black;}h5.useless-subject%20{display:%20none;}div.keyinfo%20>%20div.smalltext%20{position:%20absolute;top:%203em;right:%200;font-family:%20"Comic%20Sans%20MS",%20sans;font-size:%2060%;}.post%20{margin-top:%200.5em;padding-top:%200.5em;border-top:%200.15em%20solid%20#9AC4ED;}div.poster%20%20>%20ul%20>%20li:not(.avatar),.quickbuttons,%20.reportlinks,%20.messageicon,%20.signature{display:%20none;}.moderatorbar%20{margin-bottom:%205em;}.moderatorbar%20>%20.modified%20{float:%20right;}.post%20{font-family:%20"Raleway",%20sans-serif;}br.soft-break%20{margin-bottom:%200.7em;}a#new%20{display:%20block;background:%20#9AC4ED;height:%200.25em;margin-bottom:%204.25em;}blockquote::before%20{color:%20#46718A;content:%20"%E2%80%9C";font-size:%203em;float:%20left;margin-left:%20-39px;margin-top:%207px;}blockquote%20{background:%20#E1F3FB;padding:%2029px%2059px;margin:%200;}blockquote::after%20{color:%20#46718A;content:%20"%E2%80%9D";font-size:%203em;float:%20right;margin-right:%20-39px;margin-top:%2038px;}div.quoteheader%20{font-family:%20Helvetica,%20sans-serif;text-align:%20right;margin-right:%2034px;margin-top:%200.3em;}div.pagesection%20~%20div.pagesection%20{display:%20block;}div.pagesection%20~%20div.pagesection%20>%20div.buttonlist,%20div.nextlinks_bottom%20{display:%20none;}div.pagesection%20~%20div.pagesection%20>%20div.pagelinks%20{float:%20right;}.timeflow%20{margin:%200%200%201em;text-align:%20center;font-family:%20"Comic%20Sans%20MS",%20sans;}.tfsmall%20{font-size:%2080%;color:%20gray}.tflarge%20{font-size:%20150%}a{color:%20#46718A;text-decoration:%20none;}a:hover{color:%20#385D74;text-decoration:%20underline;}table{empty-cells:%20show;}code{display:%20block;font-family:%20"courier%20new",%20monospace;background:%20#E1F3FB;border:%201px%20solid%20#000000;line-height:%201.3em;padding:%200.2em%200.4em;overflow:%20auto;white-space:%20pre;max-height:%2024em;}body%20>%20div.highslide-container%20{font-size:%200.8em;font-family:%20inherit;}body%20>%20div.highslide-container%20div%20{font-size:%20inherit;font-family:%20inherit;}div.aeva_caption%20{font-size:%200.8em;}body%20>%20div.highslide-container%20div.highslide-caption%20{font-family:%20"Raleway",%20sans-serif;}';document.head.appendChild(style);function%20formatDuration(d)%20{d%20/=%201000;%20var%20scope%20=%20'later';if%20(d%20<%200)%20{scope%20=%20'ago';d%20=%20-d;}if%20(d%20<%202)%20{return%20'Less%20than%20a%20second%20'+scope;}if%20(d%20<%20120)%20{return%20d.toFixed()+'%20seconds%20'+scope;}d%20/=%2060;%20if%20(d%20<%20120)%20{return%20d.toFixed()+'%20minutes%20'+scope;}d%20/=%2060;%20if%20(d%20<%2048)%20{return%20d.toFixed()+'%20hours%20'+scope;}d%20/=%2024;%20if%20(d%20<%2060)%20{return%20d.toFixed()+'%20days%20'+scope;}d%20/=%2030;%20if%20(d%20<%2024)%20{return%20d.toFixed()+'%20months%20'+scope;}d%20/=%2012;%20return%20d.toFixed()+'%20years%20'+scope;}function%20ordinal(i)%20{if%20(i%20<=%2011%20||%20i%20>=%2013)%20return%20String(i)+'th';else%20if%20(i%20%%2010%20===%202)%20return%20String(i)+'nd';else%20if%20(i%20%%2010%20===%203)%20return%20String(i)+'rd';else%20return%20String(i)+'th';}function%20formatDate(time)%20{var%20months%20=%20['Jan',%20'Feb',%20'Mar',%20'Apr',%20'May',%20'June','July',%20'Aug',%20'Sept',%20'Oct',%20'Nov',%20'Dec'];var%20date%20=%20new%20Date(time);var%20this_year%20=%20(new%20Date()).getFullYear();if%20(date.getFullYear()%20!==%20this_year)%20{var%20year%20=%20',%20'+date.getFullYear();}%20else%20{var%20year%20=%20'';}return%20months[date.getMonth()]+'%20'+ordinal(date.getDate())+year;}function%20getDateFromString(date_string)%20{date_string%20=%20date_string.replace(/Yesterday%20at/,%20(new%20Date(Date.now()%20-%203600*24000)).toDateString());date_string%20=%20date_string.replace(/Today%20at/,%20(new%20Date()).toDateString());date_string%20=%20date_string.replace(/(\d+)-(\d+)-(\d+),%20(.*)/,%20'$3-$2-$1T$4');if%20(date_string.replace(/^(\d+)-.*$/,%20'$1')%20<%202000)%20{date_string%20=%20date_string.replace(/(\d+)-(\d+)-(\d+)T(.*)/,%20'$3-$2-$1T$4');}return%20Date.parse(date_string);}var%20infoblocks%20=%20document.getElementsByClassName('keyinfo');var%20last_time%20=%20new%20Date();var%20topic%20=%20document.getElementsByClassName('catbg')[0].textContent.replace(/[\s\S]*Topic:%20(.*)%20.\(Read[\s\S]*/,%20'$1');for%20(var%20i=0;%20i%20<%20infoblocks.length;%20i++)%20{var%20infoblock%20=%20infoblocks[i];var%20subject%20=%20infoblock.children[1];if%20(subject.children[0].text%20===%20'Re:%20'+topic%20||%20subject.children[0].text%20===%20topic)%20{subject.className%20=%20'useless-subject'}var%20timeblock%20=%20infoblock.getElementsByClassName('smalltext')[0];var%20date_string%20=%20timeblock.textContent.replace(/[^:]*:.(.*)../,%20'$1');var%20time%20=%20getDateFromString(date_string);timeblock.innerHTML%20=%20formatDate(time);var%20difference%20=%20time%20-%20last_time;if%20(Math.abs(difference)%20<%20(1000%20*%203600%20*%2024%20*%203))%20continue;%20var%20flow%20=%20document.createElement('div');var%20scope%20=%20'tfsmall';if%20(Math.abs(difference)%20>%20(1000%20*%203600%20*%2024%20*%2030%20*%2012))%20{scope%20=%20'tflarge';}%20else%20if%20(Math.abs(difference)%20>%20(1000%20*%203600%20*%2024%20*%2030))%20{scope%20=%20'tfmedium';}%20flow.className%20=%20'timeflow%20'+scope;flow.innerHTML%20=%20formatDuration(difference);var%20post%20=%20infoblock.parentNode.parentNode.parentNode.parentNode;post.parentNode.insertBefore(flow,%20post);last_time%20=%20time;}var%20title%20=%20document.getElementsByClassName('catbg')[0];title.textContent%20=%20title.textContent.replace(/[\s\S]*Topic:%20(.*)%20.\(Read%20[0-9]+%20times\)/,%20'$1');var%20posts%20=%20document.getElementsByClassName('inner');for%20(var%20i=0;%20i%20<%20posts.length;%20i++)%20{var%20post%20=%20posts[i];var%20nodes%20=%20post.childNodes;for%20(var%20j=1;%20j%20<%20nodes.length-1;%20j++)%20{if%20(nodes[j].nodeName.toLowerCase()%20===%20'br'&&%20!(nodes[j-1].nodeName.toLowerCase()%20===%20'br'||%20nodes[j-1].nodeName.toLowerCase()%20===%20'hr')&&%20!(nodes[j+1].nodeName.toLowerCase()%20===%20'br'||%20nodes[j+1].nodeName.toLowerCase()%20===%20'hr'))%20{nodes[j].className%20=%20'soft-break';}}}var%20bbcSizes%20=%20document.getElementsByClassName('bbc_size');for%20(var%20i=0;%20i%20<%20bbcSizes.length;%20i++)%20{var%20bbcSize%20=%20bbcSizes[i];var%20style%20=%20bbcSize.getAttribute('style');var%20size%20=%20style.replace(/font-size:%20([0-9]+)pt;/,%20'$1')%20/%209.12;bbcSize.setAttribute('style',%20"font-size:%20"+(size*100)+"%;");}var%20blockquotes%20=%20document.getElementsByClassName('bbc_standard_quote');for%20(var%20i=0;%20i%20<%20blockquotes.length;%20++i)%20{var%20quote%20=%20blockquotes[i];var%20head%20=%20quote.previousSibling;var%20footer%20=%20quote.parentNode.insertBefore(head,%20quote.nextSibling);var%20anchor%20=%20footer.firstChild.firstChild;if%20(anchor.text%20===%20undefined)%20{footer.parentNode.removeChild(footer);}%20else%20{anchor.text%20=%20anchor.text.replace(/Quote%20from:%20(.*)%20on%20.*/,%20'%E2%80%94$1');}var%20nodes%20=%20quote.childNodes;if%20(nodes.length%20<%201)%20continue;var%20end%20=%20nodes[nodes.length-1];if%20(end.nodeName.toLowerCase()%20===%20'br')%20{quote.removeChild(end);}}var%20posters%20=%20document.getElementsByClassName('poster');for%20(var%20i=0;%20i%20<%20posters.length;%20++i)%20{var%20poster%20=%20posters[i];if%20(!poster.getElementsByClassName('avatar').length)%20{poster.children[0].className%20=%20'no-avatar';}}window.WebFontConfig%20=%20{google:%20{%20families:%20[%20'Raleway::latin'%20]%20}};(function()%20{var%20wf%20=%20document.createElement('script');wf.src%20=%20('https:'%20==%20document.location.protocol%20?%20'https'%20:%20'http')%20+'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';wf.type%20=%20'text/javascript';wf.async%20=%20'true';var%20s%20=%20document.getElementsByTagName('script')[0];s.parentNode.insertBefore(wf,%20s);})();})()