Skip to content

Instantly share code, notes, and snippets.

@ffflorian
Last active January 18, 2024 10:59
Show Gist options
  • Save ffflorian/9807bc4e037ead2f7a8defc2b86d99eb to your computer and use it in GitHub Desktop.
Save ffflorian/9807bc4e037ead2f7a8defc2b86d99eb to your computer and use it in GitHub Desktop.
Spiegel Online Paywall
/**
* Read Spiegel Online Plus Articles, hidden behind a rot(1) "encryption"
* and a blur filter.
* Just copy this and paste it into your browser's console (press F12) -
* or use the minified version, see comments below.
* Try it out on any article at http://www.spiegel.de/spiegelplus/.
*
* @ffflorian, 2016
*/
(function (d) {
var getClass = d.getElementsByClassName.bind(d);
var each = Array.prototype.forEach;
var important = '!important;';
var inherit = 'inherit' + important;
var filter = 'filter:none' + important;
var select = 'user-select:' + inherit;
var obfuscated = 'obfuscated';
var obfuscatedContentElement = getClass(obfuscated + '-content')[0].parentNode;
if (obfuscatedContentElement) {
each.call([
getClass('js-spiegelplus-'+ obfuscated + '-intro')[0],
obfuscatedContentElement.nextElementSibling,
d.getElementById('laterpay-replacement'),
getClass('laterpay-under-overlay')[0]
], obj => {
obj.parentNode.removeChild(obj);
});
obfuscatedContentElement.setAttribute('style',
filter +
'-ms-' + filter +
'-webkit-' + filter +
select +
'-webkit-' + select +
'-ms-' + select +
'-moz-' + select +
'opacity:1' + important +
'pointer-events:' + inherit
);
each.call(getClass(obfuscated), obj => {
obj.innerHTML = obj.innerHTML.replace(/(?!<*>)[^ ](?![^<]*>)/g, char => {
char = char.charCodeAt(0);
switch(char) {
case 32: return ' ';
case 177: return '&';
case 178: return '!';
case 180: return ';';
case 181: return '=';
default: return String.fromCharCode(char - 1);
}
});
});
}
}(document));
@ffflorian
Copy link
Author

ffflorian commented Sep 19, 2016

Minified:

!function(a){var b=a.getElementsByClassName.bind(a),c=[].forEach,e='!important;',f='inherit'+e,g='filter:none'
+e,h='user-select:'+f,i='obfuscated',j=b(i+'-content')[0].parentNode;j&&(c.call([b(`js-spiegelplus-${i}-intro`)
[0],j.nextElementSibling,a.getElementById('laterpay-replacement'),b('laterpay-under-overlay')[0]],k=>{k.parentNode
.removeChild(k)}),j.setAttribute('style',`${g}-ms-${g}-webkit-${g+h}-webkit-${h}-ms-${h}-moz-${h}opacity:1${e}
pointer-events:${f}`),c.call(b(i),k=>{k.innerHTML=k.innerHTML.replace(/(?!<*>)[^ ](?![^<]*>)/g,l=>{return l=l.
charCodeAt(0),32===l?' ':177===l?'&':178===l?'!':180===l?';':181===l?'=':String.fromCharCode(l-1)})}))}(document);

@ffflorian
Copy link
Author

Unfortunately, this doesn't work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment