application.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // This is a manifest file that'll be compiled into including all the files listed below.
  2. // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
  3. // be included in the compiled file accessible from http://example.com/assets/application.js
  4. // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
  5. // the compiled file.
  6. //
  7. //= require ./app/lib/core/jquery-2.1.1.js
  8. //= require ./app/lib/core/jquery-ui-1.8.23.custom.min.js
  9. //= require ./app/lib/core/underscore-1.7.0.js
  10. //not_used= require_tree ./app/lib/spine
  11. //= require ./app/lib/spine/spine.coffee
  12. //= require ./app/lib/spine/ajax.coffee
  13. //= require ./app/lib/spine/local.coffee
  14. //= require ./app/lib/spine/route.coffee
  15. //= require ./app/lib/flot/jquery.flot.js
  16. //= require ./app/lib/flot/jquery.flot.selection.js
  17. //not_used= require_tree ./app/lib/bootstrap
  18. //= require ./app/lib/bootstrap/dropdown.js
  19. //= require ./app/lib/bootstrap/tooltip.js
  20. //= require ./app/lib/bootstrap/popover.js
  21. //= require ./app/lib/bootstrap/modal.js
  22. //= require ./app/lib/bootstrap/tab.js
  23. //= require ./app/lib/bootstrap/transition.js
  24. //= require ./app/lib/bootstrap/button.js
  25. //= require ./app/lib/bootstrap/collapse.js
  26. //= require_tree ./app/lib/base
  27. //= require ./app/index.js.coffee
  28. // IE8 workaround for missing console.log
  29. if (!window.console) {
  30. window.console = {}
  31. }
  32. if (!console.log) {
  33. console.log = function(){}
  34. }
  35. function escapeRegExp(str) {
  36. return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
  37. }
  38. Date.prototype.getWeek = function() {
  39. var onejan = new Date(this.getFullYear(),0,1);
  40. return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
  41. }
  42. function difference(object1, object2) {
  43. var changes = {};
  44. for ( var name in object1 ) {
  45. if ( name in object2 ) {
  46. if ( _.isObject( object2[name] ) && !_.isArray( object2[name] ) ) {
  47. var diff = difference( object1[name], object2[name] );
  48. if ( !_.isEmpty( diff ) ) {
  49. changes[name] = diff;
  50. }
  51. } else if ( !_.isEqual( object1[name], object2[name] ) ) {
  52. changes[name] = object2[name];
  53. }
  54. }
  55. }
  56. return changes;
  57. }
  58. function clone(object) {
  59. if (!object) {
  60. return object
  61. }
  62. return JSON.parse(JSON.stringify(object));
  63. }
  64. jQuery.event.special.remove = {
  65. remove: function(e) {
  66. if (e.handler) e.handler();
  67. }
  68. };
  69. // start application
  70. jQuery(function(){
  71. new App.Run();
  72. });