src/js/model.js
branchnew-model
changeset 917 eb8677d3a663
parent 916 ec6849bbbdcc
child 919 972099304059
--- a/src/js/model.js	Tue Jun 12 19:44:20 2012 +0200
+++ b/src/js/model.js	Wed Jun 20 14:45:30 2012 +0200
@@ -1,3 +1,5 @@
+/* TODO: Separate Project-specific data from Source */
+
 /* model.js is where data is stored in a standard form, whatever the serializer */
 
 IriSP.Model = {
@@ -294,11 +296,11 @@
 }
 
 IriSP.Model.Time.prototype.getSeconds = function() {
-    return Math.floor(this.milliseconds / 1000);
+    return this.milliseconds / 1000;
 }
 
 IriSP.Model.Time.prototype.getHMS = function() {
-    var _totalSeconds = Math.abs(this.getSeconds());
+    var _totalSeconds = Math.abs(Math.floor(this.getSeconds()));
     return {
         hours : Math.floor(_totalSeconds / 3600),
         minutes : (Math.floor(_totalSeconds / 60) % 60),
@@ -779,6 +781,9 @@
 }
 
 IriSP.Model.Directory.prototype.remoteSource = function(_properties) {
+    if (typeof _properties !== "object" || typeof _properties.url === "undefined") {
+        throw "Error : IriSP.Model.Directory.remoteSource(configuration): configuration.url is undefined";
+    }
     var _config = IriSP._({ directory: this }).extend(_properties);
     if (typeof this.remoteSources[_properties.url] === "undefined") {
         this.remoteSources[_properties.url] = new IriSP.Model.RemoteSource(_config);