aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/baggy/js
diff options
context:
space:
mode:
authorMaryana Rozhankivska <mariroz@mr.lviv.ua>2014-03-12 17:36:04 +0200
committerMaryana Rozhankivska <mariroz@mr.lviv.ua>2014-03-12 17:36:04 +0200
commit6775da70a845a7fa8364dd3bc1a8e7702e9789bf (patch)
tree71c9ac9f873077d5cc3bdf3d47e3e5917106bdff /themes/baggy/js
parentf7382cd8c3141c2d1a7dd4fc129cb4b53992d95c (diff)
downloadwallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.tar.gz
wallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.tar.zst
wallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.zip
feature #505 - it is now possible to add link from bagged article (TODO: redev it to ajax action). Some enhancements to "save a link" popup div
Diffstat (limited to 'themes/baggy/js')
-rwxr-xr-xthemes/baggy/js/init.js61
1 files changed, 44 insertions, 17 deletions
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js
index 4e85beaa..4830bd25 100755
--- a/themes/baggy/js/init.js
+++ b/themes/baggy/js/init.js
@@ -48,31 +48,58 @@ $.fn.ready(function() {
48 } 48 }
49 49
50 /* ========================================================================== 50 /* ==========================================================================
51 bag it link 51 bag it link and close button
52 ========================================================================== */ 52 ========================================================================== */
53 53
54 $bagit.click(function(){ 54 function toggleSaveLinkForm(url) {
55 $bagit.toggleClass("active-current");
55 $bagitForm.toggle(); 56 $bagitForm.toggle();
57 $('#content').toggleClass("opacity03");
58 if (url !== 'undefined' && url) {
59 $('#plainurl').val(url);
60 }
61 $('#plainurl').focus();
62 }
63
64 $bagit.click(function(){
65 toggleSaveLinkForm();
66 });
67
68 $("#bagit-form-close").click(function(){
69 toggleSaveLinkForm();
70 });
71
72 $('#bagit-form form').submit(function(){
73 toggleSaveLinkForm();
74 return true;
56 }); 75 });
57 76
58 /* ========================================================================== 77 /* ==========================================================================
59 Keyboard gestion 78 Keyboard gestion
60 ========================================================================== */ 79 ========================================================================== */
61 80
62 $(window).keydown(function(e){ 81 $(window).keydown(function(e){
63 if ( e.target.tagName.toLowerCase() !== 'input' ) { 82 if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) {
64 switch (e.keyCode) { 83 toggleSaveLinkForm();
65 // s letter 84 return false;
66 case 83:
67 $bagitForm.toggle();
68 return false;
69 break;
70 case 27:
71 $bagitForm.hide();
72 break;
73 }
74 } 85 }
75 }) 86 });
87
88 /* ==========================================================================
89 Process all links inside an article
90 ========================================================================== */
91
92 $("article a[href^='http']").after(function() {
93 return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> ";
94 });
95
96 $(".add-to-wallabag-link-after").click(function(event){
97 event.preventDefault();
98 toggleSaveLinkForm($(this).attr('href'));
99 return false;
100 });
101
102
76 103
77 104
78}); 105});