SlideShare a Scribd company logo
1 of 12
Download to read offline
Get more votes!
function removeEdit(oid)
if (oid)
var cont = jQuery("#Comments-comment-"+oid).closest(".brandNewComment");
cont.find(".newCommentOptions").fadeOut("fast", function()
jQuery(this).remove();
);
function getComment(oid, commentLimit)
var url = "/chicago/get-more-votes/Content?oid=17121636";
var limitMsg = commentLimit?'':'';
if (oid)
var params =
ajaxComponent: componentId,
commentOid: oid
;
jQuery.ajax(
url: url,
data: (params),
success: function (data)
if (!jQuery.trim(jQuery("#"+componentId+"_commentContent").html()))
jQuery("#"+componentId+"_commentContent").append(limitMsg+data).find(".brandNewComment")
.fadeIn("fast");
else
jQuery("#"+componentId+"_commentContent").children("div.comment, div.brandNewComment,
div.limitMsg").filter(":last").after(limitMsg+data).parent().find(".brandNewComment").fadeIn("fast");
var t=setTimeout(function()removeEdit(oid),300000);
var myTotal = parseInt(jQuery("#comments_total").text(), 10);
myTotal++;
updateCommentTotals(false,myTotal);
);
function doLikeComment(e)
e.preventDefault();
if (!this.clicked) 0;
var thisRating = jQuery(this).attr("rel");
if (thisRating == "Like")
myCurrentLikes = parseFloat(myCurrentLikes)+1;
else
myCurrentDislikes = parseFloat(myCurrentDislikes)+1;
var myNewLine = '' + myCurrentLikes + ' like';
if (myCurrentLikes != 1)
myNewLine += 's';
myNewLine += ', ' + '' + myCurrentDislikes + ' dislike';
if (myCurrentDislikes != 1) 
myNewLine += "s";
jQuery("#"+oid+"_rating_sub").html(myNewLine);
jQuery("#"+oid+"_rating_sub").show();
var params = 
oid: oid,
rating: thisRating
; 
jQuery.ajax(
url: "/gyrobase/Tools/AjaxLike",
type: "POST",
data: (params),
success: function (data) 
jQuery("#"+oid+"_rating_sub").html(data);
if (thisRating == "Like") 
jQuery("#Comments #"+oid+"_likeLinks
a.dislike").removeClass("dimmed").css("opacity","1").each(function()this.clicked = false;); 
else 
jQuery("#Comments #"+oid+"_likeLinks
a.like").removeClass("dimmed").css("opacity","1").each(function()this.clicked = false;);
);
function reportComment(e)
e.preventDefault();
e.stopPropagation();
var oid = jQuery(this).attr("rel"); 
var elem = jQuery("#"+oid+"_report");
elem.click(function(e)e.stopPropagation();)
if (!elem.is(":visible"))
jQuery("#Comments .reportCommentContainer").hide();
if (elem.is(":empty")) 
var params = 
oid: oid,
ajaxComponent: "ReportComment"
; 
jQuery.ajax(
url: "/gyrobase/Tools/ReportComment",
data: (params),
success: function (data) 
elem.html(data);
elem.fadeIn("fast");
);
else 
elem.fadeIn("fast");
// attach close event handler to the html
jQuery("html").one("click", function()
jQuery("#Comments .reportCommentContainer:visible").hide();
);
function closeReport(obj)
jQuery(obj).closest(".reportCommentContainer").fadeOut("fast");
function submitReport(e)
var params = jQuery(e).closest("form").serialize()+"ajaxComponent=ReportComment";
jQuery.ajax(
url: "/gyrobase/Tools/ReportComment",
type: "POST",
data: (params),
success: function (data) 
jQuery(e).closest(".reportCommentContainer").html(data);
); 
(function($) 
var subscribed=false;
function showFollowPanel(e)
e.preventDefault();
myPanel = $(this).parent().next(".togglePanel");
myPanel.fadeIn("fast");
function doSubscribe(obj) 
var myPanel = obj.parent().next(".togglePanel");
myPanel.fadeIn("fast");
if (!subscribed)
var myLink = obj.parent();
var myLoader = myPanel.children(".loading");
var myUpdater = myPanel.children(".ajaxUpdater"); 
var params = 
object: myPanel.attr("data-toolsoid"),
macro: myPanel.attr("data-toolsajaxmacro"),
url: window.location
; 
$.ajax(
url: "/gyrobase/Macros/ToolsAjax",
data: (params),
type: "POST",
dataType: "html",
success: function (data) 
subscribed = true; 
if (myUpdater)
myUpdater.html(data); 
myLoader.fadeOut("fast", function()
myUpdater.fadeIn("fast", function()
setTimeout(function()
myPanel.fadeOut("fast");
, 3000);
);
);
else 
myPanel.fadeOut("fast");
);
function activateSubscribe(e)
e.preventDefault();
var myObj = $(this);
var isAuthenticated = Foundation.SessionManager.sharedSessionManager().isAuthenticated();
if (!isAuthenticated)
new Foundation.Login.Dialog(
"feelingShy": false,
"callback": function()doSubscribe(myObj);
); 
return false;
else 
// Proceed
doSubscribe(myObj);
function deleteComment(e)
e.preventDefault();
var thisComment = $(this);
var params = 
macro: "deleteComment",
comment: thisComment.attr("data-comment")
;
$.ajax(
url: "/gyrobase/Macros/ToolsAjax",
data: (params),
type: "POST",
dataType: "html",
success: function (data) 
thisComment.closest(".brandNewComment").fadeOut("fast", function()
$(this).remove();
var myTotal = parseInt(jQuery("#comments_total").text(), 10);
myTotal--;
updateCommentTotals(false,myTotal);
);
); 
function editComment(e)
e.preventDefault();
var thisComment = $(this);
var commentCont = thisComment.closest(".brandNewComment").find(".description");
var commentTemp = thisComment.closest(".brandNewComment").find(".commentTemp");
var commentText = commentTemp.html();
var toolbar = thisComment.closest(".brandNewComment").find(".commentToolbar");
commentCont.next(".commentEditCont").remove();
commentCont.after('');
toolbar.fadeOut("fast");
commentCont.fadeOut("fast", function()
commentCont.next(".commentEditCont").fadeIn("fast", function()
$(".brandNewComment textarea.expandableBox").autoBoxResize();
$(".brandNewComment textarea.expandableBox").focus();
);
);
function editCommentSave(e)
e.preventDefault();
var thisComment = $(this);
var editCont = thisComment.closest(".commentEditCont");
var commentTemp = thisComment.closest(".brandNewComment").find(".commentTemp");
var newText = thisComment.prevAll("textarea").val();
var toolbar = thisComment.closest(".brandNewComment").find(".commentToolbar");
var params =
macro: "editComment",
comment: thisComment.attr("data-comment"),
commentText: newText
;
$.ajax(
url: "/gyrobase/Macros/ToolsAjax",
data: (params),
type: "POST",
success: function (data)
if (data.error)
$(".editErrorDisplay").html(""+data.error+"").fadeIn("fast");
else if (data.result)
editCont.fadeOut("fast", function()
$(".editErrorDisplay").hide().html("");
editCont.prev(".description").html($.trim(data.result));
commentTemp.html(newText);
editCont.prev(".description").fadeIn("fast");
toolbar.fadeIn("fast");
);
);
function editCommentCancel(e)
e.preventDefault();
var editCont = $(this).closest(".commentEditCont");
var toolbar = $(this).closest(".brandNewComment").find(".commentToolbar");
editCont.fadeOut("fast", function()
$(".editErrorDisplay").hide().html("");
editCont.prev(".description").fadeIn("fast");
toolbar.fadeIn("fast");
editCont.remove();
);
$("#Comments").on('click', ".bottomOptionBar a#doSubscribe", activateSubscribe);
$("#Comments").on('click', ".bottomOptionBar a.togglePanelClose",
function()$(this).parent().fadeOut("fast"); return false;);
$("#Comments").on('click', ".brandNewComment a.commentDeleteLink", deleteComment);
$("#Comments").on('click', ".brandNewComment a.commentEditLink", editComment);
$("#Comments").on('click', ".brandNewComment a.doneEditLink", editCommentSave);
$("#Comments").on('click', ".brandNewComment a.cancelEditLink", editCommentCancel);
)(jQuery);
jQuery(document).ready(function($)
$("#Comments").on('click', '#showMoreComments,#showAllComments', getMoreComments);
$("#Comments #sortSelect").change(getMoreComments);
getMoreComments();
new Foundation.PostCommentComponent(componentId);
var nc = Foundation.NotificationCenter.sharedNotificationCenter();
nc.observe("comment:added", function (e)
var comment = e.data;
getComment(comment.get("oid"));
// clear rating
if (jQuery(".commentFormRating").length!=0)
jQuery(".commentFormRating input[name='reviewRating']").val("");
jQuery(".commentFormRating .goldStarContainer").css("left", zeroPos+"px");
);
var subscribeCheckBox = $("#Comments_commentSubscribe");
subscribeCheckBox.prop("checked", getCookie("subscribeToThread") === "true" ? true : false);
subscribeCheckBox.change(function (e)
var subscribeToThread = $(this).prop("checked");
setCookie("subscribeToThread", subscribeToThread ? "true" : "false", 30);
);
var shareFacebookBox = $("#Comments_postCommentToFacebook");
shareFacebookBox.prop("checked", getCookie("shareOnFacebook") === "true" ? true : false);
shareFacebookBox.change(function (e)
var shareOnFacebook = $(this).prop("checked");
setCookie("shareOnFacebook", shareOnFacebook ? "true" : "false", 30);
);
$("#Comments").on('click', 'a.likeLink', doLikeComment);
$("#Comments").on('click', 'a.reportCommentLink', reportComment);
);
http://www.chicagoreader.com/chicago/get-more-votes/Content?oid=17121636

More Related Content

What's hot

Peek inside the fantastical Ukrainian Village home and studio of artists Jare...
Peek inside the fantastical Ukrainian Village home and studio of artists Jare...Peek inside the fantastical Ukrainian Village home and studio of artists Jare...
Peek inside the fantastical Ukrainian Village home and studio of artists Jare...irwinvifxcfesre
 
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...irwinvifxcfesre
 
Check out our photos of the Pixies' Metro show
Check out our photos of the Pixies' Metro showCheck out our photos of the Pixies' Metro show
Check out our photos of the Pixies' Metro showchicagonewsyesterday
 
Pianist and composer Jeff Kowalkowski releases strong new trio album
Pianist and composer Jeff Kowalkowski releases strong new trio albumPianist and composer Jeff Kowalkowski releases strong new trio album
Pianist and composer Jeff Kowalkowski releases strong new trio albumirwinvifxcfesre
 
第二节课:html5 – web开发步入新阶段
第二节课:html5 – web开发步入新阶段第二节课:html5 – web开发步入新阶段
第二节课:html5 – web开发步入新阶段Tommy Chang
 
Assalamualaykum warahmatullahi wabarakatuu
Assalamualaykum warahmatullahi wabarakatuuAssalamualaykum warahmatullahi wabarakatuu
Assalamualaykum warahmatullahi wabarakatuuiswan_di
 
jQuery sans jQuery
jQuery sans jQueryjQuery sans jQuery
jQuery sans jQuerygoldoraf
 
Android Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAndroid Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAgus Haryanto
 
Migrating Legacy Web Applications to AngularJS
Migrating Legacy Web Applications to AngularJSMigrating Legacy Web Applications to AngularJS
Migrating Legacy Web Applications to AngularJSBTI360
 
Back To The Front - Javascript Test Driven Development is between us (workshop)
Back To The Front - Javascript Test Driven Development is between us (workshop)Back To The Front - Javascript Test Driven Development is between us (workshop)
Back To The Front - Javascript Test Driven Development is between us (workshop)Marco Cedaro
 
Javascript技巧参考大全
Javascript技巧参考大全Javascript技巧参考大全
Javascript技巧参考大全fgghyyfk
 
Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Somenath Mukhopadhyay
 

What's hot (20)

Peek inside the fantastical Ukrainian Village home and studio of artists Jare...
Peek inside the fantastical Ukrainian Village home and studio of artists Jare...Peek inside the fantastical Ukrainian Village home and studio of artists Jare...
Peek inside the fantastical Ukrainian Village home and studio of artists Jare...
 
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...
George McCaskey's handling of the Ray McDonald affair offers a lesson to the ...
 
Check out our photos of the Pixies' Metro show
Check out our photos of the Pixies' Metro showCheck out our photos of the Pixies' Metro show
Check out our photos of the Pixies' Metro show
 
Best gourmet market
Best gourmet marketBest gourmet market
Best gourmet market
 
Pianist and composer Jeff Kowalkowski releases strong new trio album
Pianist and composer Jeff Kowalkowski releases strong new trio albumPianist and composer Jeff Kowalkowski releases strong new trio album
Pianist and composer Jeff Kowalkowski releases strong new trio album
 
Poetry in the age of hip-hop
Poetry in the age of hip-hopPoetry in the age of hip-hop
Poetry in the age of hip-hop
 
第二节课:html5 – web开发步入新阶段
第二节课:html5 – web开发步入新阶段第二节课:html5 – web开发步入新阶段
第二节课:html5 – web开发步入新阶段
 
Assalamualaykum warahmatullahi wabarakatuu
Assalamualaykum warahmatullahi wabarakatuuAssalamualaykum warahmatullahi wabarakatuu
Assalamualaykum warahmatullahi wabarakatuu
 
jQuery sans jQuery
jQuery sans jQueryjQuery sans jQuery
jQuery sans jQuery
 
Jquery ui, ajax
Jquery ui, ajaxJquery ui, ajax
Jquery ui, ajax
 
Android Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAndroid Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySql
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
Migrating Legacy Web Applications to AngularJS
Migrating Legacy Web Applications to AngularJSMigrating Legacy Web Applications to AngularJS
Migrating Legacy Web Applications to AngularJS
 
Jquery Framework
Jquery FrameworkJquery Framework
Jquery Framework
 
Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)
 
Back To The Front - Javascript Test Driven Development is between us (workshop)
Back To The Front - Javascript Test Driven Development is between us (workshop)Back To The Front - Javascript Test Driven Development is between us (workshop)
Back To The Front - Javascript Test Driven Development is between us (workshop)
 
Blog 3
Blog 3Blog 3
Blog 3
 
Javascript技巧参考大全
Javascript技巧参考大全Javascript技巧参考大全
Javascript技巧参考大全
 
Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...Developing an Android REST client to determine POI using asynctask and integr...
Developing an Android REST client to determine POI using asynctask and integr...
 
Parse
ParseParse
Parse
 

Viewers also liked

Viewers also liked (16)

Uts
UtsUts
Uts
 
Annual Report
Annual ReportAnnual Report
Annual Report
 
My Resume, Until May 7, 2015
My Resume, Until May 7, 2015My Resume, Until May 7, 2015
My Resume, Until May 7, 2015
 
Kembali pada role model
Kembali pada role modelKembali pada role model
Kembali pada role model
 
home safety education by Kwong 5122016
home safety education by Kwong 5122016home safety education by Kwong 5122016
home safety education by Kwong 5122016
 
Power point latihan
Power point latihanPower point latihan
Power point latihan
 
Salsa album art
Salsa album artSalsa album art
Salsa album art
 
Long term drug treatment
Long term drug treatmentLong term drug treatment
Long term drug treatment
 
Guion
GuionGuion
Guion
 
Fok Cheuk Kwong Resume
Fok Cheuk Kwong ResumeFok Cheuk Kwong Resume
Fok Cheuk Kwong Resume
 
Klein_Resume
Klein_ResumeKlein_Resume
Klein_Resume
 
Resume Ritter, Kimberly_2016
Resume Ritter, Kimberly_2016Resume Ritter, Kimberly_2016
Resume Ritter, Kimberly_2016
 
prakerin kratingdaeng powerpoint
prakerin kratingdaeng powerpointprakerin kratingdaeng powerpoint
prakerin kratingdaeng powerpoint
 
Ecuación Cubica genérica
Ecuación Cubica genérica Ecuación Cubica genérica
Ecuación Cubica genérica
 
Islas Galápagos
Islas GalápagosIslas Galápagos
Islas Galápagos
 
Islas Galápagos
Islas GalápagosIslas Galápagos
Islas Galápagos
 

More from chicagonewsonlineradio

Singer-songwriter Jennifer Hall celebrates her first studio material in four ...
Singer-songwriter Jennifer Hall celebrates her first studio material in four ...Singer-songwriter Jennifer Hall celebrates her first studio material in four ...
Singer-songwriter Jennifer Hall celebrates her first studio material in four ...chicagonewsonlineradio
 
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazz
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n JazzLooks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazz
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazzchicagonewsonlineradio
 
Mad Max is back, plus the rest of our new reviews and notable screenings
Mad Max is back, plus the rest of our new reviews and notable screeningsMad Max is back, plus the rest of our new reviews and notable screenings
Mad Max is back, plus the rest of our new reviews and notable screeningschicagonewsonlineradio
 
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautifulchicagonewsonlineradio
 

More from chicagonewsonlineradio (7)

What's happened to Chicago's Haring?
What's happened to Chicago's Haring?What's happened to Chicago's Haring?
What's happened to Chicago's Haring?
 
Singer-songwriter Jennifer Hall celebrates her first studio material in four ...
Singer-songwriter Jennifer Hall celebrates her first studio material in four ...Singer-songwriter Jennifer Hall celebrates her first studio material in four ...
Singer-songwriter Jennifer Hall celebrates her first studio material in four ...
 
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazz
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n JazzLooks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazz
Looks like Blake Schwarzenbach of Jawbreaker will be joining Cap'n Jazz
 
Mad Max is back, plus the rest of our new reviews and notable screenings
Mad Max is back, plus the rest of our new reviews and notable screeningsMad Max is back, plus the rest of our new reviews and notable screenings
Mad Max is back, plus the rest of our new reviews and notable screenings
 
Test
TestTest
Test
 
Discontinuing Reader Matches
Discontinuing Reader MatchesDiscontinuing Reader Matches
Discontinuing Reader Matches
 
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
 

Get more votes!

  • 1. Get more votes! function removeEdit(oid) if (oid) var cont = jQuery("#Comments-comment-"+oid).closest(".brandNewComment"); cont.find(".newCommentOptions").fadeOut("fast", function() jQuery(this).remove(); ); function getComment(oid, commentLimit) var url = "/chicago/get-more-votes/Content?oid=17121636"; var limitMsg = commentLimit?'':''; if (oid) var params = ajaxComponent: componentId, commentOid: oid ; jQuery.ajax( url: url, data: (params), success: function (data) if (!jQuery.trim(jQuery("#"+componentId+"_commentContent").html())) jQuery("#"+componentId+"_commentContent").append(limitMsg+data).find(".brandNewComment") .fadeIn("fast"); else jQuery("#"+componentId+"_commentContent").children("div.comment, div.brandNewComment, div.limitMsg").filter(":last").after(limitMsg+data).parent().find(".brandNewComment").fadeIn("fast"); var t=setTimeout(function()removeEdit(oid),300000);
  • 2. var myTotal = parseInt(jQuery("#comments_total").text(), 10); myTotal++; updateCommentTotals(false,myTotal); ); function doLikeComment(e) e.preventDefault(); if (!this.clicked) 0; var thisRating = jQuery(this).attr("rel"); if (thisRating == "Like") myCurrentLikes = parseFloat(myCurrentLikes)+1; else myCurrentDislikes = parseFloat(myCurrentDislikes)+1; var myNewLine = '' + myCurrentLikes + ' like'; if (myCurrentLikes != 1) myNewLine += 's'; myNewLine += ', ' + '' + myCurrentDislikes + ' dislike'; if (myCurrentDislikes != 1) myNewLine += "s"; jQuery("#"+oid+"_rating_sub").html(myNewLine); jQuery("#"+oid+"_rating_sub").show(); var params = oid: oid, rating: thisRating
  • 3. ; jQuery.ajax( url: "/gyrobase/Tools/AjaxLike", type: "POST", data: (params), success: function (data) jQuery("#"+oid+"_rating_sub").html(data); if (thisRating == "Like") jQuery("#Comments #"+oid+"_likeLinks a.dislike").removeClass("dimmed").css("opacity","1").each(function()this.clicked = false;); else jQuery("#Comments #"+oid+"_likeLinks a.like").removeClass("dimmed").css("opacity","1").each(function()this.clicked = false;); ); function reportComment(e) e.preventDefault(); e.stopPropagation(); var oid = jQuery(this).attr("rel"); var elem = jQuery("#"+oid+"_report"); elem.click(function(e)e.stopPropagation();) if (!elem.is(":visible")) jQuery("#Comments .reportCommentContainer").hide();
  • 4. if (elem.is(":empty")) var params = oid: oid, ajaxComponent: "ReportComment" ; jQuery.ajax( url: "/gyrobase/Tools/ReportComment", data: (params), success: function (data) elem.html(data); elem.fadeIn("fast"); ); else elem.fadeIn("fast"); // attach close event handler to the html jQuery("html").one("click", function() jQuery("#Comments .reportCommentContainer:visible").hide(); ); function closeReport(obj) jQuery(obj).closest(".reportCommentContainer").fadeOut("fast");
  • 5. function submitReport(e) var params = jQuery(e).closest("form").serialize()+"ajaxComponent=ReportComment"; jQuery.ajax( url: "/gyrobase/Tools/ReportComment", type: "POST", data: (params), success: function (data) jQuery(e).closest(".reportCommentContainer").html(data); ); (function($) var subscribed=false; function showFollowPanel(e) e.preventDefault(); myPanel = $(this).parent().next(".togglePanel"); myPanel.fadeIn("fast"); function doSubscribe(obj) var myPanel = obj.parent().next(".togglePanel"); myPanel.fadeIn("fast"); if (!subscribed) var myLink = obj.parent();
  • 6. var myLoader = myPanel.children(".loading"); var myUpdater = myPanel.children(".ajaxUpdater"); var params = object: myPanel.attr("data-toolsoid"), macro: myPanel.attr("data-toolsajaxmacro"), url: window.location ; $.ajax( url: "/gyrobase/Macros/ToolsAjax", data: (params), type: "POST", dataType: "html", success: function (data) subscribed = true; if (myUpdater) myUpdater.html(data); myLoader.fadeOut("fast", function() myUpdater.fadeIn("fast", function() setTimeout(function() myPanel.fadeOut("fast"); , 3000); ); ); else myPanel.fadeOut("fast");
  • 7. ); function activateSubscribe(e) e.preventDefault(); var myObj = $(this); var isAuthenticated = Foundation.SessionManager.sharedSessionManager().isAuthenticated(); if (!isAuthenticated) new Foundation.Login.Dialog( "feelingShy": false, "callback": function()doSubscribe(myObj); ); return false; else // Proceed doSubscribe(myObj); function deleteComment(e) e.preventDefault(); var thisComment = $(this); var params = macro: "deleteComment", comment: thisComment.attr("data-comment")
  • 8. ; $.ajax( url: "/gyrobase/Macros/ToolsAjax", data: (params), type: "POST", dataType: "html", success: function (data) thisComment.closest(".brandNewComment").fadeOut("fast", function() $(this).remove(); var myTotal = parseInt(jQuery("#comments_total").text(), 10); myTotal--; updateCommentTotals(false,myTotal); ); ); function editComment(e) e.preventDefault(); var thisComment = $(this); var commentCont = thisComment.closest(".brandNewComment").find(".description"); var commentTemp = thisComment.closest(".brandNewComment").find(".commentTemp"); var commentText = commentTemp.html(); var toolbar = thisComment.closest(".brandNewComment").find(".commentToolbar"); commentCont.next(".commentEditCont").remove(); commentCont.after('');
  • 9. toolbar.fadeOut("fast"); commentCont.fadeOut("fast", function() commentCont.next(".commentEditCont").fadeIn("fast", function() $(".brandNewComment textarea.expandableBox").autoBoxResize(); $(".brandNewComment textarea.expandableBox").focus(); ); ); function editCommentSave(e) e.preventDefault(); var thisComment = $(this); var editCont = thisComment.closest(".commentEditCont"); var commentTemp = thisComment.closest(".brandNewComment").find(".commentTemp"); var newText = thisComment.prevAll("textarea").val(); var toolbar = thisComment.closest(".brandNewComment").find(".commentToolbar"); var params = macro: "editComment", comment: thisComment.attr("data-comment"), commentText: newText ; $.ajax( url: "/gyrobase/Macros/ToolsAjax", data: (params), type: "POST", success: function (data) if (data.error) $(".editErrorDisplay").html(""+data.error+"").fadeIn("fast");
  • 10. else if (data.result) editCont.fadeOut("fast", function() $(".editErrorDisplay").hide().html(""); editCont.prev(".description").html($.trim(data.result)); commentTemp.html(newText); editCont.prev(".description").fadeIn("fast"); toolbar.fadeIn("fast"); ); ); function editCommentCancel(e) e.preventDefault(); var editCont = $(this).closest(".commentEditCont"); var toolbar = $(this).closest(".brandNewComment").find(".commentToolbar"); editCont.fadeOut("fast", function() $(".editErrorDisplay").hide().html(""); editCont.prev(".description").fadeIn("fast"); toolbar.fadeIn("fast"); editCont.remove(); ); $("#Comments").on('click', ".bottomOptionBar a#doSubscribe", activateSubscribe); $("#Comments").on('click', ".bottomOptionBar a.togglePanelClose", function()$(this).parent().fadeOut("fast"); return false;); $("#Comments").on('click', ".brandNewComment a.commentDeleteLink", deleteComment); $("#Comments").on('click', ".brandNewComment a.commentEditLink", editComment); $("#Comments").on('click', ".brandNewComment a.doneEditLink", editCommentSave);
  • 11. $("#Comments").on('click', ".brandNewComment a.cancelEditLink", editCommentCancel); )(jQuery); jQuery(document).ready(function($) $("#Comments").on('click', '#showMoreComments,#showAllComments', getMoreComments); $("#Comments #sortSelect").change(getMoreComments); getMoreComments(); new Foundation.PostCommentComponent(componentId); var nc = Foundation.NotificationCenter.sharedNotificationCenter(); nc.observe("comment:added", function (e) var comment = e.data; getComment(comment.get("oid")); // clear rating if (jQuery(".commentFormRating").length!=0) jQuery(".commentFormRating input[name='reviewRating']").val(""); jQuery(".commentFormRating .goldStarContainer").css("left", zeroPos+"px"); ); var subscribeCheckBox = $("#Comments_commentSubscribe"); subscribeCheckBox.prop("checked", getCookie("subscribeToThread") === "true" ? true : false); subscribeCheckBox.change(function (e) var subscribeToThread = $(this).prop("checked"); setCookie("subscribeToThread", subscribeToThread ? "true" : "false", 30); ); var shareFacebookBox = $("#Comments_postCommentToFacebook"); shareFacebookBox.prop("checked", getCookie("shareOnFacebook") === "true" ? true : false); shareFacebookBox.change(function (e) var shareOnFacebook = $(this).prop("checked");
  • 12. setCookie("shareOnFacebook", shareOnFacebook ? "true" : "false", 30); ); $("#Comments").on('click', 'a.likeLink', doLikeComment); $("#Comments").on('click', 'a.reportCommentLink', reportComment); ); http://www.chicagoreader.com/chicago/get-more-votes/Content?oid=17121636