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,31 +151,33 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// update vote counter, but hide if votes sum to 0
|
if (config.vote) {
|
||||||
var votes = function(value) {
|
// update vote counter, but hide if votes sum to 0
|
||||||
var span = $("span.votes", footer);
|
var votes = function (value) {
|
||||||
if (span === null && value !== 0) {
|
var span = $("span.votes", footer);
|
||||||
footer.prepend($.new("span.votes", value));
|
if (span === null && value !== 0) {
|
||||||
} else {
|
footer.prepend($.new("span.votes", value));
|
||||||
if (value === 0) {
|
|
||||||
span.remove();
|
|
||||||
} else {
|
} else {
|
||||||
span.textContent = value;
|
if (value === 0) {
|
||||||
|
span.remove();
|
||||||
|
} else {
|
||||||
|
span.textContent = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
$("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 comment.likes - comment.dislikes != 0
|
if conf.vote
|
||||||
span(class='votes') #{comment.likes - comment.dislikes}
|
if comment.likes - comment.dislikes != 0
|
||||||
a(class='upvote' href='#')
|
span(class='votes') #{comment.likes - comment.dislikes}
|
||||||
i!= svg['arrow-up']
|
a(class='upvote' href='#')
|
||||||
span(class='spacer') |
|
!= svg['arrow-up']
|
||||||
a(class='downvote' href='#')
|
span(class='spacer') |
|
||||||
i!= svg['arrow-down']
|
a(class='downvote' href='#')
|
||||||
|
!= 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