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 $('#registration-form').ajaxForm({
40 beforeSubmit: function() {
41 $('#registration-form input[type=submit]')
42 .attr('disabled', 'disabled')
43 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
45 success: function(response) {
46 if (response.success) {
47 location.reload(true);
49 $('#registration-form span.error').remove();
50 $.each(response.errors, function(id, errors) {
51 $('#id_registration-' + id).before('<span class="error">' + errors[0] + '</span>');
53 $('#registration-form input[type=submit]').removeAttr('disabled');
54 $('#registration-form img').remove();
59 $('#login-form').ajaxForm({
61 beforeSubmit: function() {
62 $('#login-form input[type=submit]')
63 .attr('disabled', 'disabled')
64 .after('<img src="/media/img/indicator.gif" style="margin-left: 0.5em"/>');
66 success: function(response) {
67 if (response.success) {
68 location.reload(true);
70 $('#login-form span.error').remove();
71 $.each(response.errors, function(id, errors) {
72 $('#id_login-' + id).before('<span class="error">' + errors[0] + '</span>');
74 $('#login-form input[type=submit]').removeAttr('disabled');
75 $('#login-form img').remove();
80 $('#login-register-window').jqm({
83 trigger: '.login-register-link',
84 onShow: function(hash) {
85 var offset = $(hash.t).offset();
86 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
87 $('div.header', hash.w).css({width: $(hash.t).width()});
92 $('.delete-shelf').click(function() {
94 var shelf_name = $('.visit-shelf', link.parent()).text();
95 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
96 $.post(link.attr('href'), function(data, textStatus) {
97 link.parent().remove();
103 $('#user-shelves-window').jqm({
105 target: $('#user-shelves-window div.target')[0],
107 trigger: '#user-shelves-link',
108 onShow: function(hash) {
109 var offset = $(hash.t).offset();
110 hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top});
111 $('div.header', hash.w).css({width: $(hash.t).width()});
114 onLoad: function(hash) {
115 $('form', hash.w).ajaxForm({
116 target: $('#user-shelves-window div.target'),
117 success: function() { setTimeout(function() { $('#user-shelves-window').jqmHide() }, 1000) }
120 $('ul.shelf-list li', hash.w).hover(function() {
121 $(this).css({background: '#EEE', cursor: 'pointer'});
123 $(this).css({background: 'transparent'});
124 }).click(function() {
125 location.href = $('a.visit-shelf', this).attr('href');
128 $('.delete-shelf').click(function() {
130 var shelf_name = $('.visit-shelf', link.parent()).text();
131 console.log(shelf_name);
132 if (confirm('Czy na pewno usunąć półkę ' + shelf_name + '?')) {
133 $.post(link.attr('href'), function(data, textStatus) {
134 link.parent().remove();