Updating js plugins
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "bootstrapToastWrapper",
|
||||
"_release": "fec5a24c81",
|
||||
"_resolution": {
|
||||
"type": "branch",
|
||||
"branch": "master",
|
||||
"commit": "fec5a24c81849ebb7c70e52cbfde7c8342e8695b"
|
||||
},
|
||||
"_source": "https://git.inforsistemas-devel1.com.br/bower/bootstrapToastWrapper.git",
|
||||
"_target": "*",
|
||||
"_originalSource": "https://git.inforsistemas-devel1.com.br/bower/bootstrapToastWrapper.git"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/nbproject
|
||||
@@ -0,0 +1,2 @@
|
||||
# bootstrap-toast-wrapper
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
(function ($) {
|
||||
|
||||
$.fn.bootstrapToastWrapper = function (content) {
|
||||
|
||||
var type = {
|
||||
'primary': '#084298',
|
||||
'secondary': '#41464b',
|
||||
'success': '#0f5132',
|
||||
'danger': '#842029',
|
||||
'warning': '#664d03',
|
||||
'info': '#055160',
|
||||
'light': '#636464',
|
||||
'dark': '#141619'
|
||||
}
|
||||
|
||||
var toastContent = "<div class='toast show'> <div class='toast-header'> {{type}} <strong class='me-auto'>{{title}}</strong> <button type='button' class='btn-close' data-bs-dismiss='toast' aria-label='Close'></button> </div> <div class='toast-body'>{{body}}</div> </div>";
|
||||
var rect = '<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="{{type}}"></rect></svg>';
|
||||
|
||||
rect = rect.replace('{{type}}', type[content['type']]);
|
||||
|
||||
toastContent = toastContent.replace('{{type}}', rect);
|
||||
|
||||
|
||||
for(key in content){
|
||||
toastContent = toastContent.replace('{{'+key+'}}', content[key] );
|
||||
}
|
||||
|
||||
var a = $(this).append(toastContent).children("div:last-child");;
|
||||
|
||||
if(content.timeout){
|
||||
setTimeout(function(){
|
||||
$(a).remove();
|
||||
}, content.timeout);
|
||||
}
|
||||
|
||||
}
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>TODO supply a title</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="src/bootstrapToastWrapper.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button onclick="toast()">Toast</button>
|
||||
|
||||
<div id="toasts" class="toast-container p-3 error" style="position: fixed; right: 0px; bottom: 0px; "> </div>
|
||||
|
||||
<script>
|
||||
|
||||
function toast(){
|
||||
$('#toasts').bootstrapToastWrapper({
|
||||
'type': 'danger',
|
||||
'title': 'Algo deu errado',
|
||||
'body' : 'Cpf não pode ser validado',
|
||||
'timeout': 5000
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
(function ($) {
|
||||
$.fn.bootstrapToastWrapper = function (content) {
|
||||
|
||||
var type = {
|
||||
'primary': '#084298',
|
||||
'secondary': '#41464b',
|
||||
'success': '#0f5132',
|
||||
'danger': '#842029',
|
||||
'warning': '#664d03',
|
||||
'info': '#055160',
|
||||
'light': '#636464',
|
||||
'dark': '#141619'
|
||||
}
|
||||
|
||||
var toastContent = "<div class='toast show'> <div class='toast-header'> {{type}} <strong class='me-auto'>{{title}}</strong> <button type='button' class='btn-close' data-bs-dismiss='toast' aria-label='Close'></button> </div> <div class='toast-body'>{{body}}</div> </div>";
|
||||
var rect = '<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="{{type}}"></rect></svg>';
|
||||
|
||||
rect = rect.replace('{{type}}', type[content['type']]);
|
||||
|
||||
toastContent = toastContent.replace('{{type}}', rect);
|
||||
|
||||
for(key in content){
|
||||
toastContent = toastContent.replace('{{'+key+'}}', content[key] );
|
||||
}
|
||||
|
||||
var a = $(this).append(toastContent).children("div:last-child");;
|
||||
|
||||
if(content.timeout){
|
||||
setTimeout(function(){
|
||||
$(a).remove();
|
||||
}, content.timeout);
|
||||
}
|
||||
|
||||
}
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user