3 $('form input').labelify({labelledClass: 'blur'});
5 target = $('#login-register-window div.target');
7 $('#show-registration-form').click(function() {
8 $('#login-form').hide();
9 $('#registration-form').show();
12 $('#show-login-form').click(function() {
13 $('#registration-form').hide();
14 $('#login-form').show();
18 $('.fragment-text').each(function() {
19 if ($(this).prev().filter('.fragment-short-text').length) {
21 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
22 function() { $(this).css({background: '#FFF'}); }
24 $(this).fadeOut(function() {
25 $(this).prev().fadeIn()
31 $('.fragment-short-text').click(function() {
32 $(this).fadeOut(function() { $(this).next().fadeIn() });
34 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
35 function() { $(this).css({background: '#FFF'}); }
38 $('.show-all-tags').click(function() {
39 $(this).parent().parent().fadeOut(function() {
40 $(this).next().fadeIn();
45 $('#registration-form').ajaxForm({
47 beforeSubmit: function() {
48 $('#registration-form input[type=submit]')
49 .attr('disabled', 'disabled')
50 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
52 success: function(response) {
53 if (response.success) {
54 location.reload(true);
56 $('#registration-form span.error').remove();
57 $.each(response.errors, function(id, errors) {
58 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
60 $('#registration-form input[type=submit]').removeAttr('disabled');
61 $('#registration-form img').remove();
66 $('#login-form').ajaxForm({
68 beforeSubmit: function() {
69 $('#login-form input[type=submit]')
70 .attr('disabled', 'disabled')
71 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
73 success: function(response) {
74 if (response.success) {
75 location.reload(true);
77 $('#login-form span.error').remove();
78 $.each(response.errors, function(id, errors) {
79 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
81 $('#login-form input[type=submit]').removeAttr('disabled');
82 $('#login-form img').remove();
87 $('#login-register-window').jqm({
90 trigger: '.login-register-link',
91 onShow: function(hash) {
92 var offset = $(hash.t).offset();
93 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
94 $('div.header', hash.w).css({width: $(hash.t).width()});
99 $('ul.shelf-list li').hover(function() {
100 $(this).css({background: '#EEE', cursor: 'pointer'});
102 $(this).css({background: 'transparent'});
103 }).click(function() {
104 location.href = $('a.visit-shelf', this).attr('href');
107 $('.delete-shelf').click(function() {
109 var shelf_name = $('.visit-shelf', link.parent()).text();
110 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
111 $.post(link.attr('href'), function(data, textStatus) {
112 link.parent().remove();
118 $('#user-shelves-window').jqm({
120 target: $('#user-shelves-window div.target')[0],
122 trigger: '#user-shelves-link',
123 onShow: function(hash) {
124 var offset = $(hash.t).offset();
125 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
126 $('div.header', hash.w).css({width: $(hash.t).width()});
129 onLoad: function(hash) {
130 $('form', hash.w).ajaxForm({
131 target: $('#user-shelves-window div.target'),
132 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
135 $('input', hash.w).labelify({labelledClass: 'blur'});
137 $('ul.shelf-list li', hash.w).hover(function() {
138 $(this).css({background: '#EEE', cursor: 'pointer'});
140 $(this).css({background: 'transparent'});
141 }).click(function() {
142 location.href = $('a.visit-shelf', this).attr('href');
145 $('.delete-shelf').click(function() {
147 var shelf_name = $('.visit-shelf', link.parent()).text();
148 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
149 $.post(link.attr('href'), function(data, textStatus) {
150 link.parent().remove();
158 $('#books-list .book').hover(
159 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
160 function() { $(this).css({background: '#FFF'}); }
162 location.href = $('h2 a', this).attr('href');
165 $('#toggle-description').hover(
166 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
167 function() { $(this).css({background: '#EEE'}); }
169 if ($('#description').hasClass('hidden')) {
170 $('#description').slideDown('fast').removeClass('hidden');
171 $('p', this).html('Zwiń opis ▲');
173 $('#description').slideUp('fast').addClass('hidden');
174 $('p', this).html('Rozwiń opis ▼');
178 var target = $('#set-window div.target');
180 $('#set-window').jqm({
184 trigger: 'a.jqm-trigger',
185 onShow: function(hash) {
186 var offset = $(hash.t).offset();
187 target.html('<p><img src="/media/img/indicator.gif" /> Ładowanie</p>');
188 hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() },
189 onLoad: function(hash) {
190 $('form', hash.w).ajaxForm({
192 success: function() { setTimeout(function() { $('#set-window').jqmHide() }, 1000) }
197 $('a.remove-from-shelf').click(function(event) {
198 event.preventDefault();
200 $.post(link.attr('href'), function(data, textStatus) {
201 link.parent().remove();