From: Marcin Koziej Date: Mon, 16 Apr 2012 14:41:51 +0000 (+0200) Subject: yet another script loading X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/eb6556f39bd39099b23e2fc9b85772857846f9dd?ds=sidebyside;hp=ff0ce1c6ab545ab8b7f4166caae9d59e6a67b421 yet another script loading --- diff --git a/apps/wolnelektury_core/static/css/widget.css b/apps/wolnelektury_core/static/css/widget.css index 14aed95f2..8da8bf36c 100644 --- a/apps/wolnelektury_core/static/css/widget.css +++ b/apps/wolnelektury_core/static/css/widget.css @@ -121,7 +121,7 @@ } .ui-menu a:hover { - color:white; +/* color:white;*/ text-decoration: none; } diff --git a/apps/wolnelektury_core/static/js/widget.js b/apps/wolnelektury_core/static/js/widget.js index 54700de7d..183b5154d 100644 --- a/apps/wolnelektury_core/static/js/widget.js +++ b/apps/wolnelektury_core/static/js/widget.js @@ -51,10 +51,18 @@ scriptSearch.setAttribute('type', 'text/javascript'); scriptSearch.setAttribute('src', 'http://'+host+'/static/js/search.js'); scriptSearch.setAttribute('id', 'wl-search-script') - body[0].appendChild(scriptJ); -body[0].appendChild(scriptUI); -body[0].appendChild(scriptSearch); +scriptJ.onload = function() { body[0].appendChild(scriptUI); }; +scriptJ.onreadystatechange = function() { if (scriptJ.readyState == 'complete') { scriptJ.onload(); } }; + +scriptUI.onload = function() { body[0].appendChild(scriptSearch); }; +scriptUI.onreadystatechange = function() { if (scriptUI.readyState == 'complete') { scriptUI.onload(); } }; + +scriptSearch.onload = function() { + var s = $('#id_qq'); + s.search({source: s.attr('data-source')}); +} +scriptSearch.onreadystatechange = function() { if (scriptSearch.readyState == 'complete') { scriptSearch.onload(); } }; /* append elements to widget */ widget.appendChild(stylesheet); @@ -83,24 +91,5 @@ if(widget.getAttribute('width') == '140'){ widget.style.width = "140px"; } -var wl_loaded_scripts = {}; - -function wl_initialize_after_load(just_loaded) { - wl_loaded_scripts[just_loaded] = true; - if (wl_loaded_scripts.jquery - && wl_loaded_scripts.ui - && wl_loaded_scripts.search) { - var s = $('#id_qq'); - s.search({source: s.attr('data-source')}); - } -} - -scriptJ.onload = function() { wl_initialize_after_load('jquery'); }; -scriptJ.onreadystatechange = function() { if (scriptJ.readyState == 'complete') { wl_initialize_after_load('jquery'); } }; - -scriptUI.onload = function() { wl_initialize_after_load('ui'); }; -scriptUI.onreadystatechange = function() { if (scriptUI.readyState == 'complete') { wl_initialize_after_load('jquery'); } }; -scriptSearch.onload = function() { wl_initialize_after_load('search'); }; -scriptSearch.onreadystatechange = function() { if (scriptSearch.readyState == 'complete') { wl_initialize_after_load('jquery'); } };