Revert loadCSS changes until unsafe-hashed-attributes is implemented

parent 27db5c5d
Pipeline #51080033 (#85) passed with stages
in 1 minute and 25 seconds
......@@ -1605,11 +1605,6 @@
"pend": "~1.2.0"
}
},
"fg-loadcss": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fg-loadcss/-/fg-loadcss-2.1.0.tgz",
"integrity": "sha512-HpvR2uRoKvrYAEwimw+k4Fr2NVHYPfld5Lc/f9uy3mKeUTXhS5urL24XA2rqyq5b2i410EXCLir4Uhsb8J1QaQ=="
},
"figures": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz",
......
......@@ -3,9 +3,7 @@
"version": "1.3.2",
"description": "[![Build Status](https://travis-ci.org/remyabel/linux-guide-and-hints.svg?branch=master)](https://travis-ci.org/remyabel/linux-guide-and-hints)",
"main": "Gruntfile.js",
"dependencies": {
"fg-loadcss": "^2.1.0"
},
"dependencies": {},
"devDependencies": {
"grunt": "^1.0.3",
"grunt-contrib-connect": "^1.0.2",
......
......@@ -5,5 +5,6 @@
] %}
{% set css_files = css_files + [
'_static/css/prism.min.css',
'_static/css/style.min.css'
] %}
......@@ -15,7 +15,7 @@
<meta charset="utf-8">
{{ metatags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests; default-src 'self'; style-src 'self' https://github.githubassets.com/ stackpath.bootstrapcdn.com; script-src 'self' 'sha256-qzKQFoz3Cq1BYgWnrhp3TgNx4R9nKQbyVFyPOyIukUk=' https://gist.github.com/remyabel/2cac59a778fa34d0c61e246554fe3e3c.js https://gist.github.com/remyabel/bbebf3043860abe24a19bf0b1d67bd33.js https://gist.github.com/remyabel/e9c33b830da73768fe6ea2363fc27e1a.js; img-src 'self'; media-src 'self'; font-src 'self' fonts.gstatic.com stackpath.bootstrapcdn.com;">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests; default-src 'self'; style-src 'self' https://github.githubassets.com/ stackpath.bootstrapcdn.com; script-src 'self' https://gist.github.com/remyabel/2cac59a778fa34d0c61e246554fe3e3c.js https://gist.github.com/remyabel/bbebf3043860abe24a19bf0b1d67bd33.js https://gist.github.com/remyabel/e9c33b830da73768fe6ea2363fc27e1a.js; img-src 'self'; media-src 'self'; font-src 'self' fonts.gstatic.com stackpath.bootstrapcdn.com;">
{% if pagename == "index" %}
<meta name="description" content="Tutorials and generally useful information regarding packages and system administration in Fedora® and CentOS®.">
{% endif %}
......@@ -46,126 +46,8 @@
{# RTD hosts this file, so just load on non RTD builds #}
{%- if not READTHEDOCS %}
<link href="{{ pathto('_static/' + style, 1) }}" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link href="{{ pathto('_static/' + style, 1) }}" rel="stylesheet" type="text/css">
</noscript>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<noscript><link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"></noscript>
<link href="{{ pathto('_static/' + 'css/prism.min.css', 1) }}" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link href="{{ pathto('_static/' + 'css/prism.min.css', 1) }}" rel="stylesheet" type="text/css">
</noscript>
<script>/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
/* This file is meant as a standalone workflow for
- testing support for link[rel=preload]
- enabling async CSS loading in browsers that do not support rel=preload
- applying rel preload css once loaded, whether supported or not.
*/
(function( w ){
"use strict";
// rel=preload support test
if( !w.loadCSS ){
w.loadCSS = function(){};
}
// define on the loadCSS obj
var rp = loadCSS.relpreload = {};
// rel=preload feature support test
// runs once and returns a function for compat purposes
rp.support = (function(){
var ret;
try {
ret = w.document.createElement( "link" ).relList.supports( "preload" );
} catch (e) {
ret = false;
}
return function(){
return ret;
};
})();
// if preload isn't supported, get an asynchronous load by using a non-matching media attribute
// then change that media back to its intended value on load
rp.bindMediaToggle = function( link ){
// remember existing media attr for ultimate state, or default to 'all'
var finalMedia = link.media || "all";
function enableStylesheet(){
// unbind listeners
if( link.addEventListener ){
link.removeEventListener( "load", enableStylesheet );
} else if( link.attachEvent ){
link.detachEvent( "onload", enableStylesheet );
}
link.setAttribute( "onload", null );
link.media = finalMedia;
}
// bind load handlers to enable media
if( link.addEventListener ){
link.addEventListener( "load", enableStylesheet );
} else if( link.attachEvent ){
link.attachEvent( "onload", enableStylesheet );
}
// Set rel and non-applicable media type to start an async request
// note: timeout allows this to happen async to let rendering continue in IE
setTimeout(function(){
link.rel = "stylesheet";
link.media = "only x";
});
// also enable media after 3 seconds,
// which will catch very old browsers (android 2.x, old firefox) that don't support onload on link
setTimeout( enableStylesheet, 3000 );
};
// loop through link elements in DOM
rp.poly = function(){
// double check this to prevent external calls from running
if( rp.support() ){
return;
}
var links = w.document.getElementsByTagName( "link" );
for( var i = 0; i < links.length; i++ ){
var link = links[ i ];
// qualify links to those with rel=preload and as=style attrs
if( link.rel === "preload" && link.getAttribute( "as" ) === "style" && !link.getAttribute( "data-loadcss" ) ){
// prevent rerunning on link
link.setAttribute( "data-loadcss", true );
// bind listeners to toggle media back
rp.bindMediaToggle( link );
}
}
};
// if unsupported, run the polyfill
if( !rp.support() ){
// run once at least
rp.poly();
// rerun poly on an interval until onload
var run = w.setInterval( rp.poly, 500 );
if( w.addEventListener ){
w.addEventListener( "load", function(){
rp.poly();
w.clearInterval( run );
} );
} else if( w.attachEvent ){
w.attachEvent( "onload", function(){
rp.poly();
w.clearInterval( run );
} );
}
}
// commonjs
if( typeof exports !== "undefined" ){
exports.loadCSS = loadCSS;
}
else {
w.loadCSS = loadCSS;
}
}( typeof global !== "undefined" ? global : this ) );
</script>
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
{%- endif %}
{%- for css in css_files %}
{%- if css|attr("rel") %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment