bsdialog4/bs4-test.html

156 lines
5.4 KiB
HTML

<!doctype html>
<html lang="en-GB">
<head>
<meta charset="UTF-8" />
<meta http-equiv="content-type" content="text/html" charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="keyword" content="" />
<!-- jquery -->
<script src="http://cdn.hiimray.co.uk/8206c600-707c-469e-8d49-a76ae35782af/jquery/3.7.0/dist/jquery.min.js"></script>
<!-- bootstrap -->
<script src="http://cdn.hiimray.co.uk/8206c600-707c-469e-8d49-a76ae35782af/bootstrap/4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<link href="http://cdn.hiimray.co.uk/8206c600-707c-469e-8d49-a76ae35782af/bootstrap/4.6.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="bsdialog4.js"></script>
<title></title>
</head>
<body class="py-5">
<div class="container">
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example One</b></p>
<p>Launch an empty modal</p>
<div class="alert alert-secondary">BSDialog.Create('abc123', 'My Modal Box 123', null, 'xl');</div>
<p><button id="button1" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Two</b></p>
<p>Launch a modal with text</p>
<div class="alert alert-secondary">BSDialog.Create('abc123', 'My Modal Box 123', 'Hello momo!', 'lg');</div>
<p><button id="button2" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Three</b></p>
<p>Launch an empty modal then update its title, body, footer and size.</p>
<div class="alert alert-secondary">
BSDialog.Create('abc123', 'My Modal Box 123', null, 'sm');<br />
BSDialog.UpdateTitle('abc123', 'My Modal Box 567');<br />
BSDialog.UpdateBody('abc123', 'Help, I\'m toast!');<br />
BSDialog.UpdateFooter('abc123', '');<br />
BSDialog.UpdateSize('abc123', 'lg');<br />
</div>
<p><button id="button3" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Four</b></p>
<p>Launch a multiple modals</p>
<div class="alert alert-secondary">
BSDialog.Create('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');<br />
BSDialog.Create('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');<br />
</div>
<p><button id="button4" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Six</b></p>
<p>Show a toast-style modal</p>
<div class="alert alert-secondary">
BSDialog.ShowToast('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');<br />
</div>
<p><button id="button6" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Five</b></p>
<p>Launch a prompt modal</p>
<div class="alert alert-secondary">
let result = await BSDialog.Prompt({<br />
&nbsp;&nbsp;&nbsp;&nbsp;Title: "Prompt",<br />
&nbsp;&nbsp;&nbsp;&nbsp;Message: "This is a prompt",<br />
&nbsp;&nbsp;&nbsp;&nbsp;Size: "md",<br />
&nbsp;&nbsp;&nbsp;&nbsp;Buttons: [<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ Label: "Yes", Value: "Yes", Colour: "primary" },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ Label: "No", Value: "No", Colour: "secondary" },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ Label: "Cancel", Value: "Cancel", Colour: "secondary" }<br />
&nbsp;&nbsp;&nbsp;&nbsp;]<br />
});<br />
<br />
alert(result);<br />
</div>
<p><button id="button5" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#button1").on('click', function(){
BSDialog.Create('abc123', 'My Modal Box 123', null, 'xl');
});
$("#button2").on('click', function(){
BSDialog.Create('abc123', 'My Modal Box 123', 'Hello momo!', 'lg');
});
$("#button3").on('click', function(){
BSDialog.Create('abc123', 'My Modal Box 123', null, 'sm');
BSDialog.UpdateTitle('abc123', 'My Modal Box 567');
BSDialog.UpdateBody('abc123', 'Help, I\'m toast!');
BSDialog.UpdateFooter('abc123', '');
BSDialog.UpdateSize('abc123', 'lg');
});
$("#button4").on('click', function(){
BSDialog.Create('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');
BSDialog.Create('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');
});
$("#button6").on('click', function(){
BSDialog.ShowToast('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');
});
$("#button5").on('click', async function(){
let result = await BSDialog.Prompt({
Title: "Prompt",
Message: "This is a prompt",
Size: "md",
PromptType: "YesNoCancel"
});
alert(result);
});
});
</script>
</body>
</html>