+/*\r
+ * Copyright (C) 2007-2011 Parisson\r
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>\r
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>\r
+ *\r
+ * This file is part of TimeSide.\r
+ *\r
+ * TimeSide is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * TimeSide is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>\r
+ * Olivier Guilyardi <olivier@samalyse.com>\r
+ */\r
+\r
+/**\r
+ * Class for telemeta global functions.\r
+ * Note that the dollar sign is a reserved keyword in some browsers\r
+ * (see http://davidwalsh.name/dollar-functions)\r
+ * which might be in conflict with jQuery dollar sign.\r
+ */\r
\r
-//Class for global functions.\r
-//Note that the dollar sign is a reserved keyword in some browsers\r
-//(see http://davidwalsh.name/dollar-functions)\r
-//which might be in conflict with jQuery dollar sign\r
\r
-//PENDING: use static method?\r
-//adds a move function to the array object.\r
-//moves the element at position from into to position\r
-//returns from if no move was accomplished, ie when either:\r
-//1) from or to are not integers\r
-//2) from==to or from==to-1 (also in this latter case there is no need to move)\r
-//3) from or to are lower than zero or greater than the array length\r
-//in any other case, returns to\r
-//Array.prototype.move = function(from, to){\r
-// var pInt = parseInt;\r
-// if(pInt(from)!==from || pInt(to)!==to){\r
-// return from;\r
-// }\r
-// var len = this.length;\r
-// if((from<0 || from>len)||(to<0 || to>len)){\r
-// return from;\r
-// }\r
-// //if we moved left to right, the insertion index is actually\r
-// //newIndex-1, as we must also consider to remove the current index markerIndex, so:\r
-// if(to>from){\r
-// to--;\r
-// }\r
-// if(from != to){\r
-// var elm = this.splice(from,1)[0];\r
-// this.splice(to,0,elm);\r
-// return to;\r
-// }\r
-// return from;\r
-//}\r
\r
+//returns the full path of the current url location removing the last slash '/' followed by one or more '#', if any\r
+function urlNormalized(){\r
+ var sPath = window.location.href;\r
+ sPath = sPath.replace(/\/#*$/,"");\r
+ return sPath;\r
+}\r
+/**\r
+ *sets up few stuff when the page is ready (see functions below it)\r
+ */\r
+jQuery(document).ready(function() {\r
+ foldInfoBlocks();\r
+ setSelectedMenu();\r
+});\r
+\r
+/**\r
+ *function inherited from old code, never touched. Guess fixes the left data table, if any\r
+ */\r
function foldInfoBlocks() {\r
var $J = jQuery;\r
var extra = $J('.extraInfos');\r
extra.find('.folded dl, .folded table').css('display', 'none');\r
- extra.find('a').click(function() { \r
+ extra.find('a').click(function() {\r
$J(this).parents('.extraInfos').children().toggleClass('folded').find('dl, table').toggle(100);\r
- return false; \r
+ return false;\r
});\r
}\r
-//returns the full path of the current url location removing the last slash '/' followed by one or more '#', if any\r
-function urlNormalized(){\r
- var sPath = window.location.href;\r
- sPath = sPath.replace(/\/#*$/,"");\r
- return sPath;\r
-}\r
\r
/**\r
- * Global telemeta function to set the current selected menu active according toi the current url\r
+ * Global telemeta function which sets the current selected menu according to the current url\r
*/\r
function setSelectedMenu(){\r
var $J = jQuery;\r
}\r
\r
\r
-jQuery(document).ready(function() {\r
- foldInfoBlocks();\r
- setSelectedMenu();\r
-});\r
\r
-//****************************************************************************\r
-//json(param, method, onSuccesFcn(data, textStatus, jqXHR), onErrorFcn(jqXHR, textStatus, errorThrown))\r
-//global function to senbd/retrieve data with the server\r
-//\r
-//param: the data to be sent or retrieved.\r
-// param will be converted to string, escaping quotes newlines and backslashes if necessary.\r
-// param can be a javascript string, boolean, number, dictionary and array.\r
-// If dictionary or array, it must contain only the above mentioned recognized types.\r
-// So, eg, {[" a string"]} is fine, {[/asd/]} not\r
-//\r
-//method: the json method, eg "telemeta.update_marker". See base.py\r
-//\r
-//onSuccesFcn(data, textStatus, jqXHR) OPTIONAL --IF MISSING, NOTHING HAPPENS --\r
-// A function to be called if the request succeeds with the same syntax of jQuery's ajax onSuccess function.\r
-// The function gets passed three arguments \r
-// The data returned from the server, formatted according to the dataType parameter;\r
-// a string describing the status;\r
-// and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object\r
-//\r
-//onErrorFcn(jqXHR, textStatus, errorThrown) OPTIONAL. --IF MISSING, THE DEFAULT ERROR DIALOG IS SHOWN--\r
-// A function to be called if the request fails with the same syntax of jQuery ajax onError function..\r
-// The function receives three arguments:\r
-// The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object,\r
-// a string describing the type of error that occurred and\r
-// an optional exception object, if one occurred.\r
-// Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror".\r
-//****************************************************************************\r
+\r
+/*****************************************************************************\r
+ * json(param, method, onSuccesFcn(data, textStatus, jqXHR), onErrorFcn(jqXHR, textStatus, errorThrown))\r
+ * global function to senbd/retrieve data with the server\r
+ *\r
+ * param: the data to be sent or retrieved.\r
+ * param will be converted to string, escaping quotes newlines and backslashes if necessary.\r
+ * param can be a javascript string, boolean, number, dictionary and array.\r
+ * If dictionary or array, it must contain only the above mentioned recognized types.\r
+ * So, eg, {[" a string"]} is fine, {[/asd/]} not\r
+ *\r
+ * method: the json method, eg "telemeta.update_marker". See base.py\r
+ *\r
+ * onSuccesFcn(data, textStatus, jqXHR) OPTIONAL --IF MISSING, NOTHING HAPPENS --\r
+ * A function to be called if the request succeeds with the same syntax of jQuery's ajax onSuccess function.\r
+ * The function gets passed three arguments\r
+ * The data returned from the server, formatted according to the dataType parameter;\r
+ * a string describing the status;\r
+ * and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object\r
+ *\r
+ * onErrorFcn(jqXHR, textStatus, errorThrown) OPTIONAL. --IF MISSING, THE DEFAULT ERROR DIALOG IS SHOWN--\r
+ * A function to be called if the request fails with the same syntax of jQuery ajax onError function..\r
+ * The function receives three arguments:\r
+ * The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object,\r
+ * a string describing the type of error that occurred and\r
+ * an optional exception object, if one occurred.\r
+ * Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror".\r
+ * ****************************************************************************/\r
\r
var json = function(param,method,onSuccessFcn,onErrorFcn){\r
//this function converts a javascript object to a string\r
}\r
return string;\r
};\r
- //var g = 9;\r
- //creating the string to send. We use array join and string concatenation with +=\r
- //as it is more efficient\r
+ \r
+ //creating the string to send. \r
var param2string = toString_(param);\r
var data2send = '{"id":"jsonrpc", "params":';\r
data2send+=param2string;\r
data2send+=', "method":"'\r
data2send+=method;\r
data2send+='","jsonrpc":"1.0"}';\r
- // var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ s(itemid)+\r
- // '", "public_id": "'+s(marker.id)+'", "time": "'+s(offset)+\r
- // '", "author": "'+s(marker.author)+\r
- // '", "title": "'+s(marker.title)+\r
- // '","description": "'+s(marker.desc)+'"}], "method":"'+method+'","jsonrpc":"1.0"}';\r
+ \r
var $J = jQuery;\r
$J.ajax({\r
type: "POST",\r
});\r
\r
};\r
+\r
+/**\r
+ * Returns an uniqid by creating the current local time in millisecond + a random number. Used for markers and some json calls\r
+ */\r
var uniqid = function() {\r
var d = new Date();\r
return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18);\r
}\r
\r
var $J = jQuery;\r
- //var time = new Date().getTime();\r
+ \r
if(loadInSeries){\r
var load = function(index){\r
if(index<len){\r
}\r
\r
\r
-\r
+/**\r
+ * function for writing to the console. Catches errors, if any (eg, console == undefined)\r
+ */\r
function consolelog(text){\r
if(typeof console != 'undefined'){\r
var c = console;\r
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli <riccardo.zaccarelli gmail.com>
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
*/
/**
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli <riccardo.zaccarelli gmail.com>
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
*/
/**
-/**\r
- * TimeSide - Web Audio Components\r
- * Copyright (c) 2011 Parisson\r
- * Author: Riccardo Zaccarelli\r
- * License: GNU General Public License version 2.0\r
+/*\r
+ * Copyright (C) 2007-2011 Parisson\r
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>\r
+ *\r
+ * This file is part of TimeSide.\r
+ *\r
+ * TimeSide is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * TimeSide is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ * Author: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>\r
*/\r
\r
/**\r
- * class for showing non-modal dialogs such as popups or combo lists\r
+ * class for showing non-modal dialogs such as popups or combo lists. Requires jQuery\r
*/\r
function PopupDiv(){\r
var $J = jQuery;\r
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
*/
/**
- * Class for showing/editing a marker on details.
+ * Class representing a marker div html element for showing/editing a marker on details.
*/
var MarkerMapDiv = TimesideArray.extend({
init:function(){
var e_descriptionText = div.find('.markersdivDescription');
var e_titleText = div.find('.markersdivTitle');
- //set defualt element values regardeless of the marker state
- e_indexLabel.attr('title',marker.toString());
+ //set defualt element values regardeless of the marker state (for debugging, comment it if not needed)
+ //e_indexLabel.attr('title',marker.toString());
this.setIndex(div, index);
//e_offsetLabel.html(this.makeTimeLabel(marker.offset));
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
*/
/**
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
var Player = TimesideClass.extend({
//sound duration is in milliseconds because the soundmanager has that unit,
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli <riccardo.zaccarelli gmail.com> and Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
*/
/**
-
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
+
+/**
+ * Class representing the ruler (upper part) of the player. Requires jQuery
+ * wz_jsgraphics.
+ */
var Ruler = TimesideArray.extend({
//init constructor: soundDuration is IN SECONDS!!! (float)
init: function(viewer, soundDuration){
var i, ii = sectionSteps.length;
- var timeLabelWidth = this._textWidth('00:00', fontSize);
+ var timeLabelWidth = this.textWidth('00:00', fontSize);
for (i = 0; i < ii; i++) {
var tempDuration = sectionSteps[i][0];
var subDivision = sectionSteps[i][1];
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli <riccardo.zaccarelli gmail.com> and Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
*/
/**
* Class representing a RulerMarker in TimesideUI
- * Requires jQuery and all associated player classes
+ * Requires jQuery wz_jsgraphics and all associated player classes
*/
var RulerMarker = TimesideClass.extend({
return label;
}
-
- //CODE HERE BELOW IS EXECUTED ONLY IF THE MARKER HAS CAN MOVE IMPLEMENTED (see Ruler???).
- //Otherwise, no mouse event can call these methods
- //re-implement function move
- // var position = 0;
- // var relativePosition = 0; //position in percentage of container width, set it in move and use it in refreshPosition
- //
- // var mRound = Math.round; //instantiate the functio once
-
- // this.move = function(pixelOffset) {
- // var width = viewer.width();
- // if (position != pixelOffset) {
- // if (pixelOffset < 0) {
- // pixelOffset = 0;
- // } else if (pixelOffset >= width) {
- // pixelOffset = width - 1;
- // }
- // nodes.each(function(i, node) {
- // $J(node).css('left', mRound(node.originalPosition + pixelOffset) + 'px');
- // });
- // position = pixelOffset;
- // this.refreshLabelPosition(width);
- // //store relative position (see refreshPosition below)
- // relativePosition = pixelOffset == width-1 ? 1 : pixelOffset/width;
- // }
- // return this;
- // };
- //
- // this.refreshLabelPosition = function(optionalContainerWidth){
- // if(!(optionalContainerWidth)){
- // optionalContainerWidth = viewer.width();
- // }
- // var width = optionalContainerWidth;
- // var pixelOffset = position;
- // var labelWidth = label.outerWidth(); //consider margins and padding //label.width();
- // var labelPixelOffset = pixelOffset - labelWidth / 2;
- // if (labelPixelOffset < 0){
- // labelPixelOffset = 0;
- // }else if (labelPixelOffset + labelWidth > width){
- // labelPixelOffset = width - labelWidth;
- // }
- // label.css({
- // left: mRound(labelPixelOffset) + 'px'
- // });
- //
- // };
- //
- // //function called on ruler.resize. Instead of recreating all markers, simply redraw them
- // this.refreshPosition = function(){
- // var width = viewer.width();
- // //store relativePosition:
- // var rp = relativePosition;
- // this.move(mRound(relativePosition*width));
- // //reset relative position, which does not have to change
- // //but in move might have been rounded:
- // relativePosition = rp;
- // //last thing: resize the vertical line.
- // //Assumptions (having a look at the web page element with a debugger and the code above
- // //which uses jsgraphics):
- // //The line is the first item (see drawLine above)
- // //not only the height, but also the height of the clip property must be set
- // var h = viewer.height();
- // $J(nodes[0]).css({
- // 'height':h+'px',
- // 'clip': 'rect(0px 1px '+h+'px 0px)'
- // });
- // }
- //
- // this.remove = function() {
- // painter.clear();
- // $J(painter.cnv).remove();
- // label.remove();
- // return this;
- // };
-
this.getViewer = function(){
return viewer;
}
var label = this.getLabel();
if (label) {
text += '';
- var labelWidth = this._textWidth(text, this.getFontSize()) + 10;
+ var labelWidth = this.textWidth(text, this.getFontSize()) + 10;
var oldWidth = label.width();
if (oldWidth != labelWidth) {
label.css({
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2011 Parisson
- * Author: Riccardo Zaccarelli <riccardo.zaccarelli gmail.com> and Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
*/
/**
* By John Resig http://ejohn.org/
* MIT Licensed.
* (Inspired by base2 and Prototype)
- *
- * In my (Riccardo) opinion the lightest and most-comprehensive way to implement inhertance and OOP in
- * javascript. Usages can be found below.
+ */
+
+/*
+ * In few words: the lightest and most-comprehensive way to implement inhertance and OOP in javascript. Usages can be found below.
* Basically,
* 1) a new Class is instantiated with Class.extend(). This function takes a dictionary
* of properties/methods which will be put IN THE PROTOTYPE of the class, so that each instance will share the same properties/methods
})();
//Defining the base TimeClass class. Player, Ruler, MarkerMap are typical implementations (see js files)
-//Basically we store here static methods which must be accessible
-//in several timside sub-classes
+//Basically we store here static methods which must be accessible in several timside sub-classes
var TimesideClass = Class.extend({
-
- _textWidth : function(text, fontSize) {
+
+ /**
+ * function to calculate the text width according to a text and a given fontsize
+ */
+ textWidth : function(text, fontSize) {
var ratio = 3/5;
return text.length * ratio * fontSize;
},
return ret.join("");
},
- cssPrefix : 'ts-',
+ cssPrefix : 'ts-', //actually almost uneuseful, backward compatibility with old code (TODO: remove?)
$J : jQuery,
- debugging : true,
+ debugging : false,
debug : function(message) {
if (this.debugging && typeof console != 'undefined' && console.log) {
console.log(message);
//the map for listeners. Must be declared in the init as it's private and NOT shared by all instances
//(ie, every instance has its own copy)
this.listenersMap={};
- //follows jquery bind. Same as adding a listener for a key
-
},
/**
- *methods defining listeners, events fire and bind:
+ * 3 methods defining listeners, events fire and bind (aloing the lines of jQuery.bind, unbind and trigger):
*/
bind : function(key, callback, optionalThisArgInCallback){
if(!(callback && callback instanceof Function)){
});
-//re-implemented array for easier access/modification of markers:
-//Ruler, MArkerMap and MarkerMapDiv implement this class
+/**
+ * An Array-like implementation that suits the need of Marker mnanagement
+ * Ruler, MarkerMap and MarkerMapDiv implement this class
+ */
var TimesideArray = TimesideClass.extend({
init: function(optionalArray){
this._super();
//NOTE: writing each : function(startInclusive, endExclusive, callback) throws an error in chrome, as the last
//argument (even if it is a function) is a number. Why?????
- //Anyway, we must write the function arguments as empty
+ //Anyway, we write the function arguments as empty
each : function(){
var startInclusive, endExclusive, callback;
* setUpPlayerTabs([jQuery('#tab1),jQuery('#tab1)], [jQuery('#div1),jQuery('#div2)], 1);
* sets the elements with id '#tab1' and '#tab2' as tab and assign the click events to them so that clicking tab_1 will show '#div_1'
* (and hide '#div2') and viceversa for '#tab2'. The selected index will be 1 (second tab '#tab2')
-*/
+ */
function setUpPlayerTabs() {//called from within controller.js once all markers have been loaded.
//this is because we need all divs to be visible to calculate size. selIndex is optional, it defaults to 0
//
<a href="{% url telemeta-items %}"
class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
<a href="#" class="component_icon button icon_save"
- onclick="document.getElementById('_addItemForm').submit(); return false;">{% trans "Save" %}</a>
+ onclick="var d=document; d.getElementById('wait-img').style.display='inline'; setTimeout(function(){d.getElementById('_addItemForm').submit();},300); return false;">{% trans "Save" %}</a>
+ <img id="wait-img" style="display:none" style="vertical-align:middle" alt="wait" src="/images/wait.gif"/>
</div>
</form>
</div>
<span id="loading_span" href="#"><img style="vertical-align:middle" alt="wait" src="/images/wait.gif"/>
<span id="loading_span_text">Loading...</span></span>
<a id="tab_analysis" style="display:none" class ="tab" href="#">{% trans "Analysis" %}</a><!--
- do not let space here as it appears in the document
+ do not let space here as it appears in the document!!!!!
--><a id="tab_markers" style="display:none" class="tab" href="#">{% trans "Markers" %}</a>
</div>
<div align="center">
<a href="{% url telemeta-item-detail item.public_id %}"
class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
- <a href="#" class="component_icon button icon_save"
-onclick="document.getElementById('_editItemForm').submit(); return false;">{% trans "Save" %}</a>
+ <a href="#" class="component_icon button icon_save"
+onclick="var d=document; d.getElementById('wait-img').style.display='inline'; setTimeout(function(){d.getElementById('_editItemForm').submit();},300); return false;">{% trans "Save" %}</a>
+ <img id="wait-img" style="display:none" style="vertical-align:middle" alt="wait" src="/images/wait.gif"/>
</div>
</form>
</div>