Implemented Add Button

Added a button to add an URL when directly into Poche. If JS isn't
enabled, nothing happens.
This commit is contained in:
Thomas Citharel 2013-09-08 21:07:59 +02:00
parent 3eb049036e
commit 693b3f8677
6 changed files with 34 additions and 1 deletions

View file

@ -558,4 +558,9 @@ class Poche
}
return $version;
}
function convertURLToBase64($plainurl){
$convertedURL = base64_encode($plainurl);
$this->action('add', new Url($convertedURL))
}
}

View file

@ -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,

View 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>
<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>

View 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;
+}

2
tpl/js/poche.js Normal file
View file

@ -0,0 +1,2 @@
function showinput(){
$('#inputform').fadeIn('fast');}

View 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>