}
}
-//end(''): clears loading span, if any
-//end('msg') if loading span is there, clear loading span. If loading span is there, display alert msg
-function end(optionalErrorMsg){
- var $ = jQuery;
- $(window).ready(function(){
- var elm = $('#loading_span');
- if(elm.length<1){
- return;
- }
- elm.empty().remove();
- if(optionalErrorMsg){
- $('#rightcol').hide();
- alert(optionalErrorMsg);
- }
- });
-}
function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName, isStaffOrSuperuser){
var $J = jQuery;
var wdw = window;
+
+
+ //end(''): clears loading span, if any
+ //end('msg') if loading span is there, clear loading span. If loading span is there, display alert msg
+
+ function end(optionalErrorMsg){
+ //var $J = jQuery;
+ $J(wdw).ready(function(){
+ var elm = $J('#loading_span');
+ if(elm.length<1){
+ return;
+ }
+ elm.empty().remove();
+ if(optionalErrorMsg){
+ $J('#rightcol').hide();
+ alert(optionalErrorMsg);
+ }
+ });
+ }
+
+
//grab the case of soundManager init errors:
soundManager.onerror = function() {
end('SoundManager error. If your browser does not support HTML5, Flash player (version '+soundManager.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser');
invoker: player.getContainer().find('.ts-wave'),
defaultCloseOperation: 'hide'
});
+ var closeTimeout = undefined;
+ var ci = clearTimeout;
player.bind('markerCrossed',function(data){
+ if(closeTimeout !== undefined){
+ cl(closeTimeout);
+ }
+ closeTimeout=undefined;
popupdiv.refresh(data.marker.desc,data.marker.title);
+ if(!popupdiv.isShowing()){
+ popupdiv.show();
+ }
var index = data.index;
if(index+1 == map.length || map.toArray()[index+1].offset-data.marker.offset>3){
- popupdiv.closeLater(3000);
+ closeTimeout = popupdiv.setTimeout('close',3000);
}
//consolelog('firing markercrossed');
//consolelog(data.marker.title);
- if(!popupdiv.isShowing()){
- popupdiv.show();
- }
+
});
}
//set title and close button to span whole width, if necessary\r
//closeButton.outerWidth should be zero if this.showClose = false\r
//titleInput.outerWidth(true) should be equal to titleInput.width(), as margins borders and padding are zero, however we want to calculate it safely\r
-// if(this.showClose || this.title){\r
-// var topDiv = this.getDiv().children().eq(0);\r
-// var closeBtn = topDiv.find('a').eq(0);\r
-// var titleInput = topDiv.find(':text').eq(0);\r
-// var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
-// titleInput.css({\r
-// 'maxWidth':'',\r
-// 'width':(titleW)+'px'\r
-// });\r
-// }\r
+ // if(this.showClose || this.title){\r
+ // var topDiv = this.getDiv().children().eq(0);\r
+ // var closeBtn = topDiv.find('a').eq(0);\r
+ // var titleInput = topDiv.find(':text').eq(0);\r
+ // var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
+ // titleInput.css({\r
+ // 'maxWidth':'',\r
+ // 'width':(titleW)+'px'\r
+ // });\r
+ // }\r
\r
this.shadow(); //updates shadow\r
if(focusable){\r
node.nodeValue = title;\r
}\r
\r
-// var titleIpt = subdiv.find(':text').hide();\r
-// var titleSpan = subdiv.find('span').css({'display':'inline-block','float':'left'});\r
-// if(title){\r
-// titleSpan.html(title);\r
-// }else{\r
-// titleSpan.hide();\r
-// }\r
-// var titleSpanWidth = titleSpan.html(title).width();\r
-// titleIpt.val(title).css('width',titleSpanWidth+'px');\r
-// titleSpan.html('').css('display','none');\r
+ // var titleIpt = subdiv.find(':text').hide();\r
+ // var titleSpan = subdiv.find('span').css({'display':'inline-block','float':'left'});\r
+ // if(title){\r
+ // titleSpan.html(title);\r
+ // }else{\r
+ // titleSpan.hide();\r
+ // }\r
+ // var titleSpanWidth = titleSpan.html(title).width();\r
+ // titleIpt.val(title).css('width',titleSpanWidth+'px');\r
+ // titleSpan.html('').css('display','none');\r
}\r
\r
p.isShowing = function(){\r
\r
if(this.showClose){\r
closeBtn.css('marginLeft','0.5em').attr('class',this.closeButtonClass).html(this.closeButtonTitle).css({\r
- 'display':'inline-block','float':'right'\r
+ 'display':'inline-block',\r
+ 'float':'right'\r
//warning: do NOT use real numbers such as 0.5ex cause browsers round it in a different manner\r
//inline-block in order to retrieve/set width and height on the element\r
});\r
closeBtn.hide(); //margin:0 is to be sure, as afterwards we must span the title the whole popup width\r
}\r
//in any case, show titleElement cause even if title="", titleElement is used to position close on the right\r
-// titleInput.css({\r
-// 'backgroundColor':'transparent',\r
-// 'padding': '0px',\r
-// 'margin':'0px',\r
-// 'border':'0px'\r
-// }).attr('readonly','readonly').attr('class',this.titleClass).css({\r
-// 'display':'inline-block','float':'left'\r
-// //it is too tricky to set the width of the input spanning the whole title (in case of long titles)\r
-// //we experienced problems in vertical align with the close button, as stated somewhere above.\r
-// //we will use a span (see setTitle below)\r
-// });\r
+ // titleInput.css({\r
+ // 'backgroundColor':'transparent',\r
+ // 'padding': '0px',\r
+ // 'margin':'0px',\r
+ // 'border':'0px'\r
+ // }).attr('readonly','readonly').attr('class',this.titleClass).css({\r
+ // 'display':'inline-block','float':'left'\r
+ // //it is too tricky to set the width of the input spanning the whole title (in case of long titles)\r
+ // //we experienced problems in vertical align with the close button, as stated somewhere above.\r
+ // //we will use a span (see setTitle below)\r
+ // });\r
this.setTitle(this.title);\r
}\r
\r
bottomDiv.hide();\r
}\r
\r
-// var centralDiv = $(subdiv[1]);\r
-// //reset properties of the central div\r
-// centralDiv.css({\r
-// 'overflow':'auto',\r
-// 'maxHeight':'',\r
-// 'maxWidth':'',\r
-// 'minHeight':'',\r
-// 'minWidth':'',\r
-// 'height':'',\r
-// 'width':'',\r
-// 'visibility':'visible'\r
-// }).show();\r
+ // var centralDiv = $(subdiv[1]);\r
+ // //reset properties of the central div\r
+ // centralDiv.css({\r
+ // 'overflow':'auto',\r
+ // 'maxHeight':'',\r
+ // 'maxWidth':'',\r
+ // 'minHeight':'',\r
+ // 'minWidth':'',\r
+ // 'height':'',\r
+ // 'width':'',\r
+ // 'visibility':'visible'\r
+ // }).show();\r
\r
\r
var invoker = this.invoker;\r
this.setBoundsInside(invoker, this.bounds, this.boundsExact, true);\r
}\r
\r
-// //set title and close button to span whole width, if necessary\r
-// //closeButton.outerWidth should be zero if this.showClose = false\r
-// //titleInput.outerWidth(true) should be equal to titleInput.width(), as margins borders and padding are zero, however we want to calculate it safely\r
-// if(this.showClose || this.title){\r
-// var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
-// titleInput.css({\r
-// 'maxWidth':'',\r
-// 'width':(titleW)+'px'\r
-// });\r
-// }\r
-//\r
-// //set central div max height ONLY IF NECESSARY (overflow). Until here, the main popup is sized and placed\r
-// //but the central div might overflow\r
-// var height = centralDiv.height();\r
-// var maxHeight = (div.height()-topDiv.outerHeight(true)-bottomDiv.outerHeight(true)-\r
-// (centralDiv.outerHeight(true)-centralDiv.height()));\r
-// if(maxHeight<height){\r
-// centralDiv.css('maxHeight',maxHeight+'px');\r
-// }\r
-// //same for width:\r
-// var maxWidth = div.width();\r
-// var width = centralDiv.outerWidth(true);\r
-// if(maxWidth<width){\r
-// centralDiv.css('maxWidth',maxWidth+'px');\r
-// }\r
+ // //set title and close button to span whole width, if necessary\r
+ // //closeButton.outerWidth should be zero if this.showClose = false\r
+ // //titleInput.outerWidth(true) should be equal to titleInput.width(), as margins borders and padding are zero, however we want to calculate it safely\r
+ // if(this.showClose || this.title){\r
+ // var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
+ // titleInput.css({\r
+ // 'maxWidth':'',\r
+ // 'width':(titleW)+'px'\r
+ // });\r
+ // }\r
+ //\r
+ // //set central div max height ONLY IF NECESSARY (overflow). Until here, the main popup is sized and placed\r
+ // //but the central div might overflow\r
+ // var height = centralDiv.height();\r
+ // var maxHeight = (div.height()-topDiv.outerHeight(true)-bottomDiv.outerHeight(true)-\r
+ // (centralDiv.outerHeight(true)-centralDiv.height()));\r
+ // if(maxHeight<height){\r
+ // centralDiv.css('maxHeight',maxHeight+'px');\r
+ // }\r
+ // //same for width:\r
+ // var maxWidth = div.width();\r
+ // var width = centralDiv.outerWidth(true);\r
+ // if(maxWidth<width){\r
+ // centralDiv.css('maxWidth',maxWidth+'px');\r
+ // }\r
\r
\r
\r
isSizable = true;\r
\r
var div = this.getDiv();\r
-// var oldCss= isSizable ? undefined : this.setSizable();\r
+ // var oldCss= isSizable ? undefined : this.setSizable();\r
\r
var shadowOffset = this.shadowOffset;\r
var windowRectangle = this.getBoundsOf(wdw); //returns the window rectangle\r
\r
this.postSizeFcn();\r
\r
-// if(oldCss){\r
-// div.css({\r
-// 'display':oldCss['display'],\r
-// 'visibility':oldCss['visibility']\r
-// });\r
-// }\r
+ // if(oldCss){\r
+ // div.css({\r
+ // 'display':oldCss['display'],\r
+ // 'visibility':oldCss['visibility']\r
+ // });\r
+ // }\r
\r
};\r
//places and resize the popupdiv inside parent\r
p.setBoundsInside = function(parent, pd, boundsExact, isSizable){\r
\r
var div = this.getDiv();\r
-// var oldCss = isSizable ? undefined : this.setSizable();\r
+ // var oldCss = isSizable ? undefined : this.setSizable();\r
\r
this.preSizeFcn();\r
isSizable = true;\r
\r
this.postSizeFcn();\r
\r
-// if(oldCss){\r
-// div.css({\r
-// 'display':oldCss['display'],\r
-// 'visibility':oldCss['visibility']\r
-// });\r
-// }\r
+ // if(oldCss){\r
+ // div.css({\r
+ // 'display':oldCss['display'],\r
+ // 'visibility':oldCss['visibility']\r
+ // });\r
+ // }\r
};\r
p.preSizeFcn = function(){\r
this.setSizable();\r
//we must set a width:100% on the topDiv in order to stretch the whole HEIGHT (having two elements inside it with float:left and right)\r
//however, we might have here a width LOWER than the actual div width, so stretch it more if it's lower:\r
\r
-// if(this.showClose || this.title){\r
-// var closeBtn = topDiv.find('a').eq(0);\r
-// var titleInput = topDiv.find(':text').eq(0);\r
-// var span = topDiv.find('span').eq(0).hide();\r
-// var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
-// titleInput.html(span.html()).css({\r
-// 'maxWidth':'',\r
-// 'width':(titleW)+'px'\r
-// });\r
-// }\r
+ // if(this.showClose || this.title){\r
+ // var closeBtn = topDiv.find('a').eq(0);\r
+ // var titleInput = topDiv.find(':text').eq(0);\r
+ // var span = topDiv.find('span').eq(0).hide();\r
+ // var titleW = topDiv.width() - closeBtn.outerWidth(true) - (titleInput.outerWidth(true)-titleInput.width());\r
+ // titleInput.html(span.html()).css({\r
+ // 'maxWidth':'',\r
+ // 'width':(titleW)+'px'\r
+ // });\r
+ // }\r
\r
var topBottom = $([]);\r
if(this.showClose || this.title){\r
if(this.showOk){\r
topBottom = topBottom.add(subdivs.eq(2));\r
}\r
- topBottom.css({'overflow':'hidden', 'width':'100%'}); //to span the whole width\r
+ topBottom.css({\r
+ 'overflow':'hidden',\r
+ 'width':'100%'\r
+ }); //to span the whole width\r
\r
\r
var centralDiv = subdivs.eq(1);\r
\r
};\r
\r
- p.closeLater = function(millseconds){\r
+ //sets a t=timeout and returns t. eventName can be 'show' or 'close'\r
+ p.setTimeout = function(eventName, millseconds){\r
var me = this;\r
- setTimeout(function(){\r
- me.close();\r
- },millseconds);\r
+ var t=undefined;\r
+ if(eventName == 'show'){\r
+ t=setTimeout(function(){\r
+ me.show();\r
+ },millseconds);\r
+ }else if(eventName == 'close'){\r
+ t=setTimeout(function(){\r
+ me.close();\r
+ },millseconds);\r
+ }\r
+ return t;\r
},\r
\r
p.setSizable = function(){\r