From 8e38343f22ed48a31455908dc6d31a230edbd3f4 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Tue, 3 Jan 2023 16:32:10 +0800 Subject: [PATCH] Fix bug. --- .../javascripts/archive/archive_frontend.js | 28 +++++++++++++++++++ .../stylesheets/archive/archive_frontend.css | 3 ++ 2 files changed, 31 insertions(+) create mode 100644 app/assets/javascripts/archive/archive_frontend.js create mode 100644 app/assets/stylesheets/archive/archive_frontend.css diff --git a/app/assets/javascripts/archive/archive_frontend.js b/app/assets/javascripts/archive/archive_frontend.js new file mode 100644 index 0000000..1d67521 --- /dev/null +++ b/app/assets/javascripts/archive/archive_frontend.js @@ -0,0 +1,28 @@ +$(document).ready(function(){ + function collapse_init(){ + var location_id = window.location.hash; + if(location_id && location_id != '' && location_id.length > 1){ + var match_collapse = location_id.match(/\#collapse(\d+)/); + if(match_collapse){ + var match_idx = parseInt(match_collapse[1]); + $('#index-archive-group .panel .collapse').removeClass('in').eq(match_idx).addClass('in'); + } + } + } + collapse_init(); + $('.i-archive .panel-heading, .w-archive .panel-heading').each(function(i, v){ + var $v = $(v); + if($v.text().trim() == ''){ + $v.css('display', 'none'); + } + }) + $('[data-list="archives"] a[href="javascript:void(0)"]').each(function(i, v){ + var $v = $(v); + $v.before($v.text()).remove(); + }) + $('[data-list="archives"] a[data-target]').each(function(i, v){ + var $v = $(v); + var target = $v.data('target'); + $v.attr('target', target); + }) +}); \ No newline at end of file diff --git a/app/assets/stylesheets/archive/archive_frontend.css b/app/assets/stylesheets/archive/archive_frontend.css new file mode 100644 index 0000000..418c4d8 --- /dev/null +++ b/app/assets/stylesheets/archive/archive_frontend.css @@ -0,0 +1,3 @@ +.widget-archive-files-item, .i-archive-files-item, .i-archive__file-name{ + white-space: pre; +} \ No newline at end of file