2
// Computes the final permalink attributes for JS Comment DIVs
3
function setPermaLinks() {
4
$(".js-kit-comments").attr(
7
var anchor = $(this).attr("permalink_anchor");
9
//ugly, gotta reconstruct the url without the trailing anchor
10
var location = document.location.href;
11
var hashlen = document.location.hash.length;
13
location = location.slice(0,-hashlen);
15
return location+anchor;
21
$(window).load(function(){
22
$("#comments_control").change(
24
var selected_value = $(this).val();
25
switch(selected_value) {
27
createJsKitCommentCookie('HIDE');
28
$('.js-kit-comments').hide();
32
createJsKitCommentCookie('SHOW');
33
$('.js-kit-comments').show();
42
// js-kit comments control configuration:
43
function createJsKitCommentCookie(value) {
44
var name = 'default_comments_control_behavior';
45
var date = new Date(2038, 0, 1);
46
date.setTime(date.getTime());
47
var expires = "; expires="+date.toGMTString();
48
document.cookie = name+"="+value+expires+"; path=/";
51
function readJsKitCommentCookie() {
52
var name = 'default_comments_control_behavior';
53
var nameEQ = name + "=";
54
var ca = document.cookie.split(';');
55
for(var i=0;i < ca.length;i++) {
57
while (c.charAt(0)==' ') c = c.substring(1,c.length);
58
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
62
var config_value = readJsKitCommentCookie();
63
switch (config_value) {
65
$("#comments_control").val('HIDE');
69
$("#comments_control").val('SHOW');
73
createJsKitCommentCookie('SHOW');
76
// ugly way to create an onload that is called *after* js-kit.com's JS has finished initializing
77
// even in WebKit(Safari/Chrome/...), because they use setTimeout as well!
78
setTimeout(function(){$("#comments_control").change();},100);