jQuery(function() { jQuery("#gallerydiv table.form-table").each(function(item) { //the table with gallery fields (hack to add to it with js, sorry) var row = this.insertRow(this.rows.length); var cell = row.insertCell(0); cell.align = "left"; cell.vAlign = "top"; cell.innerHTML = "Gallery Voting Options"; var cell = row.insertCell(1); cell.colSpan = 3; var str = ""; str += " Enable voting for this gallery
"; str += " Only allow logged in users to vote
"; str += " Only allow 1 vote per person (IP or userid is used to stop multiple)
"; str += " Allow users to see results
"; str += "Rating Type: "; cell.innerHTML = str; row = this.insertRow(this.rows.length); cell = row.insertCell(0); cell.align = "left"; cell.vAlign = "top"; cell.innerHTML = "Current Votes"; cell = row.insertCell(1); cell.colSpan = 3; if(voting_type == 3) { //likes str = nggv_num_likes+' '; str += nggv_num_likes == 1 ? 'Vote ' : 'Votes '; //str += nggv_num_dislikes+' '; //str += nggv_num_dislikes == 1 ? 'Dislike' : 'Dislikes'; str += " ("+nggv_num_votes+" votes cast)"; }else{ str = nggv_avg+" / 10 ("+nggv_num_votes+" votes cast)"; } cell.innerHTML = str; jQuery("a#nggv_more_results").click(function() { //button click to open more detail on the voting tb_show("", "#TB_inline?width=640&height=300&inlineId=nggvShowList&modal=true", false); //thick box seems to be included, so lets use it :) jQuery.get(nggv_more_url, 'gid='+nggv_gid, function(data, status) { if(status == 'success') { var start = data.indexOf("") + 33; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) eval(data.substr(start)); //the array of voters gets echoed out at the ajax url if(nggv_votes_list.length > 0) { //todo, paginate results (pseudo even, with hidden divs etc)? var bgcol; var html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; for(i=0; i'; html += ''; if(parseInt(nggv_voting_type) == 3) { html += ''; }else{ html += ''; } html += ''; html += ''; html += ''; } html += ''; html += '
DateVote
(out 10)
User Name
(if logged in)
IP
'+nggv_votes_list[i][1]+''+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike')+''+(Math.round(nggv_votes_list[i][0]) / 10)+''+nggv_votes_list[i][3][1]+''+nggv_votes_list[i][2]+'
'; jQuery("div#nggvShowList_content").html(html); }else{ jQuery("div#nggvShowList_content").html("No votes yet for this gallery"); } }else{ jQuery("div#nggvShowList_content").html("There was a problem retrieving the list of votes, please try again in a momement."); } }); return false; //cancel click }); jQuery("a#nggv_more_results_close").click(function() { tb_remove(); return false; }); jQuery("a.nggv_mote_results_image").click(function() { //button click to open more detail on the voting var pid = parseInt(this.id.substr(24)); tb_show("", "#TB_inline?width=640&height=300&inlineId=nggvShowList&modal=true", false); //thick box seems to be included, so lets use it :) jQuery.get(nggv_more_url, 'pid='+pid, function(data, status) { if(status == 'success') { var start = data.indexOf("") + 33; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) eval(data.substr(start)); //the array of voters gets echoed out at the ajax url if(nggv_votes_list.length > 0) { //todo, paginate results (pseudo even, with hidden divs etc)? var bgcol; var html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; for(i=0; i'; html += ''; if(parseInt(nggv_voting_type) == 3) { html += ''; } html += ''; html += ''; html += ''; } html += ''; html += '
DateVote
(out 10)
User Name
(if logged in)
IP
'+nggv_votes_list[i][1]+''+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike d>'; }else{ html += ''+(Math.round(nggv_votes_list[i][0]) / 10)+''+nggv_votes_list[i][3][1]+''+nggv_votes_list[i][2]+'
'; jQuery("div#nggvShowList_content").html(html); }else{ jQuery("div#nggvShowList_content").html("No votes yet for this image"); } }else{ jQuery("div#nggvShowList_content").html("There was a problem retrieving the list of votes, please try again in a momement."); } }); return false; //cancel click }); jQuery("a.nggv_clear_image_results").click(function(e) { //button click to clear all votes per image. Just add a quick confirm to it if(!confirm('Are you sure you want to delete all votes for this image? This cannot be undone!')) { e.preventDefault(); return false; } }); }); });