if(typeof jQuery != "function") { //jQuery nicht vorhanden -> einbinden (function () { function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Andere script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } loadScript("https://code.jquery.com/jquery-latest.min.js", function () { vmarkt_ticker(); }); })(); } else { jQuery(document).ready(function() { vmarkt_ticker(); }); } function vmarkt_ticker() { if(console) { console.log("Newsticker by versicherungsmarkt.de"); } error=""; //alert("?content=news1&"); //DIV suchen ticker_div=document.getElementById('vmarkt_ticker'); if(!ticker_div) { error="Kein DIV mit der ID 'vmarkt_ticker' gefunden."; } else { ticker_div.style.display='inline-block'; } if(error!="") { //document.write("Fehler bei Newsticker: "+error); if(console) { console.log("Fehler bei Newsticker: "+error); } } else { //Alles Gut - Ticker starten //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anzahl_der_news = 10; id = 1849; NewsTimeout = 8000; CharTimeout = 1; i = 0; c = -1; ticker = new Array(); current = ''; //Diese Funktion holt sich das News JSON-Objekt von online jQuery.getJSON("https://content.versicherungsmarkt.de/news/news_json.php?id="+id+"&show="+anzahl_der_news+"&logging=",'callback=?',function(data){ json_news = data; //console.log(data); if(json_news.success==1) { for(var n in json_news.result) { ticker.push(""+json_news.result[n].date+": "+json_news.result[n].headline.trim() + "..."); } show_ticker(); } else { ticker_div.innerHTML="Fehler: "+json_news.error; } }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } } function show_ticker() { if (c < ticker[i].length - 1) { c++; tmp = ticker[i]; tmp = tmp.split(''); current = current + tmp[c]; ticker_div.innerHTML = '' + current + ''; setTimeout('show_ticker()', CharTimeout); return; } c = -1; current = ''; if (i < ticker.length - 1) { i++; } else { i = 0; } setTimeout('show_ticker()', NewsTimeout); }