Bookmarklet that fixes rot13 encoding on Slashdot on April 1, 2013.
To install, visit http://bl.ocks.org/d/5285534
Bookmarklet that fixes rot13 encoding on Slashdot on April 1, 2013.
To install, visit http://bl.ocks.org/d/5285534
| <html> | |
| <title>Slashdot Rot13 Decoder</title> | |
| <head> | |
| <style type="text/css"> | |
| .button-wrapper { | |
| margin: 2em 0; | |
| } | |
| .inline-button, | |
| .button { | |
| /* base64 encoder: http://www.greywyvern.com/code/php/binary2base64 */ | |
| /* Source image: http://tiny.cc/public/images/default-favicon.ico */ | |
| background-image: url(data:image/vnd.microsoft.icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAA+/v8APn3+QCeTWQAcmh+APj5+gBVKksA9/X3APb29gD08vMA9/j5APT09gD7/PwA8/HyAPPz9QD6+/sA9fP1AGcwWQDy8vQAOB07APn6+gD49vcA2eryAPX19gCckqgA8/HzAPb19gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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GBgYGBgYGBgAAAAAAIADAACAAwAAgAMAAIADAACAAwAAgAMAAIADAACAAwAAgAMAAIADAACAAwAAgAMAAIADAACABwAAgA8AAIAfAAA=); | |
| background-repeat: no-repeat; | |
| background-color: #65a9d7; | |
| background-position: 10px center; | |
| padding: 10px 20px 10px 32px; | |
| border-radius: 8px; | |
| color: white; | |
| font-size: 18px; | |
| font-family: 'Lucida Grande', Helvetica, Arial, Sans-Serif; | |
| text-decoration: none; | |
| } | |
| .inline-button { | |
| display: inline; | |
| background-color: transparent; | |
| padding-right: 3px; | |
| padding-left: 28px; | |
| font-size: 1em; | |
| background-size: 13px 13px; | |
| } | |
| .inline-button a { | |
| text-decoration: none; | |
| color: #65a9d7; | |
| } | |
| body { | |
| padding: 20px; | |
| font-family: Helvetica, Arial, sans-serif; | |
| font-size: .9em; | |
| color: #444; | |
| } | |
| p { | |
| line-height: 1.5em; | |
| margin: .5em 0 1em 0; | |
| } | |
| ul { | |
| line-height: 2em; | |
| list-style-type: none; | |
| padding-left: 1em; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <section data-markdown> | |
| # Slashdot Rot13 Decoder | |
| The _Slashdot Rot13 Decoder_ bookmarklet fixes the rot13 encoding that Slashdot.org added on April 1, 2013. | |
| To install the bookmarklet, drag this link to your bookmark toolbar: | |
| <div class="button-wrapper"> <a class="button" href="javascript:(function(){var s = document.createElement('script');s.src='https://gist.github.com/raw/5285534/slashdot-rot13.js';document.body.appendChild(s);})();">Slashdot ROT13</a> </div> | |
| ## Get the source code | |
| To get the source code, visit <a href="https://gist.github.com/5285534">https://gist.github.com/5285534</a> | |
| <a href="https://gist.github.com/5285534"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a> | |
| </section> | |
| <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script> | |
| <script> | |
| // adapted from http://blog.harakys.com/blog/2012/02/21/embed-markdown-into-your-html/ | |
| // see also https://gist.github.com/1343518 | |
| [].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){ | |
| var html = (new Showdown.converter()).makeHtml(elem.innerHTML); | |
| elem.innerHTML = html; | |
| }); | |
| </script> | |
| <script type="text/javascript"> | |
| var _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', 'UA-37659053-1']); | |
| _gaq.push(['_setDomainName', 'ocks.org']); | |
| _gaq.push(['_trackPageview']); | |
| (function() { | |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
| ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |
| // from http://stackoverflow.com/a/5353260/9621 | |
| function rot13(str) { | |
| return str.replace(/[a-zA-Z]/g, function(c) { | |
| return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26); | |
| }); | |
| } | |
| // target only encrypted article body text | |
| $("article div.body:contains('Read below for your FREE')") | |
| .find('*') // find all descendant tags | |
| .contents() // get all children (including text nodes) | |
| .filter(function(){ return this.nodeType === 3;}) // only target text nodes | |
| .each( function() { | |
| // remove the decoder prompt | |
| if (this.textContent == "Read below for your FREE logged-in-user's-eye view of the unencrypted version!") { | |
| jQuery(this).remove(); | |
| } | |
| // decode via rot13 | |
| this.textContent = rot13(this.textContent); | |
| }); |