aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <thomas.citharet@gmail.com>2013-09-08 21:07:59 +0200
committerThomas Citharel <thomas.citharet@gmail.com>2013-09-08 21:07:59 +0200
commit693b3f86776ae236d69ac6ed085b5e46b9054642 (patch)
tree52beeeaccc06b8d9ae52ca99b507f2e29eb47fe8
parent3eb049036e601c1978cf5f7f0d5be8c577933b72 (diff)
downloadwallabag-693b3f86776ae236d69ac6ed085b5e46b9054642.tar.gz
wallabag-693b3f86776ae236d69ac6ed085b5e46b9054642.tar.zst
wallabag-693b3f86776ae236d69ac6ed085b5e46b9054642.zip
Implemented Add Button
Added a button to add an URL when directly into Poche. If JS isn't enabled, nothing happens.
-rw-r--r--inc/poche/Poche.class.php5
-rw-r--r--index.php3
-rw-r--r--tpl/_menu.twig11
-rw-r--r--tpl/css/style.css13
-rw-r--r--tpl/js/poche.js2
-rw-r--r--tpl/layout.twig1
6 files changed, 34 insertions, 1 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index a8f64151..a7479ad8 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -558,4 +558,9 @@ class Poche
558 } 558 }
559 return $version; 559 return $version;
560 } 560 }
561
562 function convertURLToBase64($plainurl){
563 $convertedURL = base64_encode($plainurl);
564 $this->action('add', new Url($convertedURL))
565 }
561} \ No newline at end of file 566} \ No newline at end of file
diff --git a/index.php b/index.php
index 5f43b740..e81a9247 100644
--- a/index.php
+++ b/index.php
@@ -44,6 +44,9 @@ elseif (isset($_GET['export'])) {
44 $poche->export(); 44 $poche->export();
45} 45}
46 46
47if (isset($_GET['plainurl'])){
48 $poche->convertURLToBase64($_GET['plainurl']);}
49
47# vars to send to templates 50# vars to send to templates
48$tpl_vars = array( 51$tpl_vars = array(
49 'referer' => $referer, 52 'referer' => $referer,
diff --git a/tpl/_menu.twig b/tpl/_menu.twig
index 699d6a0c..8341c49c 100644
--- a/tpl/_menu.twig
+++ b/tpl/_menu.twig
@@ -4,4 +4,13 @@
4 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li> 4 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
5 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li> 5 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
6 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li> 6 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
7 </ul> \ No newline at end of file 7 <li><a id="addurlbutton" onclick="showinput();" href="#" title="{% trans "addlink" %}">{% trans "addlink" %}</a></li>
8 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
9 </ul>
10 <div id="inputform">
11 <form method="get" action="index.php">
12 <label class="addurl" for="plainurl">Entrez ici votre URL</label><br />
13 <input autofocus required placeholder="Ex:monsite.net/article" class="addurl" id="plainurl" name="plainurl" type="url" />
14 <input type="submit" value="Envoyer" />
15 </form>
16 </div> \ No newline at end of file
diff --git a/tpl/css/style.css b/tpl/css/style.css
index 7633534c..808e4b69 100644
--- a/tpl/css/style.css
+++ b/tpl/css/style.css
@@ -257,3 +257,16 @@ footer {
257.reading-time { 257.reading-time {
258 font-size: 0.8em; 258 font-size: 0.8em;
259} 259}
260
261#inputform{
262+ display: none;
263+ text-align:center;
264+ max-width:300px;
265+ margin-left:auto;
266+ margin-right:auto;
267+ margin-top:5px;
268+ background-color: rgba(0, 0, 0, 0.9);
269+ opacity:0.8;
270+ color:white;
271+ border-radius: 3px;
272+} \ No newline at end of file
diff --git a/tpl/js/poche.js b/tpl/js/poche.js
new file mode 100644
index 00000000..c2e02f9c
--- /dev/null
+++ b/tpl/js/poche.js
@@ -0,0 +1,2 @@
1function showinput(){
2$('#inputform').fadeIn('fast');} \ No newline at end of file
diff --git a/tpl/layout.twig b/tpl/layout.twig
index 07ca231c..b2484019 100644
--- a/tpl/layout.twig
+++ b/tpl/layout.twig
@@ -12,6 +12,7 @@
12 <![endif]--> 12 <![endif]-->
13 <title>{% block title %}{% endblock %} - poche</title> 13 <title>{% block title %}{% endblock %} - poche</title>
14{% include '_head.twig' %} 14{% include '_head.twig' %}
15<script src="./tpl/js/poche.js"></script>
15{% include '_bookmarklet.twig' %} 16{% include '_bookmarklet.twig' %}
16 </head> 17 </head>
17 <body> 18 <body>