unshortener copies to clipboard
This commit is contained in:
		
							parent
							
								
									ca2c990002
								
							
						
					
					
						commit
						a655b3b02e
					
				@ -28,8 +28,6 @@ function getDomainFromUrl(linkUrl) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function unshortenUrl(linkUrl) {
 | 
			
		||||
    console.log(linkUrl);
 | 
			
		||||
 | 
			
		||||
    fetch("http://localhost:8000/?url=" + linkUrl)
 | 
			
		||||
    .then(res => {
 | 
			
		||||
        if (!res.ok) {
 | 
			
		||||
@ -37,7 +35,9 @@ function unshortenUrl(linkUrl) {
 | 
			
		||||
        }
 | 
			
		||||
        return res.json();
 | 
			
		||||
    })
 | 
			
		||||
    .then(data => {
 | 
			
		||||
        console.log(data);
 | 
			
		||||
    .then(unshortenedUrl => {
 | 
			
		||||
        console.log("unshortened: " + unshortenedUrl)
 | 
			
		||||
        navigator.clipboard.writeText(unshortenedUrl)
 | 
			
		||||
        .catch(err => console.error("couldn't copy to clipboard", err));
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "manifest_version": 2,
 | 
			
		||||
  "name": "Unshortener",
 | 
			
		||||
  "version": "0.2",
 | 
			
		||||
  "version": "0.3",
 | 
			
		||||
 | 
			
		||||
  "description": "Unshorten links from Twitter.",
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,8 @@
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  "permissions": [
 | 
			
		||||
    "activeTab",
 | 
			
		||||
    "clipboardWrite",
 | 
			
		||||
    "contextMenus"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user