mirror of
				https://github.com/PlaceholderAPI/Javascript-Expansion.git
				synced 2025-10-31 16:32:24 +00:00 
			
		
		
		
	 9f1162a6c7
			
		
	
	
		9f1162a6c7
		
			
		
	
	
	
	
		
			
			* Create factions.js Placeholder: %javascript_factions% Returns brackets around the faction name if the user is in a faction * Update factions.js Smaller changes
		
			
				
	
	
		
			35 lines
		
	
	
		
			916 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			916 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /*
 | |
| A simple placeholder which will return brackets around the faction name if the user 
 | |
| is in a faction, if they are not it will return nothing
 | |
| 
 | |
| Creating our faction variable which is the user's faction name (if the user is not in a faction it
 | |
| will return the specified value in the factions config)
 | |
| */
 | |
| var faction = "%factionsuuid_faction_name%";
 | |
| 
 | |
| /*
 | |
| Creating our hasFaction function which will return the correct value
 | |
| */
 | |
| function hasFaction()
 | |
| {
 | |
|   /* 
 | |
|   If the faction variable returns an empty string, we return an empty string back,
 | |
|   and if the faction variable isn't empty we return colored brackets around it
 | |
|   */
 | |
|   if (faction == '')
 | |
|   {
 | |
|     return '';
 | |
|   }
 | |
|   return '&8[&f' + faction + '&8]';
 | |
|   
 | |
|   /*
 | |
|   A compacter way of defining if statements
 | |
|   Checked value ? Boolean true : Boolean false
 | |
|   return faction == '' ? '' : '&8[&f' + faction + '&8]';
 | |
|   */
 | |
| }
 | |
| /*
 | |
| Calling the hasFaction function
 | |
| */
 | |
| hasFaction();
 |