mirror of
				https://github.com/chev2/scripts-styles.git
				synced 2025-10-30 08:11:41 +00:00 
			
		
		
		
	UserScript redirects: Use simpler domain replacement
location.hostname is a lot easier to use than replacing the domain in location.href
This commit is contained in:
		
							parent
							
								
									456bc8b095
								
							
						
					
					
						commit
						6ed3b1cd25
					
				
					 2 changed files with 4 additions and 4 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| // ==UserScript==
 | ||||
| // @name         Redirect: New Reddit to Old Reddit
 | ||||
| // @author       Chev <riskyrains@proton.me> (https://github.com/chev2)
 | ||||
| // @version      1.0.0
 | ||||
| // @version      1.0.1
 | ||||
| // @description  Redirects from new Reddit to old Reddit.
 | ||||
| // @namespace    github.com/chev2
 | ||||
| // @license      Apache-2.0
 | ||||
|  | @ -21,5 +21,5 @@ | |||
| (function() { | ||||
|     'use strict'; | ||||
| 
 | ||||
|     location.replace(location.href.replace("www.reddit.com/", "old.reddit.com/")); | ||||
|     location.hostname = "old.reddit.com"; | ||||
| })(); | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| // ==UserScript==
 | ||||
| // @name         Redirect: Twitter to Nitter
 | ||||
| // @author       Chev <riskyrains@proton.me> (https://github.com/chev2)
 | ||||
| // @version      1.0.2
 | ||||
| // @version      1.0.3
 | ||||
| // @description  Redirects from Twitter to Nitter, a Twitter alternative front-end.
 | ||||
| // @namespace    github.com/chev2
 | ||||
| // @license      Apache-2.0
 | ||||
|  | @ -23,5 +23,5 @@ | |||
| 
 | ||||
|     // Put your instance domain here
 | ||||
|     const INSTANCE_DOMAIN = "nitter.nl" | ||||
|     location.replace(location.href.replace("twitter.com/", `${INSTANCE_DOMAIN}/`)); | ||||
|     location.hostname = INSTANCE_DOMAIN; | ||||
| })(); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue