var parentID = 0; var shareID = 0; (function () { $(".upvote-btn").click(function () { var shareid = $(this).data("shareid"); var cmtid = $(this).data("cmtid"); Upvote(cmtid, shareid); return false; }); $(".share-cam-btn").click(function () { }); var clipboard = new ClipboardJS('.btn-copy'); clipboard.on('success', function (e) { var tipElem = $(e.trigger).data("tipelem"); var elemClass = "." + tipElem; $(elemClass).show('slow'); setTimeout(function () { $(elemClass).hide('slow'); }, 5 * 1000); }); $(".delPublish").click(function () { if (confirm("Are you sure you want to unpublish this camera?")) { $(".btnDelPublish").click(); return false; } return false; }); })(); $(window).resize(function () { //resizeIframe(); }); function resizeIframe() { $("#frmPlayer").width($(window).width() - 3); $("#frmPlayer").height($(window).height() - $(".sharesection").height() - 10); } function Upvote(commentID, shareID) { var url = "/api/camera/UpvoteCamera.aspx?1=1" + "&shareID=" + shareID + "&commentID=" + commentID; var api = new APIHelper(); api.get(url, function () { //failed. }, function () { //finished. var status = api.getValue("STATUS"); var descr = api.getValue("DESCR"); var totalRate = api.getValue("TOTALRATE"); var rated = api.getValue("RATED"); if (status == 0) { var key = "vote_" + commentID + "_" + shareID; $("." + key).text(totalRate); } else { alert("Failed to upvote, " + descr); } }); }