aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/baggy/js
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-03-13 20:57:22 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-03-13 20:57:22 +0100
commit181d16fe22ce67412a6766bcb9fa85b18f56bef8 (patch)
treeadcf17eb6b9b3b64cb5948e137761096bf2882ae /themes/baggy/js
parent6775da70a845a7fa8364dd3bc1a8e7702e9789bf (diff)
parent3ee27ee6ba8d44182ddeac7b54d75cc54affeec7 (diff)
downloadwallabag-181d16fe22ce67412a6766bcb9fa85b18f56bef8.tar.gz
wallabag-181d16fe22ce67412a6766bcb9fa85b18f56bef8.tar.zst
wallabag-181d16fe22ce67412a6766bcb9fa85b18f56bef8.zip
Merge pull request #557 from mariroz/feature-add-link-inside-article-issue-505
saving link form now sends ajax request, article view is now justified (issue #554)
Diffstat (limited to 'themes/baggy/js')
-rwxr-xr-xthemes/baggy/js/init.js31
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