mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
remove inline fallback code for CSP
This commit is contained in:
17
src/js/fallback-styles.js
Normal file
17
src/js/fallback-styles.js
Normal file
@@ -0,0 +1,17 @@
|
||||
var cacheTag = '/* @echo cacheTag */' || '';
|
||||
|
||||
function loadStylesheetIfMissing(property, value, paths) {
|
||||
var scripts = document.getElementsByTagName('SCRIPT'),
|
||||
siblings = scripts[scripts.length - 1].previousElementSibling,
|
||||
meta = document.defaultView && document.defaultView.getComputedStyle ?
|
||||
document.defaultView.getComputedStyle(siblings) : siblings.currentStyle;
|
||||
|
||||
if (meta && meta[property] !== value) {
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
document.write('<link rel="stylesheet" href="' + paths[i] + '?v=' + cacheTag + '" />');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadStylesheetIfMissing('visibility', 'hidden', ['lib\/bootstrap\/css\/bootstrap.min.css']);
|
||||
loadStylesheetIfMissing('fontFamily', 'FontAwesome', ['lib\/font-awesome\/css\/font-awesome.min.css']);
|
||||
Reference in New Issue
Block a user