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 $('.hide-all-tags').click(function() {
46 $(this).parent().parent().fadeOut(function() {
47 $(this).prev().fadeIn();
52 $('#registration-form').ajaxForm({
54 beforeSubmit: function() {
55 $('#registration-form input[type=submit]')
56 .attr('disabled', 'disabled')
57 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
59 success: function(response) {
60 if (response.success) {
61 location.reload(true);
63 $('#registration-form span.error').remove();
64 $.each(response.errors, function(id, errors) {
65 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
67 $('#registration-form input[type=submit]').removeAttr('disabled');
68 $('#registration-form img').remove();
73 $('#login-form').ajaxForm({
75 beforeSubmit: function() {
76 $('#login-form input[type=submit]')
77 .attr('disabled', 'disabled')
78 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
80 success: function(response) {
81 if (response.success) {
82 location.reload(true);
84 $('#login-form span.error').remove();
85 $.each(response.errors, function(id, errors) {
86 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
88 $('#login-form input[type=submit]').removeAttr('disabled');
89 $('#login-form img').remove();
94 $('#login-register-window').jqm({
97 trigger: '.login-register-link',
98 onShow: function(hash) {
99 var offset = $(hash.t).offset();
100 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
101 $('div.header', hash.w).css({width: $(hash.t).width()});
106 $('ul.shelf-list li').hover(function() {
107 $(this).css({background: '#EEE', cursor: 'pointer'});
109 $(this).css({background: 'transparent'});
110 }).click(function() {
111 location.href = $('a.visit-shelf', this).attr('href');
114 $('.delete-shelf').click(function() {
116 var shelf_name = $('.visit-shelf', link.parent()).text();
117 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
118 $.post(link.attr('href'), function(data, textStatus) {
119 link.parent().remove();
125 $('#user-shelves-window').jqm({
127 target: $('#user-shelves-window div.target')[0],
129 trigger: '#user-shelves-link',
130 onShow: function(hash) {
131 var offset = $(hash.t).offset();
132 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
133 $('div.header', hash.w).css({width: $(hash.t).width()});
136 onLoad: function(hash) {
137 $('form', hash.w).ajaxForm({
138 target: $('#user-shelves-window div.target'),
139 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
142 $('input', hash.w).labelify({labelledClass: 'blur'});
144 $('ul.shelf-list li', hash.w).hover(function() {
145 $(this).css({background: '#EEE', cursor: 'pointer'});
147 $(this).css({background: 'transparent'});
148 }).click(function() {
149 location.href = $('a.visit-shelf', this).attr('href');
152 $('.delete-shelf').click(function() {
154 var shelf_name = $('.visit-shelf', link.parent()).text();
155 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
156 $.post(link.attr('href'), function(data, textStatus) {
157 link.parent().remove();
165 $('#books-list .book').hover(
166 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
167 function() { $(this).css({background: '#FFF'}); }
169 location.href = $('h2 a', this).attr('href');
172 $('#toggle-description').hover(
173 function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
174 function() { $(this).css({background: '#EEE'}); }
176 if ($('#description').hasClass('hidden')) {
177 $('#description').slideDown('fast').removeClass('hidden');
178 $('p', this).html('Zwiń opis ▲');
180 $('#description').slideUp('fast').addClass('hidden');
181 $('p', this).html('Rozwiń opis ▼');
185 var target = $('#set-window div.target');
187 $('#set-window').jqm({
191 trigger: 'a.jqm-trigger',
192 onShow: function(hash) {
193 var offset = $(hash.t).offset();
194 target.html('<p><img src="/media/img/indicator.gif" /> Ładowanie</p>');
195 hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() },
196 onLoad: function(hash) {
197 $('form', hash.w).ajaxForm({
199 success: function() { setTimeout(function() { $('#set-window').jqmHide() }, 1000) }
204 $('a.remove-from-shelf').click(function(event) {
205 event.preventDefault();
207 $.post(link.attr('href'), function(data, textStatus) {
208 link.parent().remove();