diff --git a/.editorconfig b/.editorconfig
index 8a80734..50c6884 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,17 +1,10 @@
-# EditorConfig helps developers define and maintain consistent
-# coding styles between different editors and IDEs
+# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
-
root = true
-
[*]
-
-# Change these settings to your own preference
indent_style = space
indent_size = 4
-
-# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
diff --git a/.jshintrc b/.jshintrc
index dc1d78b..a05f209 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,38 +1,32 @@
{
- "esnext": true,
"bitwise": true,
- "camelcase": true,
"curly": true,
"eqeqeq": true,
- "immed": true,
- "indent": 2,
+ "esnext": true,
+ "freeze": true,
"latedef": true,
- "newcap": true,
"noarg": true,
- "quotmark": "true",
- "regexp": true,
+ "nonbsp": true,
+ "nonew": true,
+ "notypeof": true,
+ "shadow": false,
+ "strict": true,
"undef": true,
"unused": true,
- "strict": true,
- "trailing": true,
- "smarttabs": true,
"globals": {
"_": false,
"affix": false,
"after": false,
- "afterEach": false,
"angular": false,
"before": false,
- "beforeEach": false,
"browser": false,
- "describe": false,
+ "console": false,
"expect": false,
"inject": false,
- "it": false,
- "jasmine": false,
- "spyOn": false
+ "installPromiseMatchers": false,
+ "module": false
},
"browser": true,
"jquery": true,
- "node": true
+ "jasmine": true
}
diff --git a/Gruntfile.js b/Gruntfile.js
index e190758..1e0c6e8 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -39,7 +39,7 @@ module.exports = function (grunt) {
watch: {
bower: {
files: ['bower.json'],
- tasks: ['wiredep']
+ tasks: ['wiredep', 'copy:svg']
},
js: {
files: ['<%= yeoman.app %>/**/*.js', '!<%= yeoman.app %>/**/*_test.js'],
@@ -52,12 +52,17 @@ module.exports = function (grunt) {
files: ['<%= yeoman.app %>/**/*_test.js'],
tasks: ['karma:continuous:run']
},
+ svg: {
+ files: ['<%= yeoman.app %>/images/**/*.svg', '!<%= yeoman.app %>/images/sprite/**'],
+ tasks: ['svg_sprite:dist']
+ },
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
files: [
'<%= yeoman.app %>/**/*.html',
+ '<%= yeoman.app %>/**/*.css',
'<%= yeoman.app %>/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
@@ -89,20 +94,6 @@ module.exports = function (grunt) {
}
}
},
- test: {
- options: {
- port: 9001,
- middleware: function (connect) {
- return [
- connect().use(
- '/bower_components',
- connect.static('./bower_components')
- ),
- connect.static(appConfig.app)
- ];
- }
- }
- },
coverage: {
options: {
open: true,
@@ -123,7 +114,7 @@ module.exports = function (grunt) {
// Test settings
karma: {
options: {
- configFile: './karma.conf.js',
+ configFile: './karma.conf.js'
},
unit: {
singleRun: true,
@@ -161,22 +152,6 @@ module.exports = function (grunt) {
}
},
- // Make sure code styles are up to par and there are no obvious mistakes
- jshint: {
- options: {
- jshintrc: '.jshintrc',
- reporter: require('jshint-stylish'),
- force: true //TODO: while I work on correcting those errors, don't block the build
- },
- all: {
- src: [
- 'Gruntfile.js',
- '<%= yeoman.app %>/**/*.js',
- '!<%= yeoman.app %>/vendor/**/*.js'
- ]
- }
- },
-
// Empties folders to start fresh
clean: {
dist: {
@@ -218,7 +193,7 @@ module.exports = function (grunt) {
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
- html: ['<%= yeoman.dist %>/{,*/}*.html'],
+ html: ['<%= yeoman.dist %>/**/*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
js: ['<%= yeoman.dist %>/scripts/*.js'],
options: {
@@ -264,6 +239,22 @@ module.exports = function (grunt) {
}
},
+ svg_sprite: {
+ options: {
+ mode: {
+ symbol: {
+ dest: '',
+ sprite: 'jamstash-sprite.svg'
+ }
+ }
+ },
+ dist: {
+ cwd: '<%= yeoman.app %>/images',
+ src: ['**/*.svg', '!sprite/**/*.svg'],
+ dest: '<%= yeoman.app %>/images/sprite'
+ }
+ },
+
// Minify our CSS files but do not merge them, we still want to have two
cssmin: {
styles: {
@@ -271,7 +262,7 @@ module.exports = function (grunt) {
expand: true,
cwd: '.tmp/styles',
src: ['*.css', '!*.min.css'],
- dest: '<%= yeoman.dist %>/styles',
+ dest: '<%= yeoman.dist %>/styles'
}]
}
},
@@ -309,6 +300,12 @@ module.exports = function (grunt) {
],
dest: '<%= yeoman.dist %>'
},
+ {
+ expand: true,
+ cwd: '<%= yeoman.app %>',
+ src: ['images/sprite/*.svg'],
+ dest: '<%= yeoman.dist %>'
+ },
{
expand: true,
cwd: '<%= yeoman.app %>',
@@ -324,6 +321,13 @@ module.exports = function (grunt) {
'bower_components/fancybox/source/*.{png,gif}'
],
dest: '.tmp/styles'
+ }
+ ]
+ },
+ svg: {
+ files: [{
+ src: ['bower_components/open-iconic/sprite/sprite.svg'],
+ dest: '<%= yeoman.app %>/images/sprite/iconic.svg'
}]
}
},
@@ -365,7 +369,7 @@ module.exports = function (grunt) {
sftp: {
test: {
files: {
- './': ['<%= yeoman.dist %>/{,*/}*', '<%= yeoman.dist %>/.git*']
+ './': ['<%= yeoman.dist %>/**/*', '<%= yeoman.dist %>/.git*']
},
options: {
path: '/var/www/jamstash',
@@ -388,7 +392,7 @@ module.exports = function (grunt) {
}
});
- grunt.registerTask('serve', 'Compile then start a connect web server', function(target) {
+ grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
@@ -401,14 +405,13 @@ module.exports = function (grunt) {
]);
});
- grunt.registerTask('test', 'Run unit tests and jshint', function() {
+ grunt.registerTask('test', 'Run unit tests and jshint', function () {
return grunt.task.run([
- 'karma:unit',
- 'jshint'
+ 'karma:unit'
]);
});
- grunt.registerTask('coverage', 'Run unit tests and display test coverage results on browser', function() {
+ grunt.registerTask('coverage', 'Run unit tests and display test coverage results on browser', function () {
return grunt.task.run([
'clean:coverage',
'karma:unit',
@@ -416,10 +419,11 @@ module.exports = function (grunt) {
]);
});
- grunt.registerTask('build', 'Concatenate all JS files, minify all JS, CSS, HTML and image files and version all static assets', function() {
+ grunt.registerTask('build', 'Concatenate all JS files, minify all JS, CSS, HTML and image files and version all static assets', function () {
return grunt.task.run([
'clean:dist',
'wiredep:app',
+ 'copy:svg',
'useminPrepare',
'concat:generated',
'copy:dist',
@@ -433,7 +437,7 @@ module.exports = function (grunt) {
]);
});
- grunt.registerTask('deploy', 'Build and deploy to test server', function() {
+ grunt.registerTask('deploy', 'Build and deploy to test server', function () {
return grunt.task.run([
'build',
'sshexec:cleanTest',
diff --git a/app/archive/archive-service.js b/app/archive/archive-service.js
index e2c37b4..01166f2 100644
--- a/app/archive/archive-service.js
+++ b/app/archive/archive-service.js
@@ -23,44 +23,45 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
};
var offset = 0;
- var mapAlbum = function (data) {
- var song = data;
- var coverartthumb, coverartfull, starred, title, album, publisher, avg_rating, downloads, identifier, source, date;
- var url = globals.archiveUrl + 'details/' + song.identifier;
- coverartthumb = 'images/albumdefault_50.jpg';
- coverartfull = 'images/albumdefault_160.jpg';
- if (parseInt(song.avg_rating) == 5) { starred = true; } else { starred = false; }
- if (typeof song.title == 'undefined') { title = ' '; } else { title = song.title.toString(); }
- if (typeof song.identifier == 'undefined') { identifier = ' '; } else { identifier = song.identifier.toString(); }
- if (typeof song.collection[0] == 'undefined') { album = ' '; } else { album = song.collection[0].toString(); }
- if (typeof song.source == 'undefined') { source = ' '; } else { source = song.source.toString(); }
- if (typeof song.date == 'undefined') { date = ' '; } else { date = song.date.toString(); }
- if (typeof song.publisher == 'undefined') { publisher = ' '; } else { publisher = song.publisher.toString(); }
- if (typeof song.avg_rating == 'undefined') { avg_rating = ' '; } else { avg_rating = song.avg_rating.toString(); }
- if (typeof song.downloads == 'undefined') { downloads = ' '; } else { downloads = song.downloads.toString(); }
+ var archiveService = {
+ mapAlbum: function (data) {
+ var song = data;
+ var coverartthumb, coverartfull, starred, title, album, publisher, avg_rating, downloads, identifier, source, date;
+ var url = globals.archiveUrl + 'details/' + song.identifier;
+ coverartthumb = 'images/albumdefault_50.jpg';
+ coverartfull = 'images/albumdefault_160.jpg';
+ if (parseInt(song.avg_rating) == 5) { starred = true; } else { starred = false; }
+ if (typeof song.title == 'undefined') { title = ' '; } else { title = song.title.toString(); }
+ if (typeof song.identifier == 'undefined') { identifier = ' '; } else { identifier = song.identifier.toString(); }
+ if (typeof song.collection[0] == 'undefined') { album = ' '; } else { album = song.collection[0].toString(); }
+ if (typeof song.source == 'undefined') { source = ' '; } else { source = song.source.toString(); }
+ if (typeof song.date == 'undefined') { date = ' '; } else { date = song.date.toString(); }
+ if (typeof song.publisher == 'undefined') { publisher = ' '; } else { publisher = song.publisher.toString(); }
+ if (typeof song.avg_rating == 'undefined') { avg_rating = ' '; } else { avg_rating = song.avg_rating.toString(); }
+ if (typeof song.downloads == 'undefined') { downloads = ' '; } else { downloads = song.downloads.toString(); }
- //var description = 'Details
';
- var description = 'Source: ' + source + '
';
- description += 'Date: ' + date + '
';
- description += 'Transferer: ' + publisher + '
';
- description += 'Rating: ' + avg_rating + '
';
- description += 'Downloads: ' + downloads + '
';
- return new model.Album(identifier, null, title, album, '', coverartthumb, coverartfull, $.format.date(new Date(song.publicdate), "yyyy-MM-dd h:mm a"), starred, $sce.trustAsHtml(description), url);
- };
- var mapSong = function (key, song, server, dir, identifier, coverart) {
- var url, time, track, title, rating, starred, contenttype, suffix;
- var specs = '';
- if (song.format == 'VBR MP3') {
- url = 'http://' + server + dir + key;
- if (typeof song.bitrate == 'undefined' || typeof song.format == 'undefined') { specs = ' '; } else { specs = song.bitrate + 'kbps, ' + song.format.toLowerCase(); }
- if (typeof song.track == 'undefined') { track = ' '; } else { track = song.track; }
- if (typeof song.title == 'undefined') { title = ' '; } else { title = song.title; }
- if (typeof song.length == 'undefined') { time = ' '; } else { time = utils.timeToSeconds(song.length); }
- return new model.Song(song.md5, identifier, song.track, title, song.creator, '', song.album, '', coverart, coverart, time, '', '', 'mp3', specs, url, 0, '');
- }
- };
+ //var description = 'Details
';
+ var description = 'Source: ' + source + '
';
+ description += 'Date: ' + date + '
';
+ description += 'Transferer: ' + publisher + '
';
+ description += 'Rating: ' + avg_rating + '
';
+ description += 'Downloads: ' + downloads + '
';
+ return new model.Album(identifier, null, title, album, '', coverartthumb, coverartfull, utils.formatDate(new Date(song.publicdate), "yyyy-MM-dd h:mm a"), starred, $sce.trustAsHtml(description), url);
+ },
+
+ mapSong: function (key, song, server, dir, identifier, coverart) {
+ var url, time, track, title, rating, starred, contenttype, suffix;
+ var specs = '';
+ if (song.format == 'VBR MP3') {
+ url = 'http://' + server + dir + key;
+ if (typeof song.bitrate == 'undefined' || typeof song.format == 'undefined') { specs = ' '; } else { specs = song.bitrate + 'kbps, ' + song.format.toLowerCase(); }
+ if (typeof song.track == 'undefined') { track = ' '; } else { track = song.track; }
+ if (typeof song.title == 'undefined') { title = ' '; } else { title = song.title; }
+ if (typeof song.length == 'undefined') { time = ' '; } else { time = utils.timeToSeconds(song.length); }
+ return new model.Song(song.md5, identifier, song.track, title, song.creator, '', song.album, '', coverart, coverart, time, '', '', 'mp3', specs, url, 0, '');
+ }
+ },
- return {
getArtists: function (query) {
var deferred = $q.defer();
if (globals.settings.Debug) { console.log("LOAD ARCHIVE.ORG COLLECTIONS"); }
@@ -138,7 +139,7 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
- content.album.push(mapAlbum(item));
+ content.album.push(archiveService.mapAlbum(item));
});
notifications.updateMessage(content.album.length + ' Items Returned', true);
} else {
@@ -178,7 +179,7 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
var items = data.files;
if (action == 'add') {
angular.forEach(items, function (item, key) {
- var song = mapSong(key, item, server, dir, identifier, coverart);
+ var song = archiveService.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
player.queue.push(song);
}
@@ -187,7 +188,7 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
} else if (action == 'play') {
player.queue = [];
angular.forEach(items, function (item, key) {
- var song = mapSong(key, item, server, dir, identifier, coverart);
+ var song = archiveService.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
player.queue.push(song);
}
@@ -199,7 +200,7 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
- var song = mapSong(key, item, server, dir, identifier, coverart);
+ var song = archiveService.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
content.song.push(song);
}
@@ -214,4 +215,5 @@ angular.module('jamstash.archive.service', ['jamstash.settings.service', 'jamsta
return deferred.promise;
}
};
+ return archiveService;
}]);
diff --git a/app/archive/archive-service_test.js b/app/archive/archive-service_test.js
index 543f5a7..981d047 100644
--- a/app/archive/archive-service_test.js
+++ b/app/archive/archive-service_test.js
@@ -1,4 +1,52 @@
describe("archive service", function() {
- 'use strict';
+ 'use strict';
-});
\ No newline at end of file
+ var archive, mockBackend, mockGlobals, utils,
+ response;
+
+ beforeEach(function() {
+
+ mockGlobals = {
+ archiveUrl: "http://hysterotomy.com/hippolytus/quercitrin?a=chillagite&b=savour#superfecundation"
+ };
+
+ module('jamstash.archive.service', function ($provide) {
+ $provide.value('globals', mockGlobals);
+ $provide.decorator('player', function () {
+ var playerService = jasmine.createSpyObj("player", ["play"]);
+ playerService.queue = [];
+ return playerService;
+ });
+ $provide.decorator('notifications', function () {
+ return jasmine.createSpyObj("notifications", ["updateMessage"]);
+ });
+ $provide.decorator('utils', function () {
+ return jasmine.createSpyObj("utils", ["formatDate"]);
+ });
+ });
+
+ inject(function (_archive_, $httpBackend, _utils_) {
+ archive = _archive_;
+ mockBackend = $httpBackend;
+ utils = _utils_;
+ });
+ });
+
+ afterEach(function() {
+ mockBackend.verifyNoOutstandingExpectation();
+ mockBackend.verifyNoOutstandingRequest();
+ });
+
+ describe("mapAlbum() -", function() {
+ it("Given album data with a publicDate defined, when I map it to an Album, then utils.formatDate will be called", function() {
+ var albumData = {
+ id: 504,
+ publicDate: "2015-03-29T18:22:06.000Z",
+ collection: ['Sternal Daubreelite']
+ };
+
+ archive.mapAlbum(albumData);
+ expect(utils.formatDate).toHaveBeenCalledWith(jasmine.any(Date), "yyyy-MM-dd h:mm a");
+ });
+ });
+});
diff --git a/app/archive/archive.html b/app/archive/archive.html
index d9ff685..7a4ea67 100644
--- a/app/archive/archive.html
+++ b/app/archive/archive.html
@@ -44,7 +44,7 @@
-
+
- * Encodes the given data with base64.
- * String $.base64Encode ( String str )
- *
- * Decodes a base64 encoded data.
- * String $.base64Decode ( String str )
- *
- *
- * Encodes and Decodes the given data in base64.
- * This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
- * Base64-encoded data takes about 33% more space than the original data.
- * This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.
- * If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
- * This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
- *
- * Example
- * Code
- *
- * $.base64Encode("I'm Persian.");
- *
- * Result
- *
- * "SSdtIFBlcnNpYW4u"
- *
- * Code
- *
- * $.base64Decode("SSdtIFBlcnNpYW4u");
- *
- * Result
- *
- * "I'm Persian."
- *
- *
- * @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
- * @link http://www.semnanweb.com/jquery-plugin/base64.html
- * @see http://www.webtoolkit.info/
- * @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
- * @param {jQuery} {base64Encode:function(input))
- * @param {jQuery} {base64Decode:function(input))
- * @return string
- */
-
- (function($){
-
- var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
- var uTF8Encode = function(string) {
- string = string.replace(/\x0d\x0a/g, "\x0a");
- var output = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- output += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- output += String.fromCharCode((c >> 6) | 192);
- output += String.fromCharCode((c & 63) | 128);
- } else {
- output += String.fromCharCode((c >> 12) | 224);
- output += String.fromCharCode(((c >> 6) & 63) | 128);
- output += String.fromCharCode((c & 63) | 128);
- }
- }
- return output;
- };
-
- var uTF8Decode = function(input) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
- while ( i < input.length ) {
- c = input.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if ((c > 191) && (c < 224)) {
- c2 = input.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = input.charCodeAt(i+1);
- c3 = input.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
-
- $.extend({
- base64Encode: function(input) {
- var output = "";
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
- var i = 0;
- input = uTF8Encode(input);
- while (i < input.length) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
- }
- return output;
- },
- base64Decode: function(input) {
- var output = "";
- var chr1, chr2, chr3;
- var enc1, enc2, enc3, enc4;
- var i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (i < input.length) {
- enc1 = keyString.indexOf(input.charAt(i++));
- enc2 = keyString.indexOf(input.charAt(i++));
- enc3 = keyString.indexOf(input.charAt(i++));
- enc4 = keyString.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 != 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 != 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = uTF8Decode(output);
- return output;
- }
- });
- })(jQuery);
\ No newline at end of file
diff --git a/app/vendor/jquery.dateFormat-1.0.js b/app/vendor/jquery.dateFormat-1.0.js
deleted file mode 100644
index 985d313..0000000
--- a/app/vendor/jquery.dateFormat-1.0.js
+++ /dev/null
@@ -1,317 +0,0 @@
-(function (jQuery) {
-
- var daysInWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
- var shortMonthsInYear = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
- var longMonthsInYear = ["January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"];
- var shortMonthsToNumber = [];
- shortMonthsToNumber["Jan"] = "01";
- shortMonthsToNumber["Feb"] = "02";
- shortMonthsToNumber["Mar"] = "03";
- shortMonthsToNumber["Apr"] = "04";
- shortMonthsToNumber["May"] = "05";
- shortMonthsToNumber["Jun"] = "06";
- shortMonthsToNumber["Jul"] = "07";
- shortMonthsToNumber["Aug"] = "08";
- shortMonthsToNumber["Sep"] = "09";
- shortMonthsToNumber["Oct"] = "10";
- shortMonthsToNumber["Nov"] = "11";
- shortMonthsToNumber["Dec"] = "12";
-
- jQuery.format = (function () {
- function strDay(value) {
- return daysInWeek[parseInt(value, 10)] || value;
- }
-
- function strMonth(value) {
- var monthArrayIndex = parseInt(value, 10) - 1;
- return shortMonthsInYear[monthArrayIndex] || value;
- }
-
- function strLongMonth(value) {
- var monthArrayIndex = parseInt(value, 10) - 1;
- return longMonthsInYear[monthArrayIndex] || value;
- }
-
- var parseMonth = function (value) {
- return shortMonthsToNumber[value] || value;
- };
-
- var parseTime = function (value) {
- var retValue = value;
- var millis = "";
- if (retValue.indexOf(".") !== -1) {
- var delimited = retValue.split('.');
- retValue = delimited[0];
- millis = delimited[1];
- }
-
- var values3 = retValue.split(":");
-
- if (values3.length === 3) {
- hour = values3[0];
- minute = values3[1];
- second = values3[2];
-
- return {
- time: retValue,
- hour: hour,
- minute: minute,
- second: second,
- millis: millis
- };
- } else {
- return {
- time: "",
- hour: "",
- minute: "",
- second: "",
- millis: ""
- };
- }
- };
-
- return {
- date: function (value, format) {
- /*
- value = new java.util.Date()
- 2009-12-18 10:54:50.546
- */
- try {
- var date = null;
- var year = null;
- var month = null;
- var dayOfMonth = null;
- var dayOfWeek = null;
- var time = null;
- if (typeof value == "number"){
- return this.date(new Date(value), format);
- } else if (typeof value.getFullYear == "function") {
- year = value.getFullYear();
- month = value.getMonth() + 1;
- dayOfMonth = value.getDate();
- dayOfWeek = value.getDay();
- time = parseTime(value.toTimeString());
- } else if (value.search(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[Z\-+]?(\d{2}:?\d{2})?/) != -1) {
- /* 2009-04-19T16:11:05+02:00 || 2009-04-19T16:11:05Z */
- var values = value.split(/[T\+-]/);
- year = values[0];
- month = values[1];
- dayOfMonth = values[2];
- time = parseTime(values[3].split(".")[0]);
- date = new Date(year, month - 1, dayOfMonth);
- dayOfWeek = date.getDay();
- } else {
- var values = value.split(" ");
- switch (values.length) {
- case 6:
- /* Wed Jan 13 10:43:41 CET 2010 */
- year = values[5];
- month = parseMonth(values[1]);
- dayOfMonth = values[2];
- time = parseTime(values[3]);
- date = new Date(year, month - 1, dayOfMonth);
- dayOfWeek = date.getDay();
- break;
- case 2:
- /* 2009-12-18 10:54:50.546 */
- var values2 = values[0].split("-");
- year = values2[0];
- month = values2[1];
- dayOfMonth = values2[2];
- time = parseTime(values[1]);
- date = new Date(year, month - 1, dayOfMonth);
- dayOfWeek = date.getDay();
- break;
- case 7:
- /* Tue Mar 01 2011 12:01:42 GMT-0800 (PST) */
- case 9:
- /*added by Larry, for Fri Apr 08 2011 00:00:00 GMT+0800 (China Standard Time) */
- case 10:
- /* added by Larry, for Fri Apr 08 2011 00:00:00 GMT+0200 (W. Europe Daylight Time) */
- year = values[3];
- month = parseMonth(values[1]);
- dayOfMonth = values[2];
- time = parseTime(values[4]);
- date = new Date(year, month - 1, dayOfMonth);
- dayOfWeek = date.getDay();
- break;
- case 1:
- /* added by Jonny, for 2012-02-07CET00:00:00 (Doctrine Entity -> Json Serializer) */
- var values2 = values[0].split("");
- year=values2[0]+values2[1]+values2[2]+values2[3];
- month= values2[5]+values2[6];
- dayOfMonth = values2[8]+values2[9];
- time = parseTime(values2[13]+values2[14]+values2[15]+values2[16]+values2[17]+values2[18]+values2[19]+values2[20])
- date = new Date(year, month - 1, dayOfMonth);
- dayOfWeek = date.getDay();
- break;
- default:
- return value;
- }
- }
-
- var pattern = "";
- var retValue = "";
- var unparsedRest = "";
- /*
- Issue 1 - variable scope issue in format.date
- Thanks jakemonO
- */
- for (var i = 0; i < format.length; i++) {
- var currentPattern = format.charAt(i);
- pattern += currentPattern;
- unparsedRest = "";
- switch (pattern) {
- case "ddd":
- retValue += strDay(dayOfWeek);
- pattern = "";
- break;
- case "dd":
- if (format.charAt(i + 1) == "d") {
- break;
- }
- if (String(dayOfMonth).length === 1) {
- dayOfMonth = '0' + dayOfMonth;
- }
- retValue += dayOfMonth;
- pattern = "";
- break;
- case "d":
- if (format.charAt(i + 1) == "d") {
- break;
- }
- retValue += parseInt(dayOfMonth, 10);
- pattern = "";
- break;
- case "MMMM":
- retValue += strLongMonth(month);
- pattern = "";
- break;
- case "MMM":
- if (format.charAt(i + 1) === "M") {
- break;
- }
- retValue += strMonth(month);
- pattern = "";
- break;
- case "MM":
- if (format.charAt(i + 1) == "M") {
- break;
- }
- if (String(month).length === 1) {
- month = '0' + month;
- }
- retValue += month;
- pattern = "";
- break;
- case "M":
- if (format.charAt(i + 1) == "M") {
- break;
- }
- retValue += parseInt(month, 10);
- pattern = "";
- break;
- case "yyyy":
- retValue += year;
- pattern = "";
- break;
- case "yy":
- if (format.charAt(i + 1) == "y" &&
- format.charAt(i + 2) == "y") {
- break;
- }
- retValue += String(year).slice(-2);
- pattern = "";
- break;
- case "HH":
- retValue += time.hour;
- pattern = "";
- break;
- case "hh":
- /* time.hour is "00" as string == is used instead of === */
- var hour = (time.hour == 0 ? 12 : time.hour < 13 ? time.hour : time.hour - 12);
- hour = String(hour).length == 1 ? '0' + hour : hour;
- retValue += hour;
- pattern = "";
- break;
- case "h":
- if (format.charAt(i + 1) == "h") {
- break;
- }
- var hour = (time.hour == 0 ? 12 : time.hour < 13 ? time.hour : time.hour - 12);
- retValue += parseInt(hour, 10);
- // Fixing issue https://github.com/phstc/jquery-dateFormat/issues/21
- // retValue = parseInt(retValue, 10);
- pattern = "";
- break;
- case "mm":
- retValue += time.minute;
- pattern = "";
- break;
- case "ss":
- /* ensure only seconds are added to the return string */
- retValue += time.second.substring(0, 2);
- pattern = "";
- break;
- case "SSS":
- retValue += time.millis.substring(0, 3);
- pattern = "";
- break;
- case "a":
- retValue += time.hour >= 12 ? "PM" : "AM";
- pattern = "";
- break;
- case " ":
- retValue += currentPattern;
- pattern = "";
- break;
- case "/":
- retValue += currentPattern;
- pattern = "";
- break;
- case ":":
- retValue += currentPattern;
- pattern = "";
- break;
- default:
- if (pattern.length === 2 && pattern.indexOf("y") !== 0 && pattern != "SS") {
- retValue += pattern.substring(0, 1);
- pattern = pattern.substring(1, 2);
- } else if ((pattern.length === 3 && pattern.indexOf("yyy") === -1)) {
- pattern = "";
- } else {
- unparsedRest = pattern;
- }
- }
- }
- retValue += unparsedRest;
- return retValue;
- } catch (e) {
- console.log(e);
- return value;
- }
- }
- };
- }());
-}(jQuery));
-
-jQuery.format.date.defaultShortDateFormat = "dd/MM/yyyy";
-jQuery.format.date.defaultLongDateFormat = "dd/MM/yyyy hh:mm:ss";
-
-jQuery(document).ready(function () {
- jQuery(".shortDateFormat").each(function (idx, elem) {
- if (jQuery(elem).is(":input")) {
- jQuery(elem).val(jQuery.format.date(jQuery(elem).val(), jQuery.format.date.defaultShortDateFormat));
- } else {
- jQuery(elem).text(jQuery.format.date(jQuery(elem).text(), jQuery.format.date.defaultShortDateFormat));
- }
- });
- jQuery(".longDateFormat").each(function (idx, elem) {
- if (jQuery(elem).is(":input")) {
- jQuery(elem).val(jQuery.format.date(jQuery(elem).val(), jQuery.format.date.defaultLongDateFormat));
- } else {
- jQuery(elem).text(jQuery.format.date(jQuery(elem).text(), jQuery.format.date.defaultLongDateFormat));
- }
- });
-});
\ No newline at end of file
diff --git a/bower.json b/bower.json
index 8252bdf..c46dbe4 100644
--- a/bower.json
+++ b/bower.json
@@ -19,28 +19,30 @@
"archive.org",
"music"
],
- "license": "MIT",
+ "license": "GPL-2.0",
"repository": {
"type": "git",
"url": "https://github.com/tsquillario/Jamstash.git"
},
"main": "app/index.html",
"dependencies": {
- "angular": "~1.2.0",
- "angular-route": "~1.2.0",
- "angular-sanitize": "~1.2.0",
- "angular-cookies": "~1.2.0",
- "angular-resource": "~1.2.0",
+ "angular": "~1.3.15",
+ "angular-route": "~1.3.15",
+ "angular-sanitize": "~1.3.15",
+ "angular-cookies": "~1.3.15",
+ "angular-resource": "~1.3.15",
"jquery": "~2.0.0",
"jquery-ui": "~1.10.0",
"jplayer": "~2.9.0",
"fancybox": "~2.1.4",
"notify.js": "<=1.2.2",
"jquery.scrollTo": "~1.4.5",
- "underscore": "~1.7.0",
+ "jquery-dateFormat": "~1.0.2",
+ "underscore": "~1.8.3",
"angular-underscore": "~0.5.0",
"angular-locker": "~1.2.0",
- "angular-ui-utils": "bower-keypress"
+ "angular-ui-utils": "bower-keypress",
+ "open-iconic": "~1.1.1"
},
"overrides": {
"fancybox": {
@@ -51,8 +53,8 @@
}
},
"devDependencies": {
- "angular-mocks": "~1.2.0",
- "jasmine-promise-matchers": "~0.0.3",
+ "angular-mocks": "~1.3.15",
+ "jasmine-promise-matchers": "~1.1.1",
"jasmine-fixture": "~1.2.2"
},
"ignore": [
diff --git a/karma.conf.js b/karma.conf.js
index e4c75ba..67b8e34 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -30,6 +30,7 @@ module.exports = function (config) {
'bower_components/fancybox/source/jquery.fancybox.js',
'bower_components/notify.js/notify.js',
'bower_components/jquery.scrollTo/jquery.scrollTo.js',
+ 'bower_components/jquery-dateFormat/dist/jquery-dateFormat.js',
'bower_components/underscore/underscore.js',
'bower_components/angular-underscore/angular-underscore.js',
'bower_components/angular-locker/dist/angular-locker.min.js',
@@ -39,14 +40,21 @@ module.exports = function (config) {
'bower_components/jasmine-fixture/dist/jasmine-fixture.js',
// endbower
'app/**/*.js',
- 'app/**/*_test.js'
+ 'app/**/*_test.js',
+ 'app/**/*.html'
],
// list of files / patterns to exclude
// exclude: ['app/vendor/**/*.js'],
preprocessors: {
- 'app/**/!(*_test).js': ['coverage']
+ 'app/**/!(*_test).js': ['coverage'],
+ 'app/**/*.html': ['ng-html2js']
+ },
+
+ ngHtml2JsPreprocessor: {
+ stripPrefix: 'app/',
+ moduleName: 'templates'
},
// web server port
@@ -60,18 +68,7 @@ module.exports = function (config) {
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
- browsers: [
- 'PhantomJS'
- ],
-
- // Which plugins to enable
- plugins: [
- 'karma-chrome-launcher',
- 'karma-phantomjs-launcher',
- 'karma-jasmine',
- 'karma-coverage',
- 'karma-notify-reporter'
- ],
+ browsers: [],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
diff --git a/package.json b/package.json
index 3e20657..a7f8083 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"x37v (https://github.com/x37v)",
"Hyzual (https://github.com/Hyzual)"
],
- "license": "MIT",
+ "license": "GPL-2.0",
"homepage": "http://jamstash.com",
"keywords": [
"subsonic",
@@ -31,30 +31,29 @@
"grunt": "^0.4.5",
"grunt-bump": "^0.3.0",
"grunt-contrib-clean": "^0.6.0",
- "grunt-contrib-concat": "^0.5.0",
- "grunt-contrib-connect": "^0.8.0",
- "grunt-contrib-copy": "^0.7.0",
- "grunt-contrib-cssmin": "^0.10.0",
- "grunt-contrib-htmlmin": "^0.3.0",
- "grunt-contrib-imagemin": "^0.9.1",
- "grunt-contrib-jshint": "^0.10.0",
- "grunt-contrib-uglify": "^0.6.0",
+ "grunt-contrib-concat": "^0.5.1",
+ "grunt-contrib-connect": "^0.10.1",
+ "grunt-contrib-copy": "^0.8.0",
+ "grunt-contrib-cssmin": "^0.12.2",
+ "grunt-contrib-htmlmin": "^0.4.0",
+ "grunt-contrib-imagemin": "^0.9.4",
+ "grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
- "grunt-filerev": "^2.1.1",
- "grunt-karma": "^0.9.0",
+ "grunt-filerev": "^2.2.0",
+ "grunt-karma": "^0.10.1",
"grunt-notify": "^0.4.1",
- "grunt-ssh": "^0.12.0",
- "grunt-usemin": "^2.6.0",
- "grunt-wiredep": "^1.9.0",
- "jit-grunt": "^0.9.0",
- "jshint-stylish": "^1.0.0",
- "karma": "^0.12.32",
- "karma-chrome-launcher": "^0.1.5",
- "karma-coverage": "^0.2.6",
- "karma-jasmine": "^0.3.0",
+ "grunt-ssh": "^0.12.2",
+ "grunt-svg-sprite": "^1.1.0",
+ "grunt-usemin": "^3.0.0",
+ "grunt-wiredep": "^2.0.0",
+ "jit-grunt": "^0.9.1",
+ "karma": "^0.12.31",
+ "karma-chrome-launcher": "^0.1.7",
+ "karma-coverage": "^0.2.7",
+ "karma-jasmine": "^0.3.5",
+ "karma-ng-html2js-preprocessor": "^0.1.2",
"karma-notify-reporter": "^0.1.1",
- "karma-phantomjs-launcher": "^0.1.4",
- "time-grunt": "^1.0.0"
+ "time-grunt": "^1.1.0"
},
"engines": {
"node": ">=0.10.0"