Skip to content

Instantly share code, notes, and snippets.

@werty1st
Last active August 29, 2015 14:27
Show Gist options
  • Save werty1st/5356825fd327e52f76ca to your computer and use it in GitHub Desktop.
Save werty1st/5356825fd327e52f76ca to your computer and use it in GitHub Desktop.
function insertScript(url) {
scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript';
scriptEl.async = true;
scriptEl.src = url;
document.getElementsByTagName('head')[0].appendChild(scriptEl);
}
function appendHtml(el, str) {
var div = document.createElement('div');
div.innerHTML = str;
while (div.children.length > 0) {
el.appendChild(div.children[0]);
}
}
var html = '<div class="zdfembed" id="_123949b2e53f3580ee38fc0de144b68eb1c9ac3a" ><div class="socialbox" ><picture> <source srcset="http://sofa01.zdf.de/c/twr/123949b2e53f3580ee38fc0de144b68eb1c9ac3a/768px" media="(min-width: 320px)"><source srcset="http://sofa01.zdf.de/c/twr/123949b2e53f3580ee38fc0de144b68eb1c9ac3a/320px" media="(max-width: 320px)"><img style="widthx: 100%;" srcset="http://sofa01.zdf.de/c/twr/123949b2e53f3580ee38fc0de144b68eb1c9ac3a/320px" alt="Vorschaubild Social Media"></picture><span class="caption fade-caption"><div class="relative_wrapper_social"> <h3>Ihr Klick f&uuml;r den Datenschutz</h3> <p>Erst wenn Sie hier klicken, werden Bilder und andere Daten von Drittanbietern nachgeladen. Ihre IP-Adresse wird dabei an externe Server (Facebook, Google, Twitter etc.) &uuml;bertragen. &Uuml;ber den Datenschutz dieser Anbieter k&ouml;nnen Sie sich auf den jeweiligen Seiten informieren. </p><button class="button" onclick="activateSocial()">Einverstanden</button><a class="settingsbutton" href="http://www.zdf.de/social-media-optin-37013018.html"><button class="socialbottom button" >Datenschutz Einstellung</button></a></div></span> </div></div>';
var target = document.getElementById('content_d73ab14336b9674277f399d838d4d70e')
target.removeChild(target.childNodes[0])
insertScript('https://cdnjs.cloudflare.com/ajax/libs/picturefill/2.3.0/picturefill.min.js');
appendHtml(target, html);
insertScript('http://sofa01.zdf.de/c/twr/123949b2e53f3580ee38fc0de144b68eb1c9ac3a/script.js');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment