/*
- * brisk - commons.js
+ * brisk / fieldify - commons.js
*
- * Copyright (C) 2006-2012 Matteo Nastasi
+ * Copyright (C) 2006-2016 Matteo Nastasi
* mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
})()
-function addEvent(obj,type,fn)
+function addEvent(obj, type, fn)
{
if (obj.addEventListener) {
obj.addEventListener( type, fn, false);
var is_conn = (sess == "not_connected" ? false : true);
// alert("xhr_wr: "+xhr_wr+" is_conn: "+is_conn);
- xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+'mesg='+mesg, (is_conn ? true : false));
+ xhr_wr.open('GET', 'index_wr.php?&'+(is_conn ? 'sess='+sess : '')+'&stp='+gst.st+'&mesg='+mesg, (is_conn ? true : false));
xhr_wr.setRequestHeader("If-Modified-Since", new Date().toUTCString());
xhr_wr.onreadystatechange = function() { return; };
if (typeof(g_debug) == 'number' && g_debug > 0
if var name == '__POST__' than all other vars will be managed as POST content
and the call will be a POST
*/
-function server_request()
+function server_request(page, sess)
{
var xhr_wr = createXMLHttpRequest();
var i, collect = "", post_collect = null, is_post = false;
if (arguments.length > 0) {
- for (i = 0 ; i < arguments.length ; i+= 2) {
+ for (i = 2 ; i < arguments.length ; i+= 2) {
if (arguments[i] == "__POST__") {
is_post = true;
post_collect = "";
}
// alert("Args: "+arguments.length);
- var is_conn = (sess == "not_connected" ? false : true);
-
- // console.log("server_request:preresp: "+xhr_wr.responseText);
-
+ var uri = page + '?' + (sess != null ? 'sess=' + sess + '&' : '') + collect;
if (is_post) {
- xhr_wr.open('POST', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+collect, false);
+ xhr_wr.open('POST', uri, false);
xhr_wr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}
else {
- xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+collect, false);
+ xhr_wr.open('GET', uri, false);
}
xhr_wr.onreadystatechange = function() { return; };
xhr_wr.send(post_collect);
}
function act_chatt(value)
{
- send_mesg("chatt|"+encodeURIComponent(value));
+ if (value.substring(0, 6) == "/info ") {
+ info_show(value.substring(6));
+ }
+ else {
+ send_mesg("chatt|"+encodeURIComponent(value));
+ }
/*
obj.disabled = true;
obj.value = "";
send_mesg("roadmap");
}
-function act_whysupport()
-{
- send_mesg("whysupport");
-}
-
function act_lascio()
{
send_mesg("lascio");
{
// alert("postact_logout");
try {
- hstm.abort();
+ xstm.abort();
} catch (e) {}
// eraseCookie("sess");
var CHATT_MAXLINES = 40;
-function user_decorator(user)
+function user_decorator(user, is_real)
{
- var name;
- var flags = user[0];
- if ((flags & 0x03) != 0)
- name = "<span class='au" + (flags & 0x03) + "'>"+user[1]+"</span>";
- else
+ var name, i, sp = "", cl = "";
+ var flags = user[0] & 0x03 | ((user[0] & 0x0c0000) >> 16);
+
+ // console.log(user[1]+" FLAGS: "+flags);
+
+ for (i = 0 ; i < 4 ; i++) {
+ if (flags & (1 << i)) {
+ cl += sp + "au" + i + (is_real ? "" : "_off");
+ sp = " ";
+ }
+ }
+
+ if (flags != 0) {
+ name = "<span class='" + cl + "'><span class='" +
+ (is_real && (flags & 0xfffffe && ((flags & 0x01) == 0)) ? "id_usr" : "") +
+ "'>" + user[1] + "</span></span>";
+ }
+ else {
name = user[1];
+ }
return (name);
}
var content = "";
var val_el;
- content = user_decorator(el);
+ content = user_decorator(el, true);
content += state_add(el[0],(typeof(el[2]) != 'undefined' ? el[2] : null));
return (content);
var flags;
var isauth;
var bolder = [ (data[0] | 1), data[1] ];
- name = user_decorator(bolder);
+ name = user_decorator(bolder, false);
if ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight >= 0)
must_scroll = true;
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+ while (c.charAt(0)==' ')
+ c = c.substring(1,c.length);
+ if (c.indexOf(nameEQ) == 0)
+ return c.substring(nameEQ.length,c.length);
}
return null;
}
function onunload_cb () {
- if (typeof(hstm) != "undefined")
- hstm.the_end = true;
+ if (typeof(xstm) != "undefined")
+ xstm.the_end = true;
act_shutdown();
// console.log("A: "+a+" B: "+b);
}
-function sidebanner_init()
+function sidebanner_init(idx)
{
- setInterval(sidebanner_cb, 666);
-}
-
-function sidebanner2_init()
-{
- setInterval(sidebanner2_cb, 666);
-}
-
-function sidebanner_cb()
-{
- var a, b;
-
- a = $('sidebanner').style.backgroundColor;
- b = $('sidebanner').style.borderLeftColor;
-
- $('sidebanner').style.backgroundColor = b;
- $('sidebanner').style.borderColor = a+" "+a+" "+a+" "+a;
-
- // console.log("A: "+a+" B: "+b);
+ setInterval(function () { sidebanner_cb(idx); }, 666);
}
-function sidebanner2_cb()
+function sidebanner_cb(idx)
{
var a, b;
- a = $('sidebanner2').style.backgroundColor;
- b = $('sidebanner2').style.borderLeftColor;
+ a = $('sidebanner'+idx).style.backgroundColor;
+ b = $('sidebanner'+idx).style.borderLeftColor;
- $('sidebanner2').style.backgroundColor = b;
- $('sidebanner2').style.borderColor = a+" "+a+" "+a+" "+a;
+ $('sidebanner'+idx).style.backgroundColor = b;
+ $('sidebanner'+idx).style.borderColor = a+" "+a+" "+a+" "+a;
// console.log("A: "+a+" B: "+b);
}
download_mgr.prototype = {
ifra: null
}
+
+function submit_click(obj)
+{
+ obj.form.elements['realsub'].value = obj.id;
+}
+
+function class_check(item, cls_name)
+{
+ if ((" " + item.className + " ").indexOf(" " + cls_name + " ") == -1)
+ return (false);
+ else
+ return (true);
+}
+
+function class_add(item, cls_name)
+{
+ if (! class_check(item, cls_name)) {
+ item.className = item.className + " " + cls_name;
+ }
+}
+
+function class_rem(item, cls_name)
+{
+ var item_spc = " " + item.className + " ";
+ var cls_spc = " " + cls_name + " ";
+ var cls_out;
+
+ var pos = item_spc.indexOf(cls_spc);
+ if (pos != -1) {
+ cls_out = item_spc.substring(0, pos) + item_spc.substring(pos + cls_spc.length - 1);
+ if (cls_out == " ") {
+ item.className = "";
+ }
+ else {
+ item.className = cls_out.substring(1, cls_out.length - 1);
+ }
+ }
+}
+
+function class_subst(item, cls_out, cls_in)
+{
+ class_rem(item, cls_out);
+ class_add(item, cls_in);
+}
+