mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
8e6aab0145
Since the interface is not always in english, we mostly removed the lang attribute from all html tags. Since the error messages in error.ejs are not translated, but always in english, there the global lang="en" should be kept. Also in the slide and editor template the div, which contains the user generated text, has the attribute translate="no" now, to avoid unwanted translations. Since on the publish view (pretty.ejs) only the user generated content is shown, we set the lang to the language defined in yaml (or 'en') as a default, but that was also moved to the corresponding markdown div instead of html. Fixes #881 See also #437 Signed-off-by: Philip Molares <philip.molares@udo.edu>
203 lines
8.9 KiB
Handlebars
203 lines
8.9 KiB
Handlebars
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<title>
|
|
{{title}}
|
|
</title>
|
|
<link rel="apple-touch-icon" sizes="180x180" href="{{{url}}}/icons/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="{{{url}}}/icons/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="{{{url}}}/icons/favicon-16x16.png">
|
|
<link rel="manifest" href="{{{url}}}/icons/site.webmanifest">
|
|
<link rel="mask-icon" href="{{{url}}}/icons/safari-pinned-tab.svg" color="#b51f08">
|
|
<link rel="shortcut icon" href="{{{url}}}/icons/favicon.ico">
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.0/css/bootstrap.min.css" integrity="sha256-H0KfTigpUV+0/5tn2HXC0CPwhhDhWgSawJdnFd0CGCo=" crossorigin="anonymous" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fork-awesome/1.1.3/css/fork-awesome.min.css" integrity="sha256-ZhApazu+kejqTYhMF+1DzNKjIzP7KXu6AzyXcC1gMus=" crossorigin="anonymous" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css" integrity="sha256-3iu9jgsy9TpTwXKb7bNQzqWekRX7pPK+2OLj3R922fo=" crossorigin="anonymous" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css" integrity="sha256-vtR0hSWRc3Tb26iuN2oZHt3KRUomwTufNIf5/4oeCyg=" crossorigin="anonymous" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github-gist.min.css" integrity="sha256-tAflq+ymku3Khs+I/WcAneIlafYgDiOQ9stIHH985Wo=" crossorigin="anonymous" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/emojify.js/1.1.0/css/basic/emojify.min.css" integrity="sha256-UOrvMOsSDSrW6szVLe8ZDZezBxh5IoIfgTwdNDgTjiU=" crossorigin="anonymous" />
|
|
<style>
|
|
{{{css}}}
|
|
</style>
|
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
<!--[if lt IE 9]>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.min.js" integrity="sha256-8E4Is26QH0bD52WoQpcB+R/tcWQtpzlCojrybUd7Mxo=" crossorigin="anonymous"></script>
|
|
<![endif]-->
|
|
</head>
|
|
|
|
<body translate="no">
|
|
{{{html}}}
|
|
<div class="ui-toc dropup unselectable hidden-print" style="display:none;">
|
|
<div class="pull-right dropdown">
|
|
<a id="tocLabel" class="ui-toc-label btn btn-default" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" title="Table of content">
|
|
<i class="fa fa-bars"></i>
|
|
</a>
|
|
<ul id="ui-toc" class="ui-toc-dropdown dropdown-menu" aria-labelledby="tocLabel">
|
|
{{{ui-toc}}}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div id="ui-toc-affix" class="ui-affix-toc ui-toc-dropdown unselectable hidden-print" data-spy="affix" style="top:17px;display:none;" {{{lang}}} {{{dir}}}>
|
|
{{{ui-toc-affix}}}
|
|
</div>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.0/js/bootstrap.min.js" integrity="sha256-kJrlY+s09+QoWjpkOrXXwhxeaoDz9FW5SaxF8I0DibQ=" crossorigin="anonymous" defer></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.6.0/gist-embed.min.js" integrity="sha256-KyF2D6xPIJUW5sUDSs93vWyZm+1RzIpKCexxElmxl8g=" crossorigin="anonymous" defer></script>
|
|
<script>
|
|
var markdown = $(".markdown-body");
|
|
//smooth all hash trigger scrolling
|
|
function smoothHashScroll() {
|
|
var hashElements = $("a[href^='#']").toArray();
|
|
for (var i = 0; i < hashElements.length; i++) {
|
|
var element = hashElements[i];
|
|
var $element = $(element);
|
|
var hash = element.hash;
|
|
if (hash) {
|
|
$element.on('click', function (e) {
|
|
// store hash
|
|
var hash = this.hash;
|
|
if ($(hash).length <= 0) return;
|
|
// prevent default anchor click behavior
|
|
e.preventDefault();
|
|
// animate
|
|
$('body, html').stop(true, true).animate({
|
|
scrollTop: $(hash).offset().top
|
|
}, 100, "linear", function () {
|
|
// when done, add hash to url
|
|
// (default click behaviour)
|
|
window.location.hash = hash;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
smoothHashScroll();
|
|
var toc = $('.ui-toc');
|
|
var tocAffix = $('.ui-affix-toc');
|
|
var tocDropdown = $('.ui-toc-dropdown');
|
|
//toc
|
|
tocDropdown.click(function (e) {
|
|
e.stopPropagation();
|
|
});
|
|
|
|
var enoughForAffixToc = true;
|
|
|
|
function generateScrollspy() {
|
|
$(document.body).scrollspy({
|
|
target: ''
|
|
});
|
|
$(document.body).scrollspy('refresh');
|
|
if (enoughForAffixToc) {
|
|
toc.hide();
|
|
tocAffix.show();
|
|
} else {
|
|
tocAffix.hide();
|
|
toc.show();
|
|
}
|
|
$(document.body).scroll();
|
|
}
|
|
|
|
function windowResize() {
|
|
//toc right
|
|
var paddingRight = parseFloat(markdown.css('padding-right'));
|
|
var right = ($(window).width() - (markdown.offset().left + markdown.outerWidth() - paddingRight));
|
|
toc.css('right', right + 'px');
|
|
//affix toc left
|
|
var newbool;
|
|
var rightMargin = (markdown.parent().outerWidth() - markdown.outerWidth()) / 2;
|
|
//for ipad or wider device
|
|
if (rightMargin >= 133) {
|
|
newbool = true;
|
|
var affixLeftMargin = (tocAffix.outerWidth() - tocAffix.width()) / 2;
|
|
var left = markdown.offset().left + markdown.outerWidth() - affixLeftMargin;
|
|
tocAffix.css('left', left + 'px');
|
|
} else {
|
|
newbool = false;
|
|
}
|
|
if (newbool != enoughForAffixToc) {
|
|
enoughForAffixToc = newbool;
|
|
generateScrollspy();
|
|
}
|
|
}
|
|
$(window).resize(function () {
|
|
windowResize();
|
|
});
|
|
$(document).ready(function () {
|
|
windowResize();
|
|
generateScrollspy();
|
|
});
|
|
|
|
//remove hash
|
|
function removeHash() {
|
|
window.location.hash = '';
|
|
}
|
|
|
|
var backtotop = $('.back-to-top');
|
|
var gotobottom = $('.go-to-bottom');
|
|
|
|
backtotop.click(function (e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
if (scrollToTop)
|
|
scrollToTop();
|
|
removeHash();
|
|
});
|
|
gotobottom.click(function (e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
if (scrollToBottom)
|
|
scrollToBottom();
|
|
removeHash();
|
|
});
|
|
|
|
var toggle = $('.expand-toggle');
|
|
var tocExpand = false;
|
|
|
|
checkExpandToggle();
|
|
toggle.click(function (e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
tocExpand = !tocExpand;
|
|
checkExpandToggle();
|
|
})
|
|
|
|
function checkExpandToggle () {
|
|
var toc = $('.ui-toc-dropdown .toc');
|
|
var toggle = $('.expand-toggle');
|
|
if (!tocExpand) {
|
|
toc.removeClass('expand');
|
|
toggle.text('Expand all');
|
|
} else {
|
|
toc.addClass('expand');
|
|
toggle.text('Collapse all');
|
|
}
|
|
}
|
|
|
|
function scrollToTop() {
|
|
$('body, html').stop(true, true).animate({
|
|
scrollTop: 0
|
|
}, 100, "linear");
|
|
}
|
|
|
|
function scrollToBottom() {
|
|
$('body, html').stop(true, true).animate({
|
|
scrollTop: $(document.body)[0].scrollHeight
|
|
}, 100, "linear");
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|