Fix CSP for PDF download button by moving to external script
	
		
			
	
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	
				
					
				
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	This commit is contained in:
		
							parent
							
								
									911842dc06
								
							
						
					
					
						commit
						5ac1c24481
					
				| 
						 | 
				
			
			@ -6,6 +6,7 @@ COPY index.html /srv/
 | 
			
		|||
COPY theme.js /srv/
 | 
			
		||||
COPY utils.js /srv/
 | 
			
		||||
COPY styles.css /srv/
 | 
			
		||||
COPY pdf-download.js /srv/
 | 
			
		||||
 | 
			
		||||
# Expose port 8080
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
    <title>Colin Knapp Portfolio</title>
 | 
			
		||||
    <link rel="stylesheet" href="styles.css" integrity="sha256-Ps1dklCHzk1leTAfqkeA64YDuDJxx5QZBjC2UQhSdz0=" crossorigin="anonymous">
 | 
			
		||||
    <script src="theme.js" integrity="sha256-anTkUs/oFZJulKUMaMjZlwaALEmPOP8op0psAo5Bhh8=" crossorigin="anonymous"></script>
 | 
			
		||||
    <script src="pdf-download.js" integrity="sha256-BASkmAmg7eoYCMd6odA6kQ8yGsFnoxaX48WbQvMkehs=" crossorigin="anonymous"></script>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
    <div class="theme-switch">
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +24,6 @@
 | 
			
		|||
            aria-label="Download as PDF"
 | 
			
		||||
            title="Download resume as PDF"
 | 
			
		||||
            tabindex="0"
 | 
			
		||||
            onclick="downloadAsPDF()"
 | 
			
		||||
        >📄</button>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -202,24 +202,5 @@
 | 
			
		|||
 | 
			
		||||
        <p class="accessibility-notice"><strong>Accessibility:</strong> This website is designed and developed to meet WCAG 2.1 Level AAA standards, ensuring the highest level of accessibility for all users. Features include high contrast ratios, keyboard navigation, screen reader compatibility, and responsive design. The site supports both light and dark modes with automatic system preference detection.</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <script>
 | 
			
		||||
        function downloadAsPDF() {
 | 
			
		||||
            // Store current theme
 | 
			
		||||
            const currentTheme = document.body.getAttribute('data-theme');
 | 
			
		||||
            
 | 
			
		||||
            // Force light theme for PDF
 | 
			
		||||
            document.body.setAttribute('data-theme', 'light');
 | 
			
		||||
            
 | 
			
		||||
            // Wait for theme change to apply
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                window.print();
 | 
			
		||||
                
 | 
			
		||||
                // Restore original theme
 | 
			
		||||
                setTimeout(() => {
 | 
			
		||||
                    document.body.setAttribute('data-theme', currentTheme);
 | 
			
		||||
                }, 100);
 | 
			
		||||
            }, 100);
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
</body>
 | 
			
		||||
</html> 
 | 
			
		||||
		Loading…
	
		Reference in New Issue