🎨 New theme: NightBat

This commit is contained in:
Alicia Sykes
2024-08-05 12:20:36 +01:00
parent 090fc87859
commit 531bb954d6
3 changed files with 108 additions and 0 deletions

View File

@@ -34,6 +34,8 @@
:statusSuccess="statusResponse ? statusResponse.successStatus : undefined"
:statusText="statusResponse ? statusResponse.message : undefined"
/>
<!-- URL of the item (shown on hover, only on some themes) -->
<p class="item-url">{{ item.url | shortUrl }}</p>
<!-- Edit icon (displayed only when in edit mode) -->
<EditModeIcon v-if="isEditMode" class="edit-mode-item" @click="openItemSettings()" />
</a>
@@ -122,6 +124,26 @@ export default {
}
},
},
filters: {
shortUrl(value) {
if (!value || typeof value !== 'string') {
return '';
}
try {
// Use URL constructor to parse the input
const url = new URL(value);
return url.hostname;
} catch (e) {
// If the input is not a valid URL, try to handle it as an IP address
const ipPattern = /^(\d{1,3}\.){3}\d{1,3}/;
const match = value.match(ipPattern);
if (match) {
return match[0];
}
return '';
}
},
},
data() {
return {
editMenuOpen: false,
@@ -209,6 +231,9 @@ export default {
&.span-7 { min-width: 14%; }
&.span-8 { min-width: 12.5%; }
}
.item-url {
display: none;
}
}
.item {