From 693b3f86776ae236d69ac6ed085b5e46b9054642 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 8 Sep 2013 21:07:59 +0200 Subject: Implemented Add Button Added a button to add an URL when directly into Poche. If JS isn't enabled, nothing happens. --- inc/poche/Poche.class.php | 5 +++++ index.php | 3 +++ tpl/_menu.twig | 11 ++++++++++- tpl/css/style.css | 13 +++++++++++++ tpl/js/poche.js | 2 ++ tpl/layout.twig | 1 + 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tpl/js/poche.js 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 } return $version; } + + function convertURLToBase64($plainurl){ + $convertedURL = base64_encode($plainurl); + $this->action('add', new Url($convertedURL)) + } } \ 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'])) { $poche->export(); } +if (isset($_GET['plainurl'])){ + $poche->convertURLToBase64($_GET['plainurl']);} + # vars to send to templates $tpl_vars = array( '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 @@
  • {% trans "archive" %}
  • {% trans "config" %}
  • {% trans "logout" %}
  • - \ No newline at end of file +
  • {% trans "addlink" %}
  • +
  • {% trans "logout" %}
  • + +
    +
    +
    + + +
    +
    \ 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 { .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 index 00000000..c2e02f9c --- /dev/null +++ b/tpl/js/poche.js @@ -0,0 +1,2 @@ +function showinput(){ +$('#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 @@ {% block title %}{% endblock %} - poche {% include '_head.twig' %} + {% include '_bookmarklet.twig' %} -- cgit v1.2.3