Default theme: Add basic support for IE8

Forms still look broken and I definitly will *NOT* fix that. We don't support IE8 officially!

+ some minor improvements
This commit is contained in:
Daniel Rudolf 2016-08-03 17:14:54 +02:00
parent 51e8f31692
commit 65a37f1464
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
5 changed files with 64 additions and 81 deletions

View file

@ -17,16 +17,16 @@
</head>
<body{% if config.theme_config.widescreen %} class="widescreen"{% endif %}>
<header>
<div id="header">
<div class="container">
<a id="page-menu-toggle" title="Toggle Menu" role="button" aria-controls="page-menu" aria-expanded="false" tabindex="1">
<a id="nav-toggle" title="Toggle Menu" role="button" aria-controls="nav" aria-expanded="false" tabindex="1">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Menu</span>
</a>
<h1>
<a href="{{ "index"|link }}">{{ site_title }}</a>
</h1>
<nav id="page-menu" role="region" tabindex="-1">
<div id="nav" role="region" tabindex="-1">
<ul>
{% for page in pages if page.title %}
<li{% if page.id == current_page.id %} class="active"{% endif %}>
@ -34,17 +34,17 @@
</li>
{% endfor %}
</ul>
</nav>
</div>
</div>
</header>
</div>
<main>
<div id="main">
<div class="container">
{{ content }}
</div>
</main>
</div>
<footer>
<div id="footer">
<div class="container">
<div class="social">
{% for social in meta.social %}
@ -60,7 +60,7 @@
Released under the <a href="https://github.com/picocms/Pico/blob/master/LICENSE.md">MIT license</a>.
</p>
</div>
</footer>
</div>
<script src="{{ theme_url }}/js/modernizr-3.3.1-custom.min.js" type="text/javascript"></script>
<script src="{{ theme_url }}/js/utils.js" type="text/javascript"></script>

View file

