Fix JS errors
This commit is contained in:
parent
aa53128c30
commit
5d904a220d
|
|
@ -158,7 +158,7 @@
|
||||||
<thead class="theadsearch">
|
<thead class="theadsearch">
|
||||||
<tr data-list="head-columns" data-level="0">
|
<tr data-list="head-columns" data-level="0">
|
||||||
<th class="col-ken">
|
<th class="col-ken">
|
||||||
<a href="{{sort-url}}" class="{{sort}}" aria-label="重新排序{{title}}"><i class="universal-th-icon fa fa-{{sort-class}}" aria-hidden="true"></i></a><div class="universal-th-text {{title-class}}">{{title}}</div>
|
<a href="{{sort-url}}" class="{{sort}}" aria-label="重新排序{{title}}"><i class="universal-th-icon fa fa-{{sort-class}}" aria-hidden="true"></i></a>
|
||||||
<div class="universal-th-text {{title-class}}">{{title}}</div>
|
<div class="universal-th-text {{title-class}}">{{title}}</div>
|
||||||
<div class="dropdown universal-dropdown {{search}}">
|
<div class="dropdown universal-dropdown {{search}}">
|
||||||
<button class="btn btn-md" id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button class="btn btn-md" id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
|
@ -190,12 +190,41 @@
|
||||||
{{pagination_goes_here}}
|
{{pagination_goes_here}}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('.tdken>td:nth-child(4)').prepend($('.col-ken:nth-child(4)>.universal-th-text '));
|
$('.tdken>td:nth-child(4)').prepend($('.col-ken:nth-child(4)>.universal-th-text'));
|
||||||
$('.tdken>td:nth-child(3)').prepend($('.col-ken:nth-child(3)>.universal-th-text '));
|
$('.tdken>td:nth-child(3)').prepend($('.col-ken:nth-child(3)>.universal-th-text'));
|
||||||
$(".universal-th-text").append(" :");
|
$(".universal-th-text").append(" :");
|
||||||
# $(".tdken").append('<i class="fa-solid fa-thumbtack"></i>');
|
/**
|
||||||
|
* 圖片大小控制
|
||||||
|
* 'src' = 原圖
|
||||||
|
* 'thumb' = 縮圖 (200x200)
|
||||||
|
* 'mobile' = 行動版 (768px)
|
||||||
|
*/
|
||||||
|
const IMAGE_SIZE = 'thumb';
|
||||||
|
const cells = document.querySelectorAll('td[data-src]');
|
||||||
|
|
||||||
|
cells.forEach(cell => {
|
||||||
|
const imgSrc = cell.dataset[IMAGE_SIZE];
|
||||||
|
|
||||||
|
if (imgSrc && imgSrc !== '{{img_src}}' && imgSrc !== '{{img_thumb}}' && imgSrc !== '{{img_mobile}}') {
|
||||||
|
|
||||||
|
const oldImg = cell.querySelector('img');
|
||||||
|
if (oldImg) {
|
||||||
|
oldImg.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.className = 'image-preview';
|
||||||
|
img.alt = '圖片';
|
||||||
|
img.src = imgSrc;
|
||||||
|
cell.appendChild(img);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
cell.removeAttribute('data-src');
|
||||||
|
cell.removeAttribute('data-thumb');
|
||||||
|
cell.removeAttribute('data-mobile');
|
||||||
|
}
|
||||||
|
});
|
||||||
$('.voice-player').each(function () {
|
$('.voice-player').each(function () {
|
||||||
// 取得 <i> 元素
|
// 取得 <i> 元素
|
||||||
const icon = $(this).find('i')[0];
|
const icon = $(this).find('i')[0];
|
||||||
|
|
@ -207,42 +236,7 @@ $(document).ready(function(){
|
||||||
prevNode.remove();
|
prevNode.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 圖片大小控制
|
|
||||||
* 'src' = 原圖
|
|
||||||
* 'thumb' = 縮圖 (200x200)
|
|
||||||
* 'mobile' = 行動版 (768px)
|
|
||||||
*/
|
|
||||||
const IMAGE_SIZE = 'thumb';
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
const cells = document.querySelectorAll('td[data-src]');
|
|
||||||
|
|
||||||
cells.forEach(cell => {
|
|
||||||
const imgSrc = cell.dataset[IMAGE_SIZE];
|
|
||||||
|
|
||||||
|
|
||||||
if (imgSrc && imgSrc !== '{{img_src}}' && imgSrc !== '{{img_thumb}}' && imgSrc !== '{{img_mobile}}') {
|
|
||||||
|
|
||||||
const oldImg = cell.querySelector('img');
|
|
||||||
if (oldImg) {
|
|
||||||
oldImg.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const img = document.createElement('img');
|
|
||||||
img.className = 'image-preview';
|
|
||||||
img.alt = '圖片';
|
|
||||||
img.src = imgSrc;
|
|
||||||
cell.appendChild(img);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
cell.removeAttribute('data-src');
|
|
||||||
cell.removeAttribute('data-thumb');
|
|
||||||
cell.removeAttribute('data-mobile'); }
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue