From: riccardo Date: Mon, 16 May 2011 19:45:46 +0000 (+0200) Subject: Added licenze header in the js files, fixed some minor stuff, tested on IE7, IE8... X-Git-Tag: 1.1~174 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=7c48145828ceac1e8f3c90347d42d3f1c312b376;p=telemeta.git Added licenze header in the js files, fixed some minor stuff, tested on IE7, IE8, FF and Chrome --- diff --git a/telemeta/htdocs/js/application.js b/telemeta/htdocs/js/application.js index 26f4bff1..decd3cfd 100644 --- a/telemeta/htdocs/js/application.js +++ b/telemeta/htdocs/js/application.js @@ -1,57 +1,65 @@ +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi + */ + +/** + * Class for telemeta global functions. + * Note that the dollar sign is a reserved keyword in some browsers + * (see http://davidwalsh.name/dollar-functions) + * which might be in conflict with jQuery dollar sign. + */ -//Class for global functions. -//Note that the dollar sign is a reserved keyword in some browsers -//(see http://davidwalsh.name/dollar-functions) -//which might be in conflict with jQuery dollar sign -//PENDING: use static method? -//adds a move function to the array object. -//moves the element at position from into to position -//returns from if no move was accomplished, ie when either: -//1) from or to are not integers -//2) from==to or from==to-1 (also in this latter case there is no need to move) -//3) from or to are lower than zero or greater than the array length -//in any other case, returns to -//Array.prototype.move = function(from, to){ -// var pInt = parseInt; -// if(pInt(from)!==from || pInt(to)!==to){ -// return from; -// } -// var len = this.length; -// if((from<0 || from>len)||(to<0 || to>len)){ -// return from; -// } -// //if we moved left to right, the insertion index is actually -// //newIndex-1, as we must also consider to remove the current index markerIndex, so: -// if(to>from){ -// to--; -// } -// if(from != to){ -// var elm = this.splice(from,1)[0]; -// this.splice(to,0,elm); -// return to; -// } -// return from; -//} +//returns the full path of the current url location removing the last slash '/' followed by one or more '#', if any +function urlNormalized(){ + var sPath = window.location.href; + sPath = sPath.replace(/\/#*$/,""); + return sPath; +} +/** + *sets up few stuff when the page is ready (see functions below it) + */ +jQuery(document).ready(function() { + foldInfoBlocks(); + setSelectedMenu(); +}); + +/** + *function inherited from old code, never touched. Guess fixes the left data table, if any + */ function foldInfoBlocks() { var $J = jQuery; var extra = $J('.extraInfos'); extra.find('.folded dl, .folded table').css('display', 'none'); - extra.find('a').click(function() { + extra.find('a').click(function() { $J(this).parents('.extraInfos').children().toggleClass('folded').find('dl, table').toggle(100); - return false; + return false; }); } -//returns the full path of the current url location removing the last slash '/' followed by one or more '#', if any -function urlNormalized(){ - var sPath = window.location.href; - sPath = sPath.replace(/\/#*$/,""); - return sPath; -} /** - * Global telemeta function to set the current selected menu active according toi the current url + * Global telemeta function which sets the current selected menu according to the current url */ function setSelectedMenu(){ var $J = jQuery; @@ -101,38 +109,35 @@ function setSelectedMenu(){ } -jQuery(document).ready(function() { - foldInfoBlocks(); - setSelectedMenu(); -}); -//**************************************************************************** -//json(param, method, onSuccesFcn(data, textStatus, jqXHR), onErrorFcn(jqXHR, textStatus, errorThrown)) -//global function to senbd/retrieve data with the server -// -//param: the data to be sent or retrieved. -// param will be converted to string, escaping quotes newlines and backslashes if necessary. -// param can be a javascript string, boolean, number, dictionary and array. -// If dictionary or array, it must contain only the above mentioned recognized types. -// So, eg, {[" a string"]} is fine, {[/asd/]} not -// -//method: the json method, eg "telemeta.update_marker". See base.py -// -//onSuccesFcn(data, textStatus, jqXHR) OPTIONAL --IF MISSING, NOTHING HAPPENS -- -// A function to be called if the request succeeds with the same syntax of jQuery's ajax onSuccess function. -// The function gets passed three arguments -// The data returned from the server, formatted according to the dataType parameter; -// a string describing the status; -// and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object -// -//onErrorFcn(jqXHR, textStatus, errorThrown) OPTIONAL. --IF MISSING, THE DEFAULT ERROR DIALOG IS SHOWN-- -// A function to be called if the request fails with the same syntax of jQuery ajax onError function.. -// The function receives three arguments: -// The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, -// a string describing the type of error that occurred and -// an optional exception object, if one occurred. -// Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". -//**************************************************************************** + +/***************************************************************************** + * json(param, method, onSuccesFcn(data, textStatus, jqXHR), onErrorFcn(jqXHR, textStatus, errorThrown)) + * global function to senbd/retrieve data with the server + * + * param: the data to be sent or retrieved. + * param will be converted to string, escaping quotes newlines and backslashes if necessary. + * param can be a javascript string, boolean, number, dictionary and array. + * If dictionary or array, it must contain only the above mentioned recognized types. + * So, eg, {[" a string"]} is fine, {[/asd/]} not + * + * method: the json method, eg "telemeta.update_marker". See base.py + * + * onSuccesFcn(data, textStatus, jqXHR) OPTIONAL --IF MISSING, NOTHING HAPPENS -- + * A function to be called if the request succeeds with the same syntax of jQuery's ajax onSuccess function. + * The function gets passed three arguments + * The data returned from the server, formatted according to the dataType parameter; + * a string describing the status; + * and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object + * + * onErrorFcn(jqXHR, textStatus, errorThrown) OPTIONAL. --IF MISSING, THE DEFAULT ERROR DIALOG IS SHOWN-- + * A function to be called if the request fails with the same syntax of jQuery ajax onError function.. + * The function receives three arguments: + * The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, + * a string describing the type of error that occurred and + * an optional exception object, if one occurred. + * Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". + * ****************************************************************************/ var json = function(param,method,onSuccessFcn,onErrorFcn){ //this function converts a javascript object to a string @@ -165,20 +170,15 @@ var json = function(param,method,onSuccessFcn,onErrorFcn){ } return string; }; - //var g = 9; - //creating the string to send. We use array join and string concatenation with += - //as it is more efficient + + //creating the string to send. var param2string = toString_(param); var data2send = '{"id":"jsonrpc", "params":'; data2send+=param2string; data2send+=', "method":"' data2send+=method; data2send+='","jsonrpc":"1.0"}'; - // var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ s(itemid)+ - // '", "public_id": "'+s(marker.id)+'", "time": "'+s(offset)+ - // '", "author": "'+s(marker.author)+ - // '", "title": "'+s(marker.title)+ - // '","description": "'+s(marker.desc)+'"}], "method":"'+method+'","jsonrpc":"1.0"}'; + var $J = jQuery; $J.ajax({ type: "POST", @@ -208,6 +208,10 @@ var json = function(param,method,onSuccessFcn,onErrorFcn){ }); }; + +/** + * Returns an uniqid by creating the current local time in millisecond + a random number. Used for markers and some json calls + */ var uniqid = function() { var d = new Date(); return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18); @@ -275,7 +279,7 @@ function loadScripts(){ } var $J = jQuery; - //var time = new Date().getTime(); + if(loadInSeries){ var load = function(index){ if(index - * License: GNU General Public License version 2.0 +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * + * 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 . + * + * Author: Riccardo Zaccarelli */ /** diff --git a/telemeta/htdocs/js/playlist.js b/telemeta/htdocs/js/playlist.js index 099e2e18..d3f7a61d 100644 --- a/telemeta/htdocs/js/playlist.js +++ b/telemeta/htdocs/js/playlist.js @@ -1,8 +1,23 @@ -/** - * 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 + * + * 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 . + * + * Author: Riccardo Zaccarelli */ /** diff --git a/telemeta/htdocs/js/popupdiv.js b/telemeta/htdocs/js/popupdiv.js index 01d99d95..bf50f21e 100644 --- a/telemeta/htdocs/js/popupdiv.js +++ b/telemeta/htdocs/js/popupdiv.js @@ -1,12 +1,27 @@ -/** - * 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 + * + * 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 . + * + * Author: Riccardo Zaccarelli */ /** - * class for showing non-modal dialogs such as popups or combo lists + * class for showing non-modal dialogs such as popups or combo lists. Requires jQuery */ function PopupDiv(){ var $J = jQuery; diff --git a/telemeta/htdocs/timeside/js/divmarker.js b/telemeta/htdocs/timeside/js/divmarker.js index 190a313c..c3fb3b65 100644 --- a/telemeta/htdocs/timeside/js/divmarker.js +++ b/telemeta/htdocs/timeside/js/divmarker.js @@ -1,12 +1,27 @@ -/** - * 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 + * + * 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 . + * + * Author: Riccardo Zaccarelli */ /** - * 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(){ @@ -214,8 +229,8 @@ var MarkerMapDiv = TimesideArray.extend({ 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)); diff --git a/telemeta/htdocs/timeside/js/markermap.js b/telemeta/htdocs/timeside/js/markermap.js index 8132b6e4..f25c21bb 100644 --- a/telemeta/htdocs/timeside/js/markermap.js +++ b/telemeta/htdocs/timeside/js/markermap.js @@ -1,8 +1,25 @@ -/** - * 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 + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi */ /** diff --git a/telemeta/htdocs/timeside/js/player.js b/telemeta/htdocs/timeside/js/player.js index e69b94c5..bab1012c 100644 --- a/telemeta/htdocs/timeside/js/player.js +++ b/telemeta/htdocs/timeside/js/player.js @@ -1,3 +1,26 @@ +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi + */ var Player = TimesideClass.extend({ //sound duration is in milliseconds because the soundmanager has that unit, diff --git a/telemeta/htdocs/timeside/js/playerLoader.js b/telemeta/htdocs/timeside/js/playerLoader.js index c69363fe..82c15c0e 100644 --- a/telemeta/htdocs/timeside/js/playerLoader.js +++ b/telemeta/htdocs/timeside/js/playerLoader.js @@ -1,8 +1,25 @@ -/** - * TimeSide - Web Audio Components - * Copyright (c) 2011 Parisson - * Author: Riccardo Zaccarelli and Olivier Guilyardi - * License: GNU General Public License version 2.0 +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi */ /** diff --git a/telemeta/htdocs/timeside/js/ruler.js b/telemeta/htdocs/timeside/js/ruler.js index 80d19f7b..78ce4bf8 100644 --- a/telemeta/htdocs/timeside/js/ruler.js +++ b/telemeta/htdocs/timeside/js/ruler.js @@ -1,4 +1,31 @@ - +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi + */ + +/** + * 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){ @@ -51,7 +78,7 @@ var Ruler = TimesideArray.extend({ 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]; diff --git a/telemeta/htdocs/timeside/js/rulermarker.js b/telemeta/htdocs/timeside/js/rulermarker.js index 08643452..4ef2e512 100644 --- a/telemeta/htdocs/timeside/js/rulermarker.js +++ b/telemeta/htdocs/timeside/js/rulermarker.js @@ -1,13 +1,30 @@ -/** - * TimeSide - Web Audio Components - * Copyright (c) 2011 Parisson - * Author: Riccardo Zaccarelli and Olivier Guilyardi - * License: GNU General Public License version 2.0 +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi */ /** * 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({ @@ -91,81 +108,6 @@ 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; } @@ -184,7 +126,7 @@ var RulerMarker = TimesideClass.extend({ 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({ diff --git a/telemeta/htdocs/timeside/js/timeside.js b/telemeta/htdocs/timeside/js/timeside.js index 290d56d0..673a39d4 100644 --- a/telemeta/htdocs/timeside/js/timeside.js +++ b/telemeta/htdocs/timeside/js/timeside.js @@ -1,8 +1,25 @@ -/** - * TimeSide - Web Audio Components - * Copyright (c) 2011 Parisson - * Author: Riccardo Zaccarelli and Olivier Guilyardi - * License: GNU General Public License version 2.0 +/* + * Copyright (C) 2007-2011 Parisson + * Copyright (c) 2011 Riccardo Zaccarelli + * Copyright (c) 2010 Olivier Guilyardi + * + * 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 . + * + * Authors: Riccardo Zaccarelli + * Olivier Guilyardi */ /** @@ -13,9 +30,10 @@ * 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 @@ -134,11 +152,13 @@ })(); //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; }, @@ -226,9 +246,9 @@ var TimesideClass = Class.extend({ 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); @@ -242,12 +262,10 @@ var TimesideClass = Class.extend({ //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)){ @@ -297,8 +315,10 @@ var TimesideClass = Class.extend({ }); -//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(); @@ -345,7 +365,7 @@ var TimesideArray = TimesideClass.extend({ //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; @@ -449,7 +469,7 @@ var TimesideArray = TimesideClass.extend({ * 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 // diff --git a/telemeta/templates/telemeta_default/mediaitem_add.html b/telemeta/templates/telemeta_default/mediaitem_add.html index 5998b0fb..be3eb1a7 100644 --- a/telemeta/templates/telemeta_default/mediaitem_add.html +++ b/telemeta/templates/telemeta_default/mediaitem_add.html @@ -35,7 +35,8 @@ {% trans "Cancel" %} {% trans "Save" %} + onclick="var d=document; d.getElementById('wait-img').style.display='inline'; setTimeout(function(){d.getElementById('_addItemForm').submit();},300); return false;">{% trans "Save" %} + diff --git a/telemeta/templates/telemeta_default/mediaitem_detail.html b/telemeta/templates/telemeta_default/mediaitem_detail.html index 5821e615..7333ec44 100644 --- a/telemeta/templates/telemeta_default/mediaitem_detail.html +++ b/telemeta/templates/telemeta_default/mediaitem_detail.html @@ -140,7 +140,7 @@ wait  Loading... diff --git a/telemeta/templates/telemeta_default/mediaitem_edit.html b/telemeta/templates/telemeta_default/mediaitem_edit.html index 1dc70251..77b151c4 100644 --- a/telemeta/templates/telemeta_default/mediaitem_edit.html +++ b/telemeta/templates/telemeta_default/mediaitem_edit.html @@ -40,8 +40,9 @@