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();
46 $('#registration-form').ajaxForm({
48 beforeSubmit: function() {
49 $('#registration-form input[type=submit]')
50 .attr('disabled', 'disabled')
51 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
53 success: function(response) {
54 if (response.success) {
55 location.reload(true);
57 $('#registration-form span.error').remove();
58 $.each(response.errors, function(id, errors) {
59 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
61 $('#registration-form input[type=submit]').removeAttr('disabled');
62 $('#registration-form img').remove();
67 $('#login-form').ajaxForm({
69 beforeSubmit: function() {
70 $('#login-form input[type=submit]')
71 .attr('disabled', 'disabled')
72 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
74 success: function(response) {
75 if (response.success) {
76 location.reload(true);
78 $('#login-form span.error').remove();
79 $.each(response.errors, function(id, errors) {
80 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
82 $('#login-form input[type=submit]').removeAttr('disabled');
83 $('#login-form img').remove();
88 $('#login-register-window').jqm({
91 trigger: '.login-register-link',
92 onShow: function(hash) {
93 var offset = $(hash.t).offset();
94 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
95 $('div.header', hash.w).css({width: $(hash.t).width()});
100 $('ul.shelf-list li').hover(function() {
101 $(this).css({background: '#EEE', cursor: 'pointer'});
103 $(this).css({background: 'transparent'});
104 }).click(function() {
105 location.href = $('a.visit-shelf', this).attr('href');
108 $('.delete-shelf').click(function() {
110 var shelf_name = $('.visit-shelf', link.parent()).text();
111 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
112 $.post(link.attr('href'), function(data, textStatus) {
113 link.parent().remove();
119 $('#user-shelves-window').jqm({
121 target: $('#user-shelves-window div.target')[0],
123 trigger: '#user-shelves-link',
124 onShow: function(hash) {
125 var offset = $(hash.t).offset();
126 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
127 $('div.header', hash.w).css({width: $(hash.t).width()});
130 onLoad: function(hash) {
131 $('form', hash.w).ajaxForm({
132 target: $('#user-shelves-window div.target'),
133 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
136 $('input', hash.w).labelify({labelledClass: 'blur'});
138 $('ul.shelf-list li', hash.w).hover(function() {
139 $(this).css({background: '#EEE', cursor: 'pointer'});
141 $(this).css({background: 'transparent'});
142 }).click(function() {
143 location.href = $('a.visit-shelf', this).attr('href');
146 $('.delete-shelf').click(function() {
148 var shelf_name = $('.visit-shelf', link.parent()).text();
149 console.log(shelf_name);
150 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
151 $.post(link.attr('href'), function(data, textStatus) {
152 link.parent().remove();