2012-04-10 14:06:46 +00:00
|
|
|
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
|
|
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
|
|
// be included in the compiled file accessible from http://example.com/assets/application.js
|
2012-04-10 13:31:21 +00:00
|
|
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
|
|
// the compiled file.
|
|
|
|
//
|
2012-04-10 14:06:46 +00:00
|
|
|
|
2015-04-05 20:28:45 +00:00
|
|
|
//= require ./app/lib/core/jquery-2.1.3.js
|
2014-12-08 09:39:05 +00:00
|
|
|
//= require ./app/lib/core/jquery-ui-1.11.2.js
|
2015-04-13 12:44:36 +00:00
|
|
|
//= require ./app/lib/core/underscore-1.8.3.js
|
2014-09-02 14:35:50 +00:00
|
|
|
|
2014-09-04 00:54:33 +00:00
|
|
|
//= require ./app/lib/animations/velocity.min.js
|
2014-09-02 14:35:50 +00:00
|
|
|
//= require ./app/lib/animations/velocity.ui.js
|
2012-11-05 14:37:59 +00:00
|
|
|
|
|
|
|
//not_used= require_tree ./app/lib/spine
|
2014-04-06 11:32:20 +00:00
|
|
|
//= require ./app/lib/spine/spine.coffee
|
|
|
|
//= require ./app/lib/spine/ajax.coffee
|
|
|
|
//= require ./app/lib/spine/local.coffee
|
|
|
|
//= require ./app/lib/spine/route.coffee
|
2012-11-05 14:37:59 +00:00
|
|
|
|
2012-12-18 02:00:31 +00:00
|
|
|
//= require ./app/lib/flot/jquery.flot.js
|
|
|
|
//= require ./app/lib/flot/jquery.flot.selection.js
|
|
|
|
|
2012-11-05 14:37:59 +00:00
|
|
|
//not_used= require_tree ./app/lib/bootstrap
|
2013-08-19 21:03:03 +00:00
|
|
|
//= require ./app/lib/bootstrap/dropdown.js
|
|
|
|
//= require ./app/lib/bootstrap/tooltip.js
|
|
|
|
//= require ./app/lib/bootstrap/popover.js
|
2015-01-14 21:59:56 +00:00
|
|
|
//= require ./app/lib/bootstrap/popover-enhance.js
|
2015-01-15 09:07:06 +00:00
|
|
|
|
|
|
|
// modified by Felix Jan-2014
|
2013-08-19 21:03:03 +00:00
|
|
|
//= require ./app/lib/bootstrap/modal.js
|
2015-01-15 09:07:06 +00:00
|
|
|
|
2013-08-19 21:03:03 +00:00
|
|
|
//= require ./app/lib/bootstrap/tab.js
|
|
|
|
//= require ./app/lib/bootstrap/transition.js
|
|
|
|
//= require ./app/lib/bootstrap/button.js
|
|
|
|
//= require ./app/lib/bootstrap/collapse.js
|
2012-11-05 14:37:59 +00:00
|
|
|
|
2015-03-10 20:11:36 +00:00
|
|
|
//= require ./app/lib/rangy/rangy-core.js
|
|
|
|
//= require ./app/lib/rangy/rangy-classapplier.js
|
|
|
|
//= require ./app/lib/rangy/rangy-textrange.js
|
|
|
|
//= require ./app/lib/rangy/rangy-highlighter.js
|
|
|
|
|
2012-11-05 14:37:59 +00:00
|
|
|
//= require_tree ./app/lib/base
|
|
|
|
|
|
|
|
//= require ./app/index.js.coffee
|
2012-12-20 09:16:02 +00:00
|
|
|
|
|
|
|
// IE8 workaround for missing console.log
|
|
|
|
if (!window.console) {
|
|
|
|
window.console = {}
|
|
|
|
}
|
|
|
|
if (!console.log) {
|
|
|
|
console.log = function(){}
|
|
|
|
}
|
2013-01-25 09:15:41 +00:00
|
|
|
|
2013-03-07 22:42:37 +00:00
|
|
|
function escapeRegExp(str) {
|
|
|
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
|
|
}
|
2013-01-25 09:15:41 +00:00
|
|
|
|
|
|
|
Date.prototype.getWeek = function() {
|
|
|
|
var onejan = new Date(this.getFullYear(),0,1);
|
|
|
|
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
|
2013-03-08 07:27:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function difference(object1, object2) {
|
|
|
|
var changes = {};
|
|
|
|
for ( var name in object1 ) {
|
|
|
|
if ( name in object2 ) {
|
|
|
|
if ( _.isObject( object2[name] ) && !_.isArray( object2[name] ) ) {
|
|
|
|
var diff = difference( object1[name], object2[name] );
|
|
|
|
if ( !_.isEmpty( diff ) ) {
|
|
|
|
changes[name] = diff;
|
|
|
|
}
|
|
|
|
} else if ( !_.isEqual( object1[name], object2[name] ) ) {
|
|
|
|
changes[name] = object2[name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return changes;
|
2013-07-22 22:41:13 +00:00
|
|
|
}
|
|
|
|
|
2015-01-29 13:19:11 +00:00
|
|
|
// clone, just data, no instances of objects
|
2015-02-06 21:51:52 +00:00
|
|
|
function clone(item, full) {
|
|
|
|
if (!item) { return item }
|
2015-01-29 13:19:11 +00:00
|
|
|
|
|
|
|
// ignore certain objects
|
2015-02-06 21:51:52 +00:00
|
|
|
var acceptedInstances = [ 'Object', 'Number', 'String', 'Boolean', 'Array' ]
|
|
|
|
if (full) {
|
|
|
|
acceptedInstances.push( 'Function' )
|
|
|
|
}
|
2015-01-29 13:19:11 +00:00
|
|
|
if (item && item.constructor) {
|
|
|
|
if (!_.contains(acceptedInstances, item.constructor.name)) {
|
2015-02-06 21:51:52 +00:00
|
|
|
return
|
2015-01-29 13:19:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy array
|
2015-02-06 21:51:52 +00:00
|
|
|
var result;
|
2015-01-29 13:19:11 +00:00
|
|
|
if ( _.isArray(item) ) {
|
2015-02-06 21:51:52 +00:00
|
|
|
result = []
|
2015-01-29 13:19:11 +00:00
|
|
|
item.forEach(function(child, index, array) {
|
2015-02-06 21:51:52 +00:00
|
|
|
result[index] = clone( child, full )
|
2015-01-29 13:19:11 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-02-06 21:51:52 +00:00
|
|
|
// copy function
|
|
|
|
else if ( _.isFunction(item) ) {
|
|
|
|
result = item.bind({})
|
|
|
|
}
|
|
|
|
|
2015-01-29 13:19:11 +00:00
|
|
|
// copy object
|
|
|
|
else if ( _.isObject(item) ) {
|
2015-02-06 21:51:52 +00:00
|
|
|
result = {}
|
2015-01-29 13:19:11 +00:00
|
|
|
for(var key in item) {
|
|
|
|
if (item.hasOwnProperty(key)) {
|
2015-02-06 21:51:52 +00:00
|
|
|
result[key] = clone( item[key], full )
|
2015-01-29 13:19:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy others
|
|
|
|
else {
|
2015-02-06 21:51:52 +00:00
|
|
|
result = item
|
2015-01-29 13:19:11 +00:00
|
|
|
}
|
2015-02-06 21:51:52 +00:00
|
|
|
return result
|
2015-01-29 13:19:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// taken from http://stackoverflow.com/questions/4459928/how-to-deep-clone-in-javascript
|
|
|
|
function clone2(item) {
|
2015-01-28 22:12:16 +00:00
|
|
|
if (!item) { return item; } // null, undefined values check
|
|
|
|
|
2015-01-29 13:19:11 +00:00
|
|
|
var types = [ Number, String, Boolean ],
|
2015-01-28 22:12:16 +00:00
|
|
|
result;
|
|
|
|
|
|
|
|
// normalizing primitives if someone did new String('aaa'), or new Number('444');
|
|
|
|
types.forEach(function(type) {
|
|
|
|
if (item instanceof type) {
|
|
|
|
result = type( item );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (typeof result == "undefined") {
|
|
|
|
if (Object.prototype.toString.call( item ) === "[object Array]") {
|
|
|
|
result = [];
|
2015-01-29 13:19:11 +00:00
|
|
|
item.forEach(function(child, index, array) {
|
2015-01-28 22:12:16 +00:00
|
|
|
result[index] = clone( child );
|
|
|
|
});
|
|
|
|
} else if (typeof item == "object") {
|
|
|
|
// testing that this is DOM
|
|
|
|
if (item.nodeType && typeof item.cloneNode == "function") {
|
2015-01-29 13:19:11 +00:00
|
|
|
var result = item.cloneNode( true );
|
2015-01-28 22:12:16 +00:00
|
|
|
} else if (!item.prototype) { // check that this is a literal
|
|
|
|
if (item instanceof Date) {
|
|
|
|
result = new Date(item);
|
|
|
|
} else {
|
|
|
|
// it is an object literal
|
|
|
|
result = {};
|
|
|
|
for (var i in item) {
|
|
|
|
result[i] = clone( item[i] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// depending what you would like here,
|
|
|
|
// just keep the reference, or create new object
|
|
|
|
if (false && item.constructor) {
|
|
|
|
// would not advice to do that, reason? Read below
|
|
|
|
result = new item.constructor();
|
|
|
|
} else {
|
|
|
|
result = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
result = item;
|
|
|
|
}
|
|
|
|
}
|
2015-01-29 13:19:11 +00:00
|
|
|
|
2015-01-28 22:12:16 +00:00
|
|
|
return result;
|
2014-09-09 23:31:47 +00:00
|
|
|
}
|
|
|
|
|
2013-07-22 22:41:13 +00:00
|
|
|
jQuery.event.special.remove = {
|
|
|
|
remove: function(e) {
|
|
|
|
if (e.handler) e.handler();
|
|
|
|
}
|
|
|
|
};
|
2013-08-14 08:05:23 +00:00
|
|
|
|
|
|
|
// start application
|
|
|
|
jQuery(function(){
|
|
|
|
new App.Run();
|
|
|
|
});
|