function sv_Widget(){ sv_includes(); if (typeof(jQuery) == 'undefined'){ sv_includeLibreria('https://www.soriaviva.es/include/jquery-1.11.1.min.js','js',function(){ jQuery.noConflict(); sv_load(); }); } else { sv_load(); } } function sv_load(){ var objA = jQuery("a[href='https://www.soriaviva.es']"); if(objA.length){ objA.addClass('sv_a'); objA.attr("target","_blank"); objA.before("
...
"); jQuery.ajax( "https://www.soriaviva.es/widget/eventos.php?"+Math.random()+"&c=0&p=52492&md=10", { type: 'POST', data:{w:jQuery("#sv").width()} } ) .done(function(html) { jQuery('#sv').html(html); }) .fail(function() { jQuery('#sv').html(""); }); } } function sv_includes() { sv_includeLibreria('https://www.soriaviva.es/widget/style.css','css',null); } function sv_includeLibreria(ruta,tipo,callbackFunc){ var head = document.getElementsByTagName('head')[0]; if(tipo=='js') { var se1 = document.createElement('script'); se1.src = ruta; if(callbackFunc!=null) se1.onload=callbackFunc; head.appendChild(se1); } if(tipo=='css') { var cssNode_jquery = document.createElement('link'); cssNode_jquery.type = 'text/css'; cssNode_jquery.rel = 'stylesheet'; cssNode_jquery.href = ruta; cssNode_jquery.media = 'screen'; head.appendChild(cssNode_jquery); } } document.addEventListener( 'DOMContentLoaded', function( event ) { sv_Widget(); });