adding tabs
This commit is contained in:
parent
f259f8a122
commit
a96f31d0d2
4 changed files with 136 additions and 53 deletions
|
|
@ -1,62 +1,78 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta
|
|
||||||
name="viewport"
|
|
||||||
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover"
|
|
||||||
/>
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
||||||
<title>com.elgato.template Property Inspector</title>
|
|
||||||
<link rel="stylesheet" href="../../../libs/css/sdpi.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="sdpi-wrapper">
|
|
||||||
<form id="property-inspector">
|
|
||||||
<div class="sdpi-item">
|
|
||||||
<div data-localize class="sdpi-item-label" title="My name">Name</div>
|
|
||||||
<input data-localize class="sdpi-item-value" name="name" type="text" value="" placeholder="Click Me"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div type="textarea" class="sdpi-item">
|
<head>
|
||||||
<div class="sdpi-item-label up20" data-localize title="My message">Message</div>
|
<meta charset="utf-8" />
|
||||||
<div class="sdpi-item-value textarea">
|
<meta
|
||||||
<textarea
|
name="viewport"
|
||||||
name="message"
|
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover" />
|
||||||
type="textarea"
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
maxlength="50"
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
class="three-lines"
|
<title>com.elgato.template Property Inspector</title>
|
||||||
></textarea>
|
<link rel="stylesheet" href="../../../libs/css/sdpi.css" />
|
||||||
</div>
|
</head>
|
||||||
</div>
|
|
||||||
</form>
|
<body>
|
||||||
<div class="sdpi-item">
|
<div class="sdpi-wrapper">
|
||||||
<div class="sdpi-item-label" data-localize title="My button">Button</div>
|
<div type="tabs" class="sdpi-item">
|
||||||
<button
|
<div class="sdpi-item-label empty"></div>
|
||||||
|
<div class="tabs">
|
||||||
|
<div class="tab selected" data-target="#tab1" title="Show some inputs">Inputs</div>
|
||||||
|
<div class="tab" data-target="#tab2" title="Here's some text-areas">Text</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="tab-separator">
|
||||||
|
<form id="property-inspector">
|
||||||
|
<div id="tab1" class="tab-container">
|
||||||
|
<div class="sdpi-item">
|
||||||
|
<div data-localize class="sdpi-item-label" title="My name">Name</div>
|
||||||
|
<input data-localize class="sdpi-item-value" name="name" type="text" value="" placeholder="Click Me" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div type="textarea" class="sdpi-item">
|
||||||
|
<div class="sdpi-item-label" data-localize title="My message">Message</div>
|
||||||
|
<div class="sdpi-item-value textarea">
|
||||||
|
<textarea
|
||||||
|
name="message"
|
||||||
|
type="textarea"
|
||||||
|
maxlength="50"
|
||||||
|
class="three-lines"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="tab2" class="tab-container">
|
||||||
|
<div class="sdpi-item">
|
||||||
|
<div data-localize class="sdpi-item-label" title="More">More</div>
|
||||||
|
<input data-localize class="sdpi-item-value" name="more" type="text" value="" placeholder="More info" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="sdpi-item">
|
||||||
|
<div class="sdpi-item-label" data-localize title="My button">Button</div>
|
||||||
|
<button
|
||||||
class="sdpi-item-value"
|
class="sdpi-item-value"
|
||||||
value="Click Me"
|
value="Click Me"
|
||||||
data-localize
|
data-localize
|
||||||
id="open-external"
|
id="open-external">
|
||||||
>
|
Click Me
|
||||||
Click Me
|
</button>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sdpi-info-label hidden" style="top: -1000" value=""></div>
|
<div class="sdpi-info-label hidden" style="top: -1000" value=""></div>
|
||||||
|
|
||||||
<!-- Stream Deck Libs -->
|
<!-- Stream Deck Libs -->
|
||||||
<script src="../../../libs/js/constants.js"></script>
|
<script src="../../../libs/js/constants.js"></script>
|
||||||
<script src="../../../libs/js/prototypes.js"></script>
|
<script src="../../../libs/js/prototypes.js"></script>
|
||||||
<script src="../../../libs/js/timers.js"></script>
|
<script src="../../../libs/js/timers.js"></script>
|
||||||
<script src="../../../libs/js/utils.js"></script>
|
<script src="../../../libs/js/utils.js"></script>
|
||||||
<script src="../../../libs/js/events.js"></script>
|
<script src="../../../libs/js/events.js"></script>
|
||||||
<script src="../../../libs/js/api.js"></script>
|
<script src="../../../libs/js/api.js"></script>
|
||||||
<script src="../../../libs/js/property-inspector.js"></script>
|
<script src="../../../libs/js/property-inspector.js"></script>
|
||||||
<script src="../../../libs/js/dynamic-styles.js"></script>
|
<script src="../../../libs/js/dynamic-styles.js"></script>
|
||||||
|
|
||||||
|
<!-- Property Inspector Source -->
|
||||||
|
<script src="inspector.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
<!-- Property Inspector Source -->
|
|
||||||
<script src="inspector.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ $PI.onConnected((jsn) => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$PI.onDidReceiveGlobalSettings(({payload}) => {
|
||||||
|
console.log('onDidReceiveGlobalSettings', payload);
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide window level functions to use in the external window
|
* Provide window level functions to use in the external window
|
||||||
* (this can be removed if the external window is not used)
|
* (this can be removed if the external window is not used)
|
||||||
|
|
@ -29,3 +33,64 @@ window.sendToInspector = (data) => {
|
||||||
document.querySelector('#open-external').addEventListener('click', () => {
|
document.querySelector('#open-external').addEventListener('click', () => {
|
||||||
window.open('../../../external.html');
|
window.open('../../../external.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TABS
|
||||||
|
* ----
|
||||||
|
*
|
||||||
|
* This will make the tabs interactive:
|
||||||
|
* - clicking on a tab will make it active
|
||||||
|
* - clicking on a tab will show the corresponding content
|
||||||
|
* - clicking on a tab will hide the content of all other tabs
|
||||||
|
* - a tab must have the class "tab"
|
||||||
|
* - a tab must have a data-target attribute that points to the id of the content
|
||||||
|
* - the content must have the class "tab-content"
|
||||||
|
* - the content must have an id that matches the data-target attribute of the tab
|
||||||
|
* - the content must have a data-tab attribute that matches the data-target attribute of the tab
|
||||||
|
* <div class="tab selected" data-target="#tab1" title="Show some inputs">Inputs</div>
|
||||||
|
* <div class="tab" data-target="#tab2" title="Here's some text-areas">Text</div>
|
||||||
|
* a complete tab-example can be found in the index.html
|
||||||
|
<div type="tabs" class="sdpi-item">
|
||||||
|
<div class="sdpi-item-label empty"></div>
|
||||||
|
<div class="tabs">
|
||||||
|
<div class="tab selected" data-target="#tab1" title="Show some inputs">Inputs</div>
|
||||||
|
<div class="tab" data-target="#tab2" title="Here's some text-areas">Text</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="tab-separator" />
|
||||||
|
* You can use the code below to activate the tabs (`activateTabs` and `clickTab` are required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
function activateTabs(activeTab) {
|
||||||
|
const allTabs = Array.from(document.querySelectorAll('.tab'));
|
||||||
|
let activeTabEl = null;
|
||||||
|
allTabs.forEach((el, i) => {
|
||||||
|
el.onclick = () => clickTab(el);
|
||||||
|
if(el.dataset?.target === activeTab) {
|
||||||
|
activeTabEl = el;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(activeTabEl) {
|
||||||
|
clickTab(activeTabEl);
|
||||||
|
} else if(allTabs.length) {
|
||||||
|
clickTab(allTabs[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickTab(clickedTab) {
|
||||||
|
const allTabs = Array.from(document.querySelectorAll('.tab'));
|
||||||
|
allTabs.forEach((el, i) => el.classList.remove('selected'));
|
||||||
|
clickedTab.classList.add('selected');
|
||||||
|
activeTab = clickedTab.dataset?.target;
|
||||||
|
allTabs.forEach((el, i) => {
|
||||||
|
if(el.dataset.target) {
|
||||||
|
const t = document.querySelector(el.dataset.target);
|
||||||
|
if(t) {
|
||||||
|
t.style.display = el == clickedTab ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
activateTabs();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"Message": "Nachricht",
|
"Message": "Nachricht",
|
||||||
"Click Me": "Klicke mich",
|
"Click Me": "Klicke mich",
|
||||||
"Button": "Taste",
|
"Button": "Taste",
|
||||||
|
"More": "Mehr",
|
||||||
"My name": "Mein Name",
|
"My name": "Mein Name",
|
||||||
"My title": "Mein Titel",
|
"My title": "Mein Titel",
|
||||||
"My message": "Meine Nachricht",
|
"My message": "Meine Nachricht",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"Message": "Message",
|
"Message": "Message",
|
||||||
"Click Me": "Click Me",
|
"Click Me": "Click Me",
|
||||||
"Button": "Button",
|
"Button": "Button",
|
||||||
|
"More": "More",
|
||||||
"My name": "My name",
|
"My name": "My name",
|
||||||
"My title": "My title",
|
"My title": "My title",
|
||||||
"My message": "My message",
|
"My message": "My message",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue