* brisk - commons.js
*
* Copyright (C) 2006-2015 Matteo Nastasi
- * mailto: nastasi@alternativeoutput.it
+ * mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
*
var mlang_commons = { 'imgload_a' : { 'it' : 'Immagini caricate ',
'en' : 'Loaded images ' },
- 'imgload_b' : { 'it' : '%.',
+ 'imgload_b' : { 'it' : '%.',
'en' : '%.' },
'gamleav' : { 'it' : 'Sei sicuro di volere lasciare questa mano?' ,
'en' : 'Are you sure to leave this game?' },
return hex;
}
-function getStyle(x,IEstyleProp, MozStyleProp)
+function getStyle(x,IEstyleProp, MozStyleProp)
{
if (x.currentStyle) {
var y = x.currentStyle[IEstyleProp];
param[i-2] = arguments[i];
}
}
-
+
if(typeof(fn)=='function') {
-
+
return (function (fn,ms,param) {
var fo = function () {
fn.apply(window,param);
};
- return nativeSetInterval(fo,ms);
+ return nativeSetInterval(fo,ms);
})(fn,ms,param);
}
else if(typeof(fn)=='string')
param[i-2] = arguments[i];
}
}
-
+
if(typeof(fn)=='function') {
-
+
return (function (fn,ms,param) {
var fo = function () {
fn.apply(window,param);
function preload_images(arr,idx)
{
var im = new Image;
-
+
// $("imgct").innerHTML = "Stiamo caricando "+arr[idx]+"%.<br>";
im.onload = update_images;
im.onerror = error_images;
{
var xhr_wr = createXMLHttpRequest();
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 : '')+'&stp='+gst.st+'&mesg='+mesg, (is_conn ? true : false));
xhr_wr.setRequestHeader("If-Modified-Since", new Date().toUTCString());
// alert("Args: "+arguments.length);
var is_conn = (sess == "not_connected" ? false : true);
-
+
// console.log("server_request:preresp: "+xhr_wr.responseText);
if (is_post) {
}
xhr_wr.onreadystatechange = function() { return; };
xhr_wr.send(post_collect);
-
+
if (xhr_wr.responseText != null) {
// console.log("server_request:resp: "+xhr_wr.responseText);
return (xhr_wr.responseText);
tout: 0,
action: null,
srcend: null,
-
+
setstart: function(x0,y0)
{
this.x0 = x0;
this.y0 = y0;
},
-
+
setaction: function(act)
{
this.action = act;
},
-
+
settime: function(time)
{
this.step_free = parseInt(this.step_n * this.free);
}
},
-
+
start: function(st)
{
// $("logz").innerHTML += " xxxxxxxxxxxxxxxxxxxxxSTART<br>";
this.st = st;
this.st.st_loc_new++;
-
+
this.img.style.visibility = "visible";
setTimeout(function(obj){ obj.animate(); }, this.deltat, this);
},
-
+
animate: function()
{
// $("log").innerHTML = "Val " + this.step_cur + " N: " + this.step_n + "<br>";
{
var clo, box;
var t = this;
-
+
this.st = st;
this.ancestor = document.body;
-
+
this.st.st_loc_new++;
clo = document.createElement("input");
box.style.visibility = "visible";
this.notitag = box;
-
+
this.ancestor.appendChild(box);
-
+
this.toutid = setTimeout(function(obj){ obj.unblock(); }, tout, this);
if (block_time != 0) {
this.st.st_loc++;
}
},
-
+
hide: function()
{
clearTimeout(this.toutid);
{
notify_ex.call(this, st, text, tout, butt, w, h, false, 0);
}
-
+
function globst() {
this.st = -1;
this.st_loc = -1;
function remark_step()
{
var ct = $("remark").l_remct;
-
+
if (ct != 0) {
ct++;
if (ct > 2)
}
else
$("remark").className = "remark0";
-
+
return;
}
content = user_decorator(el, true);
content += state_add(el[0],(typeof(el[2]) != 'undefined' ? el[2] : null));
-
+
return (content);
}
}
// $("txt").innerHTML;
-
+
if (must_scroll) {
$("txt").scrollTop = 10000000;
}
}
function onunload_cb () {
-
+
if (typeof(xstm) != "undefined")
xstm.the_end = true;
act_shutdown();
-
+
return(false);
}
var length = div.childNodes.length, results = new Array(length);
while (length--)
results[length] = div.childNodes[length];
-
+
for (i=0 ; i<results.length ; i++)
memo = memo + results[i].nodeValue;
}
}
}
-function playsound(tag, sound) {
- // g_withflash is a global var
- if (g_withflash) {
- $(tag).innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
-'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" id="mysound" WIDTH=1 HEIGHT=1>' +
-'<PARAM NAME="movie" VALUE="../playsound.swf"><PARAM NAME="PLAY" VALUE="true"><PARAM NAME="LOOP" VALUE="false">' +
-'<PARAM NAME=FlashVars VALUE="streamUrl='+sound+'">' +
-'<EMBED swliveconnect="true" name="mysound" src="../playsound.swf" FlashVars="streamUrl='+sound+'" PLAY="true" LOOP="false" '+
-' WIDTH=1 HEIGHT=1 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT>';
- }
+/*
+ samples = [{'name': <name>, 'file': <file>}, ... ]
+*/
+function jukebox(samples)
+{
+ var source, a;
+ this.enable = false;
+ this.audio = {};
+
+ var pro_audio_el = document.createElement('audio');
+ this.enable = !!(pro_audio_el.canPlayType && pro_audio_el.canPlayType('audio/mpeg;').replace(/no/, ''));
+ if (this.enable) {
+ for (i in samples) {
+ sample = samples[i];
+
+ this.audio[sample['name']] = a = document.createElement('audio');
+
+ source = document.createElement('source');
+ source.setAttribute('src', sample['file']);
+ source.setAttribute('type', 'audio/mpeg');
+ a.appendChild(source);
+ a.load();
+ }
+ }
+}
+
+jukebox.prototype = {
+ is_enabled: function() {
+ return this.enable;
+ },
+
+ play: function(name) {
+ var a;
+ if (! this.enable)
+ return;
+
+ if (!(name in this.audio)) {
+ return false;
+ }
+ a = this.audio[name];
+ a.currentTime = 0;
+ a.play();
+ }
}
function topbanner_init()
' . ( /* NOTE: here facebook or fake facebook */
(!$G_is_local && $_cookie_law_3party == 'true') ?
'<div class="fb-like" style="margin-top: 4px;" data-href="https://www.facebook.com/pages/Brisk-briscola-chiamata-in-salsa-ajax/716026558416911" data-share="false" data-send="true" data-width="70" data-show-faces="false" data-colorscheme="dark" layout="button_count"></div>
-' : '' ) . '<div id="proflashext" class="proflashext"><div id="proflash" class="proflash"></div></div>
+' : '' ) . '<div id="proaudioext" class="proaudioext"><div id="proaudio" class="proaudio"></div></div>
<img id="stm_stat" class="nobo" style="margin-top: 4px;" src="img/line-status_b.png">
%s
%s
var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
var g_prefs, g_prefs_new = null;
var g_listen;
-var g_withflash = false;
+var g_jukebox = null;
var g_is_spawn = 0;
var g_nd = null;
var g_brow = null;
sidebanners_init($G_sidebanner_idx);
?>
- g_withflash = DetectFlashVer(6,0,0);
- if (g_withflash == false) {
- $("proflash").innerHTML = 'Audio con Flash.<br><a href="http://www.macromedia.com/"><img class="nobo" style="padding: 4px; width:73; height: 19;" src="img/download_now_flash.gif"></a>';
+ g_jukebox = new jukebox([]);
+ if (g_jukebox.is_enabled() == false) {
+ $("proaudio").innerHTML = 'Audio HTML5 non supportato.';
+ }
+ else {
+ $("proaudioext").innerHTML = "";
}
- else
- $("proflashext").innerHTML = "";
$("nameid").focus();
}
//-->
var g_prefs, g_prefs_new = null;
var g_listen;
var g_is_spawn = 0;
- var g_withflash = false;
+ var g_jukebox = null;
var g_imgct = 0;
var g_imgtot = g_preload_img_arr.length;
var g_brow = null;
sidebanners_init($G_sidebanner_idx);
?>
sess = "<?php echo "$sess"; ?>";
-xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
+ xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
xstm.hbit_set(heartbit);
tra = new train($('room_tit'));
window.onunload = onunload_cb;
window.onbeforeunload = onbeforeunload_cb;
- g_withflash = DetectFlashVer(6,0,0);
- if (g_withflash == false) {
- $("proflash").innerHTML = 'Audio con Flash.<br><a href="http://www.macromedia.com/"><img class="nobo" style="padding: 4px; width:73; height: 19;" src="img/download_now_flash.gif"></a>';
+ g_jukebox = new jukebox([]);
+ if (g_jukebox.is_enabled() == false) {
+ $("proaudio").innerHTML = 'Audio HTML5 non supportato.';
+ }
+ else {
+ $("proaudioext").innerHTML = "";
}
- else
- $("proflashext").innerHTML = "";
// console.log("session from main: "+sess);
xstm.start();