From 15fbcd8a53a3212dcf7da7e59596fd93dc2a95f3 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Wed, 24 Aug 2022 19:14:22 +0800 Subject: [PATCH] Updated. Fix accessibility. --- assets/javascripts/app.js | 48 +++++++++++++++---- .../stylesheets/template/layout/content.scss | 43 +++++++++++------ modules/announcement/_annc_widget20.html.erb | 32 +++++++++++++ modules/announcement/info.json | 10 +++- .../web_resource/_web_res_widget4.html.erb | 4 +- .../web_resource/_web_res_widget5.html.erb | 4 +- .../web_resource/_web_res_widget6.html.erb | 4 +- 7 files changed, 118 insertions(+), 27 deletions(-) create mode 100644 modules/announcement/_annc_widget20.html.erb diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 65e6923..58361da 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -12,6 +12,12 @@ } }); function initdata1 () { + window.temp_scrollY = window.pageYOffset; + window.temp_scrollX = window.pageXOffset; + if(window.temp_scrollY == undefined){ + window.temp_scrollY = document.documentElement.scrollTop; + window.temp_scrollX = document.documentElement.scrollLeft; + } if ($('.header-banner').html().trim() == "") { $('.downIcon').css('display','none') } @@ -34,10 +40,14 @@ $('.layout-content').css('margin-top',''); } } + var navFixed = $('.kenjohn.navFixed'); + window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height(); } // 初始函數: 把所有的程式碼都包在init裡面,方便在之後的jQuery ready 函數裡一次呼叫 function init() { // 快取一些常用的變數 + var navFixed = $('.kenjohn.navFixed'); + window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height(); var doc = document; var lang = doc.documentElement.lang; var pageModule = doc.body.getAttribute('data-module'); @@ -451,6 +461,8 @@ // 自適應網頁使用,當使用者改變瀏覽器寬度時呼叫orbit.nav.setDropdown函數 $(window).resize(function() { + var navFixed = $('.kenjohn.navFixed'); + window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height(); if ($(window).outerWidth() < 769) { if (resizeTimer) clearTimeout(resizeTimer); $('.outdropdowns').before($('.header-nav')); @@ -728,8 +740,23 @@ function transdate(){ // 當文件物件模型(DOM)載入後,執行init函數 $(document).ready(function() { - $(document).on('focus','*',function(){ - if ($('header>.kenjohn').attr('class') == "kenjohn" && $(document.activeElement).is('a.orbit-bar-logo')){ + window.temp_scrollY = window.pageYOffset; + window.temp_scrollX = window.pageXOffset; + if(window.temp_scrollY == undefined){ + window.temp_scrollY = document.documentElement.scrollTop; + window.temp_scrollX = document.documentElement.scrollLeft; + } + $(document).on('focusin','*',function(event){ + // event.stopPropagation(); + var _this = $(document.activeElement);//$(this); + var topOffset = window.temp_scrollY + window.top_barrier_height; + var ele_offset = _this.offset().top - topOffset; + if(ele_offset < 0){ + console.log(_this) + window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); + window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); + } + if ($('header>.kenjohn').attr('class') == "kenjohn" && _this.is('a.orbit-bar-logo')){ $('header>.kenjohn').addClass('navRel'); $('#gotocenter').focus(); } @@ -833,6 +860,7 @@ function transdate(){ }) var title_wrapper = $("
") $('h4.page-module-title').replaceTagName('h3'); + $('h3.i-annc__entry-title').replaceTagName('h4'); title_wrapper.append($('.view_count.pull-right,.page-module-title,#main-content .index-title,.i-member-status-title:eq(0),#main-content > * > [class*="-title"]')); $('.row.pagerow').prepend(title_wrapper); try { @@ -886,13 +914,15 @@ function transdate(){ $('.outdropdowns .modules-menu-level-1').css('right','') $('.outdropdowns .modules-menu-level-1').css('width','') }else{ - var width = $('header #main-nav').outerWidth(); - var right = $(window).width() - $('header #main-nav').offset().left - width; - if (width>50){ - calc_menu_flag = true; - $('.outdropdowns .modules-menu-level-1').css('right',right); - $('.outdropdowns .modules-menu-level-1').css('width',width); - } + try{ + var width = $('header #main-nav').outerWidth(); + var right = $(window).width() - $('header #main-nav').offset().left - width; + if (width>50){ + calc_menu_flag = true; + $('.outdropdowns .modules-menu-level-1').css('right',right); + $('.outdropdowns .modules-menu-level-1').css('width',width); + } + }catch(e){}; } } $(window).resize(function() { diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 0d6e597..1de090d 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -14,29 +14,44 @@ body{ } } } -.downIcon{ +.downIcon { position: absolute; left: 50%; bottom: 15%; //bottom: 10%; z-index: 2; color: #fff; - span{ - position: absolute; - top: 0; - left: 50%; - width: 46px; - height: 46px; - margin-left: -23px; - border: 2px solid #fff; - border-radius: 100%; - behavior: url("/assets/ie_support/PIE2/PIE.htc"); - box-sizing: border-box; + + span { + position: absolute; + top: 0; + left: 50%; + width: 46px; + height: 46px; + margin-left: -23px; + border: 2px solid #fff; + border-radius: 100%; + behavior: url("/assets/ie_support/PIE2/PIE.htc"); + box-sizing: border-box; } - a:hover{ - opacity: .5; + + a:hover span { + width: 60px; + height: 60px; + margin-left: -30px; + top: -7px; + border-width: 4px; + border-color: #facf3d; } } +.downIcon a:hover span::after { + width: 21px; + height: 21px; + border-left-width: 4px; + border-bottom-width: 4px; + margin: -14px 0 0 -10px; + border-color: #facf3d; +} .downIcon a span::after{ position: absolute; top: 50%; diff --git a/modules/announcement/_annc_widget20.html.erb b/modules/announcement/_annc_widget20.html.erb new file mode 100644 index 0000000..6ee0206 --- /dev/null +++ b/modules/announcement/_annc_widget20.html.erb @@ -0,0 +1,32 @@ +
+

+ {{widget-title}} +

+ + +
diff --git a/modules/announcement/info.json b/modules/announcement/info.json index 4c35dd3..9b1109f 100644 --- a/modules/announcement/info.json +++ b/modules/announcement/info.json @@ -305,6 +305,14 @@ "en": "19. 3-Column Standard Text List (widget-title, postdate, category, status, title, subtitle)" }, "thumbnail": "annc_index9_thumbs.png" + }, + { + "filename": "annc_widget20", + "name": { + "zh_tw": "20. 標準圖文 ( 模組標題, 圖片, 狀態, 日期, 類別, 標題, 副標題 )", + "en": "20. Standard Image + Text (widget-title, image, status, postdate, category, title, subtitle)" + }, + "thumbnail": "annc_widget1_thumbs.png" } ] -} +} \ No newline at end of file diff --git a/modules/web_resource/_web_res_widget4.html.erb b/modules/web_resource/_web_res_widget4.html.erb index 22e7870..84c3eb1 100644 --- a/modules/web_resource/_web_res_widget4.html.erb +++ b/modules/web_resource/_web_res_widget4.html.erb @@ -7,7 +7,9 @@