aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/default/js/saveLink.js
diff options
context:
space:
mode:
authorJay Sitter <jsitter@gmail.com>2014-11-18 10:01:37 -0500
committerJay Sitter <jsitter@gmail.com>2014-11-18 10:01:37 -0500
commiteb365a01fb9b0fa29f88f4cdd0e09b8d4ec76dfd (patch)
tree53d959e5f96dd8e3dc8ef87e07d121f4dea0e1f8 /themes/default/js/saveLink.js
parentdb3bffa284012aec4f96c851c413e435080fed02 (diff)
downloadwallabag-eb365a01fb9b0fa29f88f4cdd0e09b8d4ec76dfd.tar.gz
wallabag-eb365a01fb9b0fa29f88f4cdd0e09b8d4ec76dfd.tar.zst
wallabag-eb365a01fb9b0fa29f88f4cdd0e09b8d4ec76dfd.zip
_global-izing some more js & css
Diffstat (limited to 'themes/default/js/saveLink.js')
-rwxr-xr-xthemes/default/js/saveLink.js109
1 files changed, 0 insertions, 109 deletions
diff --git a/themes/default/js/saveLink.js b/themes/default/js/saveLink.js
deleted file mode 100755
index a7acd84c..00000000
--- a/themes/default/js/saveLink.js
+++ /dev/null
@@ -1,109 +0,0 @@
1$.fn.ready(function() {
2
3 var $bagit = $('#bagit'),
4 $bagitForm = $('#bagit-form'),
5 $bagitFormForm = $('#bagit-form-form');
6
7 /* ==========================================================================
8 bag it link and close button
9 ========================================================================== */
10
11 function toggleSaveLinkForm(url, event) {
12 $("#add-link-result").empty();
13
14 $bagit.toggleClass("active-current");
15
16 //only if bag-it link is not presented on page
17 if ( $bagit.length === 0 ) {
18 if ( event !== 'undefined' && event ) {
19 $bagitForm.css( {position:"absolute", top:event.pageY, left:event.pageX-200});
20 }
21 else {
22 $bagitForm.css( {position:"relative", top:"auto", left:"auto"});
23 }
24 }
25
26 if ($("#search-form").length != 0) {
27 $("#search").removeClass("current");
28 $("#search-arrow").removeClass("arrow-down");
29 $("#search-form").hide();
30 }
31 $bagitForm.toggle();
32 $('#content').toggleClass("opacity03");
33 if (url !== 'undefined' && url) {
34 $('#plainurl').val(url);
35 }
36 $('#plainurl').focus();
37 }
38
39 //---------------------------------------------------------------------------
40 // These two functions are now taken care of in popupForm.js
41 //---------------------------------------------------------------------------
42
43 // $bagit.click(function(){
44 // $bagit.toggleClass("current");
45 // $("#bagit-arrow").toggleClass("arrow-down");
46 // toggleSaveLinkForm();
47 // });
48
49 // $("#bagit-form-close").click(function(){
50 // $bagit.removeClass("current");
51 // $("#bagit-arrow").removeClass("arrow-down");
52 // toggleSaveLinkForm();
53 // });
54
55
56 //send "bag it link" form request via ajax
57 $bagitFormForm.submit( function(event) {
58 $("body").css("cursor", "wait");
59 $("#add-link-result").empty();
60
61 $.ajax({
62 type: $bagitFormForm.attr('method'),
63 url: $bagitFormForm.attr('action'),
64 data: $bagitFormForm.serialize(),
65 success: function(data) {
66 $('#add-link-result').html("Done!");
67 $('#plainurl').val('');
68 $('#plainurl').blur('');
69 $("body").css("cursor", "auto");
70 //setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay
71 },
72 error: function(data) {
73 $('#add-link-result').html("Failed!");
74 $("body").css("cursor", "auto");
75 }
76 });
77
78 event.preventDefault();
79 });
80
81 /* ==========================================================================
82 Keyboard gestion
83 ========================================================================== */
84
85 $(window).keydown(function(e){
86 if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || (e.keyCode == 27 && $bagitForm.is(':visible') ) ) {
87 $bagit.removeClass("current");
88 $("#bagit-arrow").removeClass("arrow-down");
89 toggleSaveLinkForm();
90 return false;
91 }
92 });
93
94 /* ==========================================================================
95 Process all links inside an article
96 ========================================================================== */
97
98 $("article a[href^='http']").after(function() {
99 return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\"></a> ";
100 });
101
102 $(".add-to-wallabag-link-after").click(function(event){
103 toggleSaveLinkForm($(this).attr('href'), event);
104 event.preventDefault();
105 });
106
107});
108
109