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();
47 $('#registration-form').ajaxForm({
49 beforeSubmit: function() {
50 $('#registration-form input[type=submit]')
51 .attr('disabled', 'disabled')
52 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
54 success: function(response) {
55 if (response.success) {
56 location.reload(true);
58 $('#registration-form span.error').remove();
59 $.each(response.errors, function(id, errors) {
60 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
62 $('#registration-form input[type=submit]').removeAttr('disabled');
63 $('#registration-form img').remove();
68 $('#login-form').ajaxForm({
70 beforeSubmit: function() {
71 $('#login-form input[type=submit]')
72 .attr('disabled', 'disabled')
73 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
75 success: function(response) {
76 if (response.success) {
77 location.reload(true);
79 $('#login-form span.error').remove();
80 $.each(response.errors, function(id, errors) {
81 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
83 $('#login-form input[type=submit]').removeAttr('disabled');
84 $('#login-form img').remove();
89 $('#login-register-window').jqm({
92 trigger: '.login-register-link',
93 onShow: function(hash) {
94 var offset = $(hash.t).offset();
95 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
96 $('div.header', hash.w).css({width: $(hash.t).width()});
101 $('ul.shelf-list li').hover(function() {
102 $(this).css({background: '#EEE', cursor: 'pointer'});
104 $(this).css({background: 'transparent'});
105 }).click(function() {
106 location.href = $('a.visit-shelf', this).attr('href');
109 $('.delete-shelf').click(function() {
111 var shelf_name = $('.visit-shelf', link.parent()).text();
112 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
113 $.post(link.attr('href'), function(data, textStatus) {
114 link.parent().remove();
120 $('#user-shelves-window').jqm({
122 target: $('#user-shelves-window div.target')[0],
124 trigger: '#user-shelves-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()});
131 onLoad: function(hash) {
132 $('form', hash.w).ajaxForm({
133 target: $('#user-shelves-window div.target'),
134 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
137 $('input', hash.w).labelify({labelledClass: 'blur'});
139 $('ul.shelf-list li', hash.w).hover(function() {
140 $(this).css({background: '#EEE', cursor: 'pointer'});
142 $(this).css({background: 'transparent'});
143 }).click(function() {
144 location.href = $('a.visit-shelf', this).attr('href');
147 $('.delete-shelf').click(function() {
149 var shelf_name = $('.visit-shelf', link.parent()).text();
150 console.log(shelf_name);
151 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
152 $.post(link.attr('href'), function(data, textStatus) {
153 link.parent().remove();