only attempt to get URL
If it doesn't exist, it should silently fail.
This commit is contained in:
		
							parent
							
								
									5b99800c8e
								
							
						
					
					
						commit
						f5cf3f09a2
					
				
					 1 changed files with 20 additions and 12 deletions
				
			
		|  | @ -22,19 +22,27 @@ export default class filters { | ||||||
| 
 | 
 | ||||||
| 	@param {string} URL the current URL | 	@param {string} URL the current URL | ||||||
| 	*/ | 	*/ | ||||||
| 	async select(URL = window.location.href) { | 	async select(URL) { | ||||||
| 		let SELECTED = await (async () => { | 		if (!URL) { | ||||||
| 			// Get the filters.
 | 			try { | ||||||
| 			let filter = await search(`filters`, URL, `URL`, 0.5, {"cloud": -1}); | 				URL = window.location.href; | ||||||
| 
 | 			} catch(err) {} | ||||||
| 			// If there are filters, then filter the URL.
 |  | ||||||
| 			return filter; |  | ||||||
| 		})(); |  | ||||||
| 		 |  | ||||||
| 		if ((SELECTED && SELECTED != null && (typeof SELECTED).includes(`obj`)) ? (Object.keys(SELECTED)).length > 0 : false) { |  | ||||||
| 			this.one = (Object.entries(SELECTED))[0][1]; |  | ||||||
| 			return (this.one); |  | ||||||
| 		}; | 		}; | ||||||
|  | 
 | ||||||
|  | 		if (URL) { | ||||||
|  | 			let SELECTED = await (async () => { | ||||||
|  | 				// Get the filters.
 | ||||||
|  | 				let filter = await search(`filters`, URL, `URL`, 0.5, {"cloud": -1}); | ||||||
|  | 	 | ||||||
|  | 				// If there are filters, then filter the URL.
 | ||||||
|  | 				return filter; | ||||||
|  | 			})(); | ||||||
|  | 			 | ||||||
|  | 			if ((SELECTED && SELECTED != null && (typeof SELECTED).includes(`obj`)) ? (Object.keys(SELECTED)).length > 0 : false) { | ||||||
|  | 				this.one = (Object.entries(SELECTED))[0][1]; | ||||||
|  | 				return (this.one); | ||||||
|  | 			}; | ||||||
|  | 		} | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	/* Update all filters or just one. | 	/* Update all filters or just one. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue