Commit b1424790 authored by Nikolay Gromov's avatar Nikolay Gromov

Инлайновый JS в head: добавил детектирование браузера

parent 8e2fb5c1
src/js/head-script.js
......@@ -62,7 +62,7 @@ let pugOption = {
let prettyOption = {
indent_size: 2,
indent_char: ' ',
unformatted: ['code', 'em', 'strong', 'span', 'i', 'b', 'br'],
unformatted: ['code', 'em', 'strong', 'span', 'i', 'b', 'br', 'script'],
content_unformatted: [],
};
......
document.documentElement.className = document.documentElement.className.replace('no-js', 'js');
function cth(c){document.documentElement.classList.add(c)}
'ontouchstart' in window?cth('touch'):cth('no-touch');
if(typeof InstallTrigger!=='undefined')cth('firefox');
if(/constructor/i.test(window.HTMLElement)||(function(p){return p.toString()==="[object SafariRemoteNotification]"})(!window['safari']||(typeof safari!=='undefined'&&safari.pushNotification)))cth('safari');
if(/*@cc_on!@*/false||!!document.documentMode)cth('ie');
if(!(/*@cc_on!@*/false||!!document.documentMode)&&!!window.StyleMedia)cth('edge');
if(!!window.chrome&&(!!window.chrome.webstore||!!window.chrome.runtime))cth('chrome');
......@@ -31,8 +31,8 @@ html(class='no-js page', lang='ru')
block head
link(rel='stylesheet', href='css/style.css')
link(rel='stylesheet', href='css/blocks-library.css')
script.
document.querySelector('html').classList.replace('no-js', 'js');'ontouchstart' in window ? document.querySelector('html').classList.add('touch') : document.querySelector('html').classList.add('no-touch');
script
include ../js/head-script.js
body
noscript У вас отключен JavaScript. Это пугает.
......
......@@ -30,8 +30,8 @@ html(class='no-js page', lang='ru')
block head
link(rel='stylesheet', href='css/style.css')
script.
document.querySelector('html').classList.replace('no-js', 'js');'ontouchstart' in window ? document.querySelector('html').classList.add('touch') : document.querySelector('html').classList.add('no-touch');
script
include ../js/head-script.js
body
noscript У вас отключен JavaScript. Это пугает.
......
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