add option to hide voting feature, closes #115
This commit is contained in:
parent
e2911da560
commit
c712d196d7
@ -16,6 +16,7 @@ preferably in the script tag which embeds the JS:
|
|||||||
data-isso-avatar="true"
|
data-isso-avatar="true"
|
||||||
data-isso-avatar-bg="#f0f0f0"
|
data-isso-avatar-bg="#f0f0f0"
|
||||||
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
|
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
|
||||||
|
data-isso-vote="true"
|
||||||
src="/prefix/js/embed.js"></script>
|
src="/prefix/js/embed.js"></script>
|
||||||
|
|
||||||
Furthermore you can override the automatic title detection inside
|
Furthermore you can override the automatic title detection inside
|
||||||
@ -88,6 +89,11 @@ scheme is based in `this color palette <http://colrd.com/palette/19308/>`_.
|
|||||||
Multiple colors must be separated by space. If you use less than eight colors
|
Multiple colors must be separated by space. If you use less than eight colors
|
||||||
and not a multiple of 2, the color distribution is not even.
|
and not a multiple of 2, the color distribution is not even.
|
||||||
|
|
||||||
|
data-isso-vote
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Enable or disable voting feature on the client side.
|
||||||
|
|
||||||
data-isso-id
|
data-isso-id
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -127,10 +127,11 @@
|
|||||||
color: #111111 !important;
|
color: #111111 !important;
|
||||||
text-shadow: #aaaaaa 0 0 1px !important;
|
text-shadow: #aaaaaa 0 0 1px !important;
|
||||||
}
|
}
|
||||||
.isso-comment > div.text-wrapper > .isso-comment-footer a.reply,
|
.isso-comment > div.text-wrapper > .isso-comment-footer > a {
|
||||||
.isso-comment > div.text-wrapper > .isso-comment-footer a.edit,
|
position: relative;
|
||||||
.isso-comment > div.text-wrapper > .isso-comment-footer a.cancel,
|
top: .2em;
|
||||||
.isso-comment > div.text-wrapper > .isso-comment-footer a.delete {
|
}
|
||||||
|
.isso-comment > div.text-wrapper > .isso-comment-footer > a + a {
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
}
|
}
|
||||||
.isso-comment > div.text-wrapper > .isso-comment-footer .votes {
|
.isso-comment > div.text-wrapper > .isso-comment-footer .votes {
|
||||||
|
@ -11,7 +11,8 @@ define(function() {
|
|||||||
"avatar": true,
|
"avatar": true,
|
||||||
"avatar-bg": "#f0f0f0",
|
"avatar-bg": "#f0f0f0",
|
||||||
"avatar-fg": ["#9abf88", "#5698c4", "#e279a3", "#9163b6",
|
"avatar-fg": ["#9abf88", "#5698c4", "#e279a3", "#9163b6",
|
||||||
"#be5168", "#f19670", "#e4bf80", "#447c69"].join(" ")
|
"#be5168", "#f19670", "#e4bf80", "#447c69"].join(" "),
|
||||||
|
"vote": true
|
||||||
};
|
};
|
||||||
|
|
||||||
var js = document.getElementsByTagName("script");
|
var js = document.getElementsByTagName("script");
|
||||||
|
@ -151,8 +151,9 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (config.vote) {
|
||||||
// update vote counter, but hide if votes sum to 0
|
// update vote counter, but hide if votes sum to 0
|
||||||
var votes = function(value) {
|
var votes = function (value) {
|
||||||
var span = $("span.votes", footer);
|
var span = $("span.votes", footer);
|
||||||
if (span === null && value !== 0) {
|
if (span === null && value !== 0) {
|
||||||
footer.prepend($.new("span.votes", value));
|
footer.prepend($.new("span.votes", value));
|
||||||
@ -165,17 +166,18 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$("a.upvote", footer).on("click", function() {
|
$("a.upvote", footer).on("click", function () {
|
||||||
api.like(comment.id).then(function(rv) {
|
api.like(comment.id).then(function (rv) {
|
||||||
votes(rv.likes - rv.dislikes);
|
votes(rv.likes - rv.dislikes);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("a.downvote", footer).on("click", function() {
|
$("a.downvote", footer).on("click", function () {
|
||||||
api.dislike(comment.id).then(function(rv) {
|
api.dislike(comment.id).then(function (rv) {
|
||||||
votes(rv.likes - rv.dislikes);
|
votes(rv.likes - rv.dislikes);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$("a.edit", footer).toggle("click",
|
$("a.edit", footer).toggle("click",
|
||||||
function(toggler) {
|
function(toggler) {
|
||||||
|
@ -23,13 +23,14 @@ div(class='isso-comment' id='isso-#{comment.id}')
|
|||||||
!= comment.text
|
!= comment.text
|
||||||
|
|
||||||
div(class='isso-comment-footer')
|
div(class='isso-comment-footer')
|
||||||
|
if conf.vote
|
||||||
if comment.likes - comment.dislikes != 0
|
if comment.likes - comment.dislikes != 0
|
||||||
span(class='votes') #{comment.likes - comment.dislikes}
|
span(class='votes') #{comment.likes - comment.dislikes}
|
||||||
a(class='upvote' href='#')
|
a(class='upvote' href='#')
|
||||||
i!= svg['arrow-up']
|
!= svg['arrow-up']
|
||||||
span(class='spacer') |
|
span(class='spacer') |
|
||||||
a(class='downvote' href='#')
|
a(class='downvote' href='#')
|
||||||
i!= svg['arrow-down']
|
!= svg['arrow-down']
|
||||||
a(class='reply' href='#') #{i18n('comment-reply')}
|
a(class='reply' href='#') #{i18n('comment-reply')}
|
||||||
a(class='edit' href='#') #{i18n('comment-edit')}
|
a(class='edit' href='#') #{i18n('comment-edit')}
|
||||||
a(class='delete' href='#') #{i18n('comment-delete')}
|
a(class='delete' href='#') #{i18n('comment-delete')}
|
||||||
|
Loading…
Reference in New Issue
Block a user