Webovy server odsud https://github.com/vortigont/ESPAsyncWebServer/tree/yubxmod - vsechny upravy a zpristupneni bufferu pro JSON dle https://github.com/yubox-node-org/ESPAsyncWebServer/pull/8
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
// Written using ES5 JS for browser support
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
var form = document.querySelector('form');
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Form elements
|
||||
var title = form.querySelector('#title').value;
|
||||
var message = form.querySelector('#message').value;
|
||||
var position = form.querySelector('#position').value;
|
||||
var duration = form.querySelector('#duration').value;
|
||||
var theme = form.querySelector('#theme').value;
|
||||
var closeOnClick = form.querySelector('#close').checked;
|
||||
var displayClose = form.querySelector('#closeButton').checked;
|
||||
|
||||
if(!message) {
|
||||
message = 'You did not enter a message...';
|
||||
}
|
||||
|
||||
window.createNotification({
|
||||
closeOnClick: closeOnClick,
|
||||
displayCloseButton: displayClose,
|
||||
positionClass: position,
|
||||
showDuration: duration,
|
||||
theme: theme
|
||||
})({
|
||||
title: title,
|
||||
message: message
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
</hea>
|
||||
<meta charset="UTF-8">
|
||||
<title>Notifications</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
body {
|
||||
background-color: floralwhite;
|
||||
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
form {
|
||||
text-align: left;
|
||||
max-width: 600px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
input, select {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type=checkbox] {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
background: #2f96b4;
|
||||
border: 0;
|
||||
color: #fff;
|
||||
margin-bottom: 0;
|
||||
padding: 10px 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Notifications styling -->
|
||||
<link rel="stylesheet" href="../dist/notifications.css" type="text/css">
|
||||
<head>
|
||||
<body>
|
||||
<h1>Notifications</h1>
|
||||
<form>
|
||||
<label for="title">Title (optional)</label>
|
||||
<br/>
|
||||
<input type="text" id="title" placeholder="Enter a title..." value="Notification">
|
||||
|
||||
<label for="message">Message</label>
|
||||
<br/>
|
||||
<input type="text" id="message" placeholder="Enter a message..." value="I am a default message">
|
||||
|
||||
<label for="position">Notification position:</label>
|
||||
<br/>
|
||||
<select id="position">
|
||||
<option value="nfc-top-right">Top Right</option>
|
||||
<option value="nfc-bottom-right">Bottom Right</option>
|
||||
<option value="nfc-top-left">Top Left</option>
|
||||
<option value="nfc-bottom-left">Bottom Left</option>
|
||||
</select>
|
||||
|
||||
<label for="duration">Show Duration (ms)</label>
|
||||
<br/>
|
||||
<input id="duration" type="number" value="3000"/>
|
||||
|
||||
<label for="theme">Theme</label>
|
||||
<br/>
|
||||
<select id="theme">
|
||||
<option value="success">Success</option>
|
||||
<option value="info">Information</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="error">Error</option>
|
||||
<option value="none">None</option>
|
||||
</select>
|
||||
|
||||
<label for="close">Close on click</label>
|
||||
<input id="close" type="checkbox" value="Close on click" checked>
|
||||
|
||||
<br/>
|
||||
|
||||
<label for="closeButton">Display a close button</label>
|
||||
<input id="closeButton" type="checkbox" value="Display close button">
|
||||
|
||||
<input type="submit" value="Display notification">
|
||||
</form>
|
||||
|
||||
<script src="../dist/notifications.js" type="text/javascript"></script>
|
||||
<script src="./demo.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Notifications</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="../dist/notifications.css" type="text/css">
|
||||
<script src="../dist/notifications.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button id="not" type="button" class="tbu" onclick="button2Click(this);">Notify</button>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
const successNotification = window.createNotification({
|
||||
positionClass: 'nfc-bottom-right',
|
||||
theme: 'info',
|
||||
showDuration: 2000
|
||||
});
|
||||
|
||||
function button2Click(e) {
|
||||
// Invoke success notification
|
||||
successNotification({
|
||||
message: 'Simple success notification ' + e.id
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user