X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/65c55a07a1ed0605f8059809281ca69320363964..088b37be4aa9fe5156c101c0e65b0d229bcec849:/wolnelektury/static/js/catalogue.js diff --git a/wolnelektury/static/js/catalogue.js b/wolnelektury/static/js/catalogue.js index 88d4b0761..1c23be82f 100644 --- a/wolnelektury/static/js/catalogue.js +++ b/wolnelektury/static/js/catalogue.js @@ -6,46 +6,46 @@ var LOCALE_TEXTS = { "LOADING": "Åadowanie" }, "de": { - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "Möchtest du wirklich dieses Bücherregal entfernen?", + "HIDE_DESCRIPTION": "Beschreibung zuklappen", + "EXPAND_DESCRIPTION": "Beschreibung aufklappen", + "LOADING": "Herunterladen" }, "fr": { - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "Voulez-vous supprimer l'étagère définitivement?", + "HIDE_DESCRIPTION": "Montrer la description", + "EXPAND_DESCRIPTION": "Cacher la description", + "LOADING": "Chargement" }, "en": { - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "Are you sure you want to delete this shelf?", + "HIDE_DESCRIPTION": "Hide", + "EXPAND_DESCRIPTION": "Expand", + "LOADING": "Loading" }, "ru": { - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "УвеÑÐµÐ½Ñ Ð»Ð¸ Ð²Ñ Ñом, ÑÑÐ¾Ð±Ñ ÑдалиÑÑ Ð¿Ð¾Ð»ÐºÑ?", + "HIDE_DESCRIPTION": "СвеÑнÑÑÑ Ð¾Ð¿Ð¸Ñание", + "EXPAND_DESCRIPTION": "РаÑкÑÑÑÑ Ð¾Ð¿Ð¸Ñание", + "LOADING": "ÐагÑÑзка" }, "es": { - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "¿Estás seguro que quieres borrar este estante?", + "HIDE_DESCRIPTION": "Esconder la descripción", + "EXPAND_DESCRIPTION": "Ampliar la descripción", + "LOADING": "Cargando" }, "lt":{ - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "Ar tikrai nori paÅ¡alinti lentnÄ ?", + "HIDE_DESCRIPTION": "Suvyniok apraÅ¡ymÄ ", + "EXPAND_DESCRIPTION": "IÅ¡plÄsk apraÅ¡ymÄ ", + "LOADING": "Krovimas" }, "uk":{ - "DELETE_SHELF": "Translate me!", - "HIDE_DESCRIPTION": "Translate me!", - "EXPAND_DESCRIPTION": "Translate me!", - "LOADING": "Translate me!" + "DELETE_SHELF": "Ðи впевненÑ, Ñо Ñ Ð¾ÑеÑе видалиÑи полиÑÑ?", + "HIDE_DESCRIPTION": "Ð¡Ñ Ð¾Ð²Ð°Ñи опиÑ", + "EXPAND_DESCRIPTION": "ÐоказаÑи опиÑ", + "LOADING": "ÐаванÑажÑÑÑÑÑÑ" } } var BANNER_TEXTS = [ @@ -267,6 +267,7 @@ function serverTime() { return false; }); + var serverResponse; $('#user-shelves-window').jqm({ ajax: '@href', target: $('#user-shelves-window div.target')[0], @@ -280,8 +281,12 @@ function serverTime() { }, onLoad: function(hash) { $('form', hash.w).ajaxForm({ - target: $('#user-shelves-window div.target'), - success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) } + target: serverResponse, + success: function(serverResponse) { + var newShelf = $.parseJSON(serverResponse); + $('#user-shelves-window div.target').html(newShelf.msg); + setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000); + } }); $('input', hash.w).labelify({labelledClass: 'blur'}); @@ -378,19 +383,31 @@ function serverTime() { target.html('
'+LOCALE_TEXTS[LANGUAGE_CODE]['DELETE_SHELF']+'
'); hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() }, onLoad: function(hash) { - try { - $('#createShelfTrigger').click(function(){ - $('#createNewShelf').show(); - }); - } catch (e){} - + try { + $('#createShelfTrigger').click(function(){ + // who cares it's not needed, but I was looking for it + // that's why I want it to stay.. :) + // var slug = $(hash.t).attr('href').split("/")[3]; + $('#createNewShelf').show(); + }); + } catch (e){} + $("#putOnShelf input[type=checkbox]").attr("checked",false); + var serverResponse; $('form', hash.w).ajaxForm({ - target: target, - success: function() { - setTimeout(function() { - $('#set-window').jqmHide(); - }, 1000)} - }); + target: serverResponse, + success: function(serverResponse) { + var newShelf = $.parseJSON(serverResponse); + // for live shelf adding + if(newShelf.name){ + var noIds = $("#putOnShelf ol ul").children('li').length; + $("#putOnShelf ol ul").prepend(''); + $("#createNewShelf ol input[name=name]").val(""); + } + if(newShelf.after == "close"){ + setTimeout(function() {$('#set-window').jqmHide();}, 1000); + } + } + }); } }); @@ -446,5 +463,34 @@ function serverTime() { $('#download-shelf-menu').slideUp('fast'); return false; }); + + $('.sponsor-logos').cycle({timeout: 3000}); + + $('.widget-code').focus( + function(){ + $(this).animate({rows: '11'}, 100, function(){ + this.select(); + $(this).click(function(){ + this.select(); + }); + }) + + } + ).blur( + function(){ + $(this).animate({rows: '1'}, 300, function(){ + $(this).unbind('click'); + }) + } + ); + + $('.book-list-index').click(function(){ + $('.book-list-show-index').hide('slow'); + if($(this).parent().next('ul:not(:hidden)').length == 0){ + $(this).parent().next('ul').toggle('slow'); + } + return false; + }); + }); })(jQuery)