ui-general.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. var UIGeneral = function () {
  2. var handlePulsate = function () {
  3. if (!jQuery().pulsate) {
  4. return;
  5. }
  6. if (App.isIE8() == true) {
  7. return; // pulsate plugin does not support IE8 and below
  8. }
  9. if (jQuery().pulsate) {
  10. jQuery('#pulsate-regular').pulsate({
  11. color: "#bf1c56"
  12. });
  13. jQuery('#pulsate-once').click(function () {
  14. $(this).pulsate({
  15. color: "#399bc3",
  16. repeat: false
  17. });
  18. });
  19. jQuery('#pulsate-hover').pulsate({
  20. color: "#5ebf5e",
  21. repeat: false,
  22. onHover: true
  23. });
  24. jQuery('#pulsate-crazy').click(function () {
  25. $(this).pulsate({
  26. color: "#fdbe41",
  27. reach: 50,
  28. repeat: 10,
  29. speed: 100,
  30. glow: true
  31. });
  32. });
  33. }
  34. }
  35. var handleGritterNotifications = function () {
  36. if (!jQuery.gritter) {
  37. return;
  38. }
  39. $('#gritter-sticky').click(function () {
  40. var unique_id = $.gritter.add({
  41. // (string | mandatory) the heading of the notification
  42. title: 'This is a sticky notice!',
  43. // (string | mandatory) the text inside the notification
  44. text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#">some link sample</a> montes, nascetur ridiculus mus.',
  45. // (string | optional) the image to display on the left
  46. image: './assets/img/avatar1.jpg',
  47. // (bool | optional) if you want it to fade out on its own or just sit there
  48. sticky: true,
  49. // (int | optional) the time you want it to be alive for before fading out
  50. time: '',
  51. // (string | optional) the class name you want to apply to that specific message
  52. class_name: 'my-sticky-class'
  53. });
  54. return false;
  55. });
  56. $('#gritter-regular').click(function () {
  57. $.gritter.add({
  58. // (string | mandatory) the heading of the notification
  59. title: 'This is a regular notice!',
  60. // (string | mandatory) the text inside the notification
  61. text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#">some link sample</a> montes, nascetur ridiculus mus.',
  62. // (string | optional) the image to display on the left
  63. image: './assets/img/avatar1.jpg',
  64. // (bool | optional) if you want it to fade out on its own or just sit there
  65. sticky: false,
  66. // (int | optional) the time you want it to be alive for before fading out
  67. time: ''
  68. });
  69. return false;
  70. });
  71. $('#gritter-max').click(function () {
  72. $.gritter.add({
  73. // (string | mandatory) the heading of the notification
  74. title: 'This is a notice with a max of 3 on screen at one time!',
  75. // (string | mandatory) the text inside the notification
  76. text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#">some link sample</a> montes, nascetur ridiculus mus.',
  77. // (string | optional) the image to display on the left
  78. image: './assets/img/avatar1.jpg',
  79. // (bool | optional) if you want it to fade out on its own or just sit there
  80. sticky: false,
  81. // (function) before the gritter notice is opened
  82. before_open: function () {
  83. if ($('.gritter-item-wrapper').length == 3) {
  84. // Returning false prevents a new gritter from opening
  85. return false;
  86. }
  87. }
  88. });
  89. return false;
  90. });
  91. $('#gritter-without-image').click(function () {
  92. $.gritter.add({
  93. // (string | mandatory) the heading of the notification
  94. title: 'This is a notice without an image!',
  95. // (string | mandatory) the text inside the notification
  96. text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#">some link sample</a> montes, nascetur ridiculus mus.'
  97. });
  98. return false;
  99. });
  100. $('#gritter-light').click(function () {
  101. $.gritter.add({
  102. // (string | mandatory) the heading of the notification
  103. title: 'This is a light notification',
  104. // (string | mandatory) the text inside the notification
  105. text: 'Just add a "gritter-light" class_name to your $.gritter.add or globally to $.gritter.options.class_name',
  106. class_name: 'gritter-light'
  107. });
  108. return false;
  109. });
  110. $("#gritter-remove-all").click(function () {
  111. $.gritter.removeAll();
  112. return false;
  113. });
  114. }
  115. var handleDynamicPagination = function() {
  116. $('#dynamic_pager_demo1').bootpag({
  117. total: 6,
  118. page: 1,
  119. }).on("page", function(event, num){
  120. $("#dynamic_pager_content1").html("Page " + num + " content here"); // or some ajax content loading...
  121. });
  122. $('#dynamic_pager_demo2').bootpag({
  123. total: 24,
  124. page: 1,
  125. maxVisible: 6
  126. }).on('page', function(event, num){
  127. $("#dynamic_pager_content2").html("Page " + num + " content here"); // or some ajax content loading...
  128. });
  129. }
  130. return {
  131. //main function to initiate the module
  132. init: function () {
  133. handlePulsate();
  134. handleGritterNotifications();
  135. handleDynamicPagination();
  136. }
  137. };
  138. }();