Refactor browser check.

This commit is contained in:
Lars Jung 2015-05-16 21:36:05 +02:00
parent 8d3611e30c
commit 0a843a0b1f
5 changed files with 38 additions and 30 deletions

View file

@ -2,8 +2,7 @@ block init
<?php header('Content-type: text/html;charset=utf-8'); ?>
doctype html
<!--[if lt IE 10]><html class='no-js no-browser' lang='en'><![endif]-->
<!--[if gt IE 9]><!--><html class='no-js browser' lang='en'><!--<![endif]-->
html(class='no-js', lang='en')
head
meta(charset='utf-8')
@ -25,5 +24,3 @@ body#root(class='#{module}')
span.backlink #[a(href='#{pkg.homepage}', title='#{pkg.name} v#{pkg.version} - #{pkg.description}') powered by #{pkg.name}]
block body
</html>

View file

@ -88,6 +88,7 @@
}
.noJsMsg, .noBrowserMsg {
display: none;
margin: 0 16px;
color: @col-error;
}
@ -104,10 +105,10 @@ html.no-js, html.no-browser {
}
}
html.js .noJsMsg {
display: none;
html.no-js .noJsMsg {
display: inline !important;
}
html.browser .noBrowserMsg {
display: none;
html.no-browser .noBrowserMsg {
display: inline !important;
}

View file

@ -1,6 +1,7 @@
#sidebar {
display: none;
overflow: auto;
overflow-x: hidden;
overflow-y: auto;
flex: 0 0 auto;
order: 0;
background: @col-back-panel;

View file

@ -1,9 +1,5 @@
modulejs.define('boot', ['$', 'core/server'], function ($, server) {
if ($('html').hasClass('no-browser')) {
return;
}
var module = $('script[data-module]').data('module');
var data = {action: 'get', setup: true, options: true, types: true};

View file

@ -1,3 +1,14 @@
(function () {
if (function () {
var div = document.createElement('div');
div.innerHTML = '<!--[if lt IE 10]><br><![endif]-->';
return div.getElementsByTagName('br').length;
}()) {
document.documentElement.className = 'js no-browser';
return;
}
// @include "lib/modernizr-*.js"
// @include "lib/jquery-*.js"
// @include "lib/jquery.*.js"
@ -20,3 +31,5 @@
modulejs.require('boot');
}());
}());