plugins.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. $(document).ready(function(){
  2. /* bootstrap tooltip */
  3. $(".tip").tooltip({placement: 'top'});
  4. $(".tipb").tooltip({placement: 'bottom'});
  5. $(".tipl").tooltip({placement: 'left'});
  6. $(".tipr").tooltip({placement: 'right'});
  7. /* eof bootstrap tooltip */
  8. /* scroll */
  9. if($("#layout_scroll").length > 0)
  10. $("#layout_scroll").height($(window).height() - 80);
  11. if($(".scroll").length > 0) $(".scroll").mCustomScrollbar();
  12. $(".modal").on('shown.bs.modal',function(){
  13. $(this).find('.scroll').mCustomScrollbar('update');
  14. });
  15. if($(".scroll-mail").length > 0){
  16. $(".scroll-mail").height($(window).height() - 185).mCustomScrollbar();
  17. }
  18. /* eof scroll */
  19. /* Accordion */
  20. if($(".accordion").length > 0){
  21. $(".accordion").accordion({heightStyle: "content"});
  22. $(".accordion .ui-accordion-header:last").css('border-bottom','0px');
  23. }
  24. /* EOF Accordion */
  25. /* uniform */
  26. if($("input[type=checkbox]").length > 0 || $("input[type=radio]").length > 0)
  27. $("input[type=checkbox], input[type=radio]").not('.ibutton').uniform();
  28. /* eof uniform */
  29. /* select2 */
  30. if($(".select2").length > 0) $(".select2").select2();
  31. /* eof select2 */
  32. /* tagsinput */
  33. if($(".tags").length > 0) $(".tags").tagsInput({width: '100%',height:'auto'});
  34. if($(".mail_tags").length > 0) $(".mail_tags").tagsInput({width: '100%',height:'auto','defaultText':'add email'});
  35. /* eof tagsinput */
  36. /* jQuery UI Datepicker */
  37. if($(".datepicker").length > 0) $(".datepicker").datepicker({nextText: "", prevText: ""});
  38. if($(".mdatepicker").length > 0) $(".mdatepicker").datepicker({numberOfMonths: 3,nextText: "", prevText: ""});
  39. /* EOF jQuery UI Datepicker */
  40. /* Timepicker */
  41. if($(".timepicker").length > 0) $(".timepicker").timepicker();
  42. /* EOF Timepicker */
  43. /* Datetimepicker */
  44. if($(".datetimepicker").length > 0) $(".datetimepicker").datetimepicker({nextText: "", prevText: ""});
  45. /* EOF Datetimepicker */
  46. /* Datatables */
  47. if($("table.sortable_simple").length > 0)
  48. $("table.sortable_simple").dataTable({"iDisplayLength": 5,"bLengthChange": false,"bFilter": false,"bInfo": false,"bPaginate": true});
  49. if($("table.sortable_default").length > 0)
  50. $("table.sortable_default").dataTable({"iDisplayLength": 5, "sPaginationType": "full_numbers","bLengthChange": false,"bFilter": false,"bInfo": false,"bPaginate": true, "aoColumns": [ { "bSortable": false }, null, null, null, null]});
  51. if($("table.sortable").length > 0)
  52. $("table.sortable").dataTable({"iDisplayLength": 5, "aLengthMenu": [5,10,25,50,100], "sPaginationType": "full_numbers", "aoColumns": [ { "bSortable": false }, null, null, null, null]});
  53. /* eof Datatables */
  54. /* iButton plugin */
  55. if($(".ibutton").length > 0)
  56. $(".ibutton:radio, .ibutton:checkbox").iButton();
  57. /* EOF iButton plugin */
  58. /* knob plugin */
  59. if($(".knob").length > 0) $(".knob input").knob();
  60. /* eof knob plugin */
  61. /* sparkline */
  62. if($(".sparkline").length > 0)
  63. $('.sparkline span').sparkline('html', { enableTagOptions: true });
  64. /* eof sparkline */
  65. /* CLEditor */
  66. if($(".cle").length > 0)
  67. cE = $(".cle").cleditor({width:"100%",height: 230});
  68. if($(".cleditor").length > 0)
  69. cEdit = $(".cleditor").cleditor({width:"100%",height: 450});
  70. if($(".scle").length > 0)
  71. cEC = $(".scle").cleditor({width:"100%",height: 230,controls: "bold italic underline strikethrough link unlink"})[0].focus();
  72. $('#modal_mail').on('shown.bs.modal', function () {
  73. cEC.refresh();
  74. });
  75. /* eof CLEditor */
  76. /* draggable modal */
  77. if($(".modal-draggable").length > 0){
  78. $(".modal-draggable").draggable();
  79. }
  80. /* eof draggable modal */
  81. /* Tinymce */
  82. if($("textarea.tmce").length > 0){
  83. tinymce.init({
  84. selector: "textarea.tmce",
  85. height : 400
  86. });
  87. }
  88. if($("textarea.stmce").length > 0){
  89. tinymce.init({
  90. selector: "textarea.stmce",
  91. toolbar: "bold italic | alignleft aligncenter alignright alignjustify | undo redo",
  92. menu: [],
  93. height : 200
  94. });
  95. }
  96. /* eof tinymce */
  97. /* ValidationEngine */
  98. if($("#validate").length > 0 || $("#validate_custom").length > 0)
  99. $("#validate, #validate_custom").validationEngine('attach',{promptPosition : "topLeft"});
  100. /* EOF ValidationEngine */
  101. /* Stepy*/
  102. if($("#wizard").length > 0) $('#wizard').stepy();
  103. if($("#wizard_validate").length > 0){
  104. $("#wizard_validate").validationEngine('attach',{promptPosition : "topLeft"});
  105. $('#wizard_validate').stepy({
  106. back: function(index) {
  107. //if(!$("#wizard_validate").validationEngine('validate')) return false; //uncomment if u need to validate on back click
  108. },
  109. next: function(index) {
  110. if(!$("#wizard_validate").validationEngine('validate')) return false;
  111. },
  112. finish: function(index) {
  113. if(!$("#wizard_validate").validationEngine('validate')) return false;
  114. }
  115. });
  116. }
  117. /* EOF Stepy */
  118. /* Masked Input */
  119. if($("input[class^='mask_']").length > 0){
  120. $("input.mask_tin").mask('99-9999999');
  121. $("input.mask_ssn").mask('999-99-9999');
  122. $("input.mask_date").mask('9999-99-99');
  123. $("input.mask_product").mask('a*-999-a999');
  124. $("input.mask_phone").mask('99 (999) 999-99-99');
  125. $("input.mask_phone_ext").mask('99 (999) 999-9999? x99999');
  126. $("input.mask_credit").mask('9999-9999-9999-9999');
  127. $("input.mask_percent").mask('99%');
  128. }
  129. /* EOF Masked Input */
  130. /* Syntax Highlight */
  131. if($("pre[class^=brush]").length > 0){
  132. SyntaxHighlighter.defaults['toolbar'] = false;
  133. SyntaxHighlighter.all();
  134. }
  135. /* EOF Syntax Highlight */
  136. /* Fancybox */
  137. if($(".fancybox").length > 0)
  138. $(".fancybox").fancybox({padding: 10});
  139. /* EOF Fancybox */
  140. /* carousel */
  141. if($('.carousel').length > 0) $('.carousel').carousel();
  142. /* eof carousel */
  143. /* fullcalendar (demo) */
  144. if($("#calendar").length > 0){
  145. var date = new Date();
  146. var d = date.getDate();
  147. var m = date.getMonth();
  148. var y = date.getFullYear();
  149. $('#external-events .external-event').each(function() {
  150. var eventObject = {title: $.trim($(this).text())};
  151. $(this).data('eventObject', eventObject);
  152. $(this).draggable({
  153. zIndex: 999,
  154. revert: true,
  155. revertDuration: 0
  156. });
  157. });
  158. var calendar = $('#calendar').fullCalendar({
  159. header: {
  160. left: 'prev,next today',
  161. center: 'title',
  162. right: 'month,agendaWeek,agendaDay'
  163. },
  164. editable: true,
  165. events: [{title: 'All Day Event',start: new Date(y, m, 1)},
  166. {title: 'Long Event',start: new Date(y, m, d-5),end: new Date(y, m, d-2)},
  167. {id: 999,title: 'Repeating Event',start: new Date(y, m, d-3, 16, 0),allDay: false},
  168. {id: 999,title: 'Repeating Event',start: new Date(y, m, d+4, 16, 0),allDay: false},
  169. {title: 'Meeting',start: new Date(y, m, d, 10, 30),allDay: false},
  170. {title: 'Lunch',start: new Date(y, m, d, 12, 0),end: new Date(y, m, d, 14, 0),allDay: false},
  171. {title: 'Birthday Party',start: new Date(y, m, d+1, 19, 0),end: new Date(y, m, d+1, 22, 30),allDay: false},
  172. {title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}],
  173. droppable: true,
  174. selectable: true,
  175. selectHelper: true,
  176. select: function(start, end, allDay) {
  177. var title = prompt('Event Title:');
  178. if (title) {
  179. calendar.fullCalendar('renderEvent',
  180. {
  181. title: title,
  182. start: start,
  183. end: end,
  184. allDay: allDay
  185. },
  186. true
  187. );
  188. }
  189. calendar.fullCalendar('unselect');
  190. },
  191. drop: function(date, allDay) {
  192. var originalEventObject = $(this).data('eventObject');
  193. var copiedEventObject = $.extend({}, originalEventObject);
  194. copiedEventObject.start = date;
  195. copiedEventObject.allDay = allDay;
  196. $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
  197. if ($('#drop-remove').is(':checked')) {
  198. $(this).remove();
  199. }
  200. }
  201. });
  202. }
  203. /* eof fullcalendar (demo) */
  204. /* popover (demo) */
  205. $("[data-toggle=popover]").popover();
  206. /* eof popover (demo) */
  207. /* slider example(demo) */
  208. $(".slider_example").slider({range: "min", min: 0, max: 100, value: 50});
  209. $(".slider_example2").slider({range: true,min: 0,max: 500,values: [ 150, 350 ]});
  210. $(".slider_example3").slider({orientation: "vertical",range: "min",min: 0,max: 100,value: 50});
  211. $(".slider_example4").slider({orientation: "vertical",min: 0,max: 500,range: true,values: [ 150, 350 ]});
  212. if($("#price_rage").length > 0){
  213. $("#price_rage").slider({range: true,min: 0,max: 3000,values: [ 1000, 2000 ],
  214. slide: function(event,ui){
  215. $("#price_amount").html( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
  216. }});
  217. $("#price_amount").html("$"+$("#price_rage").slider("values",0)+" - $"+$("#price_rage").slider("values",1));
  218. }
  219. /* eof slider example(demo) */
  220. /* slider example(demo) */
  221. $("#spinner").spinner();
  222. $("#spinner2").spinner({step: 0.1});
  223. $("#spinner3").spinner({min: 0,max: 2500,step: 25.15,numberFormat: "C"});
  224. /* eof slider example(demo) */
  225. /* button state(demo)*/
  226. $('#fat-btn').click(function () {
  227. var btn = $(this)
  228. btn.button('loading')
  229. setTimeout(function () {
  230. btn.button('reset')
  231. }, 3000);
  232. });
  233. /* eof button state(demo)*/
  234. /* sortable (demo)*/
  235. if($("#sortable_example_1").length > 0){
  236. $("#sortable_example_1").sortable({items: ".list-group-item"});
  237. $("#sortable_example_1").disableSelection();
  238. }
  239. /* eof sortable (demo)*/
  240. /* selectable (demo)*/
  241. if($( "#selectable_example_1" ).length > 0){
  242. $( "#selectable_example_1" ).selectable();
  243. }
  244. /* eof selectable (demo)*/
  245. });
  246. $(window).resize(function(){
  247. if($("#layout_scroll").length > 0)
  248. $("#layout_scroll").height($(window).height() - 80).mCustomScrollbar('update');
  249. if($(".scroll-mail").length > 0)
  250. $(".scroll-mail").height($(window).height() - 205).mCustomScrollbar('update');
  251. });