mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lobibox test code updated
This commit is contained in:
+114
-110
@@ -5,130 +5,134 @@
|
||||
///<reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
//extending default parameters
|
||||
Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, {
|
||||
//override any options from default options
|
||||
delay: false,
|
||||
soundPath: '/libraries/lobibox/sounds/',
|
||||
size: 'mini'
|
||||
});
|
||||
class LobiboxTest {
|
||||
static test() {
|
||||
Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, {
|
||||
//override any options from default options
|
||||
delay: false,
|
||||
soundPath: '/libraries/lobibox/sounds/',
|
||||
size: 'mini'
|
||||
});
|
||||
|
||||
// notify
|
||||
Lobibox.notify("error", {msg: "Hello world"});
|
||||
Lobibox.notify("success", {msg: "Hello world"});
|
||||
Lobibox.notify("warning", {msg: "Hello world"});
|
||||
Lobibox.notify("info", {msg: "Hello world"});
|
||||
Lobibox.notify("error", {msg: "Hello world"});
|
||||
Lobibox.notify("success", {msg: "Hello world"});
|
||||
Lobibox.notify("warning", {msg: "Hello world"});
|
||||
Lobibox.notify("info", {msg: "Hello world"});
|
||||
|
||||
// alert
|
||||
Lobibox.alert("error", {msg: "Hello world"});
|
||||
Lobibox.alert("success", {msg: "Hello world"});
|
||||
Lobibox.alert("warning", {msg: "Hello world"});
|
||||
Lobibox.alert("info", {msg: "Hello world"});
|
||||
Lobibox.alert("error", {msg: "Hello world"});
|
||||
Lobibox.alert("success", {msg: "Hello world"});
|
||||
Lobibox.alert("warning", {msg: "Hello world"});
|
||||
Lobibox.alert("info", {msg: "Hello world"});
|
||||
|
||||
//alert with more options
|
||||
Lobibox.alert('error', {
|
||||
msg: 'This is an error message',
|
||||
//buttons: ['ok', 'cancel', 'yes', 'no'],
|
||||
//Or more powerfull way
|
||||
buttons: {
|
||||
ok: {
|
||||
'class': 'btn btn-info',
|
||||
closeOnClick: false
|
||||
},
|
||||
cancel: {
|
||||
'class': 'btn btn-danger',
|
||||
closeOnClick: false
|
||||
},
|
||||
yes: {
|
||||
'class': 'btn btn-success',
|
||||
closeOnClick: false
|
||||
},
|
||||
no: {
|
||||
'class': 'btn btn-warning',
|
||||
closeOnClick: false
|
||||
},
|
||||
custom: {
|
||||
'class': 'btn btn-default',
|
||||
text: 'Custom'
|
||||
}
|
||||
},
|
||||
callback: function (lobibox, type) {
|
||||
var btnType;
|
||||
if (type === 'no') {
|
||||
btnType = 'warning';
|
||||
} else if (type === 'yes') {
|
||||
btnType = 'success';
|
||||
} else if (type === 'ok') {
|
||||
btnType = 'info';
|
||||
} else if (type === 'cancel') {
|
||||
btnType = 'error';
|
||||
}
|
||||
Lobibox.notify(btnType, {
|
||||
size: 'mini',
|
||||
msg: 'This is ' + btnType + ' message'
|
||||
Lobibox.alert('error', {
|
||||
msg: 'This is an error message',
|
||||
//buttons: ['ok', 'cancel', 'yes', 'no'],
|
||||
//Or more powerfull way
|
||||
buttons: {
|
||||
ok: {
|
||||
'class': 'btn btn-info',
|
||||
closeOnClick: false
|
||||
},
|
||||
cancel: {
|
||||
'class': 'btn btn-danger',
|
||||
closeOnClick: false
|
||||
},
|
||||
yes: {
|
||||
'class': 'btn btn-success',
|
||||
closeOnClick: false
|
||||
},
|
||||
no: {
|
||||
'class': 'btn btn-warning',
|
||||
closeOnClick: false
|
||||
},
|
||||
custom: {
|
||||
'class': 'btn btn-default',
|
||||
text: 'Custom'
|
||||
}
|
||||
},
|
||||
callback: function (lobibox, type) {
|
||||
var btnType;
|
||||
if (type === 'no') {
|
||||
btnType = 'warning';
|
||||
} else if (type === 'yes') {
|
||||
btnType = 'success';
|
||||
} else if (type === 'ok') {
|
||||
btnType = 'info';
|
||||
} else if (type === 'cancel') {
|
||||
btnType = 'error';
|
||||
}
|
||||
Lobibox.notify(btnType, {
|
||||
size: 'mini',
|
||||
msg: 'This is ' + btnType + ' message'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// confirm
|
||||
Lobibox.confirm({
|
||||
msg: "Are you ok",
|
||||
});
|
||||
Lobibox.confirm({
|
||||
msg: "Are you ok",
|
||||
});
|
||||
|
||||
// prompt
|
||||
Lobibox.prompt("text", {
|
||||
title: 'Please enter username',
|
||||
//Attributes of <input>
|
||||
attrs: {
|
||||
placeholder: "Username"
|
||||
}
|
||||
});
|
||||
Lobibox.prompt("text", {
|
||||
title: 'Please enter username',
|
||||
//Attributes of <input>
|
||||
attrs: {
|
||||
placeholder: "Username"
|
||||
}
|
||||
});
|
||||
|
||||
// progress
|
||||
Lobibox.progress({
|
||||
title: 'Please wait',
|
||||
label: 'Uploading files...',
|
||||
onShow: function ($this) {
|
||||
var i = 0;
|
||||
var inter = setInterval(function () {
|
||||
window.console.log(i);
|
||||
if (i > 100) {
|
||||
clearInterval(inter);
|
||||
Lobibox.progress({
|
||||
title: 'Please wait',
|
||||
label: 'Uploading files...',
|
||||
onShow: function ($this) {
|
||||
var i = 0;
|
||||
var inter = setInterval(function () {
|
||||
window.console.log(i);
|
||||
if (i > 100) {
|
||||
clearInterval(inter);
|
||||
}
|
||||
i = i + 0.1;
|
||||
$this.setProgress(i);
|
||||
}, 10);
|
||||
}
|
||||
i = i + 0.1;
|
||||
$this.setProgress(i);
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// window
|
||||
Lobibox.window({
|
||||
title: 'Window title',
|
||||
//Available types: string, jquery object, function
|
||||
content: function () {
|
||||
return $('.container');
|
||||
},
|
||||
url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css',
|
||||
autoload: false,
|
||||
loadMethod: 'GET',
|
||||
//Load parameters
|
||||
params: {
|
||||
param1: 'Lorem',
|
||||
param2: 'Ipsum'
|
||||
},
|
||||
buttons: {
|
||||
load: {
|
||||
text: 'Load from url'
|
||||
},
|
||||
close: {
|
||||
text: 'Close',
|
||||
closeOnClick: true
|
||||
}
|
||||
},
|
||||
callback: function ($this, type, ev) {
|
||||
if (type === 'load') {
|
||||
$this.load(function () {
|
||||
//Do something when content is loaded
|
||||
});
|
||||
}
|
||||
Lobibox.window({
|
||||
title: 'Window title',
|
||||
//Available types: string, jquery object, function
|
||||
content: function () {
|
||||
return $('.container');
|
||||
},
|
||||
url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css',
|
||||
autoload: false,
|
||||
loadMethod: 'GET',
|
||||
//Load parameters
|
||||
params: {
|
||||
param1: 'Lorem',
|
||||
param2: 'Ipsum'
|
||||
},
|
||||
buttons: {
|
||||
load: {
|
||||
text: 'Load from url'
|
||||
},
|
||||
close: {
|
||||
text: 'Close',
|
||||
closeOnClick: true
|
||||
}
|
||||
},
|
||||
callback: function ($this, type, ev) {
|
||||
if (type === 'load') {
|
||||
$this.load(function () {
|
||||
//Do something when content is loaded
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user