YaWK  24.1
Yet another WebKit
voting.js File Reference

Go to the source code of this file.

Functions

document ready (function(){ var votingAmount=1;var itemid=$('#itemid').val();var totalVotesText=$('#totalVotesText');var voteUpText=$('#voteUpText');var voteDownText=$('#voteDownText');var voteUpIcon=$('#voteUpIcon');var voteDownIcon=$('#voteDownIcon');var totalVotes=$(totalVotesText).text();var voteUp=$(voteUpText).text();var voteDown=$(voteDownText).text();$('#voteUp').click(function(){ $.ajax({ url:'system/plugins/blog/js/vote-up.php', type:'post', data:'voteUp='+votingAmount+'&itemid='+itemid, success:function(data){ if(! data){ alert('Something went wrong!');return false;} else { $(voteUpIcon).addClass('fa fa-thumbs-up');$(voteUpIcon).addClass('animated bounceIn');totalVotes++;voteUp++;voteUpText.html(voteUp);totalVotesText.html(totalVotes);} } });});$('#voteDown').click(function(){ $.ajax({ url:'system/plugins/blog/js/vote-down.php', type:'post', data:'voteDown='+votingAmount+'&itemid='+itemid, success:function(data){ if(! data){ alert('Something went wrong!');return false;} else { $(voteDownIcon).addClass('fa fa-thumbs-down');$(voteDownIcon).addClass('animated bounceIn');totalVotes++;voteDown++;voteDownText.html(voteDown);totalVotesText.html(totalVotes);localStorage.setItem('voted', '1');} } });});})
 

Function Documentation

◆ ready()

document ready ( function(){ var votingAmount=1;var itemid=$('#itemid').val();var totalVotesText=$('#totalVotesText');var voteUpText=$('#voteUpText');var voteDownText=$('#voteDownText');var voteUpIcon=$('#voteUpIcon');var voteDownIcon=$('#voteDownIcon');var totalVotes=$(totalVotesText).text();var voteUp=$(voteUpText).text();var voteDown=$(voteDownText).text();$('#voteUp').click(function(){ $.ajax({ url:'system/plugins/blog/js/vote-up.php', type:'post', data:'voteUp='+votingAmount+'&itemid='+itemid, success:function(data){ if(! data){ alert('Something went wrong!');return false;} else { $(voteUpIcon).addClass('fa fa-thumbs-up');$(voteUpIcon).addClass('animated bounceIn');totalVotes++;voteUp++;voteUpText.html(voteUp);totalVotesText.html(totalVotes);} } });});$('#voteDown').click(function(){ $.ajax({ url:'system/plugins/blog/js/vote-down.php', type:'post', data:'voteDown='+votingAmount+'&itemid='+itemid, success:function(data){ if(! data){ alert('Something went wrong!');return false;} else { $(voteDownIcon).addClass('fa fa-thumbs-down');$(voteDownIcon).addClass('animated bounceIn');totalVotes++;voteDown++;voteDownText.html(voteDown);totalVotesText.html(totalVotes);localStorage.setItem('voted', '1');} } });});}  )

References itemid, and type.