2 'Przekaż 1% żeby ukryć ten baner.',
3 'Jak dobrze wydać 1% swojego podatku? <strong>Poradnik dla opornych</strong>.',
4 'Wiadomość systemowa: wystąpił błąd brak funduszy. Wykonaj procedurę 1%.',
5 '<strong>FREE!</strong> Wygraj darmowe lektury!',
6 'Confidential business offer. Not scam! 1% for you.',
7 'Biblioteka Wolne Lektury wymaga aktualizacji. Kliknij dalej.',
8 '1000 lektur. <strong>1 procent</strong>.'
12 function changeBannerText() {
13 var index = Math.floor(Math.random() * BANNER_TEXTS.length);
14 if (BANNER_TEXTS[index] == $('#onepercent-text').html()) {
18 $('#onepercent-text').fadeOut('slow', function() {
19 $(this).html(BANNER_TEXTS[index]);
20 $(this).fadeIn('slow');
23 setTimeout(changeBannerText, 30 * 1000);
30 $('form input').labelify({labelledClass: 'blur'});
32 target = $('#login-register-window div.target');
34 $('#show-registration-form').click(function() {
35 $('#login-form').hide();
36 $('#registration-form').show();
39 $('#show-login-form').click(function() {
40 $('#registration-form').hide();
41 $('#login-form').show();
45 $('.fragment-text').each(function() {
46 if ($(this).prev().filter('.fragment-short-text').length) {
48 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
49 function() { $(this).css({background: '#FFF'}); }
51 $(this).fadeOut(function() {
52 $(this).prev().fadeIn()
58 $('.fragment-short-text').click(function() {
59 $(this).fadeOut(function() { $(this).next().fadeIn() });
61 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
62 function() { $(this).css({background: '#FFF'}); }
65 $('.show-all-tags').click(function() {
66 $(this).parent().parent().fadeOut(function() {
67 $(this).next().fadeIn();
72 $('.hide-all-tags').click(function() {
73 $(this).parent().parent().fadeOut(function() {
74 $(this).prev().fadeIn();
79 $('#registration-form').ajaxForm({
81 beforeSubmit: function() {
82 $('#registration-form input[type=submit]')
83 .attr('disabled', 'disabled')
84 .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
86 success: function(response) {
87 if (response.success) {
88 location.reload(true);
90 $('#registration-form span.error').remove();
91 $.each(response.errors, function(id, errors) {
92 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
94 $('#registration-form input[type=submit]').removeAttr('disabled');
95 $('#registration-form img').remove();
100 $('#login-form').ajaxForm({
102 beforeSubmit: function() {
103 $('#login-form input[type=submit]')
104 .attr('disabled', 'disabled')
105 .after('<img src="/static/img/indicator.gif" style="margin-left: 0.5em"/>');
107 success: function(response) {
108 if (response.success) {
109 location.reload(true);
111 $('#login-form span.error').remove();
112 $.each(response.errors, function(id, errors) {
113 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
115 $('#login-form input[type=submit]').removeAttr('disabled');
116 $('#login-form img').remove();
121 $('#login-register-window').jqm({
124 trigger: '.login-register-link',
125 onShow: function(hash) {
126 var offset = $(hash.t).offset();
127 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
128 $('div.header', hash.w).css({width: $(hash.t).width()});
133 $('ul.shelf-list li').hover(function() {
134 $(this).css({background: '#EEE', cursor: 'pointer'});
136 $(this).css({background: 'transparent'});
137 }).click(function() {
138 location.href = $('a.visit-shelf', this).attr('href');
141 $('.delete-shelf').click(function() {
143 var shelf_name = $('.visit-shelf', link.parent()).text();
144 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
145 $.post(link.attr('href'), function(data, textStatus) {
146 link.parent().remove();
152 $('#user-shelves-window').jqm({
154 target: $('#user-shelves-window div.target')[0],
156 trigger: '#user-shelves-link',
157 onShow: function(hash) {
158 var offset = $(hash.t).offset();
159 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
160 $('div.header', hash.w).css({width: $(hash.t).width()});
163 onLoad: function(hash) {
164 $('form', hash.w).ajaxForm({
165 target: $('#user-shelves-window div.target'),
166 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
169 $('input', hash.w).labelify({labelledClass: 'blur'});
171 $('ul.shelf-list li', hash.w).hover(function() {
172 $(this).css({background: '#EEE', cursor: 'pointer'});
174 $(this).css({background: 'transparent'});
175 }).click(function() {
176 location.href = $('a.visit-shelf', this).attr('href');
179 $('.delete-shelf').click(function() {
181 var shelf_name = $('.visit-shelf', link.parent()).text();
182 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
183 $.post(link.attr('href'), function(data, textStatus) {
184 link.parent().remove();
192 $('#books-list .book').hover(
193 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
194 function() { $(this).css({background: '#FFF'}); }
196 location.href = $('h2 a', this).attr('href');
199 $('#toggle-description').hover(
200 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
201 function() { $(this).css({background: '#EEE'}); }
203 if ($('#description').hasClass('hidden')) {
204 $('#description').slideDown('fast').removeClass('hidden');
205 $.cookie('description-state', 'opened', {path: '/', expires: 30});
206 $('p', this).html('Zwiń opis ▲');
208 $('#description').slideUp('fast').addClass('hidden');
209 $.cookie('description-state', 'closed', {path: '/', expires: 30});
210 $('p', this).html('Rozwiń opis ▼');
214 var target = $('#set-window div.target');
216 $('#set-window').jqm({
220 trigger: 'a.jqm-trigger',
221 onShow: function(hash) {
222 var offset = $(hash.t).offset();
223 target.html('<p><img src="/static/img/indicator.gif" /> Ładowanie</p>');
224 hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() },
225 onLoad: function(hash) {
226 $('form', hash.w).ajaxForm({
228 success: function() { setTimeout(function() { $('#set-window').jqmHide() }, 1000) }
233 $('a.remove-from-shelf').click(function(event) {
234 event.preventDefault();
236 $.post(link.attr('href'), function(data, textStatus) {
237 link.parent().remove();
241 if ($.cookie('description-state') == 'closed') {
242 $('#description').hide().addClass('hidden');
243 $('#toggle-description p').html('Rozwiń opis ▼');
246 $('#user-info').show();
248 $('#onepercent-banner').slideDown('slow');
250 var formatsDownloaded = false;
251 $('#download-shelf').click(function() {
252 $('#download-shelf-menu').slideDown('fast');
254 if (!formatsDownloaded) {
255 // Pobierz dane o formatach
256 formatsDownloaded = true;
258 url: $('#download-formats-form').attr('data-formats-feed'),
261 complete: function() {
262 $('#download-formats-form-submit').attr('disabled', null);
263 $('#download-formats-form-submit-li img').remove();
264 $('#updating-formats').fadeOut('fast', function() {
265 $('#formats-updated').fadeIn('fast');
268 success: function(data) {
269 $('#download-formats-form li').each(function() {
271 if (!!item.attr('data-format') && !data[item.attr('data-format')]) {
272 item.fadeOut('fast', function() {
283 $('#download-formats-form-cancel').click(function() {
284 $('#download-shelf-menu').slideUp('fast');