@ -1,3 +1,3 @@
/*! modernizr 3.3.1 (Custom Build) | MIT *
* https://modernizr.com/download/?-classlist-csstransitions-dataset-requestanimationframe !*/
!function(e,n,t){function r(e,n){return typeof e===n}function i(){var e,n,t,i,o,s,a;for(var f in y)if(y.hasOwnProperty(f)){if(e=[],n=y[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(i=r(n.fn,"function")?n.fn():n.fn,o=0;o<e.length;o++)s=e[o],a=s.split("."),1===a.length?Modernizr[a[0]]=i:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=i),C.push((i?"":"no-")+a.join("-"))}}function o(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):x?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function s(e,n){return!!~(""+e).indexOf(n)}function a(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function f(e,n){return function(){return e.apply(n,arguments)}}function u(e,n,t){var i;for(var o in e)if(e[o]in n)return t===!1?e[o]:(i=n[e[o]],r(i,"function")?f(i,t||n):i);return!1}function l(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n.toLowerCase()}).replace(/^ms-/,"-ms-")}function d(){var e=n.body;return e||(e=o(x?"svg":"body"),e.fake=!0),e}function p(e,t,r,i){var s,a,f,u,l="modernizr",p=o("div"),c=d();if(parseInt(r,10))for(;r--;)f=o("div"),f.id=i?i[r]:l+(r+1),p.appendChild(f);return s=o("style"),s.type="text/css",s.id="s"+l,(c.fake?c:p).appendChild(s),c.appendChild(p),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(n.createTextNode(e)),p.id=l,c.fake&&(c.style.background="",c.style.overflow="hidden",u=w.style.overflow,w.style.overflow="hidden",w.appendChild(c)),a=t(p,e),c.fake?(c.parentNode.removeChild(c),w.style.overflow=u,w.offsetHeight):p.parentNode.removeChild(p),!!a}function c(n,r){var i=n.length;if("CSS"in e&&"supports"in e.CSS){for(;i--;)if(e.CSS.supports(l(n[i]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var o=[];i--;)o.push("("+l(n[i])+":"+r+")");return o=o.join(" or "),p("@supports ("+o+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return t}function m(e,n,i,f){function u(){d&&(delete E.style,delete E.modElem)}if(f=r(f,"undefined")?!1:f,!r(i,"undefined")){var l=c(e,i);if(!r(l,"undefined"))return l}for(var d,p,m,v,h,y=["modernizr","tspan","samp"];!E.style&&y.length;)d=!0,E.modElem=o(y.shift()),E.style=E.modElem.style;for(m=e.length,p=0;m>p;p++)if(v=e[p],h=E.style[v],s(v,"-")&&(v=a(v)),E.style[v]!==t){if(f||r(i,"undefined"))return u(),"pfx"==n?v:!0;try{E.style[v]=i}catch(g){}if(E.style[v]!=h)return u(),"pfx"==n?v:!0}return u(),!1}function v(e,n,t,i,o){var s=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+S.join(s+" ")+s).split(" ");return r(n,"string")||r(n,"undefined")?m(a,n,i,o):(a=(e+" "+T.join(s+" ")+s).split(" "),u(a,n,t))}function h(e,n,r){return v(e,t,t,n,r)}var y=[],g={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){y.push({name:e,fn:n,options:t})},addAsyncTest:function(e){y.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=g,Modernizr=new Modernizr;var C=[],w=n.documentElement;Modernizr.addTest("classlist","classList"in w);var x="svg"===w.nodeName.toLowerCase();Modernizr.addTest("dataset",function(){var e=o("div");return e.setAttribute("data-a-b","c"),!(!e.dataset||"c"!==e.dataset.aB)});var _="Moz O ms Webkit",S=g._config.usePrefixes?_.split(" "):[];g._cssomPrefixes=S;var T=g._config.usePrefixes?_.toLowerCase().split(" "):[];g._domPrefixes=T;var b={elem:o("modernizr")};Modernizr._q.push(function(){delete b.elem});var E={style:b.elem.style};Modernizr._q.unshift(function(){delete E.style}),g.testAllProps=v,g.testAllProps=h,Modernizr.addTest("csstransitions",h("transition","all",!0));var z=function(n){var r,i=prefixes.length,o=e.CSSRule;if("undefined"==typeof o)return t;if(!n)return!1;if(n=n.replace(/^@/,""),r=n.replace(/-/g,"_").toUpperCase()+"_RULE",r in o)return"@"+n;for(var s=0;i>s;s++){var a=prefixes[s],f=a.toUpperCase()+"_"+r;if(f in o)return"@-"+a.toLowerCase()+"-"+n}return!1};g.atRule=z;var P=g.prefixed=function(e,n,t){return 0===e.indexOf("@")?z(e):(-1!=e.indexOf("-")&&(e=a(e)),n?v(e,n,t):v(e,"pfx"))};Modernizr.addTest("requestanimationframe",!!P("requestAnimationFrame",e),{aliases:["raf"]}),i(),delete g.addTest,delete g.addAsyncTest;for(var A=0;A<Modernizr._q.length;A++)Modernizr._q[A]();e.Modernizr=Modernizr}(window,document);
* https://modernizr.com/download/?-classlist-csstransitions-requestanimationframe !*/
!function(e,n,t){function r(e,n){return typeof e===n}function i(){var e,n,t,i,o,s,a;for(var f in y)if(y.hasOwnProperty(f)){if(e=[],n=y[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(i=r(n.fn,"function")?n.fn():n.fn,o=0;o<e.length;o++)s=e[o],a=s.split("."),1===a.length?Modernizr[a[0]]=i:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=i),C.push((i?"":"no-")+a.join("-"))}}function o(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function s(e,n){return!!~(""+e).indexOf(n)}function a(e,n){return function(){return e.apply(n,arguments)}}function f(e,n,t){var i;for(var o in e)if(e[o]in n)return t===!1?e[o]:(i=n[e[o]],r(i,"function")?a(i,t||n):i);return!1}function l(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):T?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function u(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n.toLowerCase()}).replace(/^ms-/,"-ms-")}function d(){var e=n.body;return e||(e=l(T?"svg":"body"),e.fake=!0),e}function p(e,t,r,i){var o,s,a,f,u="modernizr",p=l("div"),c=d();if(parseInt(r,10))for(;r--;)a=l("div"),a.id=i?i[r]:u+(r+1),p.appendChild(a);return o=l("style"),o.type="text/css",o.id="s"+u,(c.fake?c:p).appendChild(o),c.appendChild(p),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(n.createTextNode(e)),p.id=u,c.fake&&(c.style.background="",c.style.overflow="hidden",f=w.style.overflow,w.style.overflow="hidden",w.appendChild(c)),s=t(p,e),c.fake?(c.parentNode.removeChild(c),w.style.overflow=f,w.offsetHeight):p.parentNode.removeChild(p),!!s}function c(n,r){var i=n.length;if("CSS"in e&&"supports"in e.CSS){for(;i--;)if(e.CSS.supports(u(n[i]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var o=[];i--;)o.push("("+u(n[i])+":"+r+")");return o=o.join(" or "),p("@supports ("+o+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return t}function m(e,n,i,a){function f(){d&&(delete P.style,delete P.modElem)}if(a=r(a,"undefined")?!1:a,!r(i,"undefined")){var u=c(e,i);if(!r(u,"undefined"))return u}for(var d,p,m,v,h,y=["modernizr","tspan","samp"];!P.style&&y.length;)d=!0,P.modElem=l(y.shift()),P.style=P.modElem.style;for(m=e.length,p=0;m>p;p++)if(v=e[p],h=P.style[v],s(v,"-")&&(v=o(v)),P.style[v]!==t){if(a||r(i,"undefined"))return f(),"pfx"==n?v:!0;try{P.style[v]=i}catch(g){}if(P.style[v]!=h)return f(),"pfx"==n?v:!0}return f(),!1}function v(e,n,t,i,o){var s=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+_.join(s+" ")+s).split(" ");return r(n,"string")||r(n,"undefined")?m(a,n,i,o):(a=(e+" "+E.join(s+" ")+s).split(" "),f(a,n,t))}function h(e,n,r){return v(e,t,t,n,r)}var y=[],g={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){y.push({name:e,fn:n,options:t})},addAsyncTest:function(e){y.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=g,Modernizr=new Modernizr;var C=[],w=n.documentElement;Modernizr.addTest("classlist","classList"in w);var x="Moz O ms Webkit",_=g._config.usePrefixes?x.split(" "):[];g._cssomPrefixes=_;var S=function(n){var r,i=prefixes.length,o=e.CSSRule;if("undefined"==typeof o)return t;if(!n)return!1;if(n=n.replace(/^@/,""),r=n.replace(/-/g,"_").toUpperCase()+"_RULE",r in o)return"@"+n;for(var s=0;i>s;s++){var a=prefixes[s],f=a.toUpperCase()+"_"+r;if(f in o)return"@-"+a.toLowerCase()+"-"+n}return!1};g.atRule=S;var E=g._config.usePrefixes?x.toLowerCase().split(" "):[];g._domPrefixes=E;var T="svg"===w.nodeName.toLowerCase(),z={elem:l("modernizr")};Modernizr._q.push(function(){delete z.elem});var P={style:z.elem.style};Modernizr._q.unshift(function(){delete P.style}),g.testAllProps=v;var b=g.prefixed=function(e,n,t){return 0===e.indexOf("@")?S(e):(-1!=e.indexOf("-")&&(e=o(e)),n?v(e,n,t):v(e,"pfx"))};Modernizr.addTest("requestanimationframe",!!b("requestAnimationFrame",e),{aliases:["raf"]}),g.testAllProps=h,Modernizr.addTest("csstransitions",h("transition","all",!0)),i(),delete g.addTest,delete g.addAsyncTest;for(var L=0;L<Modernizr._q.length;L++)Modernizr._q[L]();e.Modernizr=Modernizr}(window,document);

View file

@ -15,19 +15,20 @@ function main()
document.documentElement.className = 'js';
// wrap tables
utils.forEach(document.querySelectorAll('main table'), function (_, table) {
if (!/\btable-responsive\b/.test(table.parentElement.className)) {
var tables = document.querySelectorAll('#main > .container > table');
for (var i = 0; i < tables.length; i++) {
if (!/\btable-responsive\b/.test(tables[i].parentElement.className)) {
var tableWrapper = document.createElement('div');
tableWrapper.className = 'table-responsive';
table.parentElement.insertBefore(tableWrapper, table);
tableWrapper.appendChild(table);
tables[i].parentElement.insertBefore(tableWrapper, tables[i]);
tableWrapper.appendChild(tables[i]);
}
});
}
// responsive menu
var menu = document.getElementById('page-menu'),
menuToggle = document.getElementById('page-menu-toggle'),
var menu = document.getElementById('nav'),
menuToggle = document.getElementById('nav-toggle'),
toggleMenuEvent = function (event) {
if (event.type === 'keydown') {
if ((event.keyCode != 13) && (event.keyCode != 32)) {

View file

@ -11,27 +11,6 @@
utils = {};
/**
* Iterates through an iterable object (e.g. plain objects, arrays, NodeList)
*
* @param object object the object to iterate through
* @param function callback function to call on every item; the key is passed
* as first, the value as second parameter; the callback may return FALSE
* to stop the iteration
* @return void
*/
utils.forEach = function (object, callback)
{
var i = 0,
keys = Object.keys(object),
length = keys.length;
for (; i < length; i++) {
if (callback(keys[i], object[keys[i]]) === false) {
return;
}
}
};
/**
* Checks whether the client's browser is able to slide elements or not
*

View file

@ -21,10 +21,6 @@
padding: 0;
}
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
display:block
}
.hidden { display: none !important; }
.sr-only {
position: absolute;
@ -48,10 +44,10 @@ article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, s
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
header, footer { flex: 0 0 auto; }
#main { flex: 1 0 auto; }
#header, #footer { flex: 0 0 auto; }
main {
#main {
padding: 5em 0 4em;
}
@ -63,93 +59,98 @@ main {
.widescreen .container { max-width: 72em; }
main .container {
/* very ugly, avoid this whenever possible! */
overflow-x: auto;
}
/* very ugly overflow fix, avoid this whenever possible! */
#main .container { overflow-x: auto; }
/*** BASIC LAYOUT: HEADER ***/
header { background: #2EAE9B; }
#header { background: #2EAE9B; }
header h1 {
#header h1 {
float: left;
font-size: 2rem;
margin: 0;
padding: 1.5em 1em 1.5em 0;
}
header h1 a, header h1 a:hover { color: #fff; }
#header h1 a, #header h1 a:hover { color: #fff; }
header nav {
#nav {
text-align: right;
padding: 3em 0;
}
header nav ul {
#nav ul {
list-style: none;
margin: 0;
padding: 0;
}
header nav ul li {
#nav ul li {
display: inline-block;
margin-left: 1em;
padding: 0;
font-weight: bold;
}
header nav a, #page-menu-toggle { color: #afe1da; }
header nav .active a, header nav a:hover, #page-menu-toggle:hover { color: #fff; }
#nav a, #nav-toggle { color: #afe1da; }
#nav .active a, #nav a:hover, #nav-toggle:hover { color: #fff; }
#page-menu-toggle { display: none; }
#nav-toggle { display: none; }
/* IE8 + IE9 clearfix */
#header > .container:after {
content: '';
display: block;
clear: both;
}
/*** BASIC LAYOUT: FOOTER ***/
footer {
#footer {
background: #707070;
color: #C0C0C0;
}
footer a { color: #ddd; }
footer a:hover { color: #fff; }
#footer a { color: #ddd; }
#footer a:hover { color: #fff; }
footer p {
#footer p {
margin: 0;
padding: 3em 0;
}
footer .social {
#footer .social {
float: right;
padding: 1.5em 0 0.5em 1em;
padding: 1.5em 0 1.5em 1em;
font-size: 2rem;
}
/*** BASIC LAYOUT: EXTRA SMALL DEVICES ***/
@media (max-width: 767px) {
main { padding: 2em 0 1em; }
#main { padding: 2em 0 1em; }
header h1 {
#header h1 {
float: none;
padding: 0.5em 0;
}
header nav {
#nav {
clear: right;
padding: 0;
}
header nav ul {
#nav ul {
padding-bottom: 1em;
}
header nav ul li {
#nav ul li {
display: block;
margin-left: 0;
text-align: center;
}
header nav ul li a {
#nav ul li a {
display: block;
padding: 0.5em 0;
}
.js #page-menu-toggle {
.js #nav-toggle {
display: block;
float: right;
width: 2em;
@ -159,13 +160,13 @@ footer .social {
text-align: center;
cursor: pointer;
}
.js #page-menu-toggle > * { vertical-align: middle; }
.js #nav-toggle > * { vertical-align: middle; }
footer p { padding: 1em 0; }
footer .social { padding: 0.5em 0 0.5em 1em; }
#footer p { padding: 1em 0; }
#footer .social { padding: 0.5em 0 0.5em 1em; }
}
/*** TEXT ***/
/*** TYPOGRAPHY ***/
html { font-size: 16px; }
@ -245,6 +246,7 @@ tbody tr:last-child td:last-child { border-bottom-rig
table thead + tbody tr:first-child td { border-radius: 0 !important; }
.table-responsive { overflow-x: auto; }
.table-responsive > table { margin-bottom: 0; }
/*** LISTS ***/
@ -299,11 +301,6 @@ blockquote {
label, fieldset legend { font-weight: bold; }
input::-moz-focus-inner, button::-moz-focus-inner {
border: 0;
padding: 0;
}
input:not([type="checkbox"]):not([type="radio"]), button, select, textarea, fieldset, fieldset legend {
border: solid 1px #ccc;
border-radius: 0.3em;
@ -352,3 +349,9 @@ fieldset label:last-child, fieldset input:last-child, fieldset button:last-child
fieldset select:last-child, fieldset textarea:last-child {
margin-right: 0;
}
/* Firefox input size fix */
input::-moz-focus-inner, button::-moz-focus-inner {
border: 0;
padding: 0;
}