Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
205ba6e116 | ||
|
|
e88bb1db6b | ||
|
|
92dd5c1a9d | ||
|
|
45ea95a312 | ||
|
|
d1200f1670 |
@@ -80,16 +80,6 @@ function showGalleryImage(){
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function modalZoomToggle(event){
|
||||
modalImage = gradioApp().getElementById("modalImage");
|
||||
if( !modalImage.classList.contains('modalImageFullscreen') ){
|
||||
modalImage.classList.add('modalImageFullscreen');
|
||||
}else{
|
||||
modalImage.classList.remove('modalImageFullscreen');
|
||||
}
|
||||
event.stopPropagation()
|
||||
}
|
||||
|
||||
function galleryImageHandler(e){
|
||||
if(e && e.parentElement.tagName == 'BUTTON'){
|
||||
e.onclick = showGalleryImage;
|
||||
@@ -97,44 +87,26 @@ function galleryImageHandler(e){
|
||||
}
|
||||
|
||||
onUiUpdate(function(){
|
||||
fullImg_preview = gradioApp().querySelectorAll('img.w-full')
|
||||
if(fullImg_preview != null){
|
||||
fullImg_preview.forEach(galleryImageHandler);
|
||||
}
|
||||
|
||||
if(Object.keys(opts).length == 0) return;
|
||||
|
||||
if(!window.lightbox_settings_applied){
|
||||
window.lightbox_settings_applied = true;
|
||||
if(opts.js_modal_lightbox_initialy_zoomed){
|
||||
var imageModal = gradioApp().getElementById('modalImage');
|
||||
if(imageModal){
|
||||
imageModal.className = 'modalImageFullscreen';
|
||||
}
|
||||
}
|
||||
}
|
||||
fullImg_preview = gradioApp().querySelectorAll('img.w-full')
|
||||
if(fullImg_preview != null){
|
||||
fullImg_preview.forEach(galleryImageHandler);
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const modalFragment = document.createDocumentFragment();
|
||||
const modal = document.createElement('div')
|
||||
modal.onclick = closeModal;
|
||||
modal.id = "lightboxModal";
|
||||
modal.tabIndex=0
|
||||
modal.addEventListener('keydown', modalKeyHandler, true)
|
||||
|
||||
|
||||
const modalClose = document.createElement('span')
|
||||
modalClose.className = 'modalClose cursor';
|
||||
modalClose.innerHTML = '×'
|
||||
modalClose.onclick = closeModal;
|
||||
modal.id = "lightboxModal";
|
||||
modal.tabIndex=0
|
||||
modal.addEventListener('keydown', modalKeyHandler, true)
|
||||
modal.appendChild(modalClose)
|
||||
|
||||
const modalZoom = document.createElement('span')
|
||||
modalZoom.className = 'modalZoom cursor';
|
||||
modalZoom.innerHTML = '⤡'
|
||||
modalZoom.addEventListener('click', modalZoomToggle, true)
|
||||
modal.appendChild(modalZoom)
|
||||
|
||||
const modalImage = document.createElement('img')
|
||||
modalImage.id = 'modalImage';
|
||||
modalImage.onclick = closeModal;
|
||||
|
||||
@@ -236,7 +236,7 @@ input[type="range"]{
|
||||
#lightboxModal{
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1001;
|
||||
z-index: 900;
|
||||
padding-top: 100px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
@@ -246,26 +246,17 @@ input[type="range"]{
|
||||
background-color: rgba(20, 20, 20, 0.95);
|
||||
}
|
||||
|
||||
.modalClose,
|
||||
.modalZoom {
|
||||
.modalClose {
|
||||
color: white;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 25px;
|
||||
font-size: 35px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.modalZoom {
|
||||
left: 10px;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
.modalClose:hover,
|
||||
.modalClose:focus,
|
||||
.modalZoom:hover,
|
||||
.modalZoom:focus {
|
||||
.modalClose:focus {
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
@@ -279,11 +270,6 @@ input[type="range"]{
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.modalImageFullscreen {
|
||||
max-width: max-content;
|
||||
height: 90%;
|
||||
}
|
||||
|
||||
.modalPrev,
|
||||
.modalNext {
|
||||
cursor: pointer;
|
||||
|
||||
Reference in New Issue
Block a user