application.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. //= require ./app/lib/animations/velocity.min.js
  11. //= require ./app/lib/animations/velocity.ui.js
  12. //= require ./app/lib/animations/skrollr.js
  13. //not_used= require_tree ./app/lib/spine
  14. //= require ./app/lib/spine/spine.coffee
  15. //= require ./app/lib/spine/ajax.coffee
  16. //= require ./app/lib/spine/local.coffee
  17. //= require ./app/lib/spine/route.coffee
  18. //= require ./app/lib/flot/jquery.flot.js
  19. //= require ./app/lib/flot/jquery.flot.selection.js
  20. //not_used= require_tree ./app/lib/bootstrap
  21. //= require ./app/lib/bootstrap/dropdown.js
  22. //= require ./app/lib/bootstrap/tooltip.js
  23. //= require ./app/lib/bootstrap/popover.js
  24. //= require ./app/lib/bootstrap/modal.js
  25. //= require ./app/lib/bootstrap/tab.js
  26. //= require ./app/lib/bootstrap/transition.js
  27. //= require ./app/lib/bootstrap/button.js
  28. //= require ./app/lib/bootstrap/collapse.js
  29. //= require_tree ./app/lib/base
  30. //= require ./app/index.js.coffee
  31. // IE8 workaround for missing console.log
  32. if (!window.console) {
  33. window.console = {}
  34. }
  35. if (!console.log) {
  36. console.log = function(){}
  37. }
  38. function escapeRegExp(str) {
  39. return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
  40. }
  41. Date.prototype.getWeek = function() {
  42. var onejan = new Date(this.getFullYear(),0,1);
  43. return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
  44. }
  45. function difference(object1, object2) {
  46. var changes = {};
  47. for ( var name in object1 ) {
  48. if ( name in object2 ) {
  49. if ( _.isObject( object2[name] ) && !_.isArray( object2[name] ) ) {
  50. var diff = difference( object1[name], object2[name] );
  51. if ( !_.isEmpty( diff ) ) {
  52. changes[name] = diff;
  53. }
  54. } else if ( !_.isEqual( object1[name], object2[name] ) ) {
  55. changes[name] = object2[name];
  56. }
  57. }
  58. }
  59. return changes;
  60. }
  61. function clone(object) {
  62. if (!object) {
  63. return object
  64. }
  65. return JSON.parse(JSON.stringify(object));
  66. }
  67. function HTMLEscape(string) {
  68. return ( '' + string )
  69. .replace(/&/g, '&')
  70. .replace(/</g, '&lt;')
  71. .replace(/>/g, '&gt;')
  72. .replace(/"/g, '&quot;')
  73. .replace(/'/g, '&#39;')
  74. }
  75. jQuery.event.special.remove = {
  76. remove: function(e) {
  77. if (e.handler) e.handler();
  78. }
  79. };
  80. // start application
  81. jQuery(function(){
  82. new App.Run();
  83. });