aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/baggy
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-03-27 19:44:28 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-03-27 19:44:28 +0100
commit04fbe8f5efdf7fda0505c5aab9353d2cc61507ed (patch)
tree691934473700749cd12dfd07771dd90c3c58622e /themes/baggy
parent9591ee2603dd107cd49b61957d0f71a652b7bea3 (diff)
parente68348f6271fab591960902feebe167d01e15468 (diff)
downloadwallabag-04fbe8f5efdf7fda0505c5aab9353d2cc61507ed.tar.gz
wallabag-04fbe8f5efdf7fda0505c5aab9353d2cc61507ed.tar.zst
wallabag-04fbe8f5efdf7fda0505c5aab9353d2cc61507ed.zip
Merge pull request #586 from mariroz/wb-link-in-wb
wallabag a link in wallabag now in default theme, issue #505
Diffstat (limited to 'themes/baggy')
-rwxr-xr-xthemes/baggy/_head.twig1
-rwxr-xr-xthemes/baggy/js/init.js80
2 files changed, 2 insertions, 79 deletions
diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig
index 144bcaa6..acc9fa3d 100755
--- a/themes/baggy/_head.twig
+++ b/themes/baggy/_head.twig
@@ -11,4 +11,5 @@
11 <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/autoClose.js"></script> 11 <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/autoClose.js"></script>
12 <script src="{{ poche_url }}/themes/{{theme}}/js/jquery.cookie.js"></script> 12 <script src="{{ poche_url }}/themes/{{theme}}/js/jquery.cookie.js"></script>
13 <script src="{{ poche_url }}/themes/{{theme}}/js/init.js"></script> 13 <script src="{{ poche_url }}/themes/{{theme}}/js/init.js"></script>
14 <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/saveLink.js"></script>
14 <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/closeMessage.js"></script> 15 <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/closeMessage.js"></script>
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js
index da644fbe..00470fbf 100755
--- a/themes/baggy/js/init.js
+++ b/themes/baggy/js/init.js
@@ -1,10 +1,7 @@
1$.fn.ready(function() { 1$.fn.ready(function() {
2 2
3 var $listmode = $('#listmode'), 3 var $listmode = $('#listmode'),
4 $listentries = $("#list-entries"), 4 $listentries = $("#list-entries");
5 $bagit = $('#bagit'),
6 $bagitForm = $('#bagit-form');
7 $bagitFormForm = $('#bagit-form-form');
8 5
9 /* ========================================================================== 6 /* ==========================================================================
10 Menu 7 Menu
@@ -48,79 +45,4 @@ $.fn.ready(function() {
48 $listmode.addClass("tablemode"); 45 $listmode.addClass("tablemode");
49 } 46 }
50 47
51 /* ==========================================================================
52 bag it link and close button
53 ========================================================================== */
54
55 function toggleSaveLinkForm(url) {
56 $bagit.toggleClass("active-current");
57 $bagitForm.toggle();
58 $('#content').toggleClass("opacity03");
59 if (url !== 'undefined' && url) {
60 $('#plainurl').val(url);
61 }
62 $('#plainurl').focus();
63 }
64
65 $bagit.click(function(){
66 toggleSaveLinkForm();
67 });
68
69 $("#bagit-form-close").click(function(){
70 toggleSaveLinkForm();
71 });
72
73
74 //send "bag it link" form request via ajax
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();
97 });
98
99 /* ==========================================================================
100 Keyboard gestion
101 ========================================================================== */
102
103 $(window).keydown(function(e){
104 if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) {
105 toggleSaveLinkForm();
106 return false;
107 }
108 });
109
110 /* ==========================================================================
111 Process all links inside an article
112 ========================================================================== */
113
114 $("article a[href^='http']").after(function() {
115 return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> ";
116 });
117
118 $(".add-to-wallabag-link-after").click(function(event){
119 toggleSaveLinkForm($(this).attr('href'));
120 event.preventDefault();
121 });
122
123
124
125
126}); 48});