From 2440326118730fd8ec352217dc43cd6688955eb0 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:39:01 +0500 Subject: [PATCH] lobibox test code updated --- lobibox/lobibox.js-test.ts | 224 +++++++++++++++++++------------------ 1 file changed, 114 insertions(+), 110 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index 4a14edf47..6060ac175 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -5,130 +5,134 @@ /// //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 - attrs: { - placeholder: "Username" - } -}); + 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); + 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 + }); + } + } + }); } -}); +}