From e5c2ba602a37e812110a98baf59e8ef6a594c124 Mon Sep 17 00:00:00 2001 From: Matthieu Lalonde Date: Fri, 9 Nov 2012 14:08:22 -0500 Subject: [PATCH] Added webaudio module files, small lint changes and comments --- index.html | 3 +- resources/js/main.js | 29 ++++++++--------- resources/js/modules/daap.js | 0 resources/js/modules/webaudio.js | 18 +++++++++++ resources/js/views/player.js | 53 +++++++++++++++++++++++++++++++- 5 files changed, 86 insertions(+), 17 deletions(-) delete mode 100644 resources/js/modules/daap.js create mode 100644 resources/js/modules/webaudio.js diff --git a/index.html b/index.html index d58b364..73c1238 100644 --- a/index.html +++ b/index.html @@ -26,6 +26,5 @@ - - + \ No newline at end of file diff --git a/resources/js/main.js b/resources/js/main.js index 60484b5..607b64b 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -2,6 +2,8 @@ /*jslint laxcomma:true */ /*jslint loopfunc:true */ /*jslint strict:true */ +/*jslint browser:true */ +/*jslint devel:true */ require.config({ shim: { "jquery-ui": ["jquery"] @@ -90,20 +92,19 @@ require.config({ , urlArgs: "v=0.3.2" }); -require( - [ - "app" +require([ + "app" - , "jquery" - ] - , function __fnMainRequireLoader( App, $ ) { - "use strict"; + , "jquery" +] +, function __fnMainRequireLoader ( App, $ ) { + "use strict"; - // JQuery Backwords compatibility fix - $.curCSS = $.css; + // JQuery Backwords compatibility fix + $.curCSS = $.css; - $("body").ready(function __fnAppRequireLoader(){ - window.App = new App(); - }); - } -); \ No newline at end of file + $("body").ready(function __fnAppRequireLoader () { + // We export App to window for debuging purposes. + window.App = new App(); + }); +}); \ No newline at end of file diff --git a/resources/js/modules/daap.js b/resources/js/modules/daap.js deleted file mode 100644 index e69de29..0000000 diff --git a/resources/js/modules/webaudio.js b/resources/js/modules/webaudio.js new file mode 100644 index 0000000..cb432e1 --- /dev/null +++ b/resources/js/modules/webaudio.js @@ -0,0 +1,18 @@ +/*jslint laxbreak:true */ +/*jslint laxcomma:true */ +/*jslint loopfunc:true */ +/*jslint strict:true */ +/*jslint browser:true */ +/*jslint devel:true */ +define([ + "underscore" +] +, function ( +_ +) { + "use strict"; + + var WebAudio = function() {}; + + return WebAudio; +}); \ No newline at end of file diff --git a/resources/js/views/player.js b/resources/js/views/player.js index b70cba0..b0a0624 100644 --- a/resources/js/views/player.js +++ b/resources/js/views/player.js @@ -9,6 +9,8 @@ define([ , "jquery" , "backbone" + , "modules/webaudio" + , "text!../../templates/player/layout.html" , "text!../../templates/player/player-status.html" ] @@ -17,6 +19,8 @@ _ , $ , Backbone +, WebAudio + , tmplPlayerLayout , tmplPlayerStatus ) { @@ -42,12 +46,26 @@ _ , _stateAudio: null + , events: { + //"click #add-friend": "showPrompt", + "click div:first-child > a.buttonPrev": "__buttonPrevious" + , "click div:first-child > a.buttonNext": "__buttonNext" + , "click div:first-child > a.buttonPlay": "__buttonPlayPause" + // Volume Down + , "click div:first-child > .playerVolumeWrapper > a:first-child": "__buttonVolumeDown" + // Volume Up + , "click div:first-child > .playerVolumeWrapper > a:last-child": "__buttonVolumeUp" + // Volume click + , "click div:first-child > .playerVolumeWrapper > input": "__buttonVolumeClick" + // Seek input + , "click div:last-child > .playerProgressWrapper > progress": "__buttonSeek" + } + , initialize: function (options) { var that = this ; _.bindAll(this - , "setPlayIndex" , "setRandomState" , "setRepeatState" , "__buttonPlayPause" @@ -56,6 +74,7 @@ _ , "__buttonVolumeUp" , "__buttonVolumeDown" , "__buttonVolumeClick" + , "__buttonSeek" , "_createWebAudio" , "__waStateChanged" , "_playerEnded" @@ -66,6 +85,8 @@ _ , "_playerStop" , "_playerStart" , "_setVolume" + , "_getItemData" + , "_getItemMediaUrl" , "_setViewport" , "_updateViewportProgress" ); @@ -84,6 +105,9 @@ _ return that; } +/** + * PUBLIC +**/ , setPlayIndex: function (index) { var that = this ; @@ -102,6 +126,9 @@ _ } +/** + * EVENTS +**/ , __buttonPlayPause: function (event) { var that = this ; @@ -138,6 +165,16 @@ _ } + , __buttonSeek: function (event) { + var that = this + ; + + } + +/** + * PRIVATE +**/ +// Audio Player , _createWebAudio: function () { var that = this ; @@ -150,6 +187,7 @@ _ } +// Player Controls , _playerEnded: function () { var that = this ; @@ -198,6 +236,19 @@ _ } +// Viewport methods + , _getItemData: function (item) { + var that = this + ; + + } + + , _getItemMediaUrl: function (item) { + var that = this + ; + + } + , _setViewport: function (item) { var that = this ;