mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 13:31:06 +00:00
72 lines
1.6 KiB
HTML
72 lines
1.6 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<style>
|
|
div {
|
|
transition: all 1000ms ease-in;
|
|
}
|
|
|
|
.indicator {
|
|
opacity: 0;
|
|
}
|
|
|
|
.hx-show-indicator .indicator {
|
|
opacity: 100%;
|
|
}
|
|
|
|
</style>
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
|
|
|
</head>
|
|
<body style="padding:20px;font-family: sans-serif">
|
|
<script src="../node_modules/sinon/pkg/sinon.js"></script>
|
|
<script src="../src/htmx.js"></script>
|
|
<script src="util/util.js"></script>
|
|
<script src="util/scratch_server.js"></script>
|
|
|
|
<script>
|
|
// this.server.respondWith("GET", "/test", '<a hx-get="/test2">Click Me</a>');
|
|
// this.server.respondWith("GET", "/test2", "Clicked!");
|
|
//
|
|
// make('<div hx-get="/test">dd</div>')
|
|
|
|
htmx.logAll();
|
|
|
|
// var i = 1;
|
|
// this.server.respondWith("GET", "/test", function(xhr){
|
|
// xhr.respond(201, {}, "" + i++);
|
|
// });
|
|
//
|
|
// make('<div hx-get="/test" hx-trigger="load, every 5s">Init</div>');
|
|
|
|
let xhr;
|
|
|
|
htmx.on('htmx:beforeSend', function(evt) {
|
|
xhr = evt.detail.xhr;
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<h2>Server Options</h2>
|
|
<button onclick="server.respond()">Server Respond</button>
|
|
<br/>
|
|
Autorespond: <input id="autorespond" type="checkbox" onclick="toggleAutoRespond()">
|
|
<br/>
|
|
<br/>
|
|
<em>Work Area</em>
|
|
<hr/>
|
|
|
|
<div id="work-area" hx-history-elt>
|
|
<button hx-get="/foo" id="my-button">My Button</button>
|
|
</div>
|
|
|
|
<script>
|
|
htmx.on('#my-button', 'click', function (evt) {
|
|
xhr.abort();
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|