mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 22:16:00 -04:00
Refactor browser check.
This commit is contained in:
parent
8d3611e30c
commit
0a843a0b1f
5 changed files with 38 additions and 30 deletions
|
@ -2,28 +2,25 @@ block init
|
||||||
|
|
||||||
<?php header('Content-type: text/html;charset=utf-8'); ?>
|
<?php header('Content-type: text/html;charset=utf-8'); ?>
|
||||||
doctype html
|
doctype html
|
||||||
<!--[if lt IE 10]><html class='no-js no-browser' lang='en'><![endif]-->
|
html(class='no-js', lang='en')
|
||||||
<!--[if gt IE 9]><!--><html class='no-js browser' lang='en'><!--<![endif]-->
|
|
||||||
|
|
||||||
head
|
head
|
||||||
meta(charset='utf-8')
|
meta(charset='utf-8')
|
||||||
meta(http-equiv='x-ua-compatible', content='ie=edge')
|
meta(http-equiv='x-ua-compatible', content='ie=edge')
|
||||||
title #{title}
|
title #{title}
|
||||||
meta(name='description', content='#{title}')
|
meta(name='description', content='#{title}')
|
||||||
meta(name='viewport', content='width=device-width, initial-scale=1')
|
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||||
link(rel='shortcut icon', href!='<?= $public_href; ?>images/favicon/favicon-16-32.ico')
|
link(rel='shortcut icon', href!='<?= $public_href; ?>images/favicon/favicon-16-32.ico')
|
||||||
link(rel='apple-touch-icon-precomposed', type='image/png', href!='<?= $public_href; ?>images/favicon/favicon-152.png')
|
link(rel='apple-touch-icon-precomposed', type='image/png', href!='<?= $public_href; ?>images/favicon/favicon-152.png')
|
||||||
link(rel='stylesheet', href!='<?= $public_href; ?>css/styles.css')
|
link(rel='stylesheet', href!='<?= $public_href; ?>css/styles.css')
|
||||||
script(src!='<?= $public_href; ?>js/scripts.js', data-module='#{module}')
|
script(src!='<?= $public_href; ?>js/scripts.js', data-module='#{module}')
|
||||||
<?= $x_head_tags; ?>
|
<?= $x_head_tags; ?>
|
||||||
|
|
||||||
body#root(class='#{module}')
|
body#root(class='#{module}')
|
||||||
|
|
||||||
div#fallback-hints
|
div#fallback-hints
|
||||||
span.noJsMsg Works best with JavaScript enabled!
|
span.noJsMsg Works best with JavaScript enabled!
|
||||||
span.noBrowserMsg Works best in #[a(href='http://browsehappy.com') modern browsers]!
|
span.noBrowserMsg Works best in #[a(href='http://browsehappy.com') modern browsers]!
|
||||||
span.backlink #[a(href='#{pkg.homepage}', title='#{pkg.name} v#{pkg.version} - #{pkg.description}') powered by #{pkg.name}]
|
span.backlink #[a(href='#{pkg.homepage}', title='#{pkg.name} v#{pkg.version} - #{pkg.description}') powered by #{pkg.name}]
|
||||||
|
|
||||||
block body
|
block body
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.noJsMsg, .noBrowserMsg {
|
.noJsMsg, .noBrowserMsg {
|
||||||
|
display: none;
|
||||||
margin: 0 16px;
|
margin: 0 16px;
|
||||||
color: @col-error;
|
color: @col-error;
|
||||||
}
|
}
|
||||||
|
@ -104,10 +105,10 @@ html.no-js, html.no-browser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html.js .noJsMsg {
|
html.no-js .noJsMsg {
|
||||||
display: none;
|
display: inline !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.browser .noBrowserMsg {
|
html.no-browser .noBrowserMsg {
|
||||||
display: none;
|
display: inline !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#sidebar {
|
#sidebar {
|
||||||
display: none;
|
display: none;
|
||||||
overflow: auto;
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
order: 0;
|
order: 0;
|
||||||
background: @col-back-panel;
|
background: @col-back-panel;
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
modulejs.define('boot', ['$', 'core/server'], function ($, server) {
|
modulejs.define('boot', ['$', 'core/server'], function ($, server) {
|
||||||
|
|
||||||
if ($('html').hasClass('no-browser')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var module = $('script[data-module]').data('module');
|
var module = $('script[data-module]').data('module');
|
||||||
var data = {action: 'get', setup: true, options: true, types: true};
|
var data = {action: 'get', setup: true, options: true, types: true};
|
||||||
|
|
||||||
|
|
|
@ -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/modernizr-*.js"
|
||||||
// @include "lib/jquery-*.js"
|
// @include "lib/jquery-*.js"
|
||||||
// @include "lib/jquery.*.js"
|
// @include "lib/jquery.*.js"
|
||||||
|
@ -20,3 +31,5 @@
|
||||||
|
|
||||||
modulejs.require('boot');
|
modulejs.require('boot');
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
}());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue