chrome support, hot injection
This commit is contained in:
		
							parent
							
								
									c35238da7b
								
							
						
					
					
						commit
						8f6ccda803
					
				
					 5 changed files with 60 additions and 14 deletions
				
			
		
							
								
								
									
										18
									
								
								js/bg.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								js/bg.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| /** DisKort | ||||
|  * (c) Er2 2022 | ||||
|  * Zlib License | ||||
|  */ | ||||
| 
 | ||||
| // Disable CSP
 | ||||
| function onHeaders(det) { | ||||
|   for (var i = 0; i < det.responseHeaders.length; i++) { | ||||
|     if (det.responseHeaders[i].name.toLowerCase() == 'content-security-policy' | ||||
|       || det.responseHeaders[i].name.toLowerCase() == 'content-security-policy-report-only' | ||||
|     ) det.responseHeaders[i].value = ''; | ||||
|   } | ||||
|   return { responseHeaders: det.responseHeaders }; | ||||
| } | ||||
| 
 | ||||
| chrome.webRequest.onHeadersReceived.addListener( | ||||
|   onHeaders, {urls: ['<all_urls>']}, ['blocking', 'responseHeaders'] | ||||
| ); | ||||
							
								
								
									
										18
									
								
								js/inj.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								js/inj.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| /** DisKort | ||||
|  * (c) Er2 2022 | ||||
|  * Zlib License | ||||
|  */ | ||||
| 
 | ||||
| const base = "https://raw.githubusercontent.com/Er2ch/diskort/main/"; | ||||
| 
 | ||||
| async function inject() { | ||||
|   try { | ||||
|     var resp = await fetch(base + 'btfl.css'); | ||||
|     var text = await resp.text(); | ||||
|     var s = document.createElement("style"); | ||||
|     s.innerHTML = text; | ||||
|     document.head.appendChild(s); | ||||
|   } catch(e) { console.error(e); } | ||||
| } | ||||
| document.addEventListener("click", inject); | ||||
| inject(); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue