widgets-init.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Prevent default on # hrefs */
  2. $(function() { "use strict";
  3. $('a[href="#"]').click(function(event) {
  4. event.preventDefault();
  5. });
  6. });
  7. /* To do check toggle */
  8. $(function() { "use strict";
  9. $(".todo-box li input").on('click', function() {
  10. $(this).parent().toggleClass('todo-done');
  11. });
  12. });
  13. /* Horizontal timeline */
  14. $(function() { "use strict";
  15. var overall_width = 0;
  16. $('.timeline-scroll .tl-row').each(function(index, elem) {
  17. var $elem = $(elem);
  18. overall_width += $elem.outerWidth() + parseInt($elem.css('margin-left'), 10) + parseInt($elem.css('margin-right'), 10);
  19. });
  20. $('.timeline-horizontal', this).width(overall_width);
  21. });
  22. /* Input switch alternate */
  23. $(function() { "use strict";
  24. $('.input-switch-alt').simpleCheckbox();
  25. });
  26. /* Slim scrollbar */
  27. $(function() { "use strict";
  28. $('.scrollable-slim').slimScroll({
  29. color: '#8da0aa',
  30. size: '10px',
  31. alwaysVisible: true
  32. });
  33. });
  34. $(function() { "use strict";
  35. $('.scrollable-slim-sidebar').slimScroll({
  36. color: '#8da0aa',
  37. size: '10px',
  38. height: '100%',
  39. alwaysVisible: true
  40. });
  41. });
  42. $(function() { "use strict";
  43. $('.scrollable-slim-box').slimScroll({
  44. color: '#8da0aa',
  45. size: '6px',
  46. alwaysVisible: false
  47. });
  48. });
  49. /* Loading buttons */
  50. $(function() { "use strict";
  51. $('.loading-button').click(function() {
  52. var btn = $(this)
  53. btn.button('loading');
  54. });
  55. });
  56. /* Tooltips */
  57. $(function() { "use strict";
  58. $('.tooltip-button').tooltip({
  59. container: 'body'
  60. });
  61. });
  62. /* Close response message */
  63. $(function() { "use strict";
  64. $('.alert-close-btn').click(function() {
  65. $(this).parent().addClass('animated fadeOutDown');
  66. });
  67. });
  68. /* Popovers */
  69. $(function() { "use strict";
  70. $('.popover-button').popover({
  71. container: 'body',
  72. html: true,
  73. animation: true,
  74. content: function() {
  75. var dataID = $(this).attr('data-id');
  76. return $(dataID).html();
  77. }
  78. }).click(function(evt) {
  79. evt.preventDefault();
  80. });
  81. });
  82. $(function() { "use strict";
  83. $('.popover-button-default').popover({
  84. container: 'body',
  85. html: true,
  86. animation: true
  87. }).click(function(evt) {
  88. evt.preventDefault();
  89. });
  90. });
  91. /* Color schemes */
  92. var mUIColors = {
  93. 'default': '#3498db',
  94. 'gray': '#d6dde2',
  95. 'primary': '#00bca4',
  96. 'success': '#2ecc71',
  97. 'warning': '#e67e22',
  98. 'danger': '#e74c3c',
  99. 'info': '#3498db'
  100. };
  101. var getUIColor = function (name) {
  102. if (mUIColors[name]) {
  103. return mUIColors[name];
  104. } else {
  105. return mUIColors['default'];
  106. }
  107. }
  108. /* Screenfull */
  109. if(document.getElementById('fullscreen-btn')) {
  110. document.getElementById('fullscreen-btn').addEventListener('click', function () {
  111. if (screenfull.enabled) {
  112. screenfull.request();
  113. }
  114. });
  115. }