diff options
author | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-13 18:37:08 +0200 |
---|---|---|
committer | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-13 18:37:08 +0200 |
commit | 3ee27ee6ba8d44182ddeac7b54d75cc54affeec7 (patch) | |
tree | adcf17eb6b9b3b64cb5948e137761096bf2882ae /themes/baggy/js/init.js | |
parent | 6775da70a845a7fa8364dd3bc1a8e7702e9789bf (diff) | |
download | wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.tar.gz wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.tar.zst wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.zip |
saving link form now sends ajax request, article view is now justified
Diffstat (limited to 'themes/baggy/js/init.js')
-rwxr-xr-x | themes/baggy/js/init.js | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index 4830bd25..da644fbe 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js | |||
@@ -4,6 +4,7 @@ $.fn.ready(function() { | |||
4 | $listentries = $("#list-entries"), | 4 | $listentries = $("#list-entries"), |
5 | $bagit = $('#bagit'), | 5 | $bagit = $('#bagit'), |
6 | $bagitForm = $('#bagit-form'); | 6 | $bagitForm = $('#bagit-form'); |
7 | $bagitFormForm = $('#bagit-form-form'); | ||
7 | 8 | ||
8 | /* ========================================================================== | 9 | /* ========================================================================== |
9 | Menu | 10 | Menu |
@@ -69,9 +70,30 @@ $.fn.ready(function() { | |||
69 | toggleSaveLinkForm(); | 70 | toggleSaveLinkForm(); |
70 | }); | 71 | }); |
71 | 72 | ||
72 | $('#bagit-form form').submit(function(){ | 73 | |
73 | toggleSaveLinkForm(); | 74 | //send "bag it link" form request via ajax |
74 | return true; | 75 | $bagitFormForm.submit( function(event) { |
76 | $bagitFormForm.css("cursor", "wait"); | ||
77 | $("#add-link-result").empty(); | ||
78 | |||
79 | $.ajax({ | ||
80 | type: $bagitFormForm.attr('method'), | ||
81 | url: $bagitFormForm.attr('action'), | ||
82 | data: $bagitFormForm.serialize(), | ||
83 | success: function(data) { | ||
84 | $('#add-link-result').html("Done!"); | ||
85 | $('#plainurl').val(''); | ||
86 | $('#plainurl').blur(''); | ||
87 | $bagitFormForm.css("cursor", "auto"); | ||
88 | //setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay | ||
89 | }, | ||
90 | error: function(data) { | ||
91 | $('#add-link-result').html("Failed!"); | ||
92 | $bagitFormForm.css("cursor", "auto"); | ||
93 | } | ||
94 | }); | ||
95 | |||
96 | event.preventDefault(); | ||
75 | }); | 97 | }); |
76 | 98 | ||
77 | /* ========================================================================== | 99 | /* ========================================================================== |
@@ -94,9 +116,8 @@ $.fn.ready(function() { | |||
94 | }); | 116 | }); |
95 | 117 | ||
96 | $(".add-to-wallabag-link-after").click(function(event){ | 118 | $(".add-to-wallabag-link-after").click(function(event){ |
97 | event.preventDefault(); | ||
98 | toggleSaveLinkForm($(this).attr('href')); | 119 | toggleSaveLinkForm($(this).attr('href')); |
99 | return false; | 120 | event.preventDefault(); |
100 | }); | 121 | }); |
101 | 122 | ||
102 | 123 | ||