Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
822a622d97 | ||
|
|
1e7aba5297 | ||
|
|
2634b37755 | ||
|
|
aaf50a403d | ||
|
|
5f06da45cf | ||
|
|
33bc3673ae |
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -6,11 +6,49 @@ nav_order: 99
|
||||
permalink: /customizing/custom-css
|
||||
---
|
||||
|
||||
## Custom-CSS
|
||||
## Custom-CSS
|
||||
|
||||
The custom.css file allows you to customize the appearance of Mainsail
|
||||
without the need of rebuilding it. All you need to do is to place a file
|
||||
named "custom.css" into the configuration directory ".theme" and define
|
||||
your css rules in there.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
### How to CSS
|
||||
|
||||
You need to be familiar with the CSS (**C**ascading **S**tyle **S**heets) syntax.
|
||||
There are many resources to learn CSS online, for example:
|
||||
- https://www.w3schools.com/css/default.asp
|
||||
|
||||
#### find the Element selector (example based on Chrome Browser)
|
||||
|
||||
Use your browser's built-in developer tools to find the right selector of the element you want to add your own flair to.
|
||||
|
||||
Open the developer tools:
|
||||
|
||||
right click anywhere on the page and select "inspect" (or F12 on the keyboard)
|
||||
|
||||

|
||||
|
||||
1. Activate the "inspector"
|
||||
2. Select the desired element
|
||||
3. Find the selector
|
||||
4. Use the style editor and fiddle arround
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
When you have achieved your desired appearance copy the full "section" including selector and curly braces
|
||||
|
||||

|
||||
|
||||
Then copy it to the "custom.css" file (you can keep everything or only what you have added)
|
||||
|
||||

|
||||
|
||||
NOTE: After saving, your browser may need a uncached reload to show the change (https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache)
|
||||
@@ -48,8 +48,11 @@ trusted_clients:
|
||||
2a02:810d:9340:33f6::/64
|
||||
|
||||
[update_manager]
|
||||
client_repo: meteyou/mainsail
|
||||
client_path: ~/mainsail
|
||||
|
||||
[update_manager client mainsail]
|
||||
type: web
|
||||
repo: meteyou/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
> 🔥 **trusted_clients - read carefully** 🔥
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"vue-context": "^6.0.0",
|
||||
"vue-github-api": "^0.1.7",
|
||||
"vue-headful": "^2.1.0",
|
||||
"vue-observe-visibility": "^1.0.0",
|
||||
"vue-plotly": "^1.1.0",
|
||||
"vue-prism-editor": "^1.2.2",
|
||||
"vue-resource": "^1.5.1",
|
||||
|
||||
@@ -43,6 +43,16 @@
|
||||
<v-switch v-model="boolNavi" hide-details label="Show in navigation" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="adaptiveFps" hide-details label="(Experimental) Adaptive FPS" class="mt-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="adaptiveFps">
|
||||
<v-col class="py-2">
|
||||
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -64,6 +74,8 @@
|
||||
return this.$store.state.gui.webcam.url;
|
||||
},
|
||||
set(url) {
|
||||
if(this.$store.state.gui.webcam.adaptiveFps)
|
||||
url = url.replace("action=stream", "action=snapshot");
|
||||
return this.$store.dispatch('gui/setSettings', { webcam: { url } });
|
||||
}
|
||||
},
|
||||
@@ -107,6 +119,22 @@
|
||||
return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } });
|
||||
}
|
||||
},
|
||||
adaptiveFps: {
|
||||
get() {
|
||||
return this.$store.state.gui.webcam.adaptiveFps;
|
||||
},
|
||||
set(useAdaptiveFps) {
|
||||
return this.$store.dispatch('gui/setSettings', { webcam: { adaptiveFps: useAdaptiveFps } });
|
||||
}
|
||||
},
|
||||
targetFps: {
|
||||
get() {
|
||||
return this.$store.state.gui.webcam.targetFps;
|
||||
},
|
||||
set(fps) {
|
||||
return this.$store.dispatch('gui/setSettings', { webcam: { targetFps: fps } });
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card v-observe-visibility="visibilityChanged">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-webcam</v-icon>Webcam</span>
|
||||
<span class="subheading"><v-icon left>mdi-webcam</v-icon>{{subHeading}}</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card-text class="px-0 py-0 content">
|
||||
<img :src="url" class="webcamImage" :style="webcamStyle" alt="Webcam"/>
|
||||
<img :src="url" class="webcamImage" :style="webcamStyle" @load="onLoad" alt="Webcam"/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -23,12 +23,27 @@
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
refresh: Math.ceil(Math.random() * Math.pow(10, 12))
|
||||
}
|
||||
refresh: Math.ceil(Math.random() * Math.pow(10, 12)),
|
||||
connection: "",
|
||||
imageData: "",
|
||||
|
||||
request_start_time: performance.now(),
|
||||
start_time: performance.now(),
|
||||
time: 0,
|
||||
request_time: 0,
|
||||
time_smoothing: 0.6,
|
||||
request_time_smoothing: 0.1,
|
||||
isVisible: true,
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
document.addEventListener("focus", () => this.handleRefreshChange(), false);
|
||||
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
|
||||
|
||||
if(this.webcamConfig.adaptiveFps) {
|
||||
this.requestMjpeg();
|
||||
}
|
||||
|
||||
},
|
||||
components: {
|
||||
|
||||
@@ -37,14 +52,28 @@
|
||||
...mapState({
|
||||
'webcamConfig': state => state.gui.webcam
|
||||
}),
|
||||
url() {
|
||||
let basicUrl = this.webcamConfig.url
|
||||
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
||||
|
||||
const params = new URLSearchParams(basicUrl)
|
||||
params.set('bypassCache', ""+this.refresh)
|
||||
return decodeURIComponent(params.toString())
|
||||
subHeading() {
|
||||
return "Webcam" + (this.webcamConfig.adaptiveFps ? " - FPS: " + Math.round(1000 / this.time) : "");
|
||||
},
|
||||
|
||||
url() {
|
||||
if(!this.webcamConfig.adaptiveFps) {
|
||||
let basicUrl = this.webcamConfig.url
|
||||
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
||||
|
||||
const params = new URLSearchParams(basicUrl)
|
||||
params.set('bypassCache', ""+this.refresh)
|
||||
return decodeURIComponent(params.toString())
|
||||
} else {
|
||||
return this.imageData;
|
||||
/*return 'data:image/jpeg;base64,' + btoa(
|
||||
new Uint8Array(this.blobData)
|
||||
.reduce((data, byte) => data.String.fromCharCode(byte), '')
|
||||
)*/
|
||||
}
|
||||
},
|
||||
|
||||
webcamStyle() {
|
||||
let transforms = '';
|
||||
if (this.webcamConfig.flipX) {
|
||||
@@ -69,6 +98,46 @@
|
||||
if (!document.hidden) {
|
||||
this.refresh = Math.ceil(Math.random() * Math.pow(10, 12))
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
var end_time = performance.now();
|
||||
var current_time = end_time - this.start_time;
|
||||
this.time = (this.time * this.time_smoothing) + (current_time * (1.0 - this.time_smoothing));
|
||||
this.start_time = end_time;
|
||||
|
||||
var target_time = 1000/this.webcamConfig.targetFps
|
||||
|
||||
var current_request_time = performance.now() - this.request_start_time;
|
||||
this.request_time = (this.request_time * this.request_time_smoothing) + (current_request_time * (1.0 - this.request_time_smoothing));
|
||||
var timeout = Math.max(0, target_time - this.request_time);
|
||||
|
||||
this.$nextTick(() => {
|
||||
console.log(end_time + " " + timeout);
|
||||
setTimeout(this.requestMjpeg, timeout);
|
||||
})
|
||||
},
|
||||
|
||||
requestMjpeg() {
|
||||
if(!this.isVisible)
|
||||
return;
|
||||
this.request_start_time = performance.now();
|
||||
let basicUrl = this.webcamConfig.url
|
||||
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
||||
|
||||
const params = new URLSearchParams(basicUrl)
|
||||
params.set('bypassCache', ""+ this.refresh + (Math.random() * 1000))
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.imageData = decodeURIComponent(params.toString())
|
||||
})
|
||||
},
|
||||
|
||||
visibilityChanged(isVisible, entry) {
|
||||
this.isVisible = isVisible;
|
||||
console.log(entry);
|
||||
if(isVisible)
|
||||
this.requestMjpeg();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ import './components'
|
||||
import store from './store'
|
||||
import router from './plugins/router'
|
||||
import vueHeadful from 'vue-headful';
|
||||
import VueObserveVisibility from 'vue-observe-visibility';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.use(VueResource);
|
||||
Vue.use(VueObserveVisibility);
|
||||
Vue.http.headers.common['Content-Type'] = 'application/json';
|
||||
Vue.http.headers.common['Access-Control-Allow-Origin'] = '*';
|
||||
Vue.http.headers.common['Accept'] = 'application/json, text/plain, */*';
|
||||
|
||||
@@ -45,7 +45,21 @@ export default {
|
||||
|
||||
if (payload.files && payload.files.length) {
|
||||
for (let file of payload.files) {
|
||||
if (!parent.find(element => (element.isDirectory === false && element.filename === file.filename))) {
|
||||
const existingFile = parent.find(element => (element.isDirectory === false && element.filename === file.filename))
|
||||
|
||||
if (
|
||||
existingFile && (
|
||||
existingFile.size !== file.size ||
|
||||
existingFile.modified.getTime() !== new Date(file.modified*1000).getTime()
|
||||
)
|
||||
) {
|
||||
Vue.set(existingFile, 'modified', new Date(file.modified*1000))
|
||||
Vue.set(existingFile, 'size', file.size)
|
||||
|
||||
if (existingFile.metadataPulled) {
|
||||
Vue.prototype.$socket.sendObj("server.files.metadata", { filename: payload.requestParams.path+'/'+file.filename }, "files/getMetadata")
|
||||
}
|
||||
} else if (!existingFile) {
|
||||
parent.push({
|
||||
isDirectory: false,
|
||||
filename: file.filename,
|
||||
|
||||
Reference in new issue
Block a user