var SITE_URL = "https://chatplayshare.com";
if(!URL_ROOT){
var URL_ROOT = "/";
}
var plugin = {
name : "comments",
comments : {},
commentTimeout : null,
commentsParsing : false,
addingComment : false,
replyingComment : false,
newChild : false,
newChildParent : false,
options :{},
createOverlay: function(container, button){
button.html("");
container.append("
");
},
hideOverlay: function(container, button){
button.html("
");
container.find(".details_overlay").remove();
},
integrate : function(plugins,options){
var framework = this;
var headID = document.getElementsByTagName("head")[0];
if(document.getElementById("comments_plugin_css") == null){
var cssNode = document.createElement('link');
cssNode.id = "comments_plugin_css";
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = URLROOT + 'plugins/comments/css/comments.css';
cssNode.media = 'screen';
headID.appendChild(cssNode);
}
if(document.getElementById("comments_plugin_mobile_css") == null){
var cssNode = document.createElement('link');
cssNode.id = "comments_plugin_mobile_css";
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = URLROOT + 'plugins/comments/css/mobile/comments.css';
cssNode.media = 'screen';
headID.appendChild(cssNode);
}
var plugin = this;
this.options = options;
$(document).ready(function(){
var html = "\
\
";
var ele = $('#' + options.element)
ele.append(html);
if(typeof(uploader) != "undefined"){
new uploader({
field:ele.find(".comment_box_container"),
button:ele.find(".upload_button").get(0),
insertBefore:false,
containField:false,
stacked: false,
fitted: true,
floatRight:false
});
ele.find(".comment_box_buttons").css({position:"absolute"});
}
var textarea = ele.find("#comment");
var addComment = ele.find(".send_button");
if(addComment.length > 0){
addComment.click(function(){
framework.createOverlay(ele.find(".comment_box_container"),addComment);
plugin.addComment(textarea,null,function(comment){
framework.hideOverlay(ele.find(".comment_box_container"),addComment);
if(typeof(comment.error) == "undefined"){
textarea.html("");
}
});
});
}
var checkScroll = function(field){
console.log(field.clientHeight);
if(field.clientHeight < field.scrollHeight || field.clientHeight >= 67){
ele.addClass("comment_scroll");
}else{
ele.removeClass("comment_scroll");
}
};
textarea.keyup(function(e){
var Ucode = e.keyCode? e.keyCode : e.charCode;
checkScroll(this);
});
//setupCheckboxes();
plugin.comments = options.comments;
if(typeof(plugin.comments) != "object"){
plugin.comments = {};
}
plugin.processComments(plugin.comments, options.entityID);
if($("#comment_sort").length > 0){
$("#comment_sort").change(function(){
$d.helpers.showOverlay($("#comments_list_container"));
$d.network.post(URLROOT+"comments/sort/" + options.type,{entity:options.entityID,sort:$("#comment_sort").val(),session_id:""},function(result){
options.comments = result;
plugin.processComments(result)
});
});
}
if("" != ""){
if(typeof(typeof window[""]) === "function"){
;
}
}
$d.initCheckboxes(ele);
$d.initSelects(ele);
});
},
processComment : function(comment,append,element,fadeIn){
var plugin = this;
var framework = this;
if(comment != null){
var image = "";
if(comment.image.startsWith("http")){
image = comment.image;
}else{
image = SITE_URL + comment.image;
}
var commentUserImage = "
";
var commentUsername = comment.username;
if(comment.link && comment.link != "" && comment.deleted == false) {
commentUserImage = "
";
commentUsername = "
"+comment.username+"";
}
var li = $(document.createElement("li"));
li.addClass("comment_item clearfix");
li.attr("data-id",comment.id);
li.attr("point-count",comment.score);
li.attr("data-parent",comment.parent);
li.attr("data-level",comment.level);
li.attr("data-type",comment.type);
li.attr("data-children",0);
li.attr("data-guildings",comment.guilds);
li.addClass("level-"+comment.level);
if(comment.parent > 0){
var p = $("li[data-id="+comment.parent+"] > ul");
if(p.length > 0){
element = p;
}
}
if(comment.level > 1){
li.addClass("sub-comment");
var parent = $(".comment_item[data-id='"+comment.parent+"']");
parent.addClass("has-children");
parent.data("children",parent.data("children") + 1);
if(parent.length){
var setText = function(parent,e){
var text = "Show";
if(e.hasClass("collapsed")){
text = "Hide";
}
var coText = "comment";
if(parent.data("children") > 1){
coText += "s";
}
e.attr("title",text + " " + parent.data("children") + " " + coText);
e.find(".comment_count").html(parent.data("children"));
};
var e = parent.find("> .comment_container .collapse_comments");
if(e.length == 0){
parent.find(".comment_left").prepend("");
e = parent.find("> .comment_container .collapse_comments");
console.log(e);
e.click(function(){
var ele = $(this);
if(parent.hasClass("collapsed")){
parent.removeClass("collapsed");
}else{
parent.addClass("collapsed");
}
setText(parent,e);
});
}
if(e.length > 0){
setText(parent,e);
}
}
}
var container = $(document.createElement("div"));
container.addClass("comment_container");
container.html("\
\
\
\
\
\
\
\
\
\
");
li.append(container);
li.append("
");
if(comment.loggedIn){
if(comment.deleted == false){
container.find(".comment_left").append("");
container.find(".comment_voting_buttons").append("
\
");
var upvote = container.find(".upVote");
if(upvote.length > 0){
upvote.click(function(){
plugin.upvote(comment.id);
});
}
var downvote = container.find(".downVote");
if(downvote.length > 0){
downvote.click(function(){
plugin.downvote(comment.id);
});
}
var guildButton = container.find(".comment_guild");
var updateGuildCount = function(){
var con = guildButton.find(".comment_guilds");
if(li.data("guildings") > 0){
con.html(li.data("guildings"));
li.addClass("guilded");
}else{
con.html("");
li.removeClass("guilded");
}
};
updateGuildCount();
guildButton.click(function(){
var doGuild = function(){};
doGuild = function(c){
$d.network.post(URLROOT+"credits/guild",{entity:comment.id,type:"comment",uid:comment.user,confirm:c},function(data){
if(data == "confirm"){
if(confirm("You've already guilded this comment are you sure you'd like to give it another one?")){
doGuild(1);
}
}else{
if(data != false){
li.data("guildings",data);
}else{
alert("You don't have enough credits");
}
updateGuildCount();
}
});
};
doGuild(0);
});
var replyButton = $("
");
container.find(".comment_buttons").append(replyButton);
replyButton.click(function(){
var existing = $(".comment_reply_box[data-parent="+comment.id+"]");
$(".comment_reply_box").remove();
$(".replying").removeClass("replying");
if(!existing.length){
container.addClass("replying");
var replyBox = $("");
if(typeof(uploader) != "undefined"){
new uploader({
field:$(replyBox).find(".comment_reply_content"),
button:$(replyBox).find(".upload_button").get(0),
insertBefore:false,
containField:false,
stacked: false,
fitted: true,
floatRight:false
});
}else{
replyBox.find(".upload_button").hide();
}
var textarea = replyBox.find(".textarea");
if(comment.level == 21){
textarea.html("@"+comment.username + " ");
}
var checkScroll = function(field){
if(field.clientHeight < field.scrollHeight || field.clientHeight >= 65){
$(replyBox).addClass("comment_scroll");
}else{
$(replyBox).removeClass("comment_scroll");
}
};
textarea.keyup(function(e){
var Ucode = e.keyCode? e.keyCode : e.charCode;
if(Ucode == 13) {
if(e.shiftKey == false){
e.preventDefault();
$(this).parent().parent().parent().find(".send_button").click();
return false;
}else{
checkScroll(this);
}
}else{
checkScroll(this);
}
});
replyBox.find(".send_button").click(function(){
var text = $(this).parent().parent().parent().find(".textarea");
var par = $(this).parent().parent().parent();
var button = $(this);
framework.createOverlay(text.parent(),$(this));
var p = par.data("parent");
if(comment.level == 21){
p = par.data("cparent");
}
plugin.addComment(text,p,function(comment){
if(typeof(comment.error) == "undefined"){
par.remove();
container.removeClass("replying");
}else{
framework.hideOverlay(text.parent(),button);
}
});
});
container.after(replyBox);
textarea.focus();
}
});
if(comment.delete == true){
li.addClass("deleteable");
var deleteButton = $("
");
container.find(".comment_buttons").append(deleteButton);
deleteButton.click(function(){
$(".comment_reply_box").remove();
container.removeClass("replying");
if(confirm("Are you sure you want to delete this comment?")){
var comment = $(this).attr("data-id");
var p = $(this).parent().parent().parent().parent();
var type = p.parent().data("type");
$d.helpers.showOverlay(p,"",false,false);
$d.network.post(URLROOT+"comments/delete/" + type,{id:comment,session_id:""},function(){
plugin.comments[comment] = null;
var children = $(".comment_item[data-parent="+comment+"]");
if(children.length > 0){
p.find(".comment_username").html("deleted");
p.find(".comment_reply").remove();
container.removeClass("replying");
p.find(".comment_delete").remove();
p.find(".comment_voting_buttons").remove();
p.addClass("comment_deleted");
p.find(".comment_content").html("");
$d.helpers.hideOverlay();
}else{
p.remove();
}
});
}
});
}
}else{
container.addClass("comment_deleted");
}
}
if(comment.previews && comment.previews.length > 0){
}
var content = container.find(".comment_content");
if(content.length > 0) {
content.html("");
}
if(fadeIn == true){
li.hide();
}
if(typeof(append) != "undefined" && append == true && typeof(element) != "undefined" && element != null){
element.append(li);
}else{
element.prepend(li);
}
if(fadeIn == true){
li.fadeIn(500);
}
if(typeof(comment.children) != "undefined" && comment.children != null){
for(var x in comment.children){
plugin.processComment(comment.children[x],true,element);
}
}
return li;
}
},
processComments : function(comments, id) {
var plugin = this;
var process = function(comments) {
if(comments && typeof(comments) != "undefined" && comments != null) {
var element = $("#comments_list");
element.html("");
var count = 0;
for(var commentIndex in comments) {
var comment = comments[commentIndex];
if(comment != null){
plugin.processComment(comment,true,element);
}
}
}
};
if(comments && typeof(comments) != "undefined" && comments != null) {
process(comments);
plugin.updateList();
$d.helpers.hideOverlay();
}
},
updateList : function(){
$("#comments_list li.comment_no_comment").remove();
var commentList = $("#comments_list li");
if(commentList.length > 1){
$("#comment_sort").css({display:"block"});
}else{
$("#comment_sort").css({display:"none"});
}
if(commentList.length == 0){
var li = $(document.createElement("li"));
li.addClass("comment_item clearfix comment_no_comment");
if($d.session && $d.session.isLoggedIn()){
li.html("
Be the first to comment!
");
}else{
//li.html("
");
}
$("#comments_list").append(li);
}
},
addComment : function(element,parent,callback) {
var plugin = this;
if(typeof(parent) == "undefined" || parent == null){
parent = 0;
}
if(plugin.addingComment == false){
plugin.addingComment = true;
if(typeof(element) != "undefined" && element != null){
var text = $(element);
}
else{
var text = $("#comment");
}
if(text.length > 0) {
var isDiv = false;
if(text.is("div")){
isDiv = true;
var content = $d.helpers.stripHTML(text.html());
}else{var content = text.val();}
var domField = null;
if(element){
domField = element.parent().get(0);
if(domField.uploader){
var used = {};
for(var x in domField.uploader.uploads){
var upload = domField.uploader.uploads[x];
if(upload != null){
if(upload.url){
if(!used[upload.url]){
content += " " + upload.url.replace("%2F","/");
used[upload.url] = true;
}
}
}
}
}
}
if(content == "") {
alert("Please enter a comment");
plugin.addingComment = false;
}
else {
var anonymous = false;
if(plugin.options.anonymous){
var anonymous = document.getElementById("comment_anonymous").checked;
}
if(anonymous == true) {anonymous = 1;}
else {anonymous = 0;}
if(!isDiv){
text.attr("disabled",true);
text.css({width:"69%"});
var loading = $("#comment_loading").css({display:"block"});
}
$d.network.request({
type:"POST",
url:URLROOT+"comments/save/" + plugin.options.type,
data:{id:plugin.options.entityID, content:content, anonymous:anonymous, parent:parent, session_id:""}
}).done(function(result){
if(result != "") {
var newComment = JSON.parse(result);
if(callback){
try{callback(newComment);}
catch(e){}
}
if(typeof(newComment.error) == "undefined"){
if(domField != null && domField.uploader){
domField.uploader.clear();
}
text.val("");
plugin.comments[newComment.id] = newComment;
$("li[data-id="+newComment.parent+"]").addClass("collapsed");
var pComment = plugin.processComment(newComment,false,$("#comments_list"),true);
plugin.updateList();
}else{
if(newComment.error == "spam"){
var element = $("#comments_list");
if($("#comments_list #spam_error_wait").length > 0){
$("#comments_list #spam_error_wait").html(newComment.wait);
} else {
element.prepend("
You're doing the thing too quickly please wait " + newComment.wait + " seconds
");
}
}
}
} else {
alert("Could not post your comment, please try again");
}
}).always(function(result){
if(!isDiv){
text.attr("disabled",false);
text.attr("style",'');
loading.css({display:"none"});
}
plugin.addingComment = false;
});
}
}
}
},
downvote : function(id) {
var plugin = this;
var uoption = $(".comment_upvote_"+id);
var doption = $(".comment_downvote_"+id);
var comment = $(".comment_item[data-id="+id+"]");
var points = parseInt(comment.attr("point-count"));
if(doption.hasClass("selected")) {
doption.removeClass("selected");
points++;
} else if(uoption.hasClass("selected")) {
uoption.removeClass("selected");
doption.addClass("selected");
points--;
points--;
} else {
doption.addClass("selected");
points--;
}
if(plugin.comments[id]){
plugin.comments[id].upclass = "";
plugin.comments[id].downclass = "";
if(doption.hasClass("selected")){
plugin.comments[id].upclass = "";
plugin.comments[id].downclass = "selected";
}else if(uoption.hasClass("selected")){
plugin.comments[id].upclass = "selected";
plugin.comments[id].downclass = "";
}
plugin.comments[id].score = points;
}
comment.attr("point-count",points);
comment.find(".comment_score").first().html(points + " points");
$d.network.post(URLROOT+"comments/downVote/" + plugin.options.type, {cid:id,session_id:""}, function(result) {});
},
upvote : function(id) {
var plugin = this;
var uoption = $(".comment_upvote_"+id);
var doption = $(".comment_downvote_"+id);
var comment = $(".comment_item[data-id="+id+"]");
var index = id;
var points = parseInt(comment.attr("point-count"));
if(uoption.hasClass("selected")) {
uoption.removeClass("selected");
points--;
} else if(doption.hasClass("selected")) {
doption.removeClass("selected");
uoption.addClass("selected");
points++;
points++;
} else {
uoption.addClass("selected");
points++;
}
if(plugin.comments[id]){
plugin.comments[id].upclass = "";
plugin.comments[id].downclass = "";
if(doption.hasClass("selected")){
plugin.comments[id].upclass = "";
plugin.comments[id].downclass = "selected";
}else if(uoption.hasClass("selected")){
plugin.comments[id].upclass = "selected";
plugin.comments[id].downclass = "";
}
plugin.comments[id].score = points;
}
comment.attr("point-count",points);
comment.find(".comment_score").first().html(points + " points");
$d.network.post(URLROOT+"comments/upVote/" + plugin.options.type, {cid:id,session_id:""}, function(result) {});
}
};
var options = {
type:"topic",
anonymous : "1",
comments : [{"id":23619,"user":81618,"comment":"Game of thrones asap","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/psychkik","date":"2016-05-24","delete":false,"datetime":"May 24th 2016 14:31","timestamp":1464100308,"loggedIn":false,"username":"psychkik","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":23590,"user":56130,"comment":"The Pern series by Anne McCaffrey and the Red Rising series... both are 10\/10 IMO","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/N1GHTM4RE","date":"2016-05-24","delete":false,"datetime":"May 24th 2016 08:53","timestamp":1464080033,"loggedIn":false,"username":"N1GHTM4RE","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":23383,"user":80156,"comment":"Do Androids Dream of Electric Sheep. 10\/10, it's one of the main sources of inspiration for Ghost in the Shell, Blade Runner, and The Matrix. easier read, not too long, and it's an all time classic.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/Xubat","date":"2016-05-18","delete":false,"datetime":"May 18th 2016 20:07","timestamp":1463602062,"loggedIn":false,"username":"Xubat","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":23350,"user":39841,"comment":"A Nameless Witch by A. Lee Martinez: A tale of vengeance, true love, and cannibalism 9\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/FieryMon","date":"2016-05-16","delete":false,"datetime":"May 16th 2016 20:08","timestamp":1463429312,"loggedIn":false,"username":"FieryMon","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":23347,"user":81026,"comment":"Twilight series, throw things at me now, preferably nudes \u00f0\u0178\u02dc\u0153","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/MrWobbly","date":"2016-05-16","delete":false,"datetime":"May 16th 2016 18:20","timestamp":1463422817,"loggedIn":false,"username":"MrWobbly","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[{"id":23354,"user":81026,"comment":"Aw, my humour got downvoted :(","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/MrWobbly","date":"2016-05-17","delete":false,"datetime":"May 17th 2016 06:13","timestamp":1463465619,"loggedIn":false,"username":"MrWobbly","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":23347,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":23345,"user":81437,"comment":"Try Larry Corriea's Monster Hunter International Series - Its really good.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/BookGoblinz","date":"2016-05-16","delete":false,"datetime":"May 16th 2016 15:04","timestamp":1463411097,"loggedIn":false,"username":"BookGoblinz","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22951,"user":81208,"comment":"The Long Earth series by Terry Pratchett and Stephen Baxter. The expected irreverence and humour of Terry Pratchett is encapsulated in Stephen Baxter's usual Sci-Fi style, and it is a blend that works fantastically. I couldn't help but find the characters engaging and the narrative pacing (to me at least) was always spot on.The only issue I had with the series was the Long Mars, as it seemed like a disparate aspect to the primary story. Kind of like a filler episode. Worth a read tough8\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/mrgimp","date":"2016-04-25","delete":false,"datetime":"Apr 25th 2016 16:35","timestamp":1461602142,"loggedIn":false,"username":"mrgimp","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22937,"user":29669,"comment":"I haven't found any other fans of it, but I really like the Coldfire Trilogy, the half of it that I've read so far. 8.5\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/SaintHellion","date":"2016-04-22","delete":false,"datetime":"Apr 22nd 2016 06:27","timestamp":1461306458,"loggedIn":false,"username":"SaintHellion","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22925,"user":81196,"comment":"Childhood's End is by far my favorite book","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/SmallPaer","date":"2016-04-20","delete":false,"datetime":"Apr 20th 2016 07:27","timestamp":1461137223,"loggedIn":false,"username":"SmallPaer","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[{"id":22952,"user":81208,"comment":"Anything by Arthur C Clarke really. The man's mind was an interesting place.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/mrgimp","date":"2016-04-25","delete":false,"datetime":"Apr 25th 2016 16:36","timestamp":1461602186,"loggedIn":false,"username":"mrgimp","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":22925,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22893,"user":65823,"comment":"I really suggest the Sword of Truth series by Terry Goodkind. It has its hard points in it for me but I would give it a 9\/10 for most of the books I really enjoy.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/SulphonicAxe","date":"2016-04-18","delete":false,"datetime":"Apr 18th 2016 03:10","timestamp":1460949012,"loggedIn":false,"username":"SulphonicAxe","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":3,"level":1,"children":[{"id":22949,"user":81208,"comment":"I can second this. I've read all of them and couldn't put them down. They can be a little dry at times but bear with them as Goodkind is incredibly descriptive and can really stir the imagination quite vividly.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/mrgimp","date":"2016-04-25","delete":false,"datetime":"Apr 25th 2016 16:27","timestamp":1461601656,"loggedIn":false,"username":"mrgimp","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":2,"children":[],"deleted":0,"parent":22893,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22894,"user":65823,"comment":"Oh another is the Inheritance Cycle by Christopher Paolini. Eragon the movie truly didn't give the books justice I would rate 8\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/SulphonicAxe","date":"2016-04-18","delete":false,"datetime":"Apr 18th 2016 03:13","timestamp":1460949204,"loggedIn":false,"username":"SulphonicAxe","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":22893,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22891,"user":81166,"comment":"i can't list all that i've read, but i always recommend the Night Angel Trilogy by Brent Weeks to people interested in fantasy stuff. mature book with knights, assassins, and magic!! 9\/10 idea, 7\/10 plot, and 10\/10 originality for a solid 8.7\/10 :)","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/SoftSocks","date":"2016-04-18","delete":false,"datetime":"Apr 18th 2016 02:34","timestamp":1460946841,"loggedIn":false,"username":"SoftSocks","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22788,"user":6694,"comment":"I'm really into The Orphan's Tale by Catheryne Valentine right now. It's beautiful imagery and is kind of like One Thousand and One Nights. Neil Gaiman is always a good choice though too.
\noh and Never Let Me Go is another favorite of mine! the movie is excellent as well. I won't tell you what it is about, because I don't want to give the plot away. just read it without any further knowledge. It's short but so good!","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/giraffe.jpg","link":"\/profile\/libbeast","date":"2016-04-09","delete":false,"datetime":"Apr 09th 2016 05:22","timestamp":1460179346,"loggedIn":false,"username":"libbeast","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22783,"user":81047,"comment":"I really like Philip K Dick! Do Androids Dream of Electric Sheep\/Bladerunner and A Scanner Darkly. The movies are worth a watch too!","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/giraffe.jpg","link":"\/profile\/Metroluxforever","date":"2016-04-08","delete":false,"datetime":"Apr 08th 2016 08:33","timestamp":1460104401,"loggedIn":false,"username":"Metroluxforever","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":3,"level":1,"children":[{"id":22950,"user":81208,"comment":"I read "Do Androids Dream of Electric Sheep" back in middle school and enjoyed it immensely. I might have to revisit it actually, thanks for the reminder!","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/mrgimp","date":"2016-04-25","delete":false,"datetime":"Apr 25th 2016 16:31","timestamp":1461601875,"loggedIn":false,"username":"mrgimp","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":22783,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":22435,"user":80827,"comment":"Hyperion 9\/10. Lord of the Rings 9\/10. Speaker for the Dead 9.5\/10. American Gods 8.5\/10. That's all I can think off the top of my head atm.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/MouseRat","date":"2016-03-19","delete":false,"datetime":"Mar 19th 2016 03:59","timestamp":1458359961,"loggedIn":false,"username":"MouseRat","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21986,"user":78174,"comment":"Two really good authors are Anne McCafferty (Sci-Fi) and Mercedes Lackey (Fantasy)","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/giraffe.jpg","link":"\/profile\/YouHaveItAllWrong","date":"2016-03-06","delete":false,"datetime":"Mar 06th 2016 13:17","timestamp":1457270221,"loggedIn":false,"username":"YouHaveItAllWrong","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21619,"user":80235,"comment":"Dune-Herbert Frank. The Last Question-AsimovThe Foundation Series-AsimovAll 10\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/Wordofguy","date":"2016-02-18","delete":false,"datetime":"Feb 18th 2016 01:28","timestamp":1455758897,"loggedIn":false,"username":"Wordofguy","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21584,"user":66742,"comment":"House of Leaves will make you question everything. The immutable space of the room that surrounds you, the aching void of the night sky. Everything","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/longusernameisloooooooooooooooooooooooooooooooooo9ooooooooooooo","date":"2016-02-13","delete":false,"datetime":"Feb 13th 2016 10:27","timestamp":1455359253,"loggedIn":false,"username":"longusernameisloooooooooooooooooooooooooooooooooo9ooooooooooooo","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":3,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21514,"user":39408,"comment":"The Dresden Files 10\/10 except for the first 2-3.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/theblackking","date":"2016-02-09","delete":false,"datetime":"Feb 09th 2016 05:03","timestamp":1454994221,"loggedIn":false,"username":"theblackking","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21473,"user":45241,"comment":"armor by John steakly and old mans war are both amazing!","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/crewchief226","date":"2016-02-03","delete":false,"datetime":"Feb 03rd 2016 22:28","timestamp":1454538525,"loggedIn":false,"username":"crewchief226","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21461,"user":79955,"comment":"I really enjoyed Starman Jones (Heinlein) when I was younger.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/PNWRedHerring","date":"2016-02-03","delete":false,"datetime":"Feb 03rd 2016 05:20","timestamp":1454476853,"loggedIn":false,"username":"PNWRedHerring","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21459,"user":79684,"comment":"Isaac Asimov stuff, There's a book called Robopocalypse which I definitely recommend, and any books by Robert A. Heinlein are always great.
\n
\nHope that helps! Let me know if you pick any of them up :)","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/Elerich","date":"2016-02-03","delete":false,"datetime":"Feb 03rd 2016 02:29","timestamp":1454466587,"loggedIn":false,"username":"Elerich","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[{"id":21618,"user":80235,"comment":"I Robot is one of Asimov's best. 10\/10 times better than the movie","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/Wordofguy","date":"2016-02-18","delete":false,"datetime":"Feb 18th 2016 01:26","timestamp":1455758789,"loggedIn":false,"username":"Wordofguy","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":21459,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":1,"type":"1","type_string":"topic"},{"id":21424,"user":70407,"comment":"Do you still need some? I have been keeping a big list in my notes just because.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/Arlwynne","date":"2016-02-01","delete":false,"datetime":"Feb 01st 2016 16:15","timestamp":1454343333,"loggedIn":false,"username":"Arlwynne","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21352,"user":79870,"comment":"For hardcore sci-fi? All of Isaac Asimov. Just all of it. Definitely an 11\/10.
\n
\nFor softer stuff? Lookup "The Moon is A Cruel Mistress" (9\/10) and "Orphans of the Sky" (8\/10) by Robert A. Heinlein.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/judahnator","date":"2016-01-29","delete":false,"datetime":"Jan 29th 2016 03:57","timestamp":1454039840,"loggedIn":false,"username":"judahnator","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21349,"user":20709,"comment":"technically all works of haruki Murakami is surrealist, but 1q84 is good, Norwegian wood, wind up bird Chronicle, Kafka by the seashore are all classics.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/cyanm","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 22:22","timestamp":1454019764,"loggedIn":false,"username":"cyanm","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21343,"user":42510,"comment":"Mistborn, by Brandon Sanderson 11\/10 (Seriously. A perfect trilogy.)Name of the Wind & Wise Man's Fear by Patrick Rothfuss, 9\/10R.A. Salvatore's series about Drizzt 8\/10Dragonlance by Margaret Weis & Tracy Hickman (Core 3 books, Dragons of Autumn Twilight is the first, is the good starting point) 8\/10Wheel of Time by Robert Jordan 8\/10 (I haven't finished it yet)Sword of Truth by Terry Goodkind 8\/10 (It gets very heavy handed with the pro capitalism point of view, but it's very good)
\n
\nAll in All, just read everything Brandon Sanderson has ever written and you'll be a happy camper.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/Benorf","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 21:39","timestamp":1454017149,"loggedIn":false,"username":"Benorf","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":3,"level":1,"children":[{"id":21668,"user":80291,"comment":"Great recommendations here. I prefer Rothfuss over Sanderson but both are great.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/Vaarky","date":"2016-02-20","delete":false,"datetime":"Feb 20th 2016 01:39","timestamp":1455932392,"loggedIn":false,"username":"Vaarky","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":2,"children":[],"deleted":0,"parent":21343,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21341,"user":11051,"comment":"The Final Empire is an incredible series.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/Laxusdex","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 19:18","timestamp":1454008682,"loggedIn":false,"username":"Laxusdex","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21336,"user":78257,"comment":"The Dark Tower by Stephen King is probably the best fiction I've ever read. It's... old western\/fantasy\/horror\/sci-fi... You need to read it to understand. And do! It has literally changed the way I look at the world. 11\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/TheSire","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 15:31","timestamp":1453995060,"loggedIn":false,"username":"TheSire","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21335,"user":-1,"comment":"+1 for Ready Play One. easily a 8-9\/10 for me and is a good book you can read multiple times","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 13:11","timestamp":1453986662,"loggedIn":false,"username":"Anonymous","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21334,"user":77040,"comment":"+1 for Wheel of Time, just finished it. Gets a bit slow but picks up again very well. 7\/10.
\nTerry Pratchett - 10\/10. Raymond E. Fesit, Riftwar saga - 7.5\/10.
\nLegend of Drizzt - 8\/10 (loads of fun those ones).
\nBrandon Sanderson, Mistborn - 7\/10. Steven Erikson, Malazan Books of the Fallen 9\/10 (heavy but brilliant).","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/bumhuggery","date":"2016-01-28","delete":false,"datetime":"Jan 28th 2016 13:01","timestamp":1453986085,"loggedIn":false,"username":"bumhuggery","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21328,"user":79605,"comment":"Name of the Wind. 9\/10!","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/giraffe.jpg","link":"\/profile\/coldpopcorn","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 23:47","timestamp":1453938458,"loggedIn":false,"username":"coldpopcorn","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":4,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21326,"user":-1,"comment":"1984 by George Orwell. Tough shit, 911\/Muricah.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 22:16","timestamp":1453932994,"loggedIn":false,"username":"Anonymous","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21325,"user":57940,"comment":"ready player one","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/Myfirstnamewaschosen","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 22:10","timestamp":1453932620,"loggedIn":false,"username":"Myfirstnamewaschosen","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21323,"user":-1,"comment":"Ghosts\/Aliens by Trey Hamburger, it's a Sci-Fi\/Comedy kind of book. The whole story is focused on these two friends and their investigations of what's possibly paranormal activity. I heard about it from a YouTube channel I'll sometimes watch and gave it a go. It's fun, humorous, and quotable (which I always find to be a plus). Rating: 8.4-8.6\/10","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:21","timestamp":1453929714,"loggedIn":false,"username":"Anonymous","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21322,"user":489,"comment":"the rivers of london - ben aarovanovitch (supernatural cups and robbers, rivers are people, magic war in the London underground)
\n
\ntales of the raksura - Martha wells (dragon people in a matriarchal society begin a mass exodus whilst fighting a deadly enemy)
\n
\nsoulless series Gail carriger (Victorian female born with no soul schools the vampire and werewolf population of steam punk London)
\n
\nhowls moving castle series - Dianna Wynne Jones (whimsical spoilt wizard faces off against no nonsense girl during the throes of war, complete with love and curses and sassy fire demons)","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/giraffe.jpg","link":"\/profile\/omikone","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:20","timestamp":1453929618,"loggedIn":false,"username":"omikone","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21321,"user":78785,"comment":"ive kinda turned to comic books lately, if you really want a long term serise the legend of Drizzt by R.A salvatore or anything published by the forgotten realms group","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/campingtomz","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:18","timestamp":1453929495,"loggedIn":false,"username":"campingtomz","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21320,"user":78785,"comment":"if you want a mental mind fuck the invasion earth by RL hubbard, this guy had alot of problems its a good sci fi book but a really mental fuck.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/campingtomz","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:13","timestamp":1453929215,"loggedIn":false,"username":"campingtomz","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21319,"user":1,"comment":"I don't have much time for real books but love audio books.
\n
\nThe Pillars of Reality Series
\nLegendarium
\nand Truesight are all great.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/cat.jpg","link":"\/profile\/TheBritishAreComing","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:12","timestamp":1453929149,"loggedIn":false,"username":"TheBritishAreComing","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":1,"level":1,"children":[],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"},{"id":21317,"user":78785,"comment":"look up Black company by glen cook, wheel of time by robert jordan, Terry goodkind sword of truth.","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/campingtomz","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:11","timestamp":1453929091,"loggedIn":false,"username":"campingtomz","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":3,"level":1,"children":[{"id":21318,"user":78785,"comment":"ohh rating 8, 10 , 8.5","image":"https:\/\/chatplayshare.com\/themes\/default\/images\/profiles\/rhino.jpg","link":"\/profile\/campingtomz","date":"2016-01-27","delete":false,"datetime":"Jan 27th 2016 21:11","timestamp":1453929119,"loggedIn":false,"username":"campingtomz","upclass":"","downclass":"","upvoted":false,"downvoted":false,"score":2,"level":2,"children":[],"deleted":0,"parent":21317,"previews":[],"entity":2265,"guilds":0,"type":"1","type_string":"topic"}],"deleted":0,"parent":0,"previews":[],"entity":2265,"guilds":1,"type":"1","type_string":"topic"}],
entityID : "2265",
title : "Comments",
element : "discussion_container",
buttonText : "Add Comment",
buttonClasses : "small_button small_button_green",
answerClasses : ""
};
if(typeof($d) == "undefined"){
$d = {
initCheckboxes:function(element){
element.find("input[type=checkbox]").each(function(){
var c = $(this);
if(!c.attr("checkbox_setup")){
c.attr("checkbox_setup",true);
var id = c.attr("id");
var container = $(document.createElement("div"));
container.addClass(c.get(0).className);
c.get(0).className = "";
container.addClass("checkbox");
container.attr("id",id);
container.prop("name",id);
c.attr("id",id + "-checkbox");
container.prop("checked",c.get(0).checked);
container.prop("value",c.val());
container.prop("type","checkbox");
container.attr("type","checkbox");
if(c.prop("title")){container.append("
"+c.prop("title")+"");}
c.before(container);
c.remove();
container.append(c);
if(c.get(0).checked){
container.addClass("checked");
}
var checkUncheck = function(){
c.addClass("toSave");
if(c.get(0).checked){container.addClass("checked");}
else{container.removeClass("checked");}
};
container.click(function(){
var container = $(this);
c.click();
container.prop("checked",c.get(0).checked);
checkUncheck();
});
}
});
},
initSelects: function(element){
try{
if(!this.helpers.isMobile()){
element.find("select").select2();
}
}catch(e){}
},
session: {
isLoggedIn:function(){return false;}
},
helpers: {
stripHTML : function(string){
var div = $(document.createElement("div"));
div.html(string.replace(/(
|
|
)/gm,'\n').replace(/<\/p>/gm,'\n\n'));
return div.text().trim();
},
showOverlay : function(containers, content, realignLeft, realignTop) {
if(!content) {content = "";}
// Adds a default loading icon
if($.trim(content) == "") {content = "
";}
if(containers) {
containers.each(function() {
var container = $(this);
container.append("
");
var contentDiv = $(".details_overlay_content");
if(typeof(realignLeft) == "undefined" || realignLeft == true || realignLeft == null){
var contentLeft = (container.outerWidth()/2)-(contentDiv.outerWidth()/2);
contentDiv.css({left:contentLeft+"px"});
}
if(typeof(realignTop) == "undefined" || realignTop == true || realignTop == null){
var contentTop = (container.outerHeight()/2)-(contentDiv.outerHeight()/2);
contentDiv.css({top:contentTop+"px"});
}
});
}
},
hideOverlay : function(container) {
if(container) {container.find("details_overlay").remove();}
else {
$(".details_overlay").each(function() {
$(this).remove();
});
}
},
},
network:{
request:$.ajax,
post:$.post,
get:$.get
}
}
plugin.integrate(null,options);
}else{
$d.plugins.add(plugin,options);
$d.plugins.get("comments").integrate($d.plugins,options);
$d.network.addHandler("comments", "update-score",function(data){
if(typeof(data) != "undefined" && data != null){
var comment = $(".comment_item[data-id="+data.comment+"]");
if(comment.length > 0){
if(typeof(plugin.comments[data.comment]) == "undefined"){
plugin.comments[data.comment] = {};
}
if(typeof(plugin.comments[data.comment].score) == "undefined"){
plugin.comments[data.comment].score = 0;
}
plugin.comments[data.comment].score = data.score;
comment.attr("point-count",data.score);
comment.find(".comment_score").html(data.score + " points");
}
}
});
$d.network.addHandler("comments","deleted",function(data){
if(typeof(data) != "undefined" && data != null){
var p = $(".comment_item[data-id="+data+"]");
var children = $(".comment_item[data-parent="+data+"]");
if(children.length > 0){
p.find(".comment_username").html("deleted");
p.find(".comment_reply").remove();
p.find(".comment_delete").remove();
p.find(".comment_voting_buttons").remove();
p.addClass("comment_deleted");
p.find(".comment_content").html("");
$d.helpers.hideOverlay();
}else{
p.remove();
}
}
});
$d.network.addHandler("comments","added",function(data){
if(typeof(data.comment) != "undefined"){
var newComment = data;
if(typeof(newComment.error) == "undefined"){
if(!plugin.comments[newComment.id]){
setTimeout(function(){
plugin.comments[newComment.id] = newComment;
var pComment = plugin.processComment(newComment,false,$("#comments_list"),true);
$d.plugins.get("comments").updateList();
},1000);
}
}
}
});
}
" + options.title + "
"; } if($d.session && $d.session.isLoggedIn()){ html += "