diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts new file mode 100644 index 000000000..4a14edf47 --- /dev/null +++ b/lobibox/lobibox.js-test.ts @@ -0,0 +1,134 @@ +/** + * Created by itboy on 11/22/2015. + */ + /// + /// + + //extending default parameters +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"}); + +// 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"}); + +//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' + }); + } +}); + +// confirm +Lobibox.confirm({ + msg: "Are you ok", +}); + +// prompt +Lobibox.prompt("text", { + title: 'Please enter username', + //Attributes of + 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); + } + 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 + }); + } + } +});