amhnews/linux — comment on commit daf2f1b57cc277457f389e4953d21b81e76062a4
File:  line 0
By amhnews:

var Nabble = new Object();
Nabble.defaultHeight = 700;
Nabble.currentHeight = 0;
Nabble.counter = 0;
Nabble.title = document.title == ""? "" : document.title + " - ";
Nabble.cookieList = ['tview','userId','username','password','anonymousName','anonymousId','date_fmt','max_width','font_size','avatarA','avatarB','visible','admin-notice'];
Nabble.resizeTimeoutID;
Nabble.context = 'http://newspaper.2286147.n4.nabble.com';
Nabble.defaultUrl = 'http://newspaper.2286147.n4.nabble.com/Forum-f3504557.html';

Nabble.get = function(id) { return document.getElementById(id); };

Nabble.resizeTimeout = function() {
Nabble.resizeTimeoutID = setTimeout(Nabble.showMoreLink, 6000);
};

Nabble.cancelTimeout = function() {
if (Nabble.resizeTimeoutID) {
clearInterval(Nabble.resizeTimeoutID);
Nabble.get('nabblemore').style.display = 'none';
Nabble.resizeTimeoutID = null;
}
};

Nabble.showMoreLink = function() {
if (Nabble.resizeTimeoutID) {
Nabble.get('nabblemore').style.display = 'block';
}
};

Nabble.showMore = function() {
if (Nabble.currentHeight == 0)
Nabble.currentHeight = Nabble.defaultHeight;
Nabble.currentHeight += 300;
Nabble.get('nabbleiframe').style.height = Nabble.currentHeight + 'px';
};

Nabble.escape = function(value) {
if (typeof value == 'string') {
var hasSpace = value.indexOf(' ') >= 0;
var hasQuote = value.indexOf('"') >= 0;

value = value.replace(/\;/g, '%3B');
value = value.replace(/"/g, '\\"');

if (hasSpace || hasQuote)
value = '"' + value + '"';
}
return value;
};

Nabble.unescape = function(value) {
if (value.charAt(0) == '"' && value.charAt(value.length-1) == '"')
value = value.substring(1, value.length-1);

value = value.replace(/\\"/g, '"');
value = value.replace(/%3B/g, ';');
return value;
};

Nabble.setCookie = function(name, value) {
document.cookie = name + "=" + Nabble.escape(value) + "; path=/";
};

Nabble.getCookie = function(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return Nabble.unescape(dc.substring(begin + prefix.length, end));
};

Nabble.getCookieParam = function() {
var p = '';
for (var i=0; i < Nabble.cookieList.length;i++) {
var v = Nabble.getCookie(Nabble.cookieList[i]);
if (v && v != '') {
p += Nabble.cookieList[i] + '=' + v + ';';
}
}
return p;
};

Nabble.setPersistentCookie = function(name, value) {
var expires = new Date();
expires.setFullYear(expires.getFullYear()+10);
var curCookie = name + "=" + Nabble.escape(value) + "; expires=" + expires.toGMTString() + "; path=/";
document.cookie = curCookie;
};

Nabble.deleteCookie = function(name) {
document.cookie = name + "=" +
"; path=/" +
"; expires=Thu, 01-Jan-1970 00:00:01 GMT";
};

Nabble.noHash = function(url) {
var pos = url.indexOf('#');
return (pos>-1)?url.substring(0, pos):url;
};

Nabble.debug = function(s) {
if (Nabble.debugElement == 0)
return;
if (!Nabble.debugElement) {
Nabble.debugElement = Nabble.get('debug');
if (!Nabble.debugElement) {
Nabble.debugElement = 0;
return;
}
}
Nabble.debugElement.innerHTML = Nabble.debugElement.innerHTML+s+'
';
};

Nabble.loadScript = function(url) {
Nabble.debug('Loading script: ' + url);
var e = document.createElement("script");
e.src = url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
};

Nabble.getJs = function(servlet, keys) {
if (!window.clientID)
return;
var p = '';
for (var i=0;i 0)
return url + '&cid=' + window.clientID;
else if (url.indexOf('.jtp') > 0)
return url + '?cid=' + window.clientID;
else
return url + ';cid=' + window.clientID;
};

Nabble.getClientID = function() {
var clientID = Nabble.getCookie('clientID');
if (!clientID) {
clientID = new Date().getTime() + '-' + Math.ceil(Math.random() * 1000);
Nabble.setCookie('clientID', clientID);
}
return clientID;
};

Nabble.restart = function(nodeId, baseUrl) {
Nabble.debug('Restart -- baseUrl=' + baseUrl);
Nabble.context = baseUrl;
Nabble.defaultUrl = baseUrl+'/';
Nabble.start();
};

Nabble.getConf = function() {
return window.nabble_ignore_scroll? 'noscroll;':'';
};

Nabble.start = function() {
Nabble.infoLoaded = false;
window.clientID = Nabble.getClientID();

var hash = location.hash;
var pipe = hash.indexOf('|');
var realHash = '';
if (pipe > 0) {

realHash = hash.substring(pipe);
hash = hash.replace(realHash, '');
realHash = realHash.substring(1);
}

Nabble.hash = hash;
Nabble.realHash = realHash;
Nabble.infoUrl = Nabble.context+"/embed/EmbedInfo.jtp?node=3504557&cid=" + window.clientID + '&cookies=' + encodeURIComponent(Nabble.getCookieParam()) + "&hash=" + realHash + '&conf=' + Nabble.getConf() + "&_=" + new Date().getTime() + "#" + Nabble.noHash(location.href);
var emptyUrl = Nabble.context+"/util/Empty.jtp";
var html = "

";
html += "

view more

";
html += "";
html += "";
html += "";
html += "";
var div = Nabble.get('nabbleforum');
div.innerHTML = html;
};

Nabble.loadMain = function() {
Nabble.debug('Loading main page...infoLoaded='+Nabble.infoLoaded);
if (!Nabble.infoLoaded) {
Nabble.debug('InfoUrl='+Nabble.infoUrl);
Nabble.get('nabbleinfo').setAttribute('src',Nabble.infoUrl);
Nabble.infoLoaded = true;
return;
}
var width = window.nabble_width? window.nabble_width : '100%';
var currentUrl = Nabble.getCurrentUrl();
Nabble.debug('CurrentUrl='+currentUrl);
var m = '';
Nabble.get('nabblemain').innerHTML = m;
Nabble.resizeTimeout();
}

Nabble.start();