Edit for Accessibility.

This commit is contained in:
BoHung Chiu 2021-06-21 13:25:01 +08:00
parent c1a0d6de89
commit 541d21a6f3
4 changed files with 40 additions and 2 deletions

View File

@ -114,6 +114,7 @@
;
window.lang = document.getElementsByTagName('html')[0].getAttribute('lang');
var pdfjsWebApp, pdfjsWebAppOptions;
{
pdfjsWebApp = __webpack_require__(1);
@ -9126,8 +9127,10 @@ var PDFOutlineViewer = /*#__PURE__*/function () {
this._bindLink(element, item);
this._setStyles(element, item);
element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE;
if(element.textContent.trim() == ""){
element.textContent = (window.lang == "zh_tw" ? "投影片編號 " : "Slide ") + (outlineCount + 1);
}
div.appendChild(element);
if (item.items.length > 0) {

View File

@ -14,3 +14,17 @@ img{
h3{
display: none;
}
a {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: underline;
color: #666;
}
.wrap_block{
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
position: absolute;
}

View File

@ -224,9 +224,13 @@ class ArchivesController < ApplicationController
@ext = @path.split("/").last.to_s.split(".").last
if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf"
render "download_file",:layout=>false
else
if (current_site.accessibility_mode rescue false)
render "redirect_to_file",:layout=>false
else
send_file(@path)
end
end
rescue
redirect_to @url
end

View File

@ -0,0 +1,17 @@
<html lang="<%= I18n.locale.to_s%>">
<head>
<title><%=@filename%></title>
<link href="/assets/archive/download_file.css" rel="stylesheet" media="all">
</head>
<body style="background: #fff;">
<div class="wrap_block">
<h1 style="display: none;"><%=@filename%></h1>
<% download_text = t('download') + " " + @filename %>
<h2 align="center"><a href="<%=@url%>" target="blank" download="<%=@filename%>" title="<%=download_text%>"><%=download_text%></a></h2>
<p align="center">
<a href="javascript:window.close();" title="<%=t('close')%>"><%=t('close')%></a>
</p>
</div>
<script>window.location.href="<%=@url%>";</script>
</body>
</html>