From 541d21a6f38847ea2ce78d61dd52dd1ac78cb5af Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 21 Jun 2021 13:25:01 +0800 Subject: [PATCH] Edit for Accessibility. --- app/assets/javascripts/archive/pdf/viewer.js | 5 ++++- .../stylesheets/archive/download_file.css | 14 ++++++++++++++ app/controllers/archives_controller.rb | 6 +++++- app/views/archives/redirect_to_file.html.erb | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 app/views/archives/redirect_to_file.html.erb diff --git a/app/assets/javascripts/archive/pdf/viewer.js b/app/assets/javascripts/archive/pdf/viewer.js index eedc602..b311f02 100644 --- a/app/assets/javascripts/archive/pdf/viewer.js +++ b/app/assets/javascripts/archive/pdf/viewer.js @@ -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) { diff --git a/app/assets/stylesheets/archive/download_file.css b/app/assets/stylesheets/archive/download_file.css index f917370..d7810e3 100644 --- a/app/assets/stylesheets/archive/download_file.css +++ b/app/assets/stylesheets/archive/download_file.css @@ -13,4 +13,18 @@ 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; } \ No newline at end of file diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index f194b67..3c67362 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -225,7 +225,11 @@ class ArchivesController < ApplicationController if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf" render "download_file",:layout=>false else - send_file(@path) + if (current_site.accessibility_mode rescue false) + render "redirect_to_file",:layout=>false + else + send_file(@path) + end end rescue redirect_to @url diff --git a/app/views/archives/redirect_to_file.html.erb b/app/views/archives/redirect_to_file.html.erb new file mode 100644 index 0000000..0968d5c --- /dev/null +++ b/app/views/archives/redirect_to_file.html.erb @@ -0,0 +1,17 @@ + + + <%=@filename%> + + + +
+

<%=@filename%>

+ <% download_text = t('download') + " " + @filename %> +

<%=download_text%>

+

+ <%=t('close')%> +

+
+ + + \ No newline at end of file