Voting on Polls and Muted Words
This commit is contained in:
@ -65,6 +65,31 @@ $query = http_build_query(array_filter(array(
|
||||
$('#postform').toggle();
|
||||
});
|
||||
|
||||
$('body').on('click', '.polloption:not(.fixed)', function(e) {
|
||||
if (typeof $(this).parent().attr('multiple') == 'undefined'){
|
||||
$('.polloption').removeClass('voted');
|
||||
}
|
||||
$(this).toggleClass('voted');
|
||||
});
|
||||
|
||||
$('body').on('click', '.vote', function(e) {
|
||||
var id = $(this).attr('id');
|
||||
var c = 0;
|
||||
var choice = [];
|
||||
$('#'+id+'.poll .polloption').each(function(a){
|
||||
if ($(this).hasClass('voted')){
|
||||
console.log(c);
|
||||
choice.push(c);
|
||||
}
|
||||
c++;
|
||||
});
|
||||
var choices = choice.join(',');
|
||||
console.log(choices);
|
||||
$.get("action.php?a=true&vote="+id+"&choices="+choices, function(result) {
|
||||
$('#'+id+'.poll').html(result);
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.searchform', function(e) {
|
||||
$(this).prev().toggle();
|
||||
});
|
||||
|
Reference in New Issue
Block a user