2013-04-11 02:24:08 -04:00
|
|
|
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
|
2013-12-11 11:17:55 -05:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
2013-12-18 14:47:12 -05:00
|
|
|
var h = document.getElementsByTagName('html')[0],
|
|
|
|
isMobileView = (localStorage && localStorage.mobileView) ? (localStorage.mobileView === 'true') :
|
|
|
|
Modernizr.mq("only screen and (max-width: 480px), only screen and (max-device-width: 480px)");
|
2013-12-11 11:17:55 -05:00
|
|
|
|
|
|
|
h.className += (isMobileView ? ' mobile-view' : ' desktop-view');
|
2013-12-18 14:47:12 -05:00
|
|
|
Modernizr.load({
|
|
|
|
test: isMobileView,
|
|
|
|
yep: <%= stylesheet_filenames(:mobile).inspect.html_safe %>,
|
|
|
|
nope: <%= stylesheet_filenames(:desktop).inspect.html_safe %>,
|
|
|
|
complete: function() {
|
|
|
|
// CSS file(s) have loaded.
|
|
|
|
$(function() {
|
|
|
|
setTimeout(function() {
|
|
|
|
// Use setTimeout to make this happen in the next event loop.
|
|
|
|
// Trying to avoid a FOUC (flash of unstyled content).
|
|
|
|
if (isMobileView) {
|
|
|
|
$('#custom-mobile-header').show();
|
|
|
|
} else {
|
|
|
|
$('#custom-desktop-header').show();
|
|
|
|
}
|
|
|
|
$('#js-app').attr('style', ''); // Show everything.
|
|
|
|
$(window).trigger('scroll.discourse-dock'); // Calc header div positions now that they're visible.
|
|
|
|
}, 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2013-12-11 11:17:55 -05:00
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
2013-04-11 02:24:08 -04:00
|
|
|
<%- end %>
|
2013-02-11 06:41:23 -05:00
|
|
|
|
2013-12-11 11:17:55 -05:00
|
|
|
<noscript>
|
|
|
|
<%= stylesheet_link_tag "desktop" %>
|
|
|
|
</noscript>
|
|
|
|
|
2013-05-02 03:22:27 -04:00
|
|
|
<%- if staff? %>
|
2013-04-11 02:24:08 -04:00
|
|
|
<%= stylesheet_link_tag "admin"%>
|
|
|
|
<%-end%>
|