Minted
1
(function($) {
2
$.extend({
3
toast: function(obj) {
4
if ($("#daftplugPublicToastMessage").length) {
5
return
6
}
7
var title = obj.title;
8
var showTime = obj.duration || 2000;
9
var width = obj.width || "auto";
10
var height = obj.height || "20px";
11
var position = obj.position || '';
12
var backgroundColor = obj.backgroundColor || 'rgba(0, 0, 0, .7)';
13
var textColor = obj.textColor || '#fff';
14
var flag = obj.flag || !0;
15
var lineheight = obj.lineheight || height;
16
if (position == 'bottom') {
17
position = "bottom: 50px;"
18
} else if (position == 'middle') {
19
position = "top: calc(45% - 15px);"
20
} else if (position == 'top') {
21
position = "top: 0px;"
22
} else if (position === '') {
23
position = "top: 80%;"
24
} else {}
25
if (flag) {
26
var content = "<div id='daftplugPublicToastMessage' style='position: fixed;display: none; z-index:999;font-size: 18px; " + position + ";left: 0;width:100%; height: " + height + "; text-align: center'>"
27
} else {
28
var content = "<div id='daftplugPublicToastMessage' style='position: fixed; display: none;z-index:999; top: 0; left: 0;width:100%; height:100%; text-align: center'>"
29
}
30
content += '<div id="toast-content" style="display: inline-block; width: ' + width + ';min-height: ' + height + ';padding: 8px 14px;background-color: ' + backgroundColor + ';text-align: center;line-height: ' + lineheight + ';border-radius: 15px;color: ' + textColor + ';">' + title + '</div>';
31
content += '</div>';
32
$("body").append(content);
33
$("#daftplugPublicToastMessage").fadeIn(200);
34
setTimeout(function() {
35
$("#daftplugPublicToastMessage").fadeOut(200)
36
}, showTime);
37
setTimeout(function() {
38
$("#daftplugPublicToastMessage").remove()
39
}, showTime + 300)
40
}
41
})
42
})(jQuery)
Bookmark:
javascript:location='http://
shauninman.com
/vs/?url='+escape(location)