aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-23 21:26:38 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-23 21:26:38 +0100
commit86846e7b97acb44a2ea0460d7951f7ef90558afd (patch)
tree606a266e2fc8198c2851abf7488c02a2afebf608 /p/scripts
parentdb120b4ed41584c7e33bfe63015f948e6230f1ab (diff)
parent27764b36353b3066a9e92da2a96ac17b546295be (diff)
Merge pull request #433 from aledeg/share
Improve sharing
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index beb77a19c..ec27bd50c 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1,6 +1,7 @@
"use strict";
var $stream = null,
- isCollapsed = true;
+ isCollapsed = true,
+ shares = 0;
function is_normal_mode() {
return $stream.hasClass('normal');
@@ -945,7 +946,7 @@ function init_confirm_action() {
}
function init_print_action() {
- $('.print-article').click(function () {
+ $('.item.share > a[href="#"]').click(function () {
var content = "<html><head><style>"
+ "body { font-family: Serif; text-align: justify; }"
+ "a { color: #000; text-decoration: none; }"
@@ -965,6 +966,27 @@ function init_print_action() {
});
}
+function init_share_observers() {
+ shares = $('.form-group:not(".form-actions")').length;
+
+ $('.post').on('click', '.share.remove', function(e){
+ e.preventDefault();
+ $(this).parents('.form-group').remove();
+ });
+
+ $('.share.add').on('click',function(e){
+ e.preventDefault();
+ var opt = $(this).siblings('select').find(':selected');
+ var row = $(this).parents('form').data(opt.data('form'));
+ row = row.replace('##label##', opt.html(), 'g');
+ row = row.replace('##type##', opt.val(), 'g');
+ row = row.replace('##help##', opt.data('help'), 'g');
+ row = row.replace('##key##', shares, 'g');
+ $(this).parents('.form-actions').before(row);
+ shares++;
+ });
+};
+
function init_all() {
if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) {
if (window.console) {
@@ -994,6 +1016,8 @@ function init_all() {
init_shortcuts();
init_print_action();
window.setInterval(refreshUnreads, 120000);
+ } else {
+ init_share_observers();
}
if (window.console) {