File tree Expand file tree Collapse file tree 2 files changed +46
-43
lines changed 
media_src/com_newsfeeds/js Expand file tree Collapse file tree 2 files changed +46
-43
lines changed Load Diff This file was deleted. 
Original file line number Diff line number Diff line change 1+ /** 
2+  * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. 
3+  * @license     GNU General Public License version 2 or later; see LICENSE.txt 
4+  */ 
5+ ( ( JText )  =>  { 
6+   'use strict' ; 
7+ 
8+   // Selectors used by this script 
9+   const  buttonsSelector  =  '[id^=category-btn-]' ; 
10+ 
11+   /** 
12+    * Handle the category toggle button click event 
13+    * @param  event 
14+    */ 
15+   const  handleCategoryToggleButtonClick  =  ( event )  =>  { 
16+     const  button  =  event . currentTarget ; 
17+     const  icon  =  button . querySelector ( 'span' ) ; 
18+ 
19+     // Toggle icon class 
20+     icon . classList . toggle ( 'icon-plus' ) ; 
21+     icon . classList . toggle ( 'icon-minus' ) ; 
22+ 
23+     // Toggle aria label 
24+     const  ariaLabel  =  button . getAttribute ( 'aria-label' ) ; 
25+     button . setAttribute ( 
26+       'aria-label' , 
27+       ( ariaLabel  ===  JText . _ ( 'JGLOBAL_COLLAPSE_CATEGORIES' ) 
28+         ||  JText . _ ( 'JGLOBAL_EXPAND_CATEGORIES' ) ) , 
29+     ) ; 
30+   } ; 
31+ 
32+   /** 
33+    * Register the events 
34+    */ 
35+   const  registerEvents  =  ( )  =>  { 
36+     const  buttons  =  [ ] . slice . call ( document . querySelectorAll ( buttonsSelector ) ) ; 
37+     buttons . forEach ( ( button )  =>  { 
38+       button . addEventListener ( 'click' ,  handleCategoryToggleButtonClick ) ; 
39+     } ) ; 
40+ 
41+     // Cleanup 
42+     document . removeEventListener ( 'DOMContentLoaded' ,  registerEvents ) ; 
43+   } ; 
44+ 
45+   document . addEventListener ( 'DOMContentLoaded' ,  registerEvents ) ; 
46+ } ) ( Joomla . JText ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments