1 var STATIC = '/static/';
4 "DELETE_SHELF": "Czy na pewno usunąć półkę",
5 "HIDE_DESCRIPTION": "Zwiń opis",
6 "EXPAND_DESCRIPTION": "Rozwiń opis",
10 "DELETE_SHELF": "Möchtest du wirklich dieses Bücherregal entfernen?",
11 "HIDE_DESCRIPTION": "Beschreibung zuklappen",
12 "EXPAND_DESCRIPTION": "Beschreibung aufklappen",
13 "LOADING": "Herunterladen"
16 "DELETE_SHELF": "Voulez-vous supprimer l'étagère définitivement?",
17 "HIDE_DESCRIPTION": "Montrer la description",
18 "EXPAND_DESCRIPTION": "Cacher la description",
19 "LOADING": "Chargement"
22 "DELETE_SHELF": "Are you sure you want to delete this shelf?",
23 "HIDE_DESCRIPTION": "Hide",
24 "EXPAND_DESCRIPTION": "Expand",
28 "DELETE_SHELF": "Уверены ли вы том, чтобы удалить полку?",
29 "HIDE_DESCRIPTION": "Свернуть описание",
30 "EXPAND_DESCRIPTION": "Раскрыть описание",
34 "DELETE_SHELF": "¿Estás seguro que quieres borrar este estante?",
35 "HIDE_DESCRIPTION": "Esconder la descripción",
36 "EXPAND_DESCRIPTION": "Ampliar la descripción",
40 "DELETE_SHELF": "Ar tikrai nori pašalinti lentną?",
41 "HIDE_DESCRIPTION": "Suvyniok aprašymą ",
42 "EXPAND_DESCRIPTION": "Išplėsk aprašymą",
46 "DELETE_SHELF": "Ви впевнені, що хочете видалити полицю?",
47 "HIDE_DESCRIPTION": "Сховати опис",
48 "EXPAND_DESCRIPTION": "Показати опис",
49 "LOADING": "Завантажується"
53 'Przekaż 1% żeby ukryć ten baner.',
54 'Jak dobrze wydać 1% swojego podatku? <strong>Poradnik dla opornych</strong>.',
55 'Wiadomość systemowa: wystąpił błąd brak funduszy. Wykonaj procedurę 1%.',
56 '<strong>FREE!</strong> Wygraj darmowe lektury!',
57 'Confidential business offer. Not scam! 1% for you.',
58 'Biblioteka Wolne Lektury wymaga aktualizacji. Kliknij dalej.',
59 '1000 lektur. <strong>1 procent</strong>.',
60 '1% dla biblioteki lektur szkolnych. 1% dla Twojej biblioteki.',
61 '1% na lektury szkolne.',
62 '1% dla wolności lektur szkolnych.',
63 'Podaruj Jeden Procent na rzecz szkolnej biblioteki internetowej.',
64 '1% podatku dla biblioteki szkolnej Wolne Lektury.',
65 '1% na rzecz darmowego dostępu do szkolnych lektur.',
66 'Żeby czytać teksty a nie skany. Przekaż 1%.',
67 'Czytaj teksty a nie skany. Przekaż 1%',
68 'Motyw artysty w literaturze - 47 cytatów. Pomóż znaleźć następne.',
69 'Twój 1% uwolni więcej lektur.',
70 'Ponad 400 motywów, blisko 10 000 000 cytatów. Pomóż znaleźć następne. Przekaż swój 1%.',
71 'Twój 1% uwolni lektury.',
72 'Rozlicz swój PIT z Wolnymi Lekturami. Skorzystaj z darmowego programu do rozliczania podatków.',
73 'Lektury 2010: Pan Tadeusz, Trylogia.',
74 'Pan Tadeusz też chce być w Internecie! Przekaż 1% swojego podatku.',
75 'Pomóż uwolnić 286 utworów z listy lektur szkolnych. Przekaż swój 1% na Wolne Lektury.'
78 function changeBannerText() {
79 var index = Math.floor(Math.random() * BANNER_TEXTS.length);
80 if (BANNER_TEXTS[index] == $('#onepercent-text').html()) {
84 $('#onepercent-text').fadeOut('slow', function() {
85 $(this).html(BANNER_TEXTS[index]);
86 $(this).fadeIn('slow');
89 setTimeout(changeBannerText, 30 * 1000);
93 function autocomplete_result_handler(event, item) {
94 $(event.target).closest('form').submit();
96 function serverTime() {
98 $.ajax({url: '/katalog/zegar/',
99 async: false, dataType: 'text',
100 success: function(text) {
101 time = new Date(text);
102 }, error: function(http, message, exc) {
111 $.fn.toggle_slide = function(p) {
113 short_el = p['short_el'] || $(':first-child', this);
114 long_el = p['long_el'] || short_el.next();
115 button = p['button'];
116 short_text = p['short_text'],
117 long_text = p['long_text'];
119 var toggle_fun = function(cont, short_el, long_el, button, short_text, long_text) {
120 var toggle = function() {
121 if (cont.hasClass('short')) {
122 cont.animate({"height": long_el.attr("cont_h")+'px'}, {duration: "fast" }).removeClass('short');
125 if (button && long_text) button.html(long_text);
127 cont.animate({"height": short_el.attr("cont_h")+'px'}, {duration: "fast" }).addClass('short');
130 if (button && short_text) button.html(short_text);
136 if (long_el.html().length <= short_el.html().length)
139 // ensure long element shown first
140 long_el.show();short_el.hide();
141 long_el.attr("cont_h", $(this).height()).hide();
142 short_el.show().attr("cont_h", $(this).height());
143 $(this).addClass('short');
145 if (button && short_text) button.html(short_text);
146 if (button) button.hover(
147 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
148 function() { $(this).css({background: '#EEE'}); }
149 ).click(toggle_fun(cont, short_el, long_el, button, short_text, long_text));
151 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
152 function() { $(this).css({background: '#FFF'}); }
153 ).click(toggle_fun(cont, short_el, long_el, button, short_text, long_text));
155 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
156 function() { $(this).css({background: '#FFF'}); }
157 ).click(toggle_fun(cont, short_el, long_el, button, short_text, long_text));
160 $('form input').labelify({labelledClass: 'blur'});
162 target = $('#login-register-window div.target');
164 $('#show-registration-form').click(function() {
165 $('#login-form').hide();
166 $('#registration-form').show();
169 $('#show-login-form').click(function() {
170 $('#registration-form').hide();
171 $('#login-form').show();
175 $('.fragment-short-text').each(function() {
176 var fragment = $(this).closest('.fragment');
177 fragment.toggle_slide({
179 long_el: fragment.find('.fragment-text')
183 $('.show-all-tags').click(function() {
184 $(this).parent().parent().fadeOut(function() {
185 $(this).next().fadeIn();
190 $('.hide-all-tags').click(function() {
191 $(this).parent().parent().fadeOut(function() {
192 $(this).prev().fadeIn();
197 $('#registration-form').ajaxForm({
199 beforeSubmit: function() {
200 $('#registration-form input[type=submit]')
201 .attr('disabled', 'disabled')
202 .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
204 success: function(response) {
205 if (response.success) {
206 location.reload(true);
208 $('#registration-form span.error').remove();
209 $.each(response.errors, function(id, errors) {
210 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
212 $('#registration-form input[type=submit]').removeAttr('disabled');
213 $('#registration-form img').remove();
218 $('#login-form').ajaxForm({
220 beforeSubmit: function() {
221 $('#login-form input[type=submit]')
222 .attr('disabled', 'disabled')
223 .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
225 success: function(response) {
226 if (response.success) {
227 location.reload(true);
229 $('#login-form span.error').remove();
230 $.each(response.errors, function(id, errors) {
231 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
233 $('#login-form input[type=submit]').removeAttr('disabled');
234 $('#login-form img').remove();
239 $('#login-register-window').jqm({
242 trigger: '.login-register-link',
243 onShow: function(hash) {
244 var offset = $(hash.t).offset();
245 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
246 $('div.header', hash.w).css({width: $(hash.t).width()});
251 $('ul.shelf-list li').hover(function() {
252 $(this).css({background: '#EEE', cursor: 'pointer'});
254 $(this).css({background: 'transparent'});
255 }).click(function() {
256 location.href = $('a.visit-shelf', this).attr('href');
259 $('.delete-shelf').click(function() {
261 var shelf_name = $('.visit-shelf', link.parent()).text();
262 if (confirm(LOCALE_TEXTS[LANGUAGE_CODE]['DELETE_SHELF']+ ' '+ shelf_name + '?')) {
263 $.post(link.attr('href'), function(data, textStatus) {
264 link.parent().remove();
271 $('#user-shelves-window').jqm({
273 target: $('#user-shelves-window div.target')[0],
275 trigger: '#user-shelves-link',
276 onShow: function(hash) {
277 var offset = $(hash.t).offset();
278 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
279 $('div.header', hash.w).css({width: $(hash.t).width()});
282 onLoad: function(hash) {
283 $('form', hash.w).ajaxForm({
284 target: serverResponse,
285 success: function(serverResponse) {
286 var newShelf = $.parseJSON(serverResponse);
287 $('#user-shelves-window div.target').html(newShelf.msg);
288 setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000);
292 $('input', hash.w).labelify({labelledClass: 'blur'});
294 $('ul.shelf-list li', hash.w).hover(function() {
295 $(this).css({background: '#EEE', cursor: 'pointer'});
297 $(this).css({background: 'transparent'});
298 }).click(function() {
299 location.href = $('a.visit-shelf', this).attr('href');
302 $('.delete-shelf').click(function() {
304 var shelf_name = $('.visit-shelf', link.parent()).text();
305 if (confirm(LOCALE_TEXTS[LANGUAGE_CODE]['DELETE_SHELF'] + ' ' + shelf_name + '?')) {
306 $.post(link.attr('href'), function(data, textStatus) {
307 link.parent().remove();
315 $('#suggest-window').jqm({
317 target: $('#suggest-window div.target')[0],
319 trigger: '#suggest-link',
320 onShow: function(hash) {
321 var offset = $(hash.t).offset();
322 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
323 $('div.header', hash.w).css({width: $(hash.t).width()});
326 onLoad: function(hash) {
327 $('form', hash.w).ajaxForm({
329 target: $('#suggest-window div.target'),
330 success: function(response) {
331 if (response.success) {
332 $('#suggest-window div.target').text(response.message);
333 setTimeout(function() { $('#suggest-window').jqmHide() }, 1000)
336 $('#suggest-form .error').remove();
337 $.each(response.errors, function(id, errors) {
338 $('#suggest-form #id_' + id).before('<span class="error">' + errors[0] + '</span>');
340 $('#suggest-form input[type=submit]').removeAttr('disabled');
348 $('#books-list .book').hover(
349 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
350 function() { $(this).css({background: '#FFF'}); }
352 location.href = $('h2 a', this).attr('href');
355 $('#description').each(function(){$(this).toggle_slide({
356 long_el: $('#description-long', this),
357 short_el: $('#description-short', this),
358 button: $(this).nextAll('#toggle-description').first().find('p'),
359 long_text: LOCALE_TEXTS[LANGUAGE_CODE]['HIDE_DESCRIPTION'] + ' ▲',
360 short_text: LOCALE_TEXTS[LANGUAGE_CODE]['EXPAND_DESCRIPTION'] + ' ▼'
363 $('#toggle-share-shelf').hover(
364 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
365 function() { $(this).css({background: '#EEE'}); }
367 if ($('#share-shelf').hasClass('hidden')) {
368 $('#share-shelf').slideDown('fast').removeClass('hidden');
370 $('#share-shelf').slideUp('fast').addClass('hidden');
374 var target = $('#set-window div.target');
376 $('#set-window').jqm({
380 trigger: 'a.jqm-trigger',
381 onShow: function(hash) {
382 var offset = $(hash.t).offset();
383 target.html('<p><img src="/static/img/indicator.gif" />'+LOCALE_TEXTS[LANGUAGE_CODE]['DELETE_SHELF']+'</p>');
384 hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() },
385 onLoad: function(hash) {
387 $('#createShelfTrigger').click(function(){
388 // who cares it's not needed, but I was looking for it
389 // that's why I want it to stay.. :)
390 // var slug = $(hash.t).attr('href').split("/")[3];
391 $('#createNewShelf').show();
395 $('form', hash.w).ajaxForm({
396 target: serverResponse,
397 success: function(serverResponse) {
398 var newShelf = $.parseJSON(serverResponse);
399 // for live shelf adding
401 var noIds = $("#putOnShelf ol ul").children('li').length;
402 $("#putOnShelf ol ul").prepend('<li><label for="id_set_ids_'+ noIds +'"><input name="set_ids" value="'+ newShelf.id +'" id="id_set_ids_'+ noIds +'" type="checkbox" checked="checked"> '+ newShelf.name +' (0)</label></li>');
403 $("#createNewShelf ol input[name=name]").val("");
405 if(newShelf.after == "close"){
406 setTimeout(function() {$('#set-window').jqmHide();}, 1000);
413 $('a.remove-from-shelf').click(function(event) {
414 event.preventDefault();
416 $.post(link.attr('href'), function(data, textStatus) {
417 link.parent().remove();
421 $('#share-shelf').hide().addClass('hidden');
422 $('#share-shelf input').focus(function(){this.select();});
424 $('#user-info').show();
426 $('#onepercent-banner').show();
428 var formatsDownloaded = false;
429 $('#download-shelf').click(function() {
430 $('#download-shelf-menu').slideDown('fast');
432 if (!formatsDownloaded) {
433 // Get info about the formats
434 formatsDownloaded = true;
436 url: $('#download-formats-form').attr('data-formats-feed'),
439 complete: function() {
440 $('#download-formats-form-submit').attr('disabled', null);
441 $('#download-formats-form-submit-li img').remove();
442 $('#updating-formats').fadeOut('fast', function() {
443 $('#formats-updated').fadeIn('fast');
446 success: function(data) {
447 $('#download-formats-form li').each(function() {
449 if (!!item.attr('data-format') && !data[item.attr('data-format')]) {
450 item.fadeOut('fast', function() {
461 $('#download-formats-form-cancel').click(function() {
462 $('#download-shelf-menu').slideUp('fast');
466 $('.sponsor-logos').cycle({timeout: 3000});
468 $('.widget-code').focus(
470 $(this).animate({rows: '11'}, 100, function(){
472 $(this).click(function(){
480 $(this).animate({rows: '1'}, 300, function(){
481 $(this).unbind('click');
486 $('.book-list-index').click(function(){
487 $('.book-list-show-index').hide('slow');
488 if($(this).parent().next('ul:not(:hidden)').length == 0){
489 $(this).parent().next('ul').toggle('slow');
494 // player for audiobooks
496 // event handlers for playing different formats
497 $('.audiotabs span').click(function(){
498 $('.audiobook-list').hide();
499 $('.audiotabs .active').removeClass('active');
500 // we don't want to interact with "audiobook" label, just 'format' tabs
502 $this.addClass("active");
503 $("#"+$this.attr('data-format')+"-files").show();
506 $('.audiobook-list').hide();
507 if($(".audiotabs .active").length > 0) {
508 $("#"+$(".audiotabs .active").html().toLowerCase()+"-files").show();
511 /* this will be useful for javascript html player
512 var medias = $('.audiobook-list a');
517 if (medias.length > 0) {
518 // creating sources list for player
519 medias.each(function(index, item) {
520 tmpExt = item.href.split(".").pop();
521 if(tmpExt == "mp3") {
522 mp3List.push(item.href);
523 } else if (tmpExt == "ogg") {
524 oggList.push(item.href);
525 } else if(tmpExt == "daisy") {
526 daisyList.push(item.href);