blog_single.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* ------------------------------------------------------------------------------
  2. *
  3. * # Blog page - detailed
  4. *
  5. * Demo JS code for blog page kit - detailed view
  6. *
  7. * ---------------------------------------------------------------------------- */
  8. // Setup module
  9. // ------------------------------
  10. var BlogSingle = function() {
  11. //
  12. // Setup module components
  13. //
  14. // CKEditor
  15. var _componentCKEditor = function() {
  16. if (typeof CKEDITOR == 'undefined') {
  17. console.warn('Warning - ckeditor.js is not loaded.');
  18. return;
  19. }
  20. // Initialize
  21. CKEDITOR.replace('add-comment', {
  22. height: 200,
  23. removeButtons: 'Subscript,Superscript',
  24. toolbarGroups: [
  25. { name: 'styles' },
  26. { name: 'editing', groups: [ 'find', 'selection' ] },
  27. { name: 'basicstyles', groups: [ 'basicstyles' ] },
  28. { name: 'paragraph', groups: [ 'list', 'blocks', 'align' ] },
  29. { name: 'links' },
  30. { name: 'insert' },
  31. { name: 'colors' },
  32. { name: 'tools' },
  33. { name: 'others' },
  34. { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }
  35. ]
  36. });
  37. };
  38. // Lightbox
  39. var _componentFancybox = function() {
  40. if (!$().fancybox) {
  41. console.warn('Warning - fancybox.min.js is not loaded.');
  42. return;
  43. }
  44. // Image lightbox
  45. $('[data-popup="lightbox"]').fancybox({
  46. padding: 3
  47. });
  48. };
  49. //
  50. // Return objects assigned to module
  51. //
  52. return {
  53. init: function() {
  54. _componentCKEditor();
  55. _componentFancybox();
  56. }
  57. }
  58. }();
  59. // Initialize module
  60. // ------------------------------
  61. document.addEventListener('DOMContentLoaded', function() {
  62. BlogSingle.init();
  63. });