hexo-theme-amane/layout/plugin/outdated-browser.jsx

45 lines
1.5 KiB
React
Raw Normal View History

2019-12-22 17:16:19 +00:00
'use strict';
const { Component, Fragment } = require('inferno');
const { cacheComponent } = require('../util/cache');
class OutdatedBrowser extends Component {
render() {
const { head, cdn } = this.props;
const js = `document.addEventListener("DOMContentLoaded", function () {
outdatedBrowser({
bgColor: '#f25648',
color: '#ffffff',
lowerThan: 'flex'
});
});`;
if (head) {
return <link rel="stylesheet" href={cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.css')} />;
}
return <Fragment>
<div id="outdated">
<h6>Your browser is out-of-date!</h6>
<p>
Update your browser to view this website correctly.&npsb;
<a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update my browser now </a>
</p>
<p className="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>
</div>
<script src={cdn('outdatedbrowser', '1.1.5', 'outdatedbrowser/outdatedbrowser.min.js')} async={true}></script>
<script dangerouslySetInnerHTML={{ __html: js }}></script>
</Fragment>;
}
}
module.exports = cacheComponent(OutdatedBrowser, 'plugin.outdatedbrowser', props => {
return {
head: props.head,
cdn: props.cdn,
// for cache purpose only
_providers: props.providers.cdn
};
});