diff options
author | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-12 17:36:04 +0200 |
---|---|---|
committer | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-12 17:36:04 +0200 |
commit | 6775da70a845a7fa8364dd3bc1a8e7702e9789bf (patch) | |
tree | 71c9ac9f873077d5cc3bdf3d47e3e5917106bdff /themes | |
parent | f7382cd8c3141c2d1a7dd4fc129cb4b53992d95c (diff) | |
download | wallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.tar.gz wallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.tar.zst wallabag-6775da70a845a7fa8364dd3bc1a8e7702e9789bf.zip |
feature #505 - it is now possible to add link from bagged article (TODO: redev it to ajax action). Some enhancements to "save a link" popup div
Diffstat (limited to 'themes')
-rwxr-xr-x | themes/baggy/_head.twig | 1 | ||||
-rw-r--r-- | themes/baggy/_menu.twig | 5 | ||||
-rwxr-xr-x | themes/baggy/_pocheit-form.twig | 7 | ||||
-rwxr-xr-x | themes/baggy/css/main.css | 64 | ||||
-rwxr-xr-x | themes/baggy/js/init.js | 61 |
5 files changed, 109 insertions, 29 deletions
diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig index 1ea59abf..144bcaa6 100755 --- a/themes/baggy/_head.twig +++ b/themes/baggy/_head.twig | |||
@@ -8,6 +8,7 @@ | |||
8 | <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/messages.css" media="all"> | 8 | <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/messages.css" media="all"> |
9 | <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/print.css" media="print"> | 9 | <link rel="stylesheet" href="{{ poche_url }}/themes/{{theme}}/css/print.css" media="print"> |
10 | <script src="{{ poche_url }}/themes/{{theme}}/js/jquery-2.0.3.min.js"></script> | 10 | <script src="{{ poche_url }}/themes/{{theme}}/js/jquery-2.0.3.min.js"></script> |
11 | <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/autoClose.js"></script> | ||
11 | <script src="{{ poche_url }}/themes/{{theme}}/js/jquery.cookie.js"></script> | 12 | <script src="{{ poche_url }}/themes/{{theme}}/js/jquery.cookie.js"></script> |
12 | <script src="{{ poche_url }}/themes/{{theme}}/js/init.js"></script> | 13 | <script src="{{ poche_url }}/themes/{{theme}}/js/init.js"></script> |
13 | <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/closeMessage.js"></script> | 14 | <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/closeMessage.js"></script> |
diff --git a/themes/baggy/_menu.twig b/themes/baggy/_menu.twig index 7dd799f9..5226728b 100644 --- a/themes/baggy/_menu.twig +++ b/themes/baggy/_menu.twig | |||
@@ -4,9 +4,10 @@ | |||
4 | <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li> | 4 | <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li> |
5 | <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li> | 5 | <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li> |
6 | <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li> | 6 | <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li> |
7 | <li><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a></li> | 7 | <li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a> |
8 | {% include '_pocheit-form.twig' %} | ||
9 | </li> | ||
8 | <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li> | 10 | <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li> |
9 | <li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li> | 11 | <li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li> |
10 | </ul> | 12 | </ul> |
11 | 13 | ||
12 | {% include '_pocheit-form.twig' %} | ||
diff --git a/themes/baggy/_pocheit-form.twig b/themes/baggy/_pocheit-form.twig index 3c4a4d6e..ff911515 100755 --- a/themes/baggy/_pocheit-form.twig +++ b/themes/baggy/_pocheit-form.twig | |||
@@ -1,7 +1,8 @@ | |||
1 | <div id="bagit-form" class="messages info"> | 1 | <div id="bagit-form" class="messages info"> |
2 | 2 | <form method="get" action="index.php" target="_blank"> | |
3 | <form method="get" action="index.php"> | 3 | <h2><a href="javascript: void(null);" id="bagit-form-close">X</a> |
4 | <h2>{% trans "Save a link" %}</h2> | 4 | {% trans "Save a link" %}</h2> |
5 | <input type="hidden" name="autoclose" value="1" /> | ||
5 | <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" /> | 6 | <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" /> |
6 | <input type="submit" value="{% trans "save link!" %}" /> | 7 | <input type="submit" value="{% trans "save link!" %}" /> |
7 | </form> | 8 | </form> |
diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 586501b0..ba4b7c7f 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css | |||
@@ -534,32 +534,78 @@ footer a { | |||
534 | display: none; | 534 | display: none; |
535 | } | 535 | } |
536 | 536 | ||
537 | /* ========================================================================== | ||
538 | 2.1 = "save a link" popup div related styles | ||
539 | ========================================================================== */ | ||
540 | |||
537 | #bagit-form { | 541 | #bagit-form { |
538 | background: rgba(0,0,0,0.8); | 542 | background: rgba(0,0,0,0.5); |
539 | position: fixed; | 543 | position: absolute; |
540 | top: 0; | 544 | top: 0; |
541 | left: 10em; | 545 | left: 10em; |
542 | z-index: 20; | 546 | z-index: 20; |
543 | height: 100%; | 547 | height: 100%; |
544 | width: 100%; | 548 | width: 100%; |
545 | margin: 0; | 549 | margin: 0; |
550 | margin-top: -30%; | ||
546 | padding: 2em; | 551 | padding: 2em; |
547 | display: none; | 552 | display: none; |
553 | border-left: 1px #EEE solid; | ||
548 | } | 554 | } |
549 | 555 | ||
550 | #bagit-form form { | 556 | #bagit-form form { |
551 | background: #FFF; | 557 | background: #FFF; |
552 | position: absolute; | 558 | position: absolute; |
553 | top: 50%; | 559 | top: 0; |
554 | left: 50%; | 560 | left: 0; |
555 | z-index: 20; | 561 | z-index: 20; |
556 | border: 10px solid #000; | 562 | border: 10px solid #000; |
557 | width: 600px; | 563 | width: 400px; |
558 | height: 300px; | 564 | height: 200px; |
559 | margin: -150px 0 0 -300px; | 565 | /* margin: -150px 0 0 -300px; */ |
560 | padding: 2em; | 566 | padding: 2em; |
561 | } | 567 | } |
562 | 568 | ||
569 | a#bagit-form-close { | ||
570 | background: #000; | ||
571 | color: #FFF; | ||
572 | padding: 0.2em 0.5em; | ||
573 | text-decoration: none; | ||
574 | display: inline-block; | ||
575 | float: right; | ||
576 | font-size: 0.6em; | ||
577 | } | ||
578 | a#bagit-form-close:hover { | ||
579 | background: #999; | ||
580 | color: #000; | ||
581 | } | ||
582 | |||
583 | .active-current { | ||
584 | background-color: #999; | ||
585 | } | ||
586 | |||
587 | .active-current:after { | ||
588 | content: ""; | ||
589 | width: 0; | ||
590 | height: 0; | ||
591 | position: absolute; | ||
592 | border-style: solid; | ||
593 | border-width: 10px; | ||
594 | border-color: transparent #EEE transparent transparent; | ||
595 | right: 0; | ||
596 | top: 50%; | ||
597 | margin-top: -10px; | ||
598 | } | ||
599 | |||
600 | .opacity03 { | ||
601 | opacity: 0.3; | ||
602 | } | ||
603 | |||
604 | .add-to-wallabag-link-after { | ||
605 | background-color: #000; | ||
606 | color: #fff; | ||
607 | padding: 0 3px 2px 3px; | ||
608 | } | ||
563 | 609 | ||
564 | /* ========================================================================== | 610 | /* ========================================================================== |
565 | 3 = Pictos | 611 | 3 = Pictos |
@@ -920,4 +966,8 @@ blockquote { | |||
920 | #display-mode { | 966 | #display-mode { |
921 | display: none; | 967 | display: none; |
922 | } | 968 | } |
969 | |||
970 | #bagit-form { | ||
971 | left: 0; | ||
972 | } | ||
923 | } | 973 | } |
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index 4e85beaa..4830bd25 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js | |||
@@ -48,31 +48,58 @@ $.fn.ready(function() { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | /* ========================================================================== | 50 | /* ========================================================================== |
51 | bag it link | 51 | bag it link and close button |
52 | ========================================================================== */ | 52 | ========================================================================== */ |
53 | 53 | ||
54 | $bagit.click(function(){ | 54 | function toggleSaveLinkForm(url) { |
55 | $bagit.toggleClass("active-current"); | ||
55 | $bagitForm.toggle(); | 56 | $bagitForm.toggle(); |
57 | $('#content').toggleClass("opacity03"); | ||
58 | if (url !== 'undefined' && url) { | ||
59 | $('#plainurl').val(url); | ||
60 | } | ||
61 | $('#plainurl').focus(); | ||
62 | } | ||
63 | |||
64 | $bagit.click(function(){ | ||
65 | toggleSaveLinkForm(); | ||
66 | }); | ||
67 | |||
68 | $("#bagit-form-close").click(function(){ | ||
69 | toggleSaveLinkForm(); | ||
70 | }); | ||
71 | |||
72 | $('#bagit-form form').submit(function(){ | ||
73 | toggleSaveLinkForm(); | ||
74 | return true; | ||
56 | }); | 75 | }); |
57 | 76 | ||
58 | /* ========================================================================== | 77 | /* ========================================================================== |
59 | Keyboard gestion | 78 | Keyboard gestion |
60 | ========================================================================== */ | 79 | ========================================================================== */ |
61 | 80 | ||
62 | $(window).keydown(function(e){ | 81 | $(window).keydown(function(e){ |
63 | if ( e.target.tagName.toLowerCase() !== 'input' ) { | 82 | if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) { |
64 | switch (e.keyCode) { | 83 | toggleSaveLinkForm(); |
65 | // s letter | 84 | return false; |
66 | case 83: | ||
67 | $bagitForm.toggle(); | ||
68 | return false; | ||
69 | break; | ||
70 | case 27: | ||
71 | $bagitForm.hide(); | ||
72 | break; | ||
73 | } | ||
74 | } | 85 | } |
75 | }) | 86 | }); |
87 | |||
88 | /* ========================================================================== | ||
89 | Process all links inside an article | ||
90 | ========================================================================== */ | ||
91 | |||
92 | $("article a[href^='http']").after(function() { | ||
93 | return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> "; | ||
94 | }); | ||
95 | |||
96 | $(".add-to-wallabag-link-after").click(function(event){ | ||
97 | event.preventDefault(); | ||
98 | toggleSaveLinkForm($(this).attr('href')); | ||
99 | return false; | ||
100 | }); | ||
101 | |||
102 | |||
76 | 103 | ||
77 | 104 | ||
78 | }); | 105 | }); |