diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig index 144bcaa..acc9fa3 100755 --- a/themes/baggy/_head.twig +++ b/themes/baggy/_head.twig @@ -11,4 +11,5 @@ + diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index da644fb..00470fb 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js @@ -1,10 +1,7 @@ $.fn.ready(function() { var $listmode = $('#listmode'), - $listentries = $("#list-entries"), - $bagit = $('#bagit'), - $bagitForm = $('#bagit-form'); - $bagitFormForm = $('#bagit-form-form'); + $listentries = $("#list-entries"); /* ========================================================================== Menu @@ -48,79 +45,4 @@ $.fn.ready(function() { $listmode.addClass("tablemode"); } - /* ========================================================================== - bag it link and close button - ========================================================================== */ - - function toggleSaveLinkForm(url) { - $bagit.toggleClass("active-current"); - $bagitForm.toggle(); - $('#content').toggleClass("opacity03"); - if (url !== 'undefined' && url) { - $('#plainurl').val(url); - } - $('#plainurl').focus(); - } - - $bagit.click(function(){ - toggleSaveLinkForm(); - }); - - $("#bagit-form-close").click(function(){ - toggleSaveLinkForm(); - }); - - - //send "bag it link" form request via ajax - $bagitFormForm.submit( function(event) { - $bagitFormForm.css("cursor", "wait"); - $("#add-link-result").empty(); - - $.ajax({ - type: $bagitFormForm.attr('method'), - url: $bagitFormForm.attr('action'), - data: $bagitFormForm.serialize(), - success: function(data) { - $('#add-link-result').html("Done!"); - $('#plainurl').val(''); - $('#plainurl').blur(''); - $bagitFormForm.css("cursor", "auto"); - //setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay - }, - error: function(data) { - $('#add-link-result').html("Failed!"); - $bagitFormForm.css("cursor", "auto"); - } - }); - - event.preventDefault(); - }); - - /* ========================================================================== - Keyboard gestion - ========================================================================== */ - - $(window).keydown(function(e){ - if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) { - toggleSaveLinkForm(); - return false; - } - }); - - /* ========================================================================== - Process all links inside an article - ========================================================================== */ - - $("article a[href^='http']").after(function() { - return " w "; - }); - - $(".add-to-wallabag-link-after").click(function(event){ - toggleSaveLinkForm($(this).attr('href')); - event.preventDefault(); - }); - - - - }); diff --git a/themes/default/_head.twig b/themes/default/_head.twig index f310e42..96a6ab3 100644 --- a/themes/default/_head.twig +++ b/themes/default/_head.twig @@ -9,4 +9,5 @@ - \ No newline at end of file + + diff --git a/themes/default/_menu.twig b/themes/default/_menu.twig index 0e7dd0a..0daa0b0 100644 --- a/themes/default/_menu.twig +++ b/themes/default/_menu.twig @@ -3,11 +3,11 @@
  • {% trans "favorites" %}
  • {% trans "archive" %}
  • {% trans "tags" %}
  • -
  • {% trans "save a link" %}
  • -
  • {% trans "search" %}
  • +
  • {% trans "save a link" %}
  • +
  • {% trans "search" %}
  • {% trans "config" %}
  • {% trans "logout" %}
  • {% include '_pocheit-form.twig' %} - {% include '_search-form.twig' %} + {% include '_search-form.twig' %} diff --git a/themes/default/_pocheit-form.twig b/themes/default/_pocheit-form.twig index 1309615..8c982db 100755 --- a/themes/default/_pocheit-form.twig +++ b/themes/default/_pocheit-form.twig @@ -1,22 +1,8 @@ -
    -
    -
    - - +
    +   + + + + -
    - diff --git a/themes/default/css/style.css b/themes/default/css/style.css index b3d300e..e536ac6 100755 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -355,3 +355,50 @@ a.reading-time span { vertical-align: top; } + +/* ========================================================================== + "save a link" popup div related styles + ========================================================================== */ + +#bagit-form { + display: none; + padding-left: 30px; + width: 450px; + +} + +a#bagit-form-close { + color: #FFF; + display: inline-block; + float: right; + background: url("../img/messages/close.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); + height: 16px; + margin: -14px -8px 0 0; + width: 16px; + text-decoration: none; +} + + +.add-to-wallabag-link-after { + background-color: #000; + color: #fff; + padding: 0 4px 1px 3px; + font-weight: bold; + font-size: 0.7em; + border-radius: 4px; +} +.add-to-wallabag-link-after:hover, .add-to-wallabag-link-after:active { + color: #fff; +} +.add-to-wallabag-link-after:visited { + color: #999; +} + +#add-link-result { + display: inline; + padding-left: 10px; +} + +.opacity03 { + /*opacity: 0.3;*/ +} diff --git a/themes/default/js/saveLink.js b/themes/default/js/saveLink.js new file mode 100755 index 0000000..ccc00d1 --- /dev/null +++ b/themes/default/js/saveLink.js @@ -0,0 +1,101 @@ +$.fn.ready(function() { + + var $bagit = $('#bagit'), + $bagitForm = $('#bagit-form'), + $bagitFormForm = $('#bagit-form-form'); + + /* ========================================================================== + bag it link and close button + ========================================================================== */ + + function toggleSaveLinkForm(url, event) { + $("#add-link-result").empty(); + + $bagit.toggleClass("active-current"); + + //only if bagiti link is not presented on page + if ( $bagit.length === 0 ) { + if ( event !== 'undefined' && event ) { + $bagitForm.css( {position:"absolute", top:event.pageY, left:event.pageX-200}); + } + else { + $bagitForm.css( {position:"relative", top:"auto", left:"auto"}); + } + } + + $bagitForm.toggle(); + $('#content').toggleClass("opacity03"); + if (url !== 'undefined' && url) { + $('#plainurl').val(url); + } + $('#plainurl').focus(); + } + + + $bagit.click(function(){ + $bagit.toggleClass("current"); + $("#bagit-arrow").toggleClass("arrow-down"); + toggleSaveLinkForm(); + }); + + $("#bagit-form-close").click(function(){ + $bagit.removeClass("current"); + $("#bagit-arrow").removeClass("arrow-down"); + toggleSaveLinkForm(); + }); + + + //send "bag it link" form request via ajax + $bagitFormForm.submit( function(event) { + $("body").css("cursor", "wait"); + $("#add-link-result").empty(); + + $.ajax({ + type: $bagitFormForm.attr('method'), + url: $bagitFormForm.attr('action'), + data: $bagitFormForm.serialize(), + success: function(data) { + $('#add-link-result').html("Done!"); + $('#plainurl').val(''); + $('#plainurl').blur(''); + $("body").css("cursor", "auto"); + //setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay + }, + error: function(data) { + $('#add-link-result').html("Failed!"); + $("body").css("cursor", "auto"); + } + }); + + event.preventDefault(); + }); + + /* ========================================================================== + Keyboard gestion + ========================================================================== */ + + $(window).keydown(function(e){ + if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) { + $bagit.removeClass("current"); + $("#bagit-arrow").removeClass("arrow-down"); + toggleSaveLinkForm(); + return false; + } + }); + + /* ========================================================================== + Process all links inside an article + ========================================================================== */ + + $("article a[href^='http']").after(function() { + return " w "; + }); + + $(".add-to-wallabag-link-after").click(function(event){ + toggleSaveLinkForm($(this).attr('href'), event); + event.preventDefault(); + }); + +}); + + diff --git a/themes/default/view.twig b/themes/default/view.twig index 916abe0..2be0c33 100644 --- a/themes/default/view.twig +++ b/themes/default/view.twig @@ -1,6 +1,7 @@ {% extends "layout.twig" %} {% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %} {% block content %} + {% include '_pocheit-form.twig' %}