-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit f6bce4a.
- Loading branch information
Showing
8 changed files
with
288 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
declare let systemDictionary: Record<string, Record<string, string>>; | ||
|
||
declare let load: (settings: Record<string, unknown>, onChange: (hasChanges: boolean) => void) => void; | ||
declare let save: (callback: (settings: Record<string, unknown>) => void) => void; | ||
|
||
// make load and save exist on the window object | ||
interface Window { | ||
load: typeof load; | ||
save: typeof save; | ||
} | ||
|
||
declare const instance: number; | ||
declare const adapter: string; | ||
/** Translates text */ | ||
declare function _(text: string, arg1?: string, arg2?: string, arg3?: string): string; | ||
declare const socket: ioBrokerSocket; | ||
declare function sendTo( | ||
instance: any | null, | ||
command: string, | ||
message: any, | ||
callback: (result: SendToResult) => void | Promise<void>, | ||
): void; | ||
|
||
interface SendToResult { | ||
error?: string | Error; | ||
result?: any; | ||
} | ||
|
||
// tslint:disable-next-line:class-name | ||
interface ioBrokerSocket { | ||
emit( | ||
command: "subscribeObjects", | ||
pattern: string, | ||
callback?: (err?: string) => void | Promise<void>, | ||
): void; | ||
emit( | ||
command: "subscribeStates", | ||
pattern: string, | ||
callback?: (err?: string) => void | Promise<void>, | ||
): void; | ||
emit( | ||
command: "unsubscribeObjects", | ||
pattern: string, | ||
callback?: (err?: string) => void | Promise<void>, | ||
): void; | ||
emit( | ||
command: "unsubscribeStates", | ||
pattern: string, | ||
callback?: (err?: string) => void | Promise<void>, | ||
): void; | ||
|
||
emit( | ||
event: "getObjectView", | ||
view: "system", | ||
type: "device", | ||
options: ioBroker.GetObjectViewParams, | ||
callback: ( | ||
err: string | undefined, | ||
result?: any, | ||
) => void | Promise<void>, | ||
): void; | ||
emit( | ||
event: "getStates", | ||
callback: ( | ||
err: string | undefined, | ||
result?: Record<string, any>, | ||
) => void, | ||
): void; | ||
emit( | ||
event: "getState", | ||
id: string, | ||
callback: (err: string | undefined, result?: ioBroker.State) => void, | ||
): void; | ||
emit( | ||
event: "setState", | ||
id: string, | ||
state: unknown, | ||
callback: (err: string | undefined, result?: any) => void, | ||
): void; | ||
|
||
on(event: "objectChange", handler: ioBroker.ObjectChangeHandler): void; | ||
on(event: "stateChange", handler: ioBroker.StateChangeHandler): void; | ||
removeEventHandler( | ||
event: "objectChange", | ||
handler: ioBroker.ObjectChangeHandler, | ||
): void; | ||
removeEventHandler( | ||
event: "stateChange", | ||
handler: ioBroker.StateChangeHandler, | ||
): void; | ||
|
||
// TODO: other events | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
<html> | ||
<head> | ||
<!-- Load ioBroker scripts and styles--> | ||
<link rel="stylesheet" type="text/css" href="../../css/adapter.css" /> | ||
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css" /> | ||
|
||
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script> | ||
<script type="text/javascript" src="../../socket.io/socket.io.js"></script> | ||
|
||
<script type="text/javascript" src="../../js/translate.js"></script> | ||
<script type="text/javascript" src="../../lib/js/materialize.js"></script> | ||
<script type="text/javascript" src="../../js/adapter-settings.js"></script> | ||
|
||
<!-- Load our own files --> | ||
<link rel="stylesheet" type="text/css" href="style.css" /> | ||
<script type="text/javascript" src="words.js"></script> | ||
|
||
<script type="text/javascript"> | ||
// This will be called by the admin adapter when the settings page loads | ||
function load(settings, onChange) { | ||
// example: select elements with id=key and class=value and insert value | ||
if (!settings) return; | ||
$('.value').each(function () { | ||
var $key = $(this); | ||
var id = $key.attr('id'); | ||
if ($key.attr('type') === 'checkbox') { | ||
// do not call onChange direct, because onChange could expect some arguments | ||
$key.prop('checked', settings[id]).on('change', () => onChange()); | ||
} else { | ||
// do not call onChange direct, because onChange could expect some arguments | ||
$key | ||
.val(settings[id]) | ||
.on('change', () => onChange()) | ||
.on('keyup', () => onChange()); | ||
} | ||
}); | ||
onChange(false); | ||
// reinitialize all the Materialize labels on the page if you are dynamically adding inputs: | ||
if (M) M.updateTextFields(); | ||
} | ||
|
||
// This will be called by the admin adapter when the user presses the save button | ||
function save(callback) { | ||
// example: select elements with class=value and build settings object | ||
var obj = {}; | ||
$('.value').each(function () { | ||
var $this = $(this); | ||
if ($this.attr('type') === 'checkbox') { | ||
obj[$this.attr('id')] = $this.prop('checked'); | ||
} else if ($this.attr('type') === 'number') { | ||
obj[$this.attr('id')] = parseFloat($this.val()); | ||
} else { | ||
obj[$this.attr('id')] = $this.val(); | ||
} | ||
}); | ||
callback(obj); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div class="m adapter-container"> | ||
<div class="row"> | ||
<div class="col s12 m4 l2"> | ||
<img src="boschindego.png" class="logo" /> | ||
</div> | ||
</div> | ||
|
||
<!-- Put your content here --> | ||
|
||
<!-- For example columns with settings: --> | ||
<div class="row"> | ||
<div class="col s6 input-field"> | ||
<input type="text" class="value" id="username" /> | ||
<label for="username" class="translate">App Email</label> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col s6 input-field"> | ||
<input type="password" class="value" id="password" /> | ||
<label for="password" class="translate">App Password</label> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col s6 input-field" id="captchaResponse"> | ||
Check Captcha Box and press Submit. Save the form. | ||
<p></p> | ||
If this is not working use the IP of the ioBroker instance in the browser and try again. | ||
<p></p> | ||
|
||
<p></p> | ||
<div> | ||
<form id="captcha_form" action="#" method="post"> | ||
<!-- hCaptcha widget --> | ||
<div class="h-captcha" data-sitekey="f8fe2d56-ad42-4f44-b9fe-5b30fcb0dd38"></div> | ||
<br /> | ||
<button type="submit" class="btn">Submit</button> | ||
</form> | ||
|
||
<!-- hCaptcha script --> | ||
<script src="https://hcaptcha.com/1/api.js" async defer></script> | ||
</div> | ||
</div> | ||
<p></p> | ||
<script> | ||
document.getElementById('captcha_form').addEventListener('submit', function (event) { | ||
event.preventDefault(); // Prevent the default form submission | ||
|
||
const hCaptchaResponse = document.querySelector('[name="h-captcha-response"]').value; | ||
const responseElement = document.getElementById('captchaResponse'); | ||
|
||
if (hCaptchaResponse) { | ||
if (typeof hCaptchaResponse === 'object') { | ||
hCaptchaResponse = JSON.stringify(hCaptchaResponse); | ||
} | ||
document.getElementById('captcha').value = hCaptchaResponse; | ||
//trigger change event | ||
var event = new Event('change'); | ||
document.getElementById('captcha').dispatchEvent(event); | ||
} | ||
}); | ||
</script> | ||
|
||
<input type="text" class="value" id="captcha" /> | ||
<label for="captcha" class="translate">Captcha</label> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col s2 input-field"> | ||
<input type="number" class="value" id="interval" /> | ||
<label for="interval" class="translate">Update interval (in minutes)</label> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col s2 input-field"> | ||
<input type="checkbox" class="value" id="getMap" /> | ||
<label for="getMap" class="translate">Get Map</label> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* You can delete those if you want. I just found them very helpful */ | ||
* { | ||
box-sizing: border-box | ||
} | ||
|
||
body { | ||
overflow: hidden; | ||
} | ||
|
||
.adapter-body { | ||
overflow: auto; | ||
} | ||
|
||
.m { | ||
/* Don't cut off dropdowns! */ | ||
overflow: initial; | ||
} | ||
|
||
.m.adapter-container, | ||
.m.adapter-container>div.App { | ||
/* Fix layout/scrolling issues with tabs */ | ||
height: 100%; | ||
width: 100%; | ||
position: relative; | ||
} | ||
|
||
.m .select-wrapper+label { | ||
/* The positioning for dropdown labels is messed up */ | ||
transform: none !important; | ||
} | ||
|
||
label>i[title] { | ||
/* Display the help cursor for the tooltip icons and fix their positioning */ | ||
cursor: help; | ||
margin-left: 0.25em; | ||
} | ||
|
||
.dropdown-content { | ||
/* Don't wrap text in dropdowns */ | ||
white-space: nowrap; | ||
} | ||
|
||
/* Add your styles here */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": [ | ||
"./admin.d.ts", | ||
"./**/*.js", | ||
// include the adapter-config definition if it exists | ||
"../src/lib/adapter-config.d.ts", | ||
] | ||
} |
Oops, something went wrong.