if(loadInSeries){\r
var load = function(index){\r
if(index<len){\r
- //consolelog("loading "+scriptArray[index]+" "+new Date().getTime());\r
$J.getScript(scriptArray[index],function(){\r
load(index+1);\r
});\r
}else if(callback){\r
- //consolelog("EXECUTING CALLBACK ELAPSED TIME:"+(new Date().getTime()-time));\r
callback();\r
}\r
};\r
var s;\r
for(i=0; i <len; i++){\r
s = scriptArray[i];\r
- //consolelog("loading "+s+" "+new Date().getTime());\r
$J.getScript(s, function(){\r
count++;\r
if(count==len && callback){\r
- //consolelog("EXECUTING CALLBACK ELAPSED TIME:"+(new Date().getTime()-time));\r
callback();\r
}\r
});\r
content: ar,
onOk:function(data){
var val = data.selIndex;
- consolelog(data);
var callbackok = undefined;
if(optionalOkMessage){
callbackok = function(){
//resourceType can be: 'collection', 'item', 'marker'
//addResource RENAME TODO!!!!
addResourceToPlaylist: function(playlistId,resourceType,objectId, callbackOnSuccess,callbackOnError){
- consolelog(playlistId)
var send = {
'public_id':uniqid(),
'resource_type':resourceType,
* Class for showing/editing a marker on details.
*/
var MarkerMapDiv = TimesideArray.extend({
- init:function(currentUserName){
+ init:function(){
this._super();
this.div = this.$J("#markers_div_id");
- this.getCurrentUserName = function(){
- return currentUserName;
- }
+
},
//overridden
add: function(marker, index, isNew){
}else{
e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable');
e_titleText.attr('readonly','readonly').addClass('markersdivUneditable');
- consolelog(e_okButton.parent());
e_okButton.add(e_okButton.parent()).hide(); //hiding also the parent div saves space (padding bottom hidden)
editButton.show();
div.css('backgroundColor','');
var $J = this.$J;
siblings.each(function(i,elm){
spaceStretchable -= $J(elm).outerWidth(true);
- //consolelog("\t"+spaceStretchable+' elm:'+$J(elm).attr('class')+" left: "+$J(elm).position().left+" outerw:" +$J(elm).outerWidth(true)+" w: "+$J(elm).width());
});
- //consolelog('w'+ jQueryElm.parent().width()+' elm.w: '+jQueryElm.width()+' spacestretchable: '+spaceStretchable);
var w = jQueryElm.width() + spaceStretchable;
jQueryElm.css('width', w+'px');
},
div.find('.markersdivOffset').html(this.makeTimeLabel(offset));
},
createMarkerDiv : function(index, marker){
- //TODO: why class 'ts-marker' does not work?
- //for the moment we set the style manually, remove
- //TODO: table width with CSS?
- var div = this.$J('<div/>').attr('tabindex','0').addClass("markerdiv").html('<div>'+
- '<a href=# class="ts-marker"></a>'+
- '<a href=# class="markersdivOffset" type="text"></a>'+
- '<input class="markersdivTitle" type="text"/>'+
- '<a class="markersdivAddPlaylist" title="add to playlist"></a>'+
- '<a class="markersdivEdit" title="edit">EDIT</a>'+
- '<a class="markersdivDelete" title="delete"></a>'+
- '</div>'+
- '<div zero_top_padding><textarea class="markersdivDescription"></textarea></div>'+
- '<div zero_top_padding><a class="markersdivSave">OK</a></div>'+
- '<div zero_top_padding><span style="font-size:75%;color:#999">'+gettrans('author')+': '+marker.author+'</span></div>'); //TODO: avoid text nodes
+ //create html content. Use array.join cause it is usually faster than string concatenation:
+ var html_ = ['<div style="white-space:nowrap">', //whitespace no wrap is really important to keep all content of first div on one line (without it, IE displays it on 2 lines)
+ '<a href=# class="ts-marker"></a>',
+ '<a href=# class="markersdivOffset" type="text"></a>',
+ '<input class="markersdivTitle" type="text"/>',
+ '<a class="markersdivAddPlaylist" title="add to playlist"></a>',
+ '<a class="markersdivEdit" title="edit">EDIT</a>',
+ '<a class="markersdivDelete" title="delete"></a>',
+ '</div>',
+ '<div zero_top_padding><textarea class="markersdivDescription"></textarea></div>',
+ '<div zero_top_padding><a class="markersdivSave">OK</a></div>',
+ '<div zero_top_padding><span style="font-size:75%;color:#999">'+gettrans('author')+': '+marker.author+'</span></div>'].join("");
+ var div = this.$J('<div/>').attr('tabindex','0').addClass("markerdiv").html(html_); //TODO: avoid text nodes
div.find('a').attr('href','#');
//todo: remove markerlabel from css!!!!!!!
//new RulerMarker(div.find('.markerlbl'),div.find('.markercanvas'),'marker',false);
e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable').unbind('focus');
e_titleText.attr('readonly','readonly').addClass('markersdivUneditable').unbind('focus');
- //add to playlist always visible, provided that it is saved on server AND current user is logged
- //(getCurrentUserName evaluates to true)
- // if(!marker.isSavedOnServer || !this.getCurrentUserName()){
- // e_addplaylistButton.hide();
- // }else{
+
e_addplaylistButton.unbind('click').bind('click',function(evtObj_){
if(!marker.isSavedOnServer){
return false;
//make a request to the server to get the pk (id)
//note that marker.id (client side) is marker.public_id (server side)
json([marker.id],"telemeta.get_marker_id", function(data){
- consolelog('received');
- consolelog(data);
var id = data.result;
playlistUtils.showAddResourceToPlaylist(e_addplaylistButton,'marker',""+id,gettrans('marker added to the selected playlist'));
});
return false;
});
- if(!this.getCurrentUserName()){
+ if(!marker.canBeAddedToPlaylist){
e_addplaylistButton.hide();
}
- if(!marker.isEditable){ //marker is editable means that author == getCurrentUserName(). addToPlaylist
- //visibility is skipped because it depends on other circumstances (see above)
+ if(!marker.isEditable){ //marker is editable means that author is superuser or author == getCurrentUserName().
+ //addToPlaylist visibility is skipped because it depends on other circumstances (see above)
e_editButton.hide();
e_deleteButton.hide();
//we unbind events to be sure
*/
var MarkerMap = TimesideArray.extend({
- init: function(itemId, currentUserName) {
+ init: function(itemId, currentUserName, isStaffOrSuperuser) {
this._super();
var ui = uniqid; //defined in application.js (global vars and functions)
this.uniqid = function(){
this.getCurrentUserName = function(){
return currentUserName;
}
+ this.isCurrentUserStaffOrSuperuser = function(){
+ return isStaffOrSuperuser;
+ }
var me = this;
var confirmExit = function(){
markerUnsaved++;
}
});
- consolelog(markerUnsaved);
if(markerUnsaved>0){
return gettrans('there is at least one unsaved marker') +' ('+ markerUnsaved+ '). '+
gettrans('If you exit the page you will loose your changes');
argument = pFloat(argument);
}
var currentUserName = this.getCurrentUserName();
+ var isStaffOrSuperuser = this.isCurrentUserStaffOrSuperuser();
if(typeof argument == 'object'){
- var editable = currentUserName === argument.author;
+ var editable = isStaffOrSuperuser || currentUserName === argument.author;
+ var canBeAddedToPlaylist_ = currentUserName ? true : false;
marker = {
id: argument.public_id,
offset: pFloat(argument.time), //IMPORTANT: IT IS A STRING!!!!!!
title: argument.title,
author: argument.author,
isEditable: editable,
+ canBeAddedToPlaylist: canBeAddedToPlaylist_,
isSavedOnServer: true
};
}else if(typeof argument == 'number'){
title: "",
author: currentUserName,
isEditable: true,
+ canBeAddedToPlaylist: true,
isSavedOnServer: false
};
}
idx = this.insertionIndex(identifier);
}
if(idx<0 || idx>=this.length){
- this.each(function(i,m){
- consolelog(m);
- });
- consolelog(identifier);
//TODO: handle error
this.debug('remove: marker not found');
return;
//sound duration is in milliseconds because the soundmanager has that unit,
//player (according to timeside syntax) has durations in seconds
- init: function(container, sound, soundDurationInMsec, itemId, visualizers, currentUserName) {
+ init: function(container, sound, soundDurationInMsec, itemId, visualizers, currentUserName, isStaffOrSuperUser) {
this._super();
this.ready = false;
var player = this;
ruler.movePointer(sPos);
}
- player.showMarkerPopup(currentMarkerIndex);
+ //player.showMarkerPopup(currentMarkerIndex);
},
onfinish: function() {
setPos(0); //reset position, not cursor, so that clicking play restarts from zero
};
//internal play function. Set all properties and play:
var play_ = function(sound, positionInSec){
- //consolelog('position is '+positionInSec+' sec');
sound.setPosition(toMsec(positionInSec)); //TODO: remove???
- //consolelog('sound position is '+sound.position+' msec');
sound.setVolume(sound.volume); //workaround. Just to be sure. Sometimes it fails when we re-play
playOptions.position = toMsec(positionInSec); //apparently THIS IS WORKING
sound.play(playOptions);
};
//initializing markermap and markerui
- var map = new MarkerMap(this.getItemId(), currentUserName);
+ var map = new MarkerMap(this.getItemId(), currentUserName, isStaffOrSuperUser);
this.getMarkerMap = function(){
return map;
}
- var mapUI = new MarkerMapDiv(currentUserName);
+ var mapUI = new MarkerMapDiv();
this.getMarkersUI = function(){
return mapUI;
}
- this.getCurrentUserName = function(){
- return currentUserName;
- }
- //TODO: define setUpInterface here????
-
},
-
-
- setupInterface: function() {
+ //sets up the player interface and loads the markers. There is theoretically no need of this method, as it might be included in
+ //the init constructor, it is separated for "historical" reasons: this method stems from the old _setupInterface,
+ //which was a separate method in the old player code. Future releases might include it in the init constructor
+ setupInterface: function(callback) {
var sound = this.getSound();
- consolelog('player _setupInterface sound.readyState:'+sound.readyState); //handle also cases 0 and 2????
+ this.debug('player _setupInterface sound.readyState:'+sound.readyState); //handle also cases 0 and 2????
var $J = this.$J; //defined in the super constructor
var me=this;
- //image source (see below) is given a src with a temporary 1x1 pixels transparent image
+ //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers.
+ //Note that the player image (see below) is given a src with a temporary 1x1 pixels transparent image
+ //Basically, NOT specifying any src for image tags can be harmful,
//see http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/ and
- //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx
- //for details
+ //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx for details
var html = ["<div class='ts-viewer'>",
"<div class='ts-ruler'></div>",
"<div class='ts-wave'>",
});
//volume:
- function setVolume(event){
+ function setVolume(event,volumeElement){
var ticks = [18,26,33,40,47];
- var vol = event.layerX;
+ var vol = event.pageX - volumeElement.offset().left; //using absolute coordinates allows us to
+ //avoid using layerX (not supported in all browsers) and clientX (which needs the window scrollLeft variable)
for(var i=0; i<ticks.length; i++){
if(vol<=ticks[i]){
var volume = i*20;
me.setSoundVolume(volume);
- me.debug('setting volume'+volume);
return false;
}
}
return false;
}
volume.attr('href', '#').click(function(event){
- return setVolume(event);
+ return setVolume(event,volume);
});
//assigning title to all anchors
//creating the ruler
var viewer = container.find('.ts-viewer');
- var ruler = new Ruler(viewer, this.getSoundDuration(), (this.getCurrentUserName() || false));
+ var ruler = new Ruler(viewer, this.getSoundDuration());
this.getRuler = function(){
return ruler;
}
//finally, load markers and bind events for markers (see method below):
//NOTE: loadMarkers ASYNCHRONOUSLY CALLS THE SERVER, SO METHODS WRITTEN AFTER IT MIGHT BE EXECUTED BEFORE
//loadMarkers has finished its job
- this.loadMarkers();
+ this.loadMarkers(callback);
//set the marker popup
//functions to set the marker popup
// var span = 0.3;
//
// if(pos>=mPos-span && pos<=mPos+span){
- // consolelog('songpos: '+pos+' nextmarkerpos:'+mPos);
// popup.attr('id','markerpopup'+markerIndex);
// popup.find('.title').html(marker.title);
// popup.find('.description').html(marker.desc);
elements.css('width', 'auto'); // for IE6
+
if (!height){
height = 200;
}
}
elements.css(style);
+ image.css({
+ 'width':'100%',
+ 'height':'100%'
+ }); // for IE7. Does not seem to hurt IE8, FF, Chrome
//refreshing images:
this.refreshImage(image);
select.add(imgWait).css('maxHeight',(maxHeight-2)+'px'); //at least a margin left and top of 1 px (see below)
var span = (maxHeight-select.outerHeight())/2; //do not include margins in oputerHeight (we will set them to zero below)
- select.css({'margin':'0px', 'marginTop':span+'px','marginLeft':span+'px'});
+ select.css({
+ 'margin':'0px',
+ 'marginTop':span+'px',
+ 'marginLeft':span+'px'
+ });
var span2 = (maxHeight - imgWait.outerHeight())/2; //do not include margins in oputerHeight (we will set them to zero below)
- imgWait.css({'margin':'0px', 'marginTop':span2+'px','marginLeft':span+'px'})
+ imgWait.css({
+ 'margin':'0px',
+ 'marginTop':span2+'px',
+ 'marginLeft':span+'px'
+ })
return this;
},
- // getImageUrl: function(){
- // return this.$J('#visualizer_id').get(0).value;
- // },
+
refreshImage: function(optionalImgJQueryElm){
var image;
var container = this.getContainer();
return _src_;
};
var imageUrl = this.getVisualizers()[""+select.val()];
- //consolelog(this.getVisualizers());
- //alert(imageUrl);
var imgSrc = funcImg(imageUrl, image.width(),image.height());
if(image.attr('src')==imgSrc){
- // consolelog('setting attrt');
return;
}
var w =select.width();
select.show();
image.unbind('load');
});
+
//this timeout is set in order to leave the time to hide show components above:
//setTimeout(function(){
image.attr('src', imgSrc);
var offset = this.getSoundDuration();
var position = this.getSoundPosition(); //parseFloat(this.getSoundPosition());
var idx = map.insertionIndex(position);
- //consolelog('current pointer position: '+position+' '+(typeof position));
if(idx<0){
idx = -idx-1; //cursor is not on a a marker, get the insertion index
}else{
offset = markers[idx].offset;
}
this.setSoundPosition(offset);
- this.getRuler().movePointer(offset)
+ this.getRuler().movePointer(offset);
return false;
},
},
- loadMarkers: function(){
+ loadMarkers: function(callback){
//ruler.bind('markermoved',this.markerMoved,this);
var $J = this.$J; //reference to jQuery
- var isInteractive_ = this.getCurrentUserName() || false;
+
var itemId = this.getItemId();
var player = this;
map.clear();
mapUI.clear();
ruler.clear();
-
+ var showAddMarker = map.getCurrentUserName() || false;
//building the onSuccess function
var onSuccess = function(data) {
var tabIndex = 0;
var setMarkerButton = player.getContainer().find('.ts-set-marker');
var tab = $J('#tab_markers');
if(setMarkerButton){
- if(isInteractive_){
+ if(showAddMarker){
setMarkerButton.show().attr('href','#').unbind('click').bind('click', function(){
if(tab && tab.length){
tab.trigger('click');
}
});
- $J('#loading_span').empty().remove();
- //TODO: move this in load_player?
- // setUpPlayerTabs([jQuery('#tab_analysis'), jQuery('#tab_markers')],
- // [jQuery('#analyzer_div_id'), jQuery('#markers_div_id')], tabIndex,
- // 'tab_selected','tab_unselected');
- setUpPlayerTabs($J('#tab_analysis').add($J('#tab_markers')),
- [$J('#analyzer_div_id'), $J('#markers_div_id')], tabIndex,
- 'tab_selected','tab_unselected');
+ if(callback){
+ callback();
+ }
};
- json([itemId],"telemeta.get_markers", onSuccess);
+ var onError = function(){
+ if(callback){
+ callback();
+ }
+ }
+ json([itemId],"telemeta.get_markers", onSuccess, onError);
}
});
\ No newline at end of file
function togglePlayerMaximization() {
var $ = jQuery;
- consolelog('entered togglePlayerMaximization');
var view = $('#player');
$('#player_maximized, #player_minimized').css('display', 'none');
var ctr;
-function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName){
+function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName, isStaffOrSuperuser){
var $J = jQuery;
var playerDiv = $J('#player');
if (!playerDiv.length){
}
- //consolelog('till here all ok1');
var msgElm = $J('#loading_span_text'); //element to show messages
- //consolelog('till here all ok2');
if(msgElm){
msgElm.html('Loading analyzer...');
}
loadScripts('/timeside/js/',['rulermarker.js','markermap.js', 'player.js', 'ruler.js','divmarker.js'], function() {
- var p = new Player(jQuery('#player'), sound, durationInMsec, itemId, visualizers, currentUserName);
- consolelog('initialized player');
- p.setupInterface();
+ var p = new Player(jQuery('#player'), sound, durationInMsec, itemId, visualizers, currentUserName, isStaffOrSuperuser);
+
+ var cbckAtEnd = function(){
+ //this callback is executed at the end and does 3 things:
+ //1)sets up the marker tab
+ $J('#loading_span').empty().remove();
+ // setUpPlayerTabs([jQuery('#tab_analysis'), jQuery('#tab_markers')],
+ // [jQuery('#analyzer_div_id'), jQuery('#markers_div_id')], tabIndex,
+ // 'tab_selected','tab_unselected');
+ var map = p.getMarkerMap();
+ var tabIndex = map.length ? 1 : 0;
+ setUpPlayerTabs($J('#tab_analysis').add($J('#tab_markers')),
+ [$J('#analyzer_div_id'), $J('#markers_div_id')], tabIndex,
+ 'tab_selected','tab_unselected');
+ //2) and selects the current marker if it is present on the url
+ var url = window.location.href+"";
+ var lastPart = url.replace(/\/+$/,"").replace(/^.*\/([^\/]*)$/,"$1");
+ var selOffs = -1;
+ map.each(function(i,marker){
+ if(marker.id == lastPart){
+ selOffs = marker.offset;
+ }
+ });
+ if(selOffs >= 0){
+ p.setSoundPosition(selOffs);
+ p.getRuler().movePointer(selOffs);
+ }
+ //3) assing a binding to the player maximization button:
+ $J('#player_maximized .toggle, #player_minimized .toggle').click(function() {
+ togglePlayerMaximization();
+ //alert(this);
+ //this.blur();
+ return false;
+ });
+ }
+ p.setupInterface(cbckAtEnd);
player = p;
- $J('#player_maximized .toggle, #player_minimized .toggle').click(function() {
- togglePlayerMaximization();
- this.blur();
- return false;
- });
+
});
};
}
var duration = $J(data).find('#duration').attr('value');
duration = duration.split(":");
- consolelog('analyzer loaded, duration: '+duration);
//format duration
var pin = parseInt;
var pfl = parseFloat;
var Ruler = TimesideArray.extend({
//init constructor: soundDuration is IN SECONDS!!! (float)
- init: function(viewer, soundDuration, isInteractive){
+ init: function(viewer, soundDuration){
this._super();
var cssPref = this.cssPrefix;
- this.isInteractive = function(){
- return isInteractive;
- };
-
+
this.getSoundDuration= function(){
return soundDuration;
};
this.getRulerContainer = function(){
return container;
}
-
-
- if(!isInteractive){ //is not interactive, skip all methods assignmenets below
- return;
- }
},
resize : function(){
pointer = this.getPointer();
}
if(!pointer){
- //consolelog('QUALE CHAZZO E IL CONTAINER?????? ' + $J(layout.get(0)).attr('class'));
- // pointer = new RulerMarker($J(layout.get(0)),this.getWaveContainer(),'pointer', true);
- // pointer.setText(this.makeTimeLabel(0));
- //
- // this.debug('WELL, ');
- // consolelog(pointer);
- // var me = this;
- // pointer.getLabel().mousedown(function(evt) {
- // var lbl = $J(evt.target);
- // me.markerBeingClicked = {
- // 'marker':pointer,
- // 'offset':evt.pageX-(lbl.offset().left+lbl.outerWidth(true)/2)
- // };
- // consolelog(evt.pageX-(lbl.offset().left+lbl.outerWidth(true)/2));
- // evt.stopPropagation(); //dont notify the ruler;
- // return false;
- // });
pointer = this.add(0);
this.getPointer = function(){
return pointer;
rulermarker.refreshPosition();
});
- // if(!pointer){
- // this.debug("Creating pointer:"+layout);
- // //this.createMarkerForRuler = function(rulerLayout,viewer,className, fontSize, optionalToolTip)
- // pointer = this.createMarkerForRuler($J(layout.get(0)),waveContainer,'pointer',fontSize,'move pointer');
- // this.debug('pointerdisplay'+pointer.css('display'));
- // }
-
- //TODO: move pointer??????
- //this._movePointer(sound.position/1000);
-
-
- //TODO: draw markers?
- // if (this.cfg.map) {
- // $J(this.markers).each(function(i, m) {
- // m.clear();
- // });
- // this.markers = new Array();
- // this.cfg.map.each(this.attach(function(i, m) {
- // this.markers.push(this._drawMarker(m, i));
- // }));
- // }
},
//overridden: Note that the pointer is NOT cleared!!!!!
var rulermarker = this._super(index);
rulermarker.remove();
this.each(index, function(i,rulermarker){
- consolelog(i);
rulermarker.setIndex(i, true);
});
},
if(typeof markerObjOrOffset == 'number'){
soundPosition = markerObjOrOffset;
- isMovable = true; //this.isInteractive();
+ isMovable = true;
markerClass='pointer';
}else{
soundPosition = markerObjOrOffset.offset;
- isMovable = markerObjOrOffset.isEditable && this.isInteractive();
+ isMovable = markerObjOrOffset.isEditable;
markerClass='marker';
}
me.setPointerMovingFromMouse(false);
}
if(newPos == startPos){
- consolelog('NOT MOVED!!!!');
return false;
}
var data = {
return false;
};
doc.bind('mouseup.'+eventId, mouseup);
- //lbl.bind('mouseup.'+eventId, mouseup);
- // doc.bind('mouseup.'+eventId, function(evt){
- // consolelog(newPos);
- // doc.unbind('mousemove.'+eventId);
- // doc.unbind('mouseup.'+eventId);
- //
- // //TODO: fire event marker moved (with the class name)
- // var data = {
- // 'markerElement':pointer,
- // 'soundPosition': me.toSoundPosition.apply(me,[newPos]),
- // 'markerClass':markerClass
- // };
- // me.fire('markermoved',data);
- // return false;
- // });
+
return false;
});
}
label.find('span').html(text);
if(oldWidth != labelWidth && optionalUpdateLabelPosition){
- consolelog('refreshing label position');
this.refreshLabelPosition();
}
}
fire : function(key, dataArgument){
var listenersMap = this.listenersMap;
if(!(key in listenersMap)){
- this.debug(key+' fired but no binding associated to it');
+ this.debug('"'+key+'" fired but no binding associated to it');
return;
}
var callbacks = listenersMap[key];
//note that this method written here OVERRIDES the same method written outside init in the children!!!!
this.toArray = function(returnACopy){
if(returnACopy){
- consolelog('copying array');
var ret = [];
for(var i=0; i<me.length; i++){
ret.push(me[i]);
//argument (even if it is a function) is a number. Why?????
//Anyway, we must write the function arguments as empty
each : function(){
- // consolelog(arguments.length+' arguments passed. Details: ');
- // for(var j=0; j<arguments.length; j++){
- // consolelog('arguments['+ j+']: ');consolelog(arguments[j]);
- // }
var startInclusive, endExclusive, callback;
var arg = arguments;
var t = $J(tabs[i]);
var div = $J(divs[i]);
- // consolelog(t.attr('id')+' is '+(i==index ? 'showing ' : 'hiding ')+div.attr('id'));
var addClass = i==index ? selectedTabClass : unselectedTabClass;
var removeClass = i==index ? unselectedTabClass : selectedTabClass;
if(removeClass){
/* This notice must be untouched at all times.\r
\r
-wz_jsgraphics.js v. 3.03\r
+wz_jsgraphics.js v. 3.05\r
The latest version is available at\r
http://www.walterzorn.com\r
or http://www.devira.com\r
or http://www.walterzorn.de\r
\r
-Copyright (c) 2002-2004 Walter Zorn. All rights reserved.\r
+Copyright (c) 2002-2009 Walter Zorn. All rights reserved.\r
Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )\r
-Last modified: 28. 1. 2008\r
+Last modified: 2. 2. 2009\r
\r
Performance optimizations for Internet Explorer\r
by Thomas Frank and John Holdsworth.\r
var jg_ok, jg_ie, jg_fast, jg_dom, jg_moz;\r
\r
\r
-function _chkDHTM(x, i)\r
+function _chkDHTM(wnd, x, i)\r
+// Under XUL, owner of 'document' must be specified explicitly\r
{\r
- x = document.body || null;\r
- jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && document.createElement;\r
+ x = wnd.document.body || null;\r
+ jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && wnd.document.createElement;\r
jg_dom = (x && !jg_ie &&\r
typeof x.appendChild != "undefined" &&\r
- typeof document.createRange != "undefined" &&\r
- typeof (i = document.createRange()).setStartBefore != "undefined" &&\r
+ typeof wnd.document.createRange != "undefined" &&\r
+ typeof (i = wnd.document.createRange()).setStartBefore != "undefined" &&\r
typeof i.createContextualFragment != "undefined");\r
- jg_fast = jg_ie && document.all && !window.opera;\r
+ jg_fast = jg_ie && wnd.document.all && !wnd.opera;\r
jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";\r
jg_ok = !!(jg_ie || jg_dom);\r
}\r
return this.htm.replace(\r
_regex,\r
'<div style="overflow:hidden;position:absolute;background-color:'+\r
- '$1;left:$2;top:$3;width:$4;height:$5"></div>\n');\r
+ '$1;left:$2px;top:$3px;width:$4px;height:$5px"></div>\n');\r
}\r
\r
function _htmPrtRpc()\r
return this.htm.replace(\r
_regex,\r
'<div style="overflow:hidden;position:absolute;background-color:'+\r
- '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');\r
+ '$1;left:$2px;top:$3px;width:$4px;height:$5px;border-left:$4px solid $1"></div>\n');\r
}\r
\r
function _mkLin(x1, y1, x2, y2)\r
| (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3))\r
| ((fAngA >= fAngZ) << 16),\r
aBndA = new Array(b+1), aBndZ = new Array(b+1);\r
- \r
+\r
// Set up radial boundary lines\r
fAngA *= Math.PI/180.0;\r
fAngZ *= Math.PI/180.0;\r
this._mkDiv(xl, yt, w, h);\r
this._mkDiv(xl, yb, w, h);\r
};\r
- \r
+\r
this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects)\r
{\r
var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w;\r
this.htm = "";\r
this.wnd = wnd || window;\r
\r
- if(!jg_ok) _chkDHTM();\r
+ if(!jg_ok) _chkDHTM(this.wnd);\r
if(jg_ok)\r
{\r
if(cnv)\r
soundManager.url = "{% url telemeta-timeside "swf/" %}";
soundManager.flashVersion = 9;
soundManager.useMovieStar = true; // enable MP4/M4A/AAC
- soundManager.debugMode = true;
+ soundManager.debugMode = false;
soundManager.allowPolling = true;
var setupPlaylist = function(){
}
//warn on soundmanager error:
soundManager.onerror = function() {
- playerError('SoundManager error. If your browser does not support HTML5, Flash player (version 9+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences) and reload the page\n - Restart the browser');
+ playerError('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');
};
setTimeout(function(){
soundManager.onready(function() {
loadScripts(scripts,
function(){
- loadPlayer('{% url telemeta-item-analyze-xml item.public_id %}',"{% url telemeta-item-export item.public_id,"mp3" %}", '{{item.id}}', visualizers, CURRENT_USER_NAME);
+ {% if user.is_staff or user.is_superuser %}
+ var superuser = true;
+ {% else %}
+ var superuser = false;
+ {% endif %}
+ loadPlayer('{% url telemeta-item-analyze-xml item.public_id %}',"{% url telemeta-item-export item.public_id,"mp3" %}", '{{item.id}}', visualizers, CURRENT_USER_NAME, superuser);
setupPlaylist();
});
});
{% block content %}
<div class="{% if item.file %}{% if item.public_access == 'full' or public_access or user.is_staff %}with-rightcol{% endif %}{% endif %}">
{% if item.file %}
- {% if public_access or user.is_staff %}
+ {% if public_access or user.is_staff or user.is_superuser %}
<div id="player_maximized" class="ts-skin-lab">
<a href="#" class="toggle">Minimize</a>
<div class="wazing"></div>