JAVASCRIPT   135
custom template js
Guest on 9th May 2022 01:58:54 AM


  1. angular.module(angAppName)
  2.     .directive('viewmodeCustom', function( customFilterService ) {
  3.                
  4.         return{
  5.            
  6.             restrict:"AE",
  7.             scope:true,
  8.             bindToController: true,
  9.             controllerAs: 'vm',
  10.             link:function( scope, elem, attrs ) {
  11.  
  12.  
  13.                                 scope.directiveInfo.ready = function(){
  14.                                        
  15.                                         if ( 'undefined' !== typeof lscfOnCustomTemplateReady ) {
  16.                                                 lscfOnCustomTemplateReady();
  17.                                         }
  18.  
  19.                                         setTimeout(function(){
  20.                                                 lscfEventListenerOnCustomTemplateReady();
  21.                                         }, 300);
  22.                                 };                                     
  23.                                        
  24.                                 scope.directiveInfo.afterPostsLoadCallback = function(){
  25.                                         if ( 'undefined' !== typeof lscfPostsLoadCallback ) {
  26.                                                 lscfPostsLoadCallback();
  27.                                         }
  28.                                         setTimeout(function(){
  29.                                                 lscfEventListenerPostsLoadCallback();                                  
  30.                                         },400);
  31.                                 };                             
  32.  
  33.                         },
  34.                         template: '<div ng-include="pluginSettings.filterSettings.theme.custom_template.url">'
  35.                 };
  36.         });
  37.  
  38.  
  39.  
  40. function lscfEventListenerOnCustomTemplateReady( state ) {
  41.    
  42.         var evt = new CustomEvent('lscf_on_custom_template_ready', { detail: state });
  43.  
  44.     window.dispatchEvent( evt );
  45. }
  46.  
  47. function lscfEventListenerPostsLoadCallback( state ) {
  48.    
  49.         var evt = new CustomEvent('lscf_posts_load_callback', { detail: state });
  50.  
  51.     window.dispatchEvent( evt );
  52. }

Raw Paste

Login or Register to edit or fork this paste. It's free.