X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d316a52151685a1b7c295baa12b73a73eabe5657..4b5ed2ce2a3a8bf845c2831666661365e0c09f09:/apps/wolnelektury_core/static/js/widget.js diff --git a/apps/wolnelektury_core/static/js/widget.js b/apps/wolnelektury_core/static/js/widget.js index de30eb714..550bf2084 100644 --- a/apps/wolnelektury_core/static/js/widget.js +++ b/apps/wolnelektury_core/static/js/widget.js @@ -8,15 +8,19 @@ var inputText = document.createElement('input'); var inputSubmit = document.createElement('input'); var body = document.getElementsByTagName('body') var stylesheet = document.createElement('link'); +var stylesheetJQUI = document.createElement('linl'); -var host = 'www.wolnelektury.pl'; +var host = 'localhost:8000'; //'www.wolnelektury.pl'; /* set attributes of created elements */ stylesheet.setAttribute('type', 'text/css'); stylesheet.setAttribute('rel', 'stylesheet'); stylesheet.setAttribute('href', 'http://'+host+'/static/css/widget.css'); +stylesheetJQUI.setAttribute('type', 'text/css'); +stylesheetJQUI.setAttribute('rel', 'stylesheet'); +stylesheetJQUI.setAttribute('href', 'http://'+host+'/static/css/ui-lightness/jquery-ui-1.8.16.custom.css'); linkLogo.setAttribute('href', 'http://'+host); -logo.setAttribute('src', 'http://'+host+'/static/img/logo.png'); +logo.setAttribute('src', 'http://'+host+'/static/img/logo-bez.png'); form.setAttribute('action', 'http://'+host+'/szukaj/'); form.setAttribute('method', 'get'); form.setAttribute('accept-charset', 'utf-8'); @@ -26,10 +30,11 @@ inputText.setAttribute('title', 'tytul, autor, motyw/temat, epoka, rodzaj, gatun inputText.setAttribute('value', ''); inputText.setAttribute('name', 'q'); inputText.setAttribute('id', 'id_qq'); -inputText.setAttribute('size', '13'); +inputText.setAttribute('data-source', 'http://'+host+'/szukaj/hint'); +/*inputText.setAttribute('size', '13');*/ inputSubmit.setAttribute('type', 'image'); inputSubmit.setAttribute('src', 'http://'+host+'/static/img/search.png'); -inputSubmit.setAttribute('style', 'position:relative; top:5px; margin-left:5px'); +/* inputSubmit.setAttribute('style', 'position:relative; top:5px; margin-left:5px');*/ /* import jquery and autocomplete */ var scriptJ = document.createElement('script'); @@ -39,6 +44,12 @@ scriptJ.setAttribute('src', 'http://'+host+'/static/js/jquery.js'); var scriptAutoComplete = document.createElement('script'); scriptAutoComplete.setAttribute('type', 'text/javascript'); scriptAutoComplete.setAttribute('src', 'http://'+host+'/static/js/jquery-ui-1.8.2.custom.min.js'); +scriptAutoComplete.setAttribute('id', 'wl-jquery-ui-script') + +var scriptSearch = document.createElement('script'); +scriptSearch.setAttribute('type', 'text/javascript'); +scriptSearch.setAttribute('src', 'http://'+host+'/static/js/search.js'); +scriptSearch.setAttribute('id', 'wl-search-script') var scriptInit = document.createElement('script'); scriptInit.setAttribute('type', 'text/javascript'); @@ -46,10 +57,12 @@ scriptInit.setAttribute('src', 'http://'+host+'/static/js/widgetInit.js'); body[0].appendChild(scriptJ); body[0].appendChild(scriptAutoComplete); +body[0].appendChild(scriptSearch); body[0].appendChild(scriptInit); /* append elements to widget */ widget.appendChild(stylesheet); +//widget.appendChild(stylesheetJQUI); widget.appendChild(linkLogo); linkLogo.appendChild(logo); widget.appendChild(form); @@ -57,6 +70,7 @@ form.appendChild(inputText); form.appendChild(inputSubmit); /* ...and a little make-up */ +/* widget.style.borderColor = "#84BF2A"; widget.style.borderWidth = "2px"; widget.style.borderStyle = "solid"; @@ -64,6 +78,7 @@ widget.style.width = "160px"; widget.style.padding = "10px"; widget.style.fontSize = "12px"; form.style.paddingTop = "10px"; +*/ /* resize - if needed */ if(widget.getAttribute('width') == '140'){