devon22_obsidian-mediaviewer/styles.css
2026-07-19 12:45:48 +08:00

1030 lines
21 KiB
CSS

.modal.mv-media-viewer-modal {
padding: 0;
background: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
max-width: 100vw;
max-height: 100vh;
position: fixed;
top: 0;
left: 0;
margin: 0;
border-radius: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: auto;
}
.mv-media-viewer-content {
width: 100%;
height: 100%;
}
.mv-media-viewer-modal .is-hidden {
display: none;
}
.mv-gallery-content {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--mv-gallery-thumbnail-width, 150px), 1fr));
gap: 15px;
padding: 20px;
justify-content: center;
width: 100%;
margin: auto;
border-radius: 8px;
}
/* 自定義滾動條樣式 */
.mv-gallery-content::-webkit-scrollbar {
width: 8px;
}
.mv-gallery-content::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
}
.mv-gallery-content::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 4px;
}
.mv-gallery-content::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
.mv-media-viewer-modal button.mv-gallery-close-button {
position: fixed;
top: 15px;
right: 15px;
width: 40px;
height: 40px;
background: rgba(0, 0, 0, 0.5);
border: none;
border-radius: 50%;
color: white;
font-size: 24px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 1001;
transition: background-color 0.3s;
}
.mv-media-viewer-modal button.mv-gallery-close-button.is-hidden {
display: none;
}
.modal.mv-media-viewer-modal .modal-close-button {
display: none;
}
.mv-media-viewer-modal button.mv-gallery-close-button:hover {
background: rgba(255, 0, 0, 0.7);
}
.mv-media-thumbnail-container {
aspect-ratio: 1;
overflow: hidden;
border-radius: 8px;
cursor: pointer;
transition: transform 0.2s;
background: var(--background-primary);
position: relative;
margin: 0;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container,
.mvgb-media-gallery-grid .mvgb-note-title {
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
.mv-media-thumbnail-container:hover {
transform: scale(1.05);
}
.mv-media-thumbnail-container img,
.mv-media-thumbnail-container video {
width: 100%;
height: 100%;
object-fit: cover;
}
.mv-media-thumbnail {
position: relative;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.mv-video-indicator {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 32px;
height: 32px;
background: rgba(0, 0, 0, 0.6);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
z-index: 1;
backdrop-filter: blur(2px);
}
.mv-video-indicator svg {
width: 20px;
height: 20px;
fill: currentColor;
}
.mv-audio-indicator {
position: absolute;
top: 8px;
left: 8px;
width: 32px;
height: 32px;
background: rgba(0, 100, 200, 0.6);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
z-index: 1;
backdrop-filter: blur(2px);
}
.mv-audio-indicator svg {
width: 20px;
height: 20px;
fill: currentColor;
}
.mv-audio-filename {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 15px;
color: var(--text-normal);
font-size: 14px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
background: var(--background-primary);
}
.mv-full-media-view {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.75);
z-index: 1000;
overflow-x: hidden;
overflow-y: hidden;
display: block;
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
.mv-full-media-view.is-thumbnail-open {
background: rgba(0, 0, 0, 0.75);
}
.mv-full-media-view.is-scroll-x {
overflow-x: scroll;
overflow-y: hidden;
}
.mv-full-media-view.is-scroll-y {
overflow-x: hidden;
overflow-y: scroll;
}
.mv-full-media-view.is-scroll-both {
overflow-x: scroll;
overflow-y: scroll;
}
.mv-media-nav-area {
position: absolute;
top: 20%;
height: 70%;
width: 7%;
z-index: 1001;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.1;
transition: opacity 0.3s;
}
.is-mobile:not(.is-tablet) .mv-media-nav-area {
width: 20%;
}
.is-tablet .mv-media-nav-area {
width: 15%;
}
.mv-media-nav-area:hover {
opacity: 0.3;
background: rgba(255, 255, 255, 0.0);
}
.mv-prev-area {
left: 0;
}
.mv-next-area {
right: 0;
}
.mv-full-image {
width: auto;
height: auto;
max-width: var(--mv-full-image-max-width, 100vw);
max-height: var(--mv-full-image-max-height, 100vh);
object-fit: contain;
position: absolute;
top: 50%;
left: 50%;
margin: 0;
transform: translate(-50%, -50%);
cursor: zoom-in;
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
.mv-full-image.is-original-size {
cursor: default;
}
.mv-full-image.is-fill-width {
width: 100%;
}
.mv-full-image.is-fill-height {
height: 100%;
}
.mv-full-image.is-zoom-width,
.mv-full-image.is-zoom-height,
.mv-full-image.is-pinch-zoomed {
display: block;
max-width: none;
max-height: none;
position: relative;
top: 0;
left: 0;
margin: auto;
transform: none;
cursor: zoom-out;
}
.mv-full-image.is-zoom-width {
width: 100vw;
height: auto;
}
.mv-full-image.is-zoom-height {
width: auto;
height: 100vh;
}
.mv-full-image.is-pinch-zoomed {
width: var(--mv-full-image-width);
height: auto;
margin: var(--mv-full-image-margin-top, 0) auto 0 auto;
}
.mv-full-video {
max-width: 100vw;
max-height: 100vh;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 0;
z-index: 1002;
}
.mv-full-iframe {
width: 90vw;
height: 90vh;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 0;
z-index: 1002;
background: black;
border: none;
}
.mv-media-viewer-modal button.mv-media-close-button {
position: fixed;
top: 15px;
right: 15px;
width: 40px;
height: 40px;
background: rgba(0, 0, 0, 0.5);
border: none;
border-radius: 50%;
color: white;
font-size: 24px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 1003;
transition: background-color 0.3s;
}
.mv-media-viewer-modal button.mv-media-close-button:hover {
background: rgba(255, 0, 0, 0.7);
}
.is-mobile:not(.is-tablet) .mv-media-close-button {
top: calc(var(--safe-area-inset-top) + 15px);
}
.mv-image-info-panel {
position: fixed;
top: 15px;
left: 15px;
background: rgba(0, 0, 0, 0.7);
padding: 7px 14px;
border-radius: 5px;
color: white;
font-size: 14px;
z-index: 1003;
opacity: 1;
transition: opacity 0.3s ease;
}
.is-mobile:not(.is-tablet) .mv-image-info-panel {
top: calc(var(--safe-area-inset-top) + 15px);
}
/* 隱藏行動裝置上 Obsidian 預設的 modal 關閉按鈕 */
.is-mobile .modal.mv-media-viewer-modal button.modal-close-button {
display: none;
}
.mv-info-item {
display: inline-block;
margin-right: 10px;
}
.mv-info-item:last-child {
margin-right: 0;
}
.mv-info-filename {
cursor: text;
}
.mv-info-dimensions {
margin-left: 0px;
}
.mv-image-info-panel.fade {
opacity: 0;
}
.mv-image-info-panel:hover {
opacity: 1;
}
.mv-image-info-panel a {
color: var(text-warning);
padding: 0 4px;
}
.mv-image-info-panel a:hover {
color: white;
background: rgba(255, 0, 0, 0.5);
border-radius: 2px;
}
/* Gallery Block */
.mvgb-media-container {
border-radius: 8px;
overflow: hidden;
margin: 1em 0;
}
.mvgb-media-gallery-grid {
position: relative;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--mv-gallery-thumbnail-width, 150px), 1fr));
gap: 15px;
padding: 15px;
background: var(--background-secondary);
border-radius: 8px;
}
.mvgb-media-gallery-grid.waterfall,
.mvgb-media-gallery-grid.waterfall.size-small,
.mvgb-media-gallery-grid.waterfall.size-medium,
.mvgb-media-gallery-grid.waterfall.size-large {
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 15px;
padding: 15px;
}
.mvgb-waterfall-column {
display: flex;
flex-direction: column;
flex: 1;
gap: 15px;
min-width: 0;
}
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container {
aspect-ratio: auto;
width: 100%;
}
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container.mvgb-note-thumbnail,
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container.mvgb-audio-thumbnail,
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container.mvgb-add-media-button,
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container.placeholder {
aspect-ratio: 1;
}
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container > img,
.mvgb-media-gallery-grid.waterfall .mv-media-thumbnail-container > video {
width: 100%;
height: auto;
object-fit: cover;
display: block;
}
.mvgb-gallery-controls {
display: flex;
justify-content: center;
align-items: center;
margin-top: 5px;
}
.mvgb-pagination {
display: flex;
align-items: center;
gap: 10px;
margin: 10px 0;
float: right;
}
.mvgb-gallery-control-button {
background-color: var(--interactive-accent);
color: var(--text-on-accent);
border: none;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s ease;
}
.mvgb-gallery-control-button:hover:not(:disabled) {
background-color: var(--interactive-accent-hover);
}
.mvgb-gallery-control-button:disabled {
background-color: var(--background-modifier-border);
cursor: not-allowed;
opacity: 0.7;
}
.mvgb-page-info {
color: var(--text-muted);
margin: 0 5px;
font-size: 0.9em;
}
.mvgb-add-image-button {
background-color: var(--interactive-success);
margin-left: 15px;
}
.mvgb-add-image-button:hover {
background-color: var(--interactive-success-hover);
}
.mvgb-add-media-button {
border: 2px dashed var(--text-faint);
display: flex;
align-items: center;
justify-content: center;
background: var(--background-primary-alt);
transition: all 0.2s ease;
}
.mvgb-add-media-button:hover {
border-color: var(--text-accent);
background: var(--background-modifier-hover);
}
.mvgb-add-media-icon {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
color: var(--text-muted);
}
.mvgb-add-media-button:hover .mvgb-add-media-icon {
color: var(--text-accent);
}
.mvgb-add-media-icon svg {
width: 32px;
height: 32px;
}
.mvgb-add-media-text {
font-size: 14px;
text-align: center;
}
.mvgb-container-link-area {
display: inline-block;
position: relative;
color: var(--text-normal);
background: var(--background-secondary);
padding: 10px 15px 2px 15px;
white-space: nowrap;
border-radius: 8px 8px 0 0;
}
.mvgb-container-link-area a {
color: var(--text-normal);
text-decoration: none;
}
.mvgb-container-link-area a:hover {
color: var(--text-accent);
text-decoration: underline;
}
.mvgb-media-gallery-grid.has-container-title {
border-radius: 0 8px 8px 8px;
}
/* Gallery Block - Small */
.mvgb-media-gallery-grid.size-small {
gap: 15px;
padding: 15px;
}
/* Gallery Block - Medium (Default) */
.mvgb-media-gallery-grid.size-medium {
gap: 15px;
padding: 15px;
}
/* Gallery Block - Large */
.mvgb-media-gallery-grid.size-large {
gap: 15px;
padding: 15px;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container {
aspect-ratio: 1;
overflow: hidden;
border-radius: 8px;
cursor: pointer;
transition: transform 0.2s;
background: var(--background-primary);
position: relative;
margin: 0;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container:hover {
transform: scale(1.05);
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-dragging {
opacity: 0.55;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-before,
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-after {
transform: scale(1.02);
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-before::before,
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-after::before {
content: "";
position: absolute;
top: 8px;
bottom: 8px;
width: 4px;
border-radius: 2px;
background: var(--interactive-accent);
z-index: 12;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-before::before {
left: 4px;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container.mvgb-reorder-after::before {
right: 4px;
}
.mvgb-media-gallery-grid .mv-media-thumbnail-container img,
.mvgb-media-gallery-grid .mv-media-thumbnail-container video {
width: 100%;
height: 100%;
object-fit: cover;
}
.mv-gallery-content.waterfall .mv-media-thumbnail-container img,
.mv-gallery-content.waterfall .mv-media-thumbnail-container video {
object-fit: contain;
}
.mv-gallery-content.waterfall .mv-media-thumbnail-container {
background: transparent;
}
.mv-media-thumbnail-container.is-placeholder-hidden {
visibility: hidden;
}
.mv-media-thumbnail-container .is-pointer-disabled {
pointer-events: none;
}
.mvgb-media-gallery-grid.drag-over {
border: 2px dashed var(--interactive-accent);
background-color: var(--background-modifier-hover);
}
.mvgb-media-link-area {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 8px;
background: rgba(0, 0, 0, 0.7);
color: white;
font-size: 12px;
opacity: 0;
transition: opacity 0.2s ease;
}
.mv-media-thumbnail-container:hover .mvgb-media-link-area {
opacity: 1;
}
.mvgb-media-link-area a {
color: white;
text-decoration: none;
}
.mvgb-media-link-text {
color: white;
}
.mvgb-media-link-area a:hover {
text-decoration: underline;
}
.mvgb-note-thumbnail {
background: var(--background-primary-alt);
border: 1px solid var(--background-modifier-border);
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.mvgb-note-preview {
text-align: center;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.mvgb-note-thumbnail-image {
max-width: 100%;
max-height: calc(100% - 50px);
/* 預留標題空間 */
object-fit: contain;
}
.mvgb-note-icon {
height: calc(100% - 50px);
/* 佔用與圖片相同的預留空間 */
width: 100%;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s;
flex-shrink: 0;
}
.mvgb-note-title {
font-size: 0.85em;
color: var(--text-normal);
overflow: hidden;
align-items: center;
min-height: 1.5em;
text-overflow: ellipsis;
display: -webkit-box;
line-clamp: 2;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
width: 100%;
margin: auto;
padding: 1px 7px;
line-height: 1.4;
max-height: 3em;
}
.mvgb-note-title.mvgb-invalid-link {
color: var(--text-error);
}
.mvgb-note-icon svg {
width: 40px;
height: 40px;
color: var(--text-muted);
}
.mvgb-note-icon.external-link svg {
color: var(--text-accent);
}
/* 移除連結上的圖示 */
.mvgb-note-icon.mvgb-note-icon.external-link {
background-image: none;
padding-inline-end: 0;
}
.mvgb-note-thumbnail:hover .mvgb-note-title {
color: var(--text-accent);
}
.mvgb-note-thumbnail:hover {
background: var(--background-modifier-hover);
}
/* 外部連結的特殊樣式 */
.mvgb-note-thumbnail.external-link {
background: var(--background-primary-alt);
}
.mvgb-note-thumbnail.external-link:hover {
background: var(--background-modifier-hover);
}
.mvgb-pagination button {
padding: 4px 8px;
border: 1px solid var(--interactive-accent);
border-radius: 4px;
background-color: var(--background-primary);
color: var(--text-normal);
cursor: pointer;
transition: all 0.2s ease;
}
.mvgb-pagination button:hover {
background-color: var(--interactive-accent);
color: var(--text-on-accent);
}
.mvgb-pagination button:disabled {
border-color: var(--text-muted);
color: var(--text-muted);
cursor: not-allowed;
}
.mvgb-pagination button:disabled:hover {
background-color: var(--background-primary);
color: var(--text-muted);
}
.mvgb-upload-modal {
padding: 20px;
}
.mvgb-upload-dropzone {
border: 3px dashed var(--text-muted);
border-radius: 10px;
padding: 40px;
text-align: center;
background: var(--background-primary-alt);
margin-bottom: 20px;
transition: all 0.2s ease;
}
.mvgb-upload-dropzone.drag-over {
border-color: var(--text-accent);
background: var(--background-modifier-hover);
}
.mvgb-upload-instructions {
color: var(--text-muted);
margin-bottom: 10px;
}
.mvgb-upload-icon svg {
width: 48px;
height: 48px;
color: var(--text-muted);
margin-bottom: 10px;
}
.mvgb-paste-button {
display: block;
width: 100%;
padding: 4px;
margin-top: 15px;
background-color: var(--interactive-accent);
color: var(--text-on-accent);
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s ease;
}
.mvgb-paste-button.mvgb-choose-note-button {
margin-top: 10px;
}
.mvgb-paste-button:hover {
background-color: var(--interactive-accent-hover);
}
/* 上傳檔案的位置選擇 */
.mvgb-insert-position-container {
margin-top: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.mvgb-setting-item {
display: flex;
align-items: center;
padding: 8px 0;
}
.mvgb-setting-label {
flex: 0 0 100px;
font-weight: 500;
color: var(--text-normal);
}
.mvgb-setting-control {
flex: 1;
}
.mvgb-insert-position-dropdown {
width: 50%;
padding: 4px 8px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
background-color: var(--background-primary);
color: var(--text-normal);
font-size: 14px;
transition: border-color 0.2s ease;
}
.mvgb-insert-position-dropdown:focus {
border-color: var(--interactive-accent);
outline: none;
}
.mvgb-insert-position-dropdown option {
background-color: var(--background-primary);
color: var(--text-normal);
}
.mvgb-media-gallery-grid.drag-over.drag-left,
.mvgb-upload-dropzone.drag-over.drag-left {
box-shadow: inset 6px 0 0 0 var(--interactive-accent);
}
.mvgb-media-gallery-grid.drag-over.drag-right,
.mvgb-upload-dropzone.drag-over.drag-right {
box-shadow: inset -6px 0 0 0 var(--interactive-accent);
}
/* 懸停控制項 */
.mvgb-hover-controls {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 10;
opacity: 0;
transition: opacity 0.2s ease;
}
.mv-media-thumbnail-container:hover .mvgb-hover-controls,
.mvgb-note-thumbnail:hover .mvgb-hover-controls {
opacity: 1;
}
.mvgb-hover-btn {
position: absolute;
top: 0;
width: 28px;
height: 28px;
background: transparent;
color: rgba(255, 255, 255, 0.6);
border: none;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
pointer-events: auto;
transition: all 0.2s ease;
padding: 0;
}
.mvgb-hover-btn:hover {
background: rgba(0, 0, 0, 0.5);
color: white;
}
/* 朝向圖片中心的側邊使用圓角以提升美感 */
.mvgb-btn-left {
left: 0;
border-radius: 8px 0 8px 0;
/* 左上角與容器一致,右下角為圓角 */
}
.mvgb-btn-right {
right: 0;
border-radius: 0 8px 0 8px;
/* 右上角與容器一致,左下角為圓角 */
}
.mvgb-btn-drag {
top: 8px;
left: 8px;
width: 32px;
height: 32px;
border-radius: 50%;
background: rgba(0, 0, 0, 0.55);
color: white;
cursor: grab;
opacity: 0.8;
transition: opacity 0.2s ease, background 0.2s ease;
}
.mvgb-btn-drag:hover {
color: white;
background: rgba(0, 0, 0, 0.72);
border-color: white;
}
.mvgb-btn-drag:active {
cursor: grabbing;
}
.mvgb-hover-btn svg {
width: 20px;
height: 20px;
}
/* Alt & Rename Modals */
.mv-settings-input-flex .setting-item-control {
flex-grow: 1;
}
.mv-settings-input-flex .setting-item-control input[type="text"] {
width: 100% !important;
min-width: 180px;
max-width: 350px;
}