From 817bf41b9e130a6a56a3a06124186c06f7e87ada Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 1 Sep 2010 11:11:22 +0200 Subject: [PATCH] widget fix --- wolnelektury/static/css/master.css | 4 ++++ wolnelektury/static/js/catalogue.js | 10 ++++++++++ wolnelektury/static/js/widget.js | 18 ++++++++++-------- wolnelektury/static/js/widgetInit.js | 2 +- wolnelektury/static/widget.html | 2 +- .../templates/catalogue/main_page.html | 2 +- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/wolnelektury/static/css/master.css b/wolnelektury/static/css/master.css index cfa644f65..80677d214 100644 --- a/wolnelektury/static/css/master.css +++ b/wolnelektury/static/css/master.css @@ -948,3 +948,7 @@ div.shown-tags p, div.all-tags p { #createNewShelf { display: none; } + +.widget-code { + overflow: hidden; +} diff --git a/wolnelektury/static/js/catalogue.js b/wolnelektury/static/js/catalogue.js index 31bad6eac..1d90e1084 100644 --- a/wolnelektury/static/js/catalogue.js +++ b/wolnelektury/static/js/catalogue.js @@ -462,5 +462,15 @@ function serverTime() { $(this).data('drag', false); }); + $('.widget-code').focus( + function(){ + $(this).animate({rows: '11'}, 100) + } + ).blur( + function(){ + $(this).animate({rows: '1'}, 300) + } + ); + }); })(jQuery) diff --git a/wolnelektury/static/js/widget.js b/wolnelektury/static/js/widget.js index 8a8202492..7012e6404 100644 --- a/wolnelektury/static/js/widget.js +++ b/wolnelektury/static/js/widget.js @@ -9,13 +9,15 @@ var inputSubmit = document.createElement('input'); var body = document.getElementsByTagName('body') var stylesheet = document.createElement('link'); +var host = 'www.wolnelektury.pl'; + /* set attributes of created elements */ stylesheet.setAttribute('type', 'text/css'); stylesheet.setAttribute('rel', 'stylesheet'); -stylesheet.setAttribute('href', 'http://lektury.staging.nowoczesnapolska.org.pl/static/css/widget.css'); -linkLogo.setAttribute('href', 'http://lektury.staging.nowoczesnapolska.org.pl'); -logo.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/img/logo.png'); -form.setAttribute('action', 'http://lektury.staging.nowoczesnapolska.org.pl/katalog/szukaj/'); +stylesheet.setAttribute('href', 'http://'+host+'/static/css/widget.css'); +linkLogo.setAttribute('href', 'http://'+host); +logo.setAttribute('src', 'http://'+host+'/static/img/logo.png'); +form.setAttribute('action', 'http://'+host+'/katalog/szukaj/'); form.setAttribute('method', 'get'); form.setAttribute('accept-charset', 'utf-8'); form.setAttribute('id', 'wl-form'); @@ -26,21 +28,21 @@ inputText.setAttribute('name', 'q'); inputText.setAttribute('id', 'id_qq'); inputText.setAttribute('size', '13'); inputSubmit.setAttribute('type', 'image'); -inputSubmit.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/img/search.png'); +inputSubmit.setAttribute('src', 'http://'+host+'/static/img/search.png'); inputSubmit.setAttribute('style', 'position:relative; top:5px; margin-left:5px'); /* import jquery and autocomplete */ var scriptJ = document.createElement('script'); scriptJ.setAttribute('type', 'text/javascript'); -scriptJ.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/jquery.js'); +scriptJ.setAttribute('src', 'http://'+host+'/static/js/jquery.js'); var scriptAutoComplete = document.createElement('script'); scriptAutoComplete.setAttribute('type', 'text/javascript'); -scriptAutoComplete.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/jquery-ui-1.8.2.custom.min.js'); +scriptAutoComplete.setAttribute('src', 'http://'+host+'/static/js/jquery-ui-1.8.2.custom.min.js'); var scriptInit = document.createElement('script'); scriptInit.setAttribute('type', 'text/javascript'); -scriptInit.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/widgetInit.js'); +scriptInit.setAttribute('src', 'http://'+host+'/static/js/widgetInit.js'); body[0].appendChild(scriptJ); body[0].appendChild(scriptAutoComplete); diff --git a/wolnelektury/static/js/widgetInit.js b/wolnelektury/static/js/widgetInit.js index 0a6e405a3..ab57a3062 100644 --- a/wolnelektury/static/js/widgetInit.js +++ b/wolnelektury/static/js/widgetInit.js @@ -2,7 +2,7 @@ $("#id_qq").autocomplete({ source: function(request, response) { $.ajax({ - url: "http://lektury.staging.nowoczesnapolska.org.pl/katalog/jtags/", + url: "http://www.wolnelektury.pl/katalog/jtags/", dataType: "jsonp", data: { featureClass: "P", diff --git a/wolnelektury/static/widget.html b/wolnelektury/static/widget.html index 67e500971..890184da4 100644 --- a/wolnelektury/static/widget.html +++ b/wolnelektury/static/widget.html @@ -5,7 +5,7 @@ - + diff --git a/wolnelektury/templates/catalogue/main_page.html b/wolnelektury/templates/catalogue/main_page.html index cef3604c0..b3ba6c548 100644 --- a/wolnelektury/templates/catalogue/main_page.html +++ b/wolnelektury/templates/catalogue/main_page.html @@ -18,7 +18,7 @@

{% trans "Wolne Lektury Widget" %}

{% trans "Place our widget - search engine for Wolne Lektury which gives access to free books and audiobooks - on your homepage! Just copy the HTML code below onto your page:" %}

-