theme.init.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. // Popover
  2. (function( $ ) {
  3. 'use strict';
  4. if ( $.isFunction( $.fn['popover'] ) ) {
  5. $( '[data-toggle=popover]' ).popover();
  6. }
  7. }).apply( this, [ jQuery ]);
  8. // Tooltip
  9. (function( $ ) {
  10. 'use strict';
  11. if ( $.isFunction( $.fn['tooltip'] ) ) {
  12. $( '[data-toggle=tooltip],[rel=tooltip]' ).tooltip({ container: 'body' });
  13. }
  14. }).apply( this, [ jQuery ]);
  15. // Sidebar Widgets
  16. (function( $ ) {
  17. 'use strict';
  18. function expand( content ) {
  19. content.children( '.widget-content' ).slideDown( 'fast', function() {
  20. $(this).css( 'display', '' );
  21. content.removeClass( 'widget-collapsed' );
  22. });
  23. }
  24. function collapse( content ) {
  25. content.children('.widget-content' ).slideUp( 'fast', function() {
  26. content.addClass( 'widget-collapsed' );
  27. $(this).css( 'display', '' );
  28. });
  29. }
  30. var $widgets = $( '.sidebar-widget' );
  31. $widgets.each( function() {
  32. var $widget = $( this ),
  33. $toggler = $widget.find( '.widget-toggle' );
  34. $toggler.on('click.widget-toggler', function() {
  35. $widget.hasClass('widget-collapsed') ? expand($widget) : collapse($widget);
  36. });
  37. });
  38. }).apply( this, [ jQuery ]);
  39. // Codemirror
  40. (function( $ ) {
  41. 'use strict';
  42. if ( typeof CodeMirror !== 'undefined' ) {
  43. $(function() {
  44. $('[data-plugin-codemirror]').each(function() {
  45. var $this = $( this ),
  46. opts = {};
  47. var pluginOptions = $this.data('plugin-options');
  48. if (pluginOptions)
  49. opts = pluginOptions;
  50. $this.themePluginCodeMirror(opts);
  51. });
  52. });
  53. }
  54. }).apply(this, [ jQuery ]);
  55. // Colorpicker
  56. (function( $ ) {
  57. 'use strict';
  58. if ( $.isFunction($.fn[ 'colorpicker' ]) ) {
  59. $(function() {
  60. $('[data-plugin-colorpicker]').each(function() {
  61. var $this = $( this ),
  62. opts = {};
  63. var pluginOptions = $this.data('plugin-options');
  64. if (pluginOptions)
  65. opts = pluginOptions;
  66. $this.themePluginColorPicker(opts);
  67. });
  68. });
  69. }
  70. }).apply(this, [ jQuery ]);
  71. // Datepicker
  72. (function( $ ) {
  73. 'use strict';
  74. if ( $.isFunction($.fn[ 'datepicker' ]) ) {
  75. $(function() {
  76. $('[data-plugin-datepicker]').each(function() {
  77. var $this = $( this ),
  78. opts = {};
  79. var pluginOptions = $this.data('plugin-options');
  80. if (pluginOptions)
  81. opts = pluginOptions;
  82. $this.themePluginDatePicker(opts);
  83. });
  84. });
  85. }
  86. }).apply(this, [ jQuery ]);
  87. // iosSwitcher
  88. (function( $ ) {
  89. 'use strict';
  90. if ( typeof Switch !== 'undefined' && $.isFunction( Switch ) ) {
  91. $(function() {
  92. $('[data-plugin-ios-switch]').each(function() {
  93. var $this = $( this );
  94. $this.themePluginIOS7Switch();
  95. });
  96. });
  97. }
  98. }).apply(this, [ jQuery ]);
  99. // Markdown
  100. (function( $ ) {
  101. 'use strict';
  102. if ( $.isFunction($.fn[ 'markdown' ]) ) {
  103. $(function() {
  104. $('[data-plugin-markdown-editor]').each(function() {
  105. var $this = $( this ),
  106. opts = {};
  107. var pluginOptions = $this.data('plugin-options');
  108. if (pluginOptions)
  109. opts = pluginOptions;
  110. $this.themePluginMarkdownEditor(opts);
  111. });
  112. });
  113. }
  114. }).apply(this, [ jQuery ]);
  115. // Masked Input
  116. (function( $ ) {
  117. 'use strict';
  118. if ( $.isFunction($.fn[ 'mask' ]) ) {
  119. $(function() {
  120. $('[data-plugin-masked-input]').each(function() {
  121. var $this = $( this ),
  122. opts = {};
  123. var pluginOptions = $this.data('plugin-options');
  124. if (pluginOptions)
  125. opts = pluginOptions;
  126. $this.themePluginMaskedInput(opts);
  127. });
  128. });
  129. }
  130. }).apply(this, [ jQuery ]);
  131. // MaxLength
  132. (function( $ ) {
  133. 'use strict';
  134. if ( $.isFunction( $.fn[ 'maxlength' ]) ) {
  135. $(function() {
  136. $('[data-plugin-maxlength]').each(function() {
  137. var $this = $( this ),
  138. opts = {};
  139. var pluginOptions = $this.data('plugin-options');
  140. if (pluginOptions)
  141. opts = pluginOptions;
  142. $this.themePluginMaxLength(opts);
  143. });
  144. });
  145. }
  146. }).apply(this, [ jQuery ]);
  147. // MultiSelect
  148. (function( $ ) {
  149. 'use strict';
  150. if ( $.isFunction( $.fn[ 'multiselect' ] ) ) {
  151. $(function() {
  152. $( '[data-plugin-multiselect]' ).each(function() {
  153. var $this = $( this ),
  154. opts = {};
  155. var pluginOptions = $this.data('plugin-options');
  156. if (pluginOptions)
  157. opts = pluginOptions;
  158. $this.themePluginMultiSelect(opts);
  159. });
  160. });
  161. }
  162. }).apply( this, [ jQuery ]);
  163. (function( $ ) {
  164. 'use strict';
  165. if ( $.isFunction( $.fn[ 'placeholder' ]) ) {
  166. $('input[placeholder]').placeholder();
  167. }
  168. }).apply(this, [ jQuery ]);
  169. // Select2
  170. (function( $ ) {
  171. 'use strict';
  172. if ( $.isFunction($.fn[ 'select2' ]) ) {
  173. $(function() {
  174. $('[data-plugin-selectTwo]').each(function() {
  175. var $this = $( this ),
  176. opts = {};
  177. var pluginOptions = $this.data('plugin-options');
  178. if (pluginOptions)
  179. opts = pluginOptions;
  180. $this.themePluginSelect2(opts);
  181. });
  182. });
  183. }
  184. }).apply(this, [ jQuery ]);
  185. // Spinner
  186. (function( $ ) {
  187. 'use strict';
  188. if ( $.isFunction($.fn[ 'spinner' ]) ) {
  189. $(function() {
  190. $('[data-plugin-spinner]').each(function() {
  191. var $this = $( this ),
  192. opts = {};
  193. var pluginOptions = $this.data('plugin-options');
  194. if (pluginOptions)
  195. opts = pluginOptions;
  196. $this.themePluginSpinner(opts);
  197. });
  198. });
  199. }
  200. }).apply(this, [ jQuery ]);
  201. // SummerNote
  202. (function( $ ) {
  203. 'use strict';
  204. if ( $.isFunction($.fn[ 'summernote' ]) ) {
  205. $(function() {
  206. $('[data-plugin-summernote]').each(function() {
  207. var $this = $( this ),
  208. opts = {};
  209. var pluginOptions = $this.data('plugin-options');
  210. if (pluginOptions)
  211. opts = pluginOptions;
  212. $this.themePluginSummerNote(opts);
  213. });
  214. });
  215. }
  216. }).apply(this, [ jQuery ]);
  217. // TextArea AutoSize
  218. (function( $ ) {
  219. 'use strict';
  220. if ( $.isFunction($.fn[ 'autosize' ]) ) {
  221. $(function() {
  222. $('[data-plugin-textarea-autosize]').each(function() {
  223. var $this = $( this ),
  224. opts = {};
  225. var pluginOptions = $this.data('plugin-options');
  226. if (pluginOptions)
  227. opts = pluginOptions;
  228. $this.themePluginTextAreaAutoSize(opts);
  229. });
  230. });
  231. }
  232. }).apply(this, [ jQuery ]);
  233. // TimePicker
  234. (function( $ ) {
  235. 'use strict';
  236. if ( $.isFunction($.fn[ 'timepicker' ]) ) {
  237. $(function() {
  238. $('[data-plugin-timepicker]').each(function() {
  239. var $this = $( this ),
  240. opts = {};
  241. var pluginOptions = $this.data('plugin-options');
  242. if (pluginOptions)
  243. opts = pluginOptions;
  244. $this.themePluginTimePicker(opts);
  245. });
  246. });
  247. }
  248. }).apply(this, [ jQuery ]);
  249. // Mailbox
  250. (function( $ ) {
  251. 'use strict';
  252. $(function() {
  253. $('[data-mailbox]').each(function() {
  254. var $this = $( this );
  255. $this.themeMailbox();
  256. });
  257. });
  258. }).apply(this, [ jQuery ]);
  259. // Animate
  260. (function( $ ) {
  261. 'use strict';
  262. if ( $.isFunction($.fn[ 'appear' ]) ) {
  263. $(function() {
  264. $('[data-plugin-animate], [data-appear-animation]').each(function() {
  265. var $this = $( this ),
  266. opts = {};
  267. var pluginOptions = $this.data('plugin-options');
  268. if (pluginOptions)
  269. opts = pluginOptions;
  270. $this.themePluginAnimate(opts);
  271. });
  272. });
  273. }
  274. }).apply(this, [ jQuery ]);
  275. // Carousel
  276. (function( $ ) {
  277. 'use strict';
  278. if ( $.isFunction($.fn[ 'owlCarousel' ]) ) {
  279. $(function() {
  280. $('[data-plugin-carousel]').each(function() {
  281. var $this = $( this ),
  282. opts = {};
  283. var pluginOptions = $this.data('plugin-options');
  284. if (pluginOptions)
  285. opts = pluginOptions;
  286. $this.themePluginCarousel(opts);
  287. });
  288. });
  289. }
  290. }).apply(this, [ jQuery ]);
  291. // Chart Circular
  292. (function( $ ) {
  293. 'use strict';
  294. if ( $.isFunction($.fn[ 'easyPieChart' ]) ) {
  295. $(function() {
  296. $('[data-plugin-chart-circular], .circular-bar-chart:not(.manual)').each(function() {
  297. var $this = $( this ),
  298. opts = {};
  299. var pluginOptions = $this.data('plugin-options');
  300. if (pluginOptions)
  301. opts = pluginOptions;
  302. $this.themePluginChartCircular(opts);
  303. });
  304. });
  305. }
  306. }).apply(this, [ jQuery ]);
  307. // Lightbox
  308. (function( $ ) {
  309. 'use strict';
  310. if ( $.isFunction($.fn[ 'magnificPopup' ]) ) {
  311. $(function() {
  312. $('[data-plugin-lightbox], .lightbox:not(.manual)').each(function() {
  313. var $this = $( this ),
  314. opts = {};
  315. var pluginOptions = $this.data('plugin-options');
  316. if (pluginOptions)
  317. opts = pluginOptions;
  318. $this.themePluginLightbox(opts);
  319. });
  320. });
  321. }
  322. }).apply(this, [ jQuery ]);
  323. // Portlets
  324. (function( $ ) {
  325. 'use strict';
  326. $(function() {
  327. $('[data-plugin-portlet]').each(function() {
  328. var $this = $( this ),
  329. opts = {};
  330. var pluginOptions = $this.data('plugin-options');
  331. if (pluginOptions)
  332. opts = pluginOptions;
  333. $this.themePluginPortlet(opts);
  334. });
  335. });
  336. }).apply(this, [ jQuery ]);
  337. // Slider
  338. (function( $ ) {
  339. 'use strict';
  340. if ( $.isFunction($.fn[ 'slider' ]) ) {
  341. $(function() {
  342. $('[data-plugin-slider]').each(function() {
  343. var $this = $( this ),
  344. opts = {};
  345. var pluginOptions = $this.data('plugin-options');
  346. if (pluginOptions) {
  347. opts = pluginOptions;
  348. }
  349. $this.themePluginSlider(opts);
  350. });
  351. });
  352. }
  353. }).apply(this, [ jQuery ]);
  354. // Toggle
  355. (function( $ ) {
  356. 'use strict';
  357. $(function() {
  358. $('[data-plugin-toggle]').each(function() {
  359. var $this = $( this ),
  360. opts = {};
  361. var pluginOptions = $this.data('plugin-options');
  362. if (pluginOptions)
  363. opts = pluginOptions;
  364. $this.themePluginToggle(opts);
  365. });
  366. });
  367. }).apply(this, [ jQuery ]);
  368. // Widget - Todo
  369. (function( $ ) {
  370. 'use strict';
  371. if ( $.isFunction($.fn[ 'themePluginWidgetTodoList' ]) ) {
  372. $(function() {
  373. $('[data-plugin-todo-list], ul.widget-todo-list').each(function() {
  374. var $this = $( this ),
  375. opts = {};
  376. var pluginOptions = $this.data('plugin-options');
  377. if (pluginOptions)
  378. opts = pluginOptions;
  379. $this.themePluginWidgetTodoList(opts);
  380. });
  381. });
  382. }
  383. }).apply(this, [ jQuery ]);
  384. // Widget - Toggle
  385. (function( $ ) {
  386. 'use strict';
  387. if ( $.isFunction($.fn[ 'themePluginWidgetToggleExpand' ]) ) {
  388. $(function() {
  389. $('[data-plugin-toggle-expand], .widget-toggle-expand').each(function() {
  390. var $this = $( this ),
  391. opts = {};
  392. var pluginOptions = $this.data('plugin-options');
  393. if (pluginOptions)
  394. opts = pluginOptions;
  395. $this.themePluginWidgetToggleExpand(opts);
  396. });
  397. });
  398. }
  399. }).apply(this, [ jQuery ]);
  400. // Word Rotate
  401. (function( $ ) {
  402. 'use strict';
  403. if ( $.isFunction($.fn[ 'themePluginWordRotate' ]) ) {
  404. $(function() {
  405. $('[data-plugin-word-rotate], .word-rotate:not(.manual)').each(function() {
  406. var $this = $( this ),
  407. opts = {};
  408. var pluginOptions = $this.data('plugin-options');
  409. if (pluginOptions)
  410. opts = pluginOptions;
  411. $this.themePluginWordRotate(opts);
  412. });
  413. });
  414. }
  415. }).apply(this, [ jQuery ]);