]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Implemented Add Button
authorThomas Citharel <thomas.citharet@gmail.com>
Sun, 8 Sep 2013 19:07:59 +0000 (21:07 +0200)
committerThomas Citharel <thomas.citharet@gmail.com>
Sun, 8 Sep 2013 19:07:59 +0000 (21:07 +0200)
Added a button to add an URL when directly into Poche. If JS isn't
enabled, nothing happens.

inc/poche/Poche.class.php
index.php
tpl/_menu.twig
tpl/css/style.css
tpl/js/poche.js [new file with mode: 0644]
tpl/layout.twig

index a8f64151d59aecaa67922fdd6dc00ff6776ca9d6..a7479ad88bdcf5dffbe78c25a486d25a394cfea6 100644 (file)
@@ -558,4 +558,9 @@ class Poche
         }
         return $version;
     }
+
+    function convertURLToBase64($plainurl){
+        $convertedURL = base64_encode($plainurl);
+        $this->action('add', new Url($convertedURL))
+   }
 }
\ No newline at end of file
index 5f43b7400c007887e94fe364bb66aabb78635499..e81a92474179ecfe9a681f94f894dee62ea84323 100644 (file)
--- a/index.php
+++ b/index.php
@@ -44,6 +44,9 @@ elseif (isset($_GET['export'])) {
     $poche->export();
 }
 
+if (isset($_GET['plainurl'])){
+  $poche->convertURLToBase64($_GET['plainurl']);}
+
 # vars to send to templates
 $tpl_vars = array(
     'referer' => $referer,
index 699d6a0c93411d46d9b04b8fbfe6c1dc18ca7370..8341c49c508aa0938b84dfec010854ff38947fcc 100644 (file)
@@ -4,4 +4,13 @@
                 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
                 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
                 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
-            </ul>
\ No newline at end of file
+               <li><a id="addurlbutton" onclick="showinput();" href="#" title="{% trans "addlink" %}">{% trans "addlink" %}</a></li>
+                   <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
+               </ul>
+               <div id="inputform">
+                       <form method="get" action="index.php">
+                               <label class="addurl" for="plainurl">Entrez ici votre URL</label><br />
+                               <input autofocus required placeholder="Ex:monsite.net/article" class="addurl" id="plainurl" name="plainurl" type="url" />
+                               <input type="submit" value="Envoyer" />
+                       </form>
+               </div>
\ No newline at end of file
index 7633534c3a428b307bae56880cdafa45164c8dbc..808e4b69623d5b7a2d53137e027e45c5e492ad48 100644 (file)
@@ -257,3 +257,16 @@ footer {
 .reading-time {
     font-size: 0.8em;
 }
+
+#inputform{
++    display: none;
++    text-align:center;
++    max-width:300px;
++    margin-left:auto;
++    margin-right:auto;
++    margin-top:5px;
++    background-color: rgba(0, 0, 0, 0.9);
++    opacity:0.8;
++    color:white;
++    border-radius: 3px;
++}
\ No newline at end of file
diff --git a/tpl/js/poche.js b/tpl/js/poche.js
new file mode 100644 (file)
index 0000000..c2e02f9
--- /dev/null
@@ -0,0 +1,2 @@
+function showinput(){
+$('#inputform').fadeIn('fast');}
\ No newline at end of file
index 07ca231c004135b8ef3012cc9dd883e6515ad9c3..b2484019f35a0524dc304e94e7a2488d7ff103a3 100644 (file)
@@ -12,6 +12,7 @@
         <![endif]-->
         <title>{% block title %}{% endblock %} - poche</title>
 {% include '_head.twig' %}
+<script src="./tpl/js/poche.js"></script>
 {% include '_bookmarklet.twig' %}
     </head>
     <body>