Initial Commit :)
This commit is contained in:
parent
a58d29e04e
commit
ea553b1652
25 changed files with 321 additions and 392 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,10 +1,11 @@
|
|||
.DS_Store
|
||||
.idea/**
|
||||
/src/DistributionTool
|
||||
com.elgato.template.streamDeckPlugin
|
||||
net.forgeserv.api.streamDeckPlugin
|
||||
.vscode/**
|
||||
package.json
|
||||
package-lock.json
|
||||
.history
|
||||
__exclude
|
||||
.editorconfig
|
||||
DistributionTool.exe
|
||||
|
|
|
|||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[submodule "src/my.domain.plugin-name/libs"]
|
||||
path = src/my.domain.plugin-name/libs
|
||||
url = https://github.com/elgatosf/streamdeck-javascript-sdk
|
||||
[submodule "src/net.forgeserv.api/libs"]
|
||||
path = src/net.forgeserv.api/libs
|
||||
url = https://github.com/elgatosf/streamdeck-javascript-sdk
|
||||
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="144" height="144" viewBox="0 0 144 144"><defs><linearGradient id="linearGradient-1" x1="0%" x2="99.133%" y1="0%" y2="99.133%"><stop offset="0%" stop-color="#142DB3"/><stop offset="100%" stop-color="#1C40FF"/></linearGradient></defs><g id="action" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><rect id="Rectangle" width="144" height="144" x="0" y="0" fill="url(#linearGradient-1)"/><g id="actionImage" fill="#EFEFEF" fill-rule="nonzero"><path id="2" d="M59.652,104.4 C56.052,104.4 54.504,105.444 54.504,109.368 L54.504,111.276 L57.816,111.276 L57.816,109.8 C57.816,107.928 58.284,107.028 59.436,107.028 C60.876,107.028 61.416,107.82 61.416,110.232 C61.416,113.976 60.516,114.948 57.816,120.24 C56.52,122.76 55.224,124.992 54,127.152 L54,130.644 L65.088,130.644 L65.088,127.548 L57.636,127.548 L61.596,120.168 C64.008,115.668 64.8,114.876 64.8,110.34 C64.8,106.38 63.828,104.4 59.652,104.4 Z M67.572,126.36 L67.572,130.644 L71.712,130.644 L71.712,126.36 L67.572,126.36 Z M85.032,110.196 C85.032,105.84 83.412,104.472 79.776,104.472 C76.032,104.472 74.376,105.84 74.376,110.16 L74.376,124.992 C74.376,128.52 75.204,130.896 79.524,130.896 C84.096,130.896 85.032,128.7 85.032,125.208 L85.032,110.196 Z M79.74,107.208 C81.072,107.208 81.648,107.928 81.648,109.8 L81.648,125.388 C81.648,127.152 81.036,128.196 79.632,128.196 C78.228,128.196 77.76,127.116 77.76,125.424 L77.76,110.196 C77.76,107.928 78.552,107.208 79.74,107.208 Z"/><path id="Template" d="M28.026,58.356 C33.102,58.356 35.1,61.056 35.1,65.592 L35.1,73.854 L25.434,73.854 L25.434,79.74 C25.434,81.792 26.136,82.764 27.918,82.764 C29.862,82.764 30.348,81.36 30.348,78.984 L30.348,76.878 L35.1,76.878 L35.1,80.658 C35.1,84.222 32.022,86.166 27.702,86.166 C22.626,86.166 20.304,84.168 20.304,78.984 L20.304,65.592 C20.304,61.218 22.464,58.356 28.026,58.356 Z M21.96,46.8 L21.96,51.336 L15.48,51.336 L15.48,85.788 L10.08,85.788 L10.08,51.336 L3.6,51.336 L3.6,46.8 L21.96,46.8 Z M27.81,61.65 C26.406,61.65 25.434,62.352 25.434,64.62 L25.434,70.344 L30.294,70.344 L30.294,65.376 C30.294,62.298 29.43,61.65 27.81,61.65 Z M53.028,61.056 C51.732,59.058 50.706,58.356 48.762,58.356 C46.656,58.356 45.306,59.22 43.74,61.218 L43.74,58.788 L38.934,58.788 L38.934,85.788 L44.01,85.788 L44.01,64.944 C44.01,63.054 44.712,62.028 46.224,62.028 C47.682,62.028 48.276,63.27 48.276,65.322 L48.276,85.788 L53.352,85.788 L53.352,64.512 C53.352,63 54.054,62.028 55.404,62.028 C56.754,62.028 57.402,63.054 57.402,64.89 L57.402,85.788 L62.478,85.788 L62.478,63.918 C62.478,60.624 60.534,58.356 57.456,58.356 C55.566,58.356 54.378,59.166 53.028,61.056 Z M71.388,58.788 L66.528,58.788 L66.528,95.724 L71.604,95.724 L71.604,84.276 C72.9,85.464 74.412,86.112 75.87,86.112 C76.842,86.112 81,85.842 81,79.308 L81,65.322 C81,61.002 79.488,58.464 76.248,58.464 C74.196,58.464 72.792,59.274 71.388,61.704 L71.388,58.788 Z M73.926,62.298 C75.33,62.298 75.87,63.324 75.87,66.078 L75.87,78.984 C75.87,81.306 75.384,82.602 73.818,82.602 C72.252,82.602 71.604,81.252 71.604,79.416 L71.604,65.268 C71.604,63.702 72.414,62.298 73.926,62.298 Z M84.726,46.8 L84.726,85.788 L89.802,85.788 L89.802,46.8 L84.726,46.8 Z M100.764,58.356 C95.742,58.356 93.528,60.408 93.528,64.242 L93.528,66.672 L98.604,66.672 L98.604,64.242 C98.604,62.73 99.144,61.92 100.764,61.92 C102.276,61.92 102.87,62.676 102.87,64.458 L102.87,68.886 C99.9,68.94 98.28,68.94 96.984,69.318 C95.634,69.696 94.446,70.668 93.798,72.288 C93.258,73.692 93.15,75.69 93.15,78.444 C93.15,84.546 94.554,86.112 98.01,86.112 C100.17,86.112 101.304,85.41 103.194,82.98 L103.194,85.788 L107.946,85.788 L107.946,64.89 C107.946,59.976 105.138,58.356 100.764,58.356 Z M98.226,78.012 C98.226,74.016 98.766,72.45 101.196,72.45 L102.87,72.45 L102.87,79.416 C102.87,81.198 102.006,82.548 100.224,82.548 C98.55,82.548 98.226,81.9 98.226,78.012 Z M117.828,51.768 L112.698,53.55 L112.698,58.788 L109.944,58.788 L109.944,62.406 L112.698,62.406 L112.698,81.684 C112.698,84.546 113.94,85.896 117.936,85.896 C119.556,85.896 120.474,85.788 121.554,85.788 L121.554,82.224 C121.014,82.332 120.528,82.332 120.258,82.332 C118.206,82.332 117.828,81.414 117.828,79.902 L117.828,62.406 L121.23,62.406 L121.23,58.788 L117.828,58.788 L117.828,51.768 Z M137.322,73.854 L137.322,65.592 C137.322,61.056 135.324,58.356 130.248,58.356 C124.686,58.356 122.526,61.218 122.526,65.592 L122.526,78.984 C122.526,84.168 124.848,86.166 129.924,86.166 C134.244,86.166 137.322,84.222 137.322,80.658 L137.322,76.878 L132.57,76.878 L132.57,78.984 C132.57,81.36 132.084,82.764 130.14,82.764 C128.358,82.764 127.656,81.792 127.656,79.74 L127.656,73.854 L137.322,73.854 Z M127.656,70.344 L127.656,64.62 C127.656,62.352 128.628,61.65 130.032,61.65 C131.652,61.65 132.516,62.298 132.516,65.376 L132.516,70.344 L127.656,70.344 Z"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 4.7 KiB |
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><g id="actionImage" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="2" fill="#EFEFEF" fill-rule="nonzero" d="M16.57,29 C15.57,29 15.14,29.29 15.14,30.38 L15.14,30.91 L16.06,30.91 L16.06,30.5 C16.06,29.98 16.19,29.73 16.51,29.73 C16.91,29.73 17.06,29.95 17.06,30.62 C17.06,31.66 16.81,31.93 16.06,33.4 C15.7,34.1 15.34,34.72 15,35.32 L15,36.29 L18.08,36.29 L18.08,35.43 L16.01,35.43 L17.11,33.38 C17.78,32.13 18,31.91 18,30.65 C18,29.55 17.73,29 16.57,29 Z M18.77,35.1 L18.77,36.29 L19.92,36.29 L19.92,35.1 L18.77,35.1 Z M23.62,30.61 C23.62,29.4 23.17,29.02 22.16,29.02 C21.12,29.02 20.66,29.4 20.66,30.6 L20.66,34.72 C20.66,35.7 20.89,36.36 22.09,36.36 C23.36,36.36 23.62,35.75 23.62,34.78 L23.62,30.61 Z M22.15,29.78 C22.52,29.78 22.68,29.98 22.68,30.5 L22.68,34.83 C22.68,35.32 22.51,35.61 22.12,35.61 C21.73,35.61 21.6,35.31 21.6,34.84 L21.6,30.61 C21.6,29.98 21.82,29.78 22.15,29.78 Z"/><path id="Template" fill="#EFEFEF" fill-rule="nonzero" d="M7.785,16.21 C9.195,16.21 9.75,16.96 9.75,18.22 L9.75,20.515 L7.065,20.515 L7.065,22.15 C7.065,22.72 7.26,22.99 7.755,22.99 C8.295,22.99 8.43,22.6 8.43,21.94 L8.43,21.355 L9.75,21.355 L9.75,22.405 C9.75,23.395 8.895,23.935 7.695,23.935 C6.285,23.935 5.64,23.38 5.64,21.94 L5.64,18.22 C5.64,17.005 6.24,16.21 7.785,16.21 Z M6.1,13 L6.1,14.26 L4.3,14.26 L4.3,23.83 L2.8,23.83 L2.8,14.26 L1,14.26 L1,13 L6.1,13 Z M7.725,17.125 C7.335,17.125 7.065,17.32 7.065,17.95 L7.065,19.54 L8.415,19.54 L8.415,18.16 C8.415,17.305 8.175,17.125 7.725,17.125 Z M14.73,16.96 C14.37,16.405 14.085,16.21 13.545,16.21 C12.96,16.21 12.585,16.45 12.15,17.005 L12.15,16.33 L10.815,16.33 L10.815,23.83 L12.225,23.83 L12.225,18.04 C12.225,17.515 12.42,17.23 12.84,17.23 C13.245,17.23 13.41,17.575 13.41,18.145 L13.41,23.83 L14.82,23.83 L14.82,17.92 C14.82,17.5 15.015,17.23 15.39,17.23 C15.765,17.23 15.945,17.515 15.945,18.025 L15.945,23.83 L17.355,23.83 L17.355,17.755 C17.355,16.84 16.815,16.21 15.96,16.21 C15.435,16.21 15.105,16.435 14.73,16.96 Z M19.83,16.33 L18.48,16.33 L18.48,26.59 L19.89,26.59 L19.89,23.41 C20.25,23.74 20.67,23.92 21.075,23.92 C21.345,23.92 22.5,23.845 22.5,22.03 L22.5,18.145 C22.5,16.945 22.08,16.24 21.18,16.24 C20.61,16.24 20.22,16.465 19.83,17.14 L19.83,16.33 Z M20.535,17.305 C20.925,17.305 21.075,17.59 21.075,18.355 L21.075,21.94 C21.075,22.585 20.94,22.945 20.505,22.945 C20.07,22.945 19.89,22.57 19.89,22.06 L19.89,18.13 C19.89,17.695 20.115,17.305 20.535,17.305 Z M23.535,13 L23.535,23.83 L24.945,23.83 L24.945,13 L23.535,13 Z M27.99,16.21 C26.595,16.21 25.98,16.78 25.98,17.845 L25.98,18.52 L27.39,18.52 L27.39,17.845 C27.39,17.425 27.54,17.2 27.99,17.2 C28.41,17.2 28.575,17.41 28.575,17.905 L28.575,19.135 C27.75,19.15 27.3,19.15 26.94,19.255 C26.565,19.36 26.235,19.63 26.055,20.08 C25.905,20.47 25.875,21.025 25.875,21.79 C25.875,23.485 26.265,23.92 27.225,23.92 C27.825,23.92 28.14,23.725 28.665,23.05 L28.665,23.83 L29.985,23.83 L29.985,18.025 C29.985,16.66 29.205,16.21 27.99,16.21 Z M27.285,21.67 C27.285,20.56 27.435,20.125 28.11,20.125 L28.575,20.125 L28.575,22.06 C28.575,22.555 28.335,22.93 27.84,22.93 C27.375,22.93 27.285,22.75 27.285,21.67 Z M32.73,14.38 L31.305,14.875 L31.305,16.33 L30.54,16.33 L30.54,17.335 L31.305,17.335 L31.305,22.69 C31.305,23.485 31.65,23.86 32.76,23.86 C33.21,23.86 33.465,23.83 33.765,23.83 L33.765,22.84 C33.615,22.87 33.48,22.87 33.405,22.87 C32.835,22.87 32.73,22.615 32.73,22.195 L32.73,17.335 L33.675,17.335 L33.675,16.33 L32.73,16.33 L32.73,14.38 Z M38.145,20.515 L38.145,18.22 C38.145,16.96 37.59,16.21 36.18,16.21 C34.635,16.21 34.035,17.005 34.035,18.22 L34.035,21.94 C34.035,23.38 34.68,23.935 36.09,23.935 C37.29,23.935 38.145,23.395 38.145,22.405 L38.145,21.355 L36.825,21.355 L36.825,21.94 C36.825,22.6 36.69,22.99 36.15,22.99 C35.655,22.99 35.46,22.72 35.46,22.15 L35.46,20.515 L38.145,20.515 Z M35.46,19.54 L35.46,17.95 C35.46,17.32 35.73,17.125 36.12,17.125 C36.57,17.125 36.81,17.305 36.81,18.16 L36.81,19.54 L35.46,19.54 Z"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 4 KiB |
|
|
@ -1,78 +0,0 @@
|
|||
<!DOCTYPE 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">
|
||||
<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">
|
||||
<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"
|
||||
value="Click Me"
|
||||
data-localize
|
||||
id="open-external">
|
||||
Click Me
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sdpi-info-label hidden" style="top: -1000" value=""></div>
|
||||
|
||||
<!-- Stream Deck Libs -->
|
||||
<script src="../../../libs/js/constants.js"></script>
|
||||
<script src="../../../libs/js/prototypes.js"></script>
|
||||
<script src="../../../libs/js/timers.js"></script>
|
||||
<script src="../../../libs/js/utils.js"></script>
|
||||
<script src="../../../libs/js/events.js"></script>
|
||||
<script src="../../../libs/js/api.js"></script>
|
||||
<script src="../../../libs/js/property-inspector.js"></script>
|
||||
<script src="../../../libs/js/dynamic-styles.js"></script>
|
||||
|
||||
<!-- Property Inspector Source -->
|
||||
<script src="inspector.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/// <reference path="../../../libs/js/property-inspector.js" />
|
||||
/// <reference path="../../../libs/js/utils.js" />
|
||||
|
||||
$PI.onConnected((jsn) => {
|
||||
const form = document.querySelector('#property-inspector');
|
||||
const {actionInfo, appInfo, connection, messageType, port, uuid} = jsn;
|
||||
const {payload, context} = actionInfo;
|
||||
const {settings} = payload;
|
||||
|
||||
Utils.setFormValue(settings, form);
|
||||
|
||||
form.addEventListener(
|
||||
'input',
|
||||
Utils.debounce(150, () => {
|
||||
const value = Utils.getFormValue(form);
|
||||
$PI.setSettings(value);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
$PI.onDidReceiveGlobalSettings(({payload}) => {
|
||||
console.log('onDidReceiveGlobalSettings', payload);
|
||||
})
|
||||
|
||||
/**
|
||||
* Provide window level functions to use in the external window
|
||||
* (this can be removed if the external window is not used)
|
||||
*/
|
||||
window.sendToInspector = (data) => {
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
document.querySelector('#open-external').addEventListener('click', () => {
|
||||
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
|
||||
*
|
||||
* <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();
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>com.elgato.template</title>
|
||||
<meta charset="utf-8"/>
|
||||
<style>
|
||||
canvas {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Stream Deck Libs -->
|
||||
<script src="libs/js/constants.js"></script>
|
||||
<script src="libs/js/prototypes.js"></script>
|
||||
<script src="libs/js/timers.js"></script>
|
||||
<script src="libs/js/utils.js"></script>
|
||||
<script src="libs/js/events.js"></script>
|
||||
<script src="libs/js/api.js"></script>
|
||||
<script src="libs/js/stream-deck.js"></script>
|
||||
<script src="libs/js/action.js"></script>
|
||||
|
||||
<!-- Plugin Source -->
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/// <reference path="libs/js/action.js" />
|
||||
/// <reference path="libs/js/stream-deck.js" />
|
||||
|
||||
const myAction = new Action('com.elgato.template.action');
|
||||
|
||||
/**
|
||||
* The first event fired when Stream Deck starts
|
||||
*/
|
||||
$SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) => {
|
||||
console.log('Stream Deck connected!');
|
||||
});
|
||||
|
||||
myAction.onKeyUp(({ action, context, device, event, payload }) => {
|
||||
console.log('Your key code goes here!');
|
||||
});
|
||||
|
||||
myAction.onDialRotate(({ action, context, device, event, payload }) => {
|
||||
console.log('Your dial code goes here!');
|
||||
});
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"Description": "Nimm diese Vorlage für dein erstes Plugin",
|
||||
"Name": "Stream Deck Template",
|
||||
"Category": "Templates",
|
||||
"com.elgato.template.action": {
|
||||
"Name": "Action",
|
||||
"Tooltip": "Dies ist die einzige 'Action' in diesem Template"
|
||||
},
|
||||
"Localization": {
|
||||
"More info": "Mehr Infos",
|
||||
"Message": "Nachricht",
|
||||
"Click Me": "Klicke mich",
|
||||
"Button": "Taste",
|
||||
"More": "Mehr",
|
||||
"My name": "Mein Name",
|
||||
"My title": "Mein Titel",
|
||||
"My message": "Meine Nachricht",
|
||||
"My button": "Meine Taste"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"Description": "Use this to create your own plugin",
|
||||
"Name": "Stream Deck Template",
|
||||
"Category": "Templates",
|
||||
"com.elgato.template.action": {
|
||||
"Name": "Action",
|
||||
"Tooltip": "This is the only action in this plugin"
|
||||
},
|
||||
"Localization": {
|
||||
"More info": "More info",
|
||||
"Message": "Message",
|
||||
"Click Me": "Click Me",
|
||||
"Button": "Button",
|
||||
"More": "More",
|
||||
"My name": "My name",
|
||||
"My title": "My title",
|
||||
"My message": "My message",
|
||||
"My button": "My button"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>com.elgato.template.externalWindow</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="libs/css/sdpi.css" />
|
||||
<style>
|
||||
body {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.sdpi-item {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.sdpi-heading {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
max-height: none;
|
||||
}
|
||||
li * {
|
||||
min-height: 18px;
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
margin: 8px;
|
||||
}
|
||||
.title {
|
||||
font-weight: bold;
|
||||
padding-bottom: 2px;
|
||||
margin-bottom: 6px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="sdpi-wrapper">
|
||||
<div class="sdpi-heading">INFORMATION</div>
|
||||
<div class="wrap">
|
||||
<p>
|
||||
In your external window you can either place your own
|
||||
designs, or simply use the built-in sdpi.css to style your
|
||||
content.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="wrap">
|
||||
<button id="send" type="button" value="Click here">
|
||||
Click here
|
||||
</button>
|
||||
<p>
|
||||
Clicking the button sends some information to your Property
|
||||
Inspector. Just open the remote-debugger for your Property
|
||||
Inspector and watch the console.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="external.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
window.onload = () => {
|
||||
document.querySelector('#send').addEventListener('click', () => {
|
||||
window.opener.sendToInspector('Message from external window.');
|
||||
});
|
||||
};
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
"SDKVersion": 2,
|
||||
"Author": "Elgato Systems",
|
||||
"CodePath": "app.html",
|
||||
"Description": "Example description",
|
||||
"Name": "Stream Deck Template",
|
||||
"Icon": "actions/template/assets/action",
|
||||
"URL": "https://www.elgato.com/en/gaming/stream-deck",
|
||||
"Version": "1.0.2",
|
||||
"Software": {
|
||||
"MinimumVersion": "5.0"
|
||||
},
|
||||
"OS": [
|
||||
{
|
||||
"Platform": "mac",
|
||||
"MinimumVersion": "10.11"
|
||||
},
|
||||
{
|
||||
"Platform": "windows",
|
||||
"MinimumVersion": "10"
|
||||
}
|
||||
],
|
||||
"Category": "Template Plugin",
|
||||
"CategoryIcon": "actions/template/assets/actionimage",
|
||||
"Actions": [
|
||||
{
|
||||
"Icon": "actions/template/assets/actionimage",
|
||||
"Name": "Example Action",
|
||||
"Controllers": ["Keypad", "Encoder"],
|
||||
"Encoder": {
|
||||
"layout": "$B1",
|
||||
"TriggerDescription": {
|
||||
"Rotate": "Describe the rotation",
|
||||
"Push": "Describe the encoder push",
|
||||
"Touch": "Describe the touch",
|
||||
"LongTouch": "Describe the long touch"
|
||||
}
|
||||
},
|
||||
"States": [
|
||||
{
|
||||
"Image": "actions/template/assets/action"
|
||||
}
|
||||
],
|
||||
"Tooltip": "This is an example tooltip",
|
||||
"UUID": "com.elgato.template.action",
|
||||
"PropertyInspectorPath": "actions/template/property-inspector/inspector.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
src/net.forgeserv.api.sdPlugin/actionIcon.png
Normal file
BIN
src/net.forgeserv.api.sdPlugin/actionIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
BIN
src/net.forgeserv.api.sdPlugin/actionIcon@2x.png
Normal file
BIN
src/net.forgeserv.api.sdPlugin/actionIcon@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE 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>net.forgeserv.api Property Inspector</title>
|
||||
<link rel="stylesheet" href="../../../libs/css/sdpi.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="sdpi-wrapper">
|
||||
<hr class="tab-separator">
|
||||
<form id="property-inspector">
|
||||
<div id="tab2" class="tab-container">
|
||||
<div class="sdpi-item">
|
||||
<div class="sdpi-item-label" title="Server Index">Server Index</div>
|
||||
<input class="sdpi-item-value" name="serverIdx" type="number" value="0" placeholder="0" />
|
||||
</div>
|
||||
|
||||
<div class="sdpi-item">
|
||||
<div class="sdpi-item-label" title="Server Index">Refresh Frequency (Seconds)</div>
|
||||
<input class="sdpi-item-value" name="refreshFrequency" type="number" value="5" placeholder="5" />
|
||||
</div>
|
||||
|
||||
<div class="sdpi-item">
|
||||
<div class="sdpi-item-label" title="Server Index">Reset Timeout (Seconds)</div>
|
||||
<input class="sdpi-item-value" name="resetTimeout" type="number" value="10" placeholder="10" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="sdpi-info-label hidden" style="top: -1000" value=""></div>
|
||||
|
||||
<!-- Stream Deck Libs -->
|
||||
<script src="../../../libs/js/constants.js"></script>
|
||||
<script src="../../../libs/js/prototypes.js"></script>
|
||||
<script src="../../../libs/js/timers.js"></script>
|
||||
<script src="../../../libs/js/utils.js"></script>
|
||||
<script src="../../../libs/js/events.js"></script>
|
||||
<script src="../../../libs/js/api.js"></script>
|
||||
<script src="../../../libs/js/property-inspector.js"></script>
|
||||
<script src="../../../libs/js/dynamic-styles.js"></script>
|
||||
|
||||
<!-- Property Inspector Source -->
|
||||
<script src="inspector.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/// <reference path="../../../libs/js/property-inspector.js" />
|
||||
/// <reference path="../../../libs/js/utils.js" />
|
||||
|
||||
$PI.onConnected((jsn) => {
|
||||
const form = document.querySelector('#property-inspector');
|
||||
const { actionInfo, appInfo, connection, messageType, port, uuid } = jsn;
|
||||
const { payload, context } = actionInfo;
|
||||
const { settings } = payload;
|
||||
|
||||
Utils.setFormValue(settings, form);
|
||||
|
||||
form.addEventListener(
|
||||
'input',
|
||||
Utils.debounce(150, () => {
|
||||
const value = Utils.getFormValue(form);
|
||||
$PI.setSettings(value);
|
||||
$PI.sendToPlugin({ value });
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
$PI.onDidReceiveGlobalSettings(({ payload }) => {
|
||||
console.log('onDidReceiveGlobalSettings', payload);
|
||||
});
|
||||
|
||||
/**
|
||||
* Provide window level functions to use in the external window
|
||||
* (this can be removed if the external window is not used)
|
||||
*/
|
||||
window.sendToInspector = (data) => {
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
29
src/net.forgeserv.api.sdPlugin/app.html
Normal file
29
src/net.forgeserv.api.sdPlugin/app.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>net.forgeserv.api</title>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
canvas {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Stream Deck Libs -->
|
||||
<script src="libs/js/constants.js"></script>
|
||||
<script src="libs/js/prototypes.js"></script>
|
||||
<script src="libs/js/timers.js"></script>
|
||||
<script src="libs/js/utils.js"></script>
|
||||
<script src="libs/js/events.js"></script>
|
||||
<script src="libs/js/api.js"></script>
|
||||
<script src="libs/js/stream-deck.js"></script>
|
||||
<script src="libs/js/action.js"></script>
|
||||
|
||||
<!-- Plugin Source -->
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
139
src/net.forgeserv.api.sdPlugin/app.js
Normal file
139
src/net.forgeserv.api.sdPlugin/app.js
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/// <reference path="libs/js/action.js" />
|
||||
/// <reference path="libs/js/stream-deck.js" />
|
||||
|
||||
const myAction = new Action('net.forgeserv.api.action');
|
||||
|
||||
const UNSET = -1;
|
||||
const preferencesByCtx = {};
|
||||
|
||||
let overrideIndicesByCtx = {};
|
||||
// Storage of the current program loop's timeout for on kill
|
||||
let processTimeoutIdsByCtx = {};
|
||||
// Storage of the current timeout when _temporarily_ setting the index to something else.
|
||||
let rerenderTimeoutIdsByCtx = {};
|
||||
// The current dataset -- used to prevent refetching all the time where possible.
|
||||
let dataCache = [];
|
||||
|
||||
/**
|
||||
* Grabs the current API data, caches it, and then sets a timeout to infinitely repeat.
|
||||
* @param {string} context The required Action contextId
|
||||
* @returns {null}
|
||||
*/
|
||||
const process = async (context) => {
|
||||
const resp = await fetch('https://api.forgeserv.net');
|
||||
if (resp.status != 200) return;
|
||||
|
||||
dataCache = await resp.json();
|
||||
rerender(context);
|
||||
|
||||
processTimeoutIdsByCtx[context] = setTimeout(() => process(context), 1000 * preferencesByCtx[context].refreshFrequency);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses each int value in the provided object
|
||||
* @param {Object} settings
|
||||
* @param {string} context The action's context
|
||||
*/
|
||||
const onSettingsUpdated = (settings, context) => {
|
||||
const newPrefs = {
|
||||
serverIdx: safeParseInt(settings.serverIdx),
|
||||
resetTimeout: safeParseFloat(settings.resetTimeout),
|
||||
refreshFrequency: safeParseFloat(settings.refreshFrequency),
|
||||
};
|
||||
|
||||
preferencesByCtx[context] = newPrefs;
|
||||
console.log(preferencesByCtx);
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-renders the Stream Deck's button with new info
|
||||
* @param {string} context The action's context
|
||||
* @returns {null}
|
||||
*/
|
||||
const rerender = context => {
|
||||
const usedIndex = overrideIndicesByCtx[context] > UNSET ? overrideIndicesByCtx[context] : clamp(preferencesByCtx[context].serverIdx);
|
||||
const server = dataCache[usedIndex];
|
||||
if (!server) return;
|
||||
|
||||
$SD.setFeedback(context, {
|
||||
title: server.name,
|
||||
value: parseInt(server.online) === 0 ? "Empty" : `${server.online} of ${server.max}`,
|
||||
icon: `data:image/png;base64,${server.icon}`,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clamps a given index to be no less than 0 and no more than dataCache.length
|
||||
* @param {Number} index
|
||||
*/
|
||||
const clamp = index => {
|
||||
return index > dataCache.length - 1 ? dataCache.length - 1 : index < 0 ? 0 : index;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns 0 if the value is evaluated as NaN, the parsed value otherwise
|
||||
* @param {Number} value
|
||||
* @returns {Number}
|
||||
*/
|
||||
const safeParseInt = value => {
|
||||
const tmp = parseInt(value);
|
||||
if (Number.isNaN(tmp)) return 0;
|
||||
return tmp;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns 0.0 if the value is evaluated as NaN, the parsed value otherwise
|
||||
* @param {Number} value
|
||||
* @returns {Number}
|
||||
*/
|
||||
const safeParseFloat = value => {
|
||||
const tmp = parseFloat(value);
|
||||
if (Number.isNaN(tmp)) return 0.0;
|
||||
return tmp;
|
||||
};
|
||||
|
||||
// BEGIN REGION: EVENT HANDLERS
|
||||
|
||||
myAction.onWillAppear(({ context, payload }) => {
|
||||
overrideIndicesByCtx[context] = UNSET;
|
||||
processTimeoutIdsByCtx[context] = UNSET;
|
||||
rerenderTimeoutIdsByCtx[context] = UNSET;
|
||||
|
||||
onSettingsUpdated(payload.settings, context);
|
||||
process(context);
|
||||
});
|
||||
|
||||
myAction.onWillDisappear(({ context }) => {
|
||||
processTimeoutIdsByCtx[context] > UNSET && clearTimeout(processTimeoutIdsByCtx[context]);
|
||||
rerenderTimeoutIdsByCtx[context] > UNSET && clearTimeout(rerenderTimeoutIdsByCtx[context]);
|
||||
});
|
||||
|
||||
myAction.onSendToPlugin(({ payload, context }) => {
|
||||
onSettingsUpdated(payload.value, context);
|
||||
rerender(context);
|
||||
});
|
||||
|
||||
myAction.onDialRotate(({ payload, context }) => {
|
||||
if (!payload || !payload.ticks) return;
|
||||
|
||||
// It makes sense from a user perspective to start scrolling from where you are _now_
|
||||
if (overrideIndicesByCtx[context] === UNSET) {
|
||||
overrideIndicesByCtx[context] = preferencesByCtx[context].serverIdx;
|
||||
}
|
||||
|
||||
overrideIndicesByCtx[context] = clamp(overrideIndicesByCtx[context] + payload.ticks);
|
||||
rerender(context);
|
||||
|
||||
if (rerenderTimeoutIdsByCtx > UNSET) {
|
||||
// Don't back-queue additional "reprocesses"
|
||||
clearTimeout(rerenderTimeoutIdsByCtx);
|
||||
}
|
||||
|
||||
rerenderTimeoutIdsByCtx[context] = setTimeout(() => {
|
||||
overrideIndicesByCtx[context] = UNSET;
|
||||
rerenderTimeoutIdsByCtx[context] = UNSET;
|
||||
rerender(context);
|
||||
}, 1000 * preferencesByCtx[context].resetTimeout);
|
||||
});
|
||||
|
||||
// END REGION: EVENT HANDLERS
|
||||
9
src/net.forgeserv.api.sdPlugin/en.json
Normal file
9
src/net.forgeserv.api.sdPlugin/en.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Description": "Use this to create your own plugin",
|
||||
"Name": "Stream Deck Template",
|
||||
"Category": "Utilities",
|
||||
"net.forgeserv.api.action": {
|
||||
"Name": "ForgeServ API Status",
|
||||
"Tooltip": "Made by oitsjustjose 💚"
|
||||
}
|
||||
}
|
||||
1
src/net.forgeserv.api.sdPlugin/libs
Submodule
1
src/net.forgeserv.api.sdPlugin/libs
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 70f866ee3adbb0634977ef9b8acbd44474c9d6fc
|
||||
49
src/net.forgeserv.api.sdPlugin/manifest.json
Normal file
49
src/net.forgeserv.api.sdPlugin/manifest.json
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"Actions": [
|
||||
{
|
||||
"Icon": "actionIcon",
|
||||
"Name": "Server Status",
|
||||
"States": [
|
||||
{
|
||||
"Image": "actionIcon"
|
||||
}
|
||||
],
|
||||
"PropertyInspectorPath": "actions/api/property-inspector/inspector.html",
|
||||
"SupporedInMultiActions": false,
|
||||
"Tooltip": "Gets the Player Count on a given server returned by the API",
|
||||
"UUID": "net.forgeserv.api.action",
|
||||
"UserTitleEnabled": false,
|
||||
"Controllers": ["Keypad", "Encoder"],
|
||||
"Encoder": {
|
||||
"layout": "$A1",
|
||||
"TriggerDescription": {
|
||||
"Rotate": "Scrolls between servers",
|
||||
"Push": "(Does Nothing)",
|
||||
"Touch": "(Does Nothing)",
|
||||
"LongTouch": "(Does Nothing)"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"SDKVersion": 2,
|
||||
"Author": "oitsjustjose",
|
||||
"CodePath": "app.html",
|
||||
"Description": "Gets the Player Count on a given server returned by the API",
|
||||
"Name": "ForgeServ API Server Status",
|
||||
"Icon": "pluginIcon",
|
||||
"URL": "https://oitsjustjose.com",
|
||||
"Version": "1.0.0",
|
||||
"OS": [
|
||||
{
|
||||
"Platform": "mac",
|
||||
"MinimumVersion": "10.11"
|
||||
},
|
||||
{
|
||||
"Platform": "windows",
|
||||
"MinimumVersion": "10"
|
||||
}
|
||||
],
|
||||
"Software": {
|
||||
"MinimumVersion": "4.1"
|
||||
}
|
||||
}
|
||||
BIN
src/net.forgeserv.api.sdPlugin/pluginIcon.png
Normal file
BIN
src/net.forgeserv.api.sdPlugin/pluginIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
BIN
src/net.forgeserv.api.sdPlugin/pluginIcon@2x.png
Normal file
BIN
src/net.forgeserv.api.sdPlugin/pluginIcon@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
Loading…
Reference in a new issue