]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
feature #505 - it is now possible to add link from bagged article (TODO: redev it... 551/head
authorMaryana Rozhankivska <mariroz@mr.lviv.ua>
Wed, 12 Mar 2014 15:36:04 +0000 (17:36 +0200)
committerMaryana Rozhankivska <mariroz@mr.lviv.ua>
Wed, 12 Mar 2014 15:36:04 +0000 (17:36 +0200)
themes/baggy/_head.twig
themes/baggy/_menu.twig
themes/baggy/_pocheit-form.twig
themes/baggy/css/main.css
themes/baggy/js/init.js

index 1ea59abf338bca278c7f4701b57bda9462138cb2..144bcaa653d0d9908b8d9c98338864bc300e5a77 100755 (executable)
@@ -8,6 +8,7 @@
         <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/messages.css" media="all">
         <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/print.css" media="print">
         <script src="{{ poche_url }}/themes/{{theme}}/js/jquery-2.0.3.min.js"></script>
+        <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/autoClose.js"></script>
         <script src="{{ poche_url }}/themes/{{theme}}/js/jquery.cookie.js"></script>
         <script src="{{ poche_url }}/themes/{{theme}}/js/init.js"></script>
         <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/closeMessage.js"></script>
index 7dd799f931bdaf57f75fa47b7c7617dfa806226d..5226728bb194599d5893acd0e642f22c32fee212 100644 (file)
@@ -4,9 +4,10 @@
                 <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
                 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
                 <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
-                <li><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a></li>
+                <li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a>
+                    {% include '_pocheit-form.twig' %}
+                </li>
                 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
                 <li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
             </ul>
 
-            {% include '_pocheit-form.twig' %}
index 3c4a4d6ebf01b7b4fc8e0175197839676c8e40e0..ff911515f60ae10eb498c9dd55e1bca1365d7d32 100755 (executable)
@@ -1,7 +1,8 @@
 <div id="bagit-form" class="messages info">
-
-    <form method="get" action="index.php">
-        <h2>{% trans "Save a link" %}</h2>
+    <form method="get" action="index.php" target="_blank">
+        <h2><a href="javascript: void(null);" id="bagit-form-close">X</a>
+        {% trans "Save a link" %}</h2>
+        <input type="hidden" name="autoclose" value="1" />
         <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
         <input type="submit" value="{% trans "save link!" %}" />
     </form>
index 586501b0611242bcf095adac5eeff939361fd772..ba4b7c7ff9d873000d0a7e1c07c61611a02d8e6e 100755 (executable)
@@ -534,32 +534,78 @@ footer a {
   display: none;
 }
 
+/* ==========================================================================
+  2.1 = "save a link" popup div related styles
+  ========================================================================== */
+
 #bagit-form {
-  background: rgba(0,0,0,0.8);
-  position: fixed;
+  background: rgba(0,0,0,0.5);
+  position: absolute;
   top: 0;
   left: 10em;
   z-index: 20;
   height: 100%;
   width: 100%;
   margin: 0;
+  margin-top: -30%;
   padding: 2em;
   display: none;
+  border-left: 1px #EEE solid;
 }
 
 #bagit-form form {
   background: #FFF;
   position: absolute;
-  top: 50%;
-  left: 50%;
+  top: 0;
+  left: 0;
   z-index: 20;
   border: 10px solid #000;
-  width: 600px;
-  height: 300px;
-  margin: -150px 0 0 -300px;
+  width: 400px;
+  height: 200px;
+  /* margin: -150px 0 0 -300px; */
   padding: 2em;
 }
 
+a#bagit-form-close {
+  background: #000;
+  color: #FFF;
+  padding: 0.2em 0.5em;
+  text-decoration: none;
+  display: inline-block;
+  float: right;
+  font-size: 0.6em;
+}
+a#bagit-form-close:hover {
+  background: #999;
+  color: #000;
+}
+
+.active-current {
+  background-color: #999;
+}
+
+.active-current:after {
+  content: "";
+  width: 0;
+  height: 0;
+  position: absolute;
+  border-style: solid;
+  border-width: 10px;
+  border-color:  transparent #EEE transparent transparent;
+  right: 0;
+  top: 50%;
+  margin-top: -10px;
+}
+
+.opacity03 {
+  opacity: 0.3;
+}
+
+.add-to-wallabag-link-after {
+  background-color: #000;
+  color: #fff;
+  padding: 0 3px 2px 3px;
+}
 
 /* ==========================================================================
    3 = Pictos
@@ -920,4 +966,8 @@ blockquote {
   #display-mode {
     display: none;
   }
+
+  #bagit-form {
+    left: 0;
+  }
 }
index 4e85beaaf7d65d24da106fa6019e33056a0b6616..4830bd25021237739e466a406b2148b57b7ab1a2 100755 (executable)
@@ -48,31 +48,58 @@ $.fn.ready(function() {
   }
 
   /* ==========================================================================
-     bag it link
-     ========================================================================== */
+    bag it link and close button
+    ========================================================================== */
 
-  $bagit.click(function(){
+  function toggleSaveLinkForm(url) {
+    $bagit.toggleClass("active-current");
     $bagitForm.toggle();
+    $('#content').toggleClass("opacity03");
+    if (url !== 'undefined' && url) {
+      $('#plainurl').val(url);
+    }
+    $('#plainurl').focus();
+  }
+
+  $bagit.click(function(){
+    toggleSaveLinkForm();
+  });
+
+  $("#bagit-form-close").click(function(){
+    toggleSaveLinkForm();
+  });
+
+  $('#bagit-form form').submit(function(){
+    toggleSaveLinkForm();
+    return true;
   });
 
   /* ==========================================================================
-     Keyboard gestion
-     ========================================================================== */
+    Keyboard gestion
+    ========================================================================== */
 
   $(window).keydown(function(e){
-    if ( e.target.tagName.toLowerCase() !== 'input' ) {
-      switch (e.keyCode) {
-        // s letter
-        case 83:
-          $bagitForm.toggle();
-          return false;
-        break;
-        case 27:
-          $bagitForm.hide();
-        break;
-      }
+    if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) {
+      toggleSaveLinkForm();
+      return false;
     }
-  })
+  });
+
+  /* ==========================================================================
+  Process all links inside an article
+  ========================================================================== */
+
+  $("article a[href^='http']").after(function() {
+        return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> ";
+  });
+
+  $(".add-to-wallabag-link-after").click(function(event){
+    event.preventDefault();
+    toggleSaveLinkForm($(this).attr('href'));
+    return false;
+  });
+
+
 
 
 });