├── .dockerignore ├── .gitignore ├── ChromeExtension ├── abc.js ├── admin.js ├── icon128.png ├── icon16.png ├── icon48.png ├── index.html ├── lib │ └── wsc-chrome.js ├── manifest.json ├── sr │ ├── index.html │ ├── main.css │ └── main.js ├── test.js └── wsc-chrome.js ├── Dockerfile ├── LICENSE ├── README.md ├── Samples └── AspDotCore │ └── WebApp │ ├── WebApp.sln │ └── WebApp │ ├── Controllers │ ├── HomeController.cs │ ├── LoginController.cs │ ├── NotificationController.cs │ └── TestController.cs │ ├── Hubs │ ├── SampleHub.cs │ └── SecuredHub.cs │ ├── Images │ ├── Advance_Token.gif │ ├── Basic_View.gif │ ├── Basic_View_Json_Param.gif │ ├── Basic_View_Multi_Param.gif │ └── Server_Broadcast_Msg.gif │ ├── Models │ ├── Address.cs │ ├── ErrorViewModel.cs │ └── User.cs │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Readme.md │ ├── SignalRWebClient │ ├── 48cec457a2842b4db342ce5a7efe615a.wav │ ├── index.html │ ├── main.css │ └── main.js │ ├── Startup.cs │ ├── Views │ ├── Home │ │ ├── Index.cshtml │ │ └── Privacy.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _CookieConsentPartial.cshtml │ │ ├── _Layout.cshtml │ │ └── _ValidationScriptsPartial.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── WebApp.csproj │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── css │ └── site.css │ ├── favicon.ico │ ├── index.html │ ├── js │ └── site.js │ ├── lib │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map │ ├── main.css │ └── main.js ├── _config.yml ├── dist ├── 48cec457a2842b4db342ce5a7efe615a.wav ├── index.html ├── main.css └── main.js ├── package-lock.json ├── package.json ├── src ├── Index.html ├── assets │ ├── Notification.wav │ └── Ting.mp3 ├── css │ ├── lib │ │ ├── bootstrap.css │ │ └── bootstrap.js │ └── main.css ├── images │ ├── 1.PNG │ ├── 2.PNG │ ├── 3.PNG │ ├── 4.PNG │ ├── 5.PNG │ ├── Advance_Token.gif │ ├── Basic_View.gif │ ├── Basic_View_ Multi_Param.gif │ ├── Basic_View_Json_Param.gif │ ├── Server_Broadcast_Msg.gif │ ├── SignalR-Web-Client.jpg │ └── delete.png └── js │ ├── components │ ├── app.component.js │ ├── dialogbox │ │ ├── custompopup.js │ │ └── custompopupStyle.css │ ├── logic │ │ ├── app.logic.js │ │ └── lib │ │ │ ├── app.common.js │ │ │ └── app.signalr.js │ ├── srform.component.js │ └── srform.js │ └── main.js └── webpack.config.js /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | 3 | # User-specific files 4 | *.suo 5 | *.user 6 | *.sln.docstates 7 | 8 | # dotnet stuff 9 | project.lock.json 10 | 11 | # Build results 12 | [Dd]ebug/ 13 | [Rr]elease/ 14 | x64/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | #project files 19 | .vs/ -------------------------------------------------------------------------------- /ChromeExtension/abc.js: -------------------------------------------------------------------------------- 1 | function init() { 2 | console.log('App launch'); 3 | 4 | var url = document.getElementById('server-url').value; 5 | var port = document.getElementById('server-port').value; 6 | 7 | debugger; 8 | startWebserver(url, port, 'SR', null); 9 | 10 | 11 | 12 | function startWebserverDirectoryEntry(host,port,entry) { 13 | directoryServer = new WSC.WebApplication({host:host, 14 | port:port, 15 | renderIndex:true, 16 | entry:entry 17 | }) 18 | directoryServer.start() 19 | } 20 | 21 | //directory must be a subdirectory of the package 22 | function startWebserver(host,port,directory,settings){ 23 | chrome.runtime.getPackageDirectoryEntry(function(packageDirectory){ 24 | 25 | console.log('packageDirectory - ' + packageDirectory); 26 | var data1 = packageDirectory.getDirectory(directory,{create: false},function(webroot){ 27 | 28 | console.log('webroot - ' + webroot); 29 | debugger; 30 | 31 | var fs = new WSC.FileSystem(webroot) 32 | var handlers = [['/data.*', AdminDataHandler], 33 | ['.*', WSC.DirectoryEntryHandler.bind(null, fs)]] 34 | adminServer = new WSC.WebApplication({host:host, 35 | port:port, 36 | handlers:handlers, 37 | renderIndex:true, 38 | auth:{ username: "a", 39 | password: "a" } 40 | }) 41 | adminServer.start() 42 | }, function(e) { 43 | 44 | console.log('error g'); 45 | console.log(e); 46 | }); 47 | 48 | }); 49 | // console.log('data1'); 50 | // console.log(data1); 51 | } 52 | } 53 | 54 | window.onload = function () { 55 | debugger; 56 | document.querySelector("#server-start").addEventListener("click", function() { 57 | 58 | 59 | var url = document.getElementById('server-url').value; 60 | var port = document.getElementById('server-port').value; 61 | 62 | var srWcServer = { Url: url, Port: port }; 63 | 64 | chrome.storage.sync.set({'srWcServerInfo': srWcServer}); 65 | chrome.runtime.sendMessage('demo'); 66 | 67 | // chrome.storage.sync.get(['srWcServerInfo'], function(result) { 68 | // console.log('Value currently is ' + result.srWcServerInfo); 69 | // console.log('Value currently is ' + result); 70 | // }); 71 | } ); 72 | }; -------------------------------------------------------------------------------- /ChromeExtension/admin.js: -------------------------------------------------------------------------------- 1 | function AdminDataHandler(request) { 2 | WSC.BaseHandler.prototype.constructor.call(this) 3 | } 4 | _.extend(AdminDataHandler.prototype, { 5 | put: function() { 6 | 7 | var newData = this.request.bodyparams 8 | 9 | chrome.storage.local.get(null, function(data) { 10 | 11 | var saveData = {} 12 | var restart = false; 13 | for(var key in newData){ 14 | var value = newData[key] 15 | if(data.hasOwnProperty(key)){ 16 | data[key] = value; 17 | saveData[key] = value; 18 | if(key == "url"){ 19 | chrome.runtime.sendMessage({url: value}); 20 | } 21 | }else if(key == "restart"){ 22 | restart = true; 23 | } 24 | } 25 | chrome.storage.local.set(saveData); 26 | this.setHeader('content-type','text/json') 27 | var buf = new TextEncoder('utf-8').encode(JSON.stringify(data)).buffer 28 | this.write(buf) 29 | this.finish() 30 | 31 | if(restart) setTimeout( function() { 32 | // allow writing out response first. 33 | chrome.runtime.sendMessage('reload'); 34 | }, 1000 ) 35 | 36 | 37 | }.bind(this)) 38 | 39 | }, 40 | get: function() { 41 | chrome.storage.local.get(null, function(data) { 42 | this.setHeader('content-type','text/json') 43 | var buf = new TextEncoder('utf-8').encode(JSON.stringify(data)).buffer 44 | this.write(buf) 45 | this.finish() 46 | }.bind(this)) 47 | } 48 | }, WSC.BaseHandler.prototype) 49 | -------------------------------------------------------------------------------- /ChromeExtension/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/ChromeExtension/icon128.png -------------------------------------------------------------------------------- /ChromeExtension/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/ChromeExtension/icon16.png -------------------------------------------------------------------------------- /ChromeExtension/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/ChromeExtension/icon48.png -------------------------------------------------------------------------------- /ChromeExtension/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 66 | 67 | 68 |
7 |
8 |
9 |
Learn about building Web apps with ASP.NET Core.
8 |Use this page to detail your site's privacy policy.
7 | -------------------------------------------------------------------------------- /Samples/AspDotCore/WebApp/WebApp/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |
12 | Request ID: @Model.RequestId
13 |
18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |
26 | -------------------------------------------------------------------------------- /Samples/AspDotCore/WebApp/WebApp/Views/Shared/_CookieConsentPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Http.Features 2 | 3 | @{ 4 | var consentFeature = Context.Features.Get9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!c.settings.submitHandler||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.hasAttribute("contenteditable")&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){!this.form&&this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name"));var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=d),!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);if("function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f){if(j=f.call(b,j),"string"!=typeof j)throw new TypeError("The normalizer should return a string value.");delete g.normalizer}for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a Warning: No message defined for "+b.name+""),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a}); -------------------------------------------------------------------------------- /Samples/AspDotCore/WebApp/WebApp/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright JS Foundation and other contributors, https://js.foundation/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-dinky -------------------------------------------------------------------------------- /dist/48cec457a2842b4db342ce5a7efe615a.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/dist/48cec457a2842b4db342ce5a7efe615a.wav -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | SignalR Web Client -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "signalr-web-client", 3 | "version": "1.0.0", 4 | "description": "ASP.Net Core SignalR Web Client.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "build": "webpack --mode production", 9 | "dev": "webpack-dev-server --content-base dist --hot --mode development" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/gouravdwivedi6590/SignalR-JS-Client.git" 14 | }, 15 | "author": "", 16 | "license": "ISC", 17 | "bugs": { 18 | "url": "https://github.com/gouravdwivedi6590/SignalR-JS-Client/issues" 19 | }, 20 | "homepage": "https://github.com/gouravdwivedi6590/SignalR-JS-Client#readme", 21 | "dependencies": { 22 | "@microsoft/signalr": "^3.1.2", 23 | "@webcomponents/webcomponentsjs": "^2.2.10", 24 | "bootstrap": "^4.3.1", 25 | "jquery": "^3.4.1", 26 | "material-design-lite": "^1.3.0", 27 | "mitt": "^1.1.3", 28 | "popper.js": "^1.15.0" 29 | }, 30 | "devDependencies": { 31 | "@babel/core": "^7.5.4", 32 | "@babel/preset-env": "^7.5.4", 33 | "babel-loader": "^8.0.6", 34 | "css-loader": "^3.0.0", 35 | "file-loader": "^4.2.0", 36 | "html-loader": "^0.5.5", 37 | "html-webpack-plugin": "^3.2.0", 38 | "mini-css-extract-plugin": "^0.7.0", 39 | "url-loader": "^2.1.0", 40 | "webpack": "^4.35.3", 41 | "webpack-cli": "^3.3.5", 42 | "webpack-dev-server": "^3.7.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SignalR Web Client
SignalR Web Client 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 |19 |20 | 21 | 22 | 23 | 34 | 35 | SignalR Web Client 36 | 37 | 38 | 41 | 42 | 54 | 55 | 56 | 57 | 58 | 65 | 66 | 67 | 69 | 75 | 76 | 77 |86 | 87 | -------------------------------------------------------------------------------- /src/assets/Notification.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/assets/Notification.wav -------------------------------------------------------------------------------- /src/assets/Ting.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/assets/Ting.mp3 -------------------------------------------------------------------------------- /src/css/main.css: -------------------------------------------------------------------------------- 1 | /* @import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"); */ 2 | 3 | h1 { 4 | color: rgb(51, 153, 97); 5 | } 6 | 7 | body { 8 | padding : 0px ; 9 | margin: 0px; 10 | font-family: 'Roboto', 'Helvetica', sans-serif; 11 | /* min-height: 600px ; */ 12 | /* height: 2000px; */ 13 | } 14 | 15 | html { 16 | overflow-y:scroll; /*This make the scrollbar always visible and only active when needed. */ 17 | } 18 | 19 | .tab { 20 | margin-top: 20px; 21 | } 22 | 23 | /* .tabcontent .tab-pane{ border:solid 1px blue; border-top: 0}; */ 24 | #tabheader li a { 25 | /* background-color: rgb(17, 106, 158); */ 26 | background-color: rgb(63,81,181); 27 | /* color: white; */ 28 | color: rgb(255,255,255); 29 | font-size: 20px; 30 | } 31 | 32 | #tabheader a.active { 33 | border-bottom-color: transparent; 34 | background-color: white; 35 | color: black; 36 | } 37 | 38 | .tab-content { 39 | background-color: white; 40 | 41 | } 42 | .panel { 43 | padding-top : 10px; 44 | padding-left: 1px; 45 | padding-right: 1px; 46 | padding-bottom: 1px; 47 | /* padding: 10px, 10px,10px, 10px; */ 48 | /* background-color: rgb(17, 106, 158); */ 49 | background-color: rgb(63,81,181); 50 | border: 1px; 51 | 52 | } 53 | 54 | li:hover { 55 | background-color: rgb(63,81,181); 56 | } 57 | 58 | /* #tab-header .nav-pills > li > a { 59 | border-radius: 4px 4px 0 0 ; 60 | } 61 | 62 | #tab-header .nav-tabs > li > a { 63 | border-radius: 4px 4px 0 0 ; 64 | } */ 65 | 66 | /* .active a { 67 | 68 | background-color: #428bca !important; 69 | 70 | } 71 | */ 72 | /* .active{ 73 | background-color: #428bca; 74 | } */ 75 | 76 | #tab-header .tab-content { 77 | /* color : white; */ 78 | /* background-color: #428bca; */ 79 | padding : 5px 15px; 80 | } 81 | 82 | .method-arguments { 83 | padding-top: 0px; 84 | } 85 | 86 | .hr.div-splitter { 87 | height: 10px; 88 | border: 0; 89 | box-shadow: 0 10px 10px -10px #8c8b8b inset; 90 | } 91 | hr.horizontal-line { 92 | height: 10px; 93 | border: 0; 94 | box-shadow: 0 10px 10px -10px #8c8b8b inset; 95 | margin-top: 10px; 96 | margin-bottom: 10px; 97 | } 98 | 99 | .btn-send-payload { 100 | margin-right: 10px; 101 | } 102 | 103 | ul.nav .nav-item a:hover { 104 | /* border-color: rgb(17, 106, 158) !important; */ 105 | border-color: rgb(63,81,181) !important; 106 | } 107 | ul.nav .nav-link.active:hover { 108 | border-color: white !important; 109 | } 110 | 111 | .bg-gray { 112 | background-color:#cccccc; 113 | border-color: black; 114 | border-width: 2px; 115 | border-style: double; 116 | padding: 10px; 117 | } 118 | 119 | .loggerView { 120 | word-wrap: break-word;/*Used because long log messages going out of div.*/ 121 | border-radius: 5px 5px 5px 5px; 122 | box-sizing: border-box; 123 | border-style: solid; 124 | border-top-width: 3px; 125 | border-right-width: 3px; 126 | border-bottom-width: .5px; 127 | border-left-width: .5px; 128 | border-color: rgba(63, 81, 181, 1); 129 | border-style: solid; 130 | background-color: rgb(255,255,255); 131 | 132 | } 133 | 134 | .logger-header { 135 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 136 | text-transform: uppercase; 137 | font-size: 20px; 138 | color: rgba(0,0,0,.54); 139 | font-weight: 500; 140 | margin-bottom: 20px; 141 | } 142 | 143 | .logger-container { 144 | padding: 10px; 145 | margin-top: 50px; 146 | } 147 | 148 | #app-logs { 149 | overflow-x: hidden; 150 | overflow-y: auto; 151 | min-height: 5px; 152 | max-height: 400px; 153 | } 154 | 155 | /* Align span text in center of the div */ 156 | .mdl-layout-title { 157 | display:table; 158 | margin:0 auto; 159 | } 160 | 161 | .error { 162 | width: 100%; 163 | padding: 0; 164 | margin: 0%; 165 | font-size: 80%; 166 | color: #900; 167 | border-radius: 0 0 5px 5px; 168 | box-sizing: border-box; 169 | font-style: italic; 170 | font-weight: bold; 171 | } 172 | 173 | .error.active { 174 | padding: 0.3em; 175 | } 176 | 177 | #inputResponseData { 178 | height: 150px; 179 | overflow-x: hidden; 180 | overflow-y: auto; 181 | text-align: left; 182 | padding: 5px; 183 | border-radius: 5px 5px 5px 5px; 184 | box-sizing: border-box; 185 | border-style: solid; 186 | border-top-width: 3px; 187 | border-right-width: 3px; 188 | border-bottom-width: .5px; 189 | border-left-width: .5px; 190 | border-color: rgba(63, 81, 181, 1); 191 | } 192 | 193 | .label-title { 194 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 195 | text-transform: uppercase; 196 | font-size: 14px; 197 | color: rgba(0,0,0,.54); 198 | font-weight: 500; 199 | } 200 | 201 | .chk-text { 202 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 203 | font-size: 12px; 204 | color: rgba(0,0,0,.54); 205 | font-weight: 500; 206 | } 207 | 208 | .logger-text { 209 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 210 | font-size: 12px; 211 | color: rgba(0,0,0,.54); 212 | font-weight: 500; 213 | } 214 | 215 | .skip-negotiation-desc { 216 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 217 | font-size: 11px; 218 | color: rgba(0,0,0,.54); 219 | font-weight: 500; 220 | } 221 | 222 | .args-container { 223 | margin-top: 10px; 224 | padding-top: 10px; 225 | border-radius: 5px 5px 5px 5px; 226 | box-sizing: border-box; 227 | border-style: solid; 228 | border-top-width: 1.5px; 229 | border-right-width: 1.5px; 230 | border-bottom-width: .5px; 231 | border-left-width: .5px; 232 | border-color: rgba(63, 81, 181, 1); 233 | } 234 | 235 | /* .mdl-layout__header-row { 236 | padding: 0px 0px 0px 80px; 237 | margin: 0 0 0 0; 238 | } 239 | 240 | #demo-menu-lower-left { 241 | padding: 0; 242 | margin: 0; 243 | } */ 244 | 245 | .scale-in-ver-top { 246 | -webkit-animation: scale-in-ver-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; 247 | animation: scale-in-ver-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; 248 | } 249 | 250 | /* ---------------------------------------------- 251 | * Generated by Animista on 2020-4-13 1:55:23 252 | * Licensed under FreeBSD License. 253 | * See http://animista.net/license for more info. 254 | * w: http://animista.net, t: @cssanimista 255 | * ---------------------------------------------- */ 256 | 257 | /** 258 | * ---------------------------------------- 259 | * animation scale-in-ver-top 260 | * ---------------------------------------- 261 | */ 262 | @-webkit-keyframes scale-in-ver-top { 263 | 0% { 264 | -webkit-transform: scaleY(0); 265 | transform: scaleY(0); 266 | -webkit-transform-origin: 100% 0%; 267 | transform-origin: 100% 0%; 268 | opacity: 1; 269 | } 270 | 100% { 271 | -webkit-transform: scaleY(1); 272 | transform: scaleY(1); 273 | -webkit-transform-origin: 100% 0%; 274 | transform-origin: 100% 0%; 275 | opacity: 1; 276 | } 277 | } 278 | @keyframes scale-in-ver-top { 279 | 0% { 280 | -webkit-transform: scaleY(0); 281 | transform: scaleY(0); 282 | -webkit-transform-origin: 100% 0%; 283 | transform-origin: 100% 0%; 284 | opacity: 1; 285 | } 286 | 100% { 287 | -webkit-transform: scaleY(1); 288 | transform: scaleY(1); 289 | -webkit-transform-origin: 100% 0%; 290 | transform-origin: 100% 0%; 291 | opacity: 1; 292 | } 293 | } 294 | -------------------------------------------------------------------------------- /src/images/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/1.PNG -------------------------------------------------------------------------------- /src/images/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/2.PNG -------------------------------------------------------------------------------- /src/images/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/3.PNG -------------------------------------------------------------------------------- /src/images/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/4.PNG -------------------------------------------------------------------------------- /src/images/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/5.PNG -------------------------------------------------------------------------------- /src/images/Advance_Token.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/Advance_Token.gif -------------------------------------------------------------------------------- /src/images/Basic_View.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/Basic_View.gif -------------------------------------------------------------------------------- /src/images/Basic_View_ Multi_Param.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/Basic_View_ Multi_Param.gif -------------------------------------------------------------------------------- /src/images/Basic_View_Json_Param.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/Basic_View_Json_Param.gif -------------------------------------------------------------------------------- /src/images/Server_Broadcast_Msg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/Server_Broadcast_Msg.gif -------------------------------------------------------------------------------- /src/images/SignalR-Web-Client.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/SignalR-Web-Client.jpg -------------------------------------------------------------------------------- /src/images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourav-d/SignalR-Web-Client/a8d53754189f47944df3488102088c151f740e01/src/images/delete.png -------------------------------------------------------------------------------- /src/js/components/app.component.js: -------------------------------------------------------------------------------- 1 | class AppComponent extends HTMLElement { 2 | constructor() { 3 | super(); 4 | } 5 | 6 | connectedCallback() { 7 | this.render(); 8 | } 9 | 10 | disconnectedCallback() { 11 | } 12 | 13 | attributeChangedCallback(attrName, oldVal, newVal) { 14 | this.render(); 15 | } 16 | 17 | render() { 18 | this.innerHTML = ` 19 | 20 |78 | 85 |79 |84 |80 |83 |
81 |82 | 21 |39 | `; 40 | } 41 | } 42 | 43 | if(!window.customElements.get("src-app")) { 44 | window.customElements.define("src-app", AppComponent); 45 | } -------------------------------------------------------------------------------- /src/js/components/dialogbox/custompopup.js: -------------------------------------------------------------------------------- 1 | import './custompopupStyle.css'; 2 | 3 | ;(function (window){ 4 | if(document.getElementById('dialogoverlay')) 5 | return; 6 | 7 | window.document.body.innerHTML = window.document.body.innerHTML + ` 8 | 9 |22 |38 | 30 | 31 |32 |37 |33 |36 |Basic
34 |35 | 10 |`; 16 | 17 | let dialogoverlay = document.getElementById('dialogoverlay'); 18 | let dialogbox = document.getElementById('dialogbox'); 19 | 20 | 21 | 22 | dialogbox.style.display = "none"; 23 | dialogoverlay.style.display = "none"; 24 | document.getElementById('dialogboxfoot').innerHTML = ''; 25 | document.getElementById('custom-popup-ok-btn') 26 | .addEventListener('click', function() { 27 | document.getElementById('dialogbox').style.display = "none"; 28 | document.getElementById('dialogoverlay').style.display = "none"; 29 | }) 30 | })(window) 31 | 32 | export function Alert(message, title) { 33 | 34 | let dialogoverlay = document.getElementById('dialogoverlay'); 35 | let dialogbox = document.getElementById('dialogbox'); 36 | 37 | let windowHeight = window.innerHeight; 38 | dialogoverlay.style.height = windowHeight + "px"; 39 | 40 | dialogbox.style.top = "100px"; 41 | 42 | dialogbox.style.display = "block"; 43 | dialogoverlay.style.display = "block"; 44 | 45 | if(typeof title === "undefined") { 46 | document.getElementById('dialogboxhead').style.display = "none"; 47 | } else { 48 | document.getElementById('dialogboxhead').innerHTML = ' '+ title; 49 | } 50 | 51 | document.getElementById('dialogboxbody').innerHTML = message; 52 | } -------------------------------------------------------------------------------- /src/js/components/dialogbox/custompopupStyle.css: -------------------------------------------------------------------------------- 1 | @import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"); 2 | 3 | /* ---------------Animation---------------- */ 4 | 5 | .slide-in-top { 6 | -webkit-animation: slide-in-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; 7 | animation: slide-in-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; 8 | } 9 | /* ---------------------------------------------- 10 | * Generated by Animista on 2020-4-13 0:23:43 11 | * Licensed under FreeBSD License. 12 | * See http://animista.net/license for more info. 13 | * w: http://animista.net, t: @cssanimista 14 | * ---------------------------------------------- */ 15 | 16 | /** 17 | * ---------------------------------------- 18 | * animation slide-in-top 19 | * ---------------------------------------- 20 | */ 21 | @-webkit-keyframes slide-in-top { 22 | 0% { 23 | -webkit-transform: translateY(-1000px); 24 | transform: translateY(-1000px); 25 | opacity: 0; 26 | } 27 | 100% { 28 | -webkit-transform: translateY(0); 29 | transform: translateY(0); 30 | opacity: 1; 31 | } 32 | } 33 | @keyframes slide-in-top { 34 | 0% { 35 | -webkit-transform: translateY(-1000px); 36 | transform: translateY(-1000px); 37 | opacity: 0; 38 | } 39 | 100% { 40 | -webkit-transform: translateY(0); 41 | transform: translateY(0); 42 | opacity: 1; 43 | } 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | .slit-in-vertical { 61 | -webkit-animation: slit-in-vertical 0.45s ease-out both; 62 | animation: slit-in-vertical 0.45s ease-out both; 63 | } 64 | 65 | @-webkit-keyframes slit-in-vertical { 66 | 0% { 67 | -webkit-transform: translateZ(-800px) rotateY(90deg); 68 | transform: translateZ(-800px) rotateY(90deg); 69 | opacity: 0; 70 | } 71 | 54% { 72 | -webkit-transform: translateZ(-160px) rotateY(87deg); 73 | transform: translateZ(-160px) rotateY(87deg); 74 | opacity: 1; 75 | } 76 | 100% { 77 | -webkit-transform: translateZ(0) rotateY(0); 78 | transform: translateZ(0) rotateY(0); 79 | } 80 | } 81 | @keyframes slit-in-vertical { 82 | 0% { 83 | -webkit-transform: translateZ(-800px) rotateY(90deg); 84 | transform: translateZ(-800px) rotateY(90deg); 85 | opacity: 0; 86 | } 87 | 54% { 88 | -webkit-transform: translateZ(-160px) rotateY(87deg); 89 | transform: translateZ(-160px) rotateY(87deg); 90 | opacity: 1; 91 | } 92 | 100% { 93 | -webkit-transform: translateZ(0) rotateY(0); 94 | transform: translateZ(0) rotateY(0); 95 | } 96 | } 97 | 98 | /*---------------#region Alert--------------- */ 99 | 100 | #dialogoverlay{ 101 | display: none; 102 | opacity: .8; 103 | position: fixed; 104 | top: 0px; 105 | left: 0px; 106 | background: #707070; 107 | width: 100%; 108 | z-index: 10; 109 | } 110 | 111 | #dialogbox{ 112 | display: none; 113 | position: absolute; 114 | /* background: rgb(0, 47, 43); */ 115 | background: #E1DEE0; 116 | border-radius:7px; 117 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.575); 118 | transition: 0.3s; 119 | width: 40%; 120 | z-index: 10; 121 | top:0; 122 | left: 0; 123 | right: 0; 124 | margin: auto; 125 | } 126 | 127 | #dialogbox:hover { 128 | box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.911); 129 | } 130 | 131 | /* .container { 132 | padding: 2px 16px; 133 | } */ 134 | 135 | .pure-material-button-contained { 136 | position: relative; 137 | display: inline-block; 138 | box-sizing: border-box; 139 | border: none; 140 | border-radius: 4px; 141 | padding: 0 16px; 142 | min-width: 64px; 143 | height: 36px; 144 | vertical-align: middle; 145 | text-align: center; 146 | text-overflow: ellipsis; 147 | text-transform: uppercase; 148 | color: rgb(var(--pure-material-onprimary-rgb, 255, 255, 255)); 149 | background-color: rgb(var(--pure-material-primary-rgb, 51, 133, 255)); 150 | /* background-color: rgb(1, 47, 61) */ 151 | box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12); 152 | font-family: var(--pure-material-font, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system); 153 | font-size: 14px; 154 | font-weight: 500; 155 | line-height: 36px; 156 | overflow: hidden; 157 | outline: none; 158 | cursor: pointer; 159 | transition: box-shadow 0.2s; 160 | } 161 | 162 | .pure-material-button-contained::-moz-focus-inner { 163 | border: none; 164 | } 165 | 166 | /* ---------------Overlay--------------- */ 167 | 168 | .pure-material-button-contained::before { 169 | content: ""; 170 | position: absolute; 171 | top: 0; 172 | bottom: 0; 173 | left: 0; 174 | right: 0; 175 | background-color: rgb(var(--pure-material-onprimary-rgb, 255, 255, 255)); 176 | opacity: 0; 177 | transition: opacity 0.2s; 178 | } 179 | 180 | /* Ripple */ 181 | .pure-material-button-contained::after { 182 | content: ""; 183 | position: absolute; 184 | left: 50%; 185 | top: 50%; 186 | border-radius: 50%; 187 | padding: 50%; 188 | width: 32px; /* Safari */ 189 | height: 32px; /* Safari */ 190 | background-color: rgb(var(--pure-material-onprimary-rgb, 255, 255, 255)); 191 | opacity: 0; 192 | transform: translate(-50%, -50%) scale(1); 193 | transition: opacity 1s, transform 0.5s; 194 | } 195 | 196 | /* Hover, Focus */ 197 | .pure-material-button-contained:hover, 198 | .pure-material-button-contained:focus { 199 | box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12); 200 | } 201 | 202 | .pure-material-button-contained:hover::before { 203 | opacity: 0.08; 204 | } 205 | 206 | .pure-material-button-contained:focus::before { 207 | opacity: 0.24; 208 | } 209 | 210 | .pure-material-button-contained:hover:focus::before { 211 | opacity: 0.3; 212 | } 213 | 214 | /* Active */ 215 | .pure-material-button-contained:active { 216 | box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12); 217 | } 218 | 219 | .pure-material-button-contained:active::after { 220 | opacity: 0.32; 221 | transform: translate(-50%, -50%) scale(0); 222 | transition: transform 0s; 223 | } 224 | 225 | /* Disabled */ 226 | .pure-material-button-contained:disabled { 227 | color: rgba(var(--pure-material-onsurface-rgb, 0, 0, 0), 0.38); 228 | background-color: rgba(var(--pure-material-onsurface-rgb, 0, 0, 0), 0.12); 229 | box-shadow: none; 230 | cursor: initial; 231 | } 232 | 233 | .pure-material-button-contained:disabled::before { 234 | opacity: 0; 235 | } 236 | 237 | .pure-material-button-contained:disabled::after { 238 | opacity: 0; 239 | } 240 | 241 | #dialogbox > div{ 242 | background:#FFF; 243 | margin:8px; 244 | } 245 | 246 | #dialogbox > div > #dialogboxhead{ 247 | /* background: rgb(0, 77, 70); */ 248 | background:#3385FF; 249 | font-size:19px; 250 | padding:10px; 251 | color:rgb(255, 255, 255); 252 | font-family: Verdana, Geneva, Tahoma, sans-serif ; 253 | } 254 | 255 | #dialogbox > div > #dialogboxbody{ 256 | /* background:rgb(0, 47, 43); */ 257 | background: #E1DEE0; 258 | padding:20px; 259 | color: black; 260 | font-family: Verdana, Geneva, Tahoma, sans-serif ; 261 | } 262 | 263 | #dialogbox > div > #dialogboxfoot{ 264 | /* background: rgb(0, 47, 43); */ 265 | background: #E1DEE0; 266 | padding:10px; 267 | text-align:right; 268 | } 269 | /*#endregion Alert*/ -------------------------------------------------------------------------------- /src/js/components/logic/app.logic.js: -------------------------------------------------------------------------------- 1 | import * as appSignalR from './lib/app.signalr'; 2 | 3 | var sr = null; 4 | class AppLogic { 5 | 6 | constructor() { 7 | this.isTokenRequired = false; 8 | this.isBasicView = true; 9 | } 10 | 11 | Init(options) { 12 | 13 | if(this.isBasicView !== true && this.isTokenRequired === true) { 14 | //adding new property to options object 15 | options["isTokenRequired"] = true; 16 | } 17 | else { 18 | options["isTokenRequired"] = false; 19 | } 20 | 21 | sr = new appSignalR.SignalRApp(options.url); 22 | sr.Init(options); 23 | } 24 | 25 | OnConnect(onSuccess, onError) { 26 | sr.OnConnect(onSuccess, onError); 27 | } 28 | 29 | OnSend(options, beforeInvoke, onError) { 30 | sr.OnSend(options, beforeInvoke, onError); 31 | } 32 | 33 | OnReceive(callback) { 34 | sr.OnReceive(callback); 35 | } 36 | 37 | OnDisconnect(onSuccess, onError) { 38 | sr.OnDisconnect(onSuccess, onError); 39 | } 40 | 41 | EnableAuth() { 42 | this.isTokenRequired = true; 43 | } 44 | 45 | DisableAuth() { 46 | this.isTokenRequired = false; 47 | } 48 | 49 | IsAuthEnabled() { 50 | return this.isTokenRequired; 51 | } 52 | 53 | GetCurrentView() { 54 | return this.isBasicView; 55 | } 56 | 57 | SetCurrentViewAsBasic() { 58 | this.isBasicView = true; 59 | } 60 | 61 | SetCurrentViewAsAdvance() { 62 | this.isBasicView = false; 63 | } 64 | } 65 | 66 | export { AppLogic } -------------------------------------------------------------------------------- /src/js/components/logic/lib/app.common.js: -------------------------------------------------------------------------------- 1 | import mitt from 'mitt'; 2 | 3 | const ContentType = { 4 | TEXT : "Text", 5 | NUMBER : "Number", 6 | JSON : "JSON" 7 | } 8 | 9 | const AppEvents = mitt(); 10 | 11 | function DisableElementByClassName(className) { 12 | var el = document.getElementsByClassName(className); 13 | 14 | for (var i = 0; i < el.length; i++) { 15 | el[i].disabled = true; 16 | } 17 | } 18 | 19 | function EnableElementByClassName(className) { 20 | var el = document.getElementsByClassName(className); 21 | 22 | for (var i = 0; i < el.length; i++) { 23 | el[i].disabled = false; 24 | } 25 | } 26 | 27 | function HideElementByClassName(className) { 28 | var el = document.getElementsByClassName(className); 29 | 30 | for (var i = 0; i < el.length; i++) { 31 | el[i].style.display = "node"; 32 | } 33 | } 34 | 35 | function ShowElementByClassName(className) { 36 | var el = document.getElementsByClassName(className); 37 | 38 | for (var i = 0; i < el.length; i++) { 39 | el[i].style.display = "block"; 40 | } 41 | } 42 | 43 | function IsValidUrl(url) 44 | { 45 | var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol 46 | '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name 47 | '((\\d{1,3}\\.){3}\\d{1,3}))'+ // ip (v4) address 48 | '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ //port 49 | '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string 50 | '(\\#[-a-z\\d_]*)?$','i'); 51 | return pattern.test(url); 52 | } 53 | 54 | function IsValidJSON(data) 55 | { 56 | try { 57 | JSON. parse(str); 58 | } catch (e) { 59 | return false; 60 | } 61 | } 62 | 63 | export { 64 | ContentType, 65 | AppEvents, 66 | EnableElementByClassName, 67 | DisableElementByClassName, 68 | HideElementByClassName, 69 | ShowElementByClassName, 70 | IsValidUrl, 71 | IsValidJSON 72 | }; -------------------------------------------------------------------------------- /src/js/components/logic/lib/app.signalr.js: -------------------------------------------------------------------------------- 1 | import * as SignalR from "@microsoft/signalr"; 2 | import { AppEvents } from './app.common'; 3 | 4 | class SignalRApp { 5 | constructor(url) { 6 | this.url = url; 7 | this.connection = null; 8 | this.isConnected = false; 9 | this.processResponse = null; 10 | } 11 | 12 | Init(options) { 13 | 14 | var confguration = {}; 15 | if(options.isTokenRequired === true) { 16 | // options.skipNegotiation = true; 17 | confguration.accessTokenFactory = () => options.getToken(); 18 | } 19 | 20 | switch(options.transportType) { 21 | case "ws": 22 | confguration.transport = SignalR.HttpTransportType.WebSockets; 23 | break; 24 | case "lp": 25 | confguration.transport = SignalR.HttpTransportType.LongPolling; 26 | break; 27 | case "sse": 28 | confguration.transport = SignalR.HttpTransportType.ServerSentEvents; 29 | break; 30 | default: 31 | confguration.transport = SignalR.HttpTransportType.WebSockets; 32 | } 33 | 34 | //confguration.logMessageContent = true; 35 | if(!!options.skipNegotiation) { 36 | confguration.skipNegotiation = options.skipNegotiation; 37 | } 38 | 39 | this.connection = new SignalR.HubConnectionBuilder() 40 | .withUrl(options.url, confguration) 41 | .configureLogging(SignalR.LogLevel.Information) 42 | .withAutomaticReconnect([0, 3000, 5000, 10000, 15000, 30000]) 43 | .build(); 44 | 45 | //Receive Data 46 | //Reading the raw response 47 | var self = this; 48 | self.processResponse = self.connection.processIncomingData; 49 | 50 | self.connection.processIncomingData = function (data) { 51 | self.processResponse.call(self.connection, data); 52 | self.HandleResponse(data); 53 | } 54 | 55 | self.connection.onreconnecting((error) => { 56 | AppEvents.emit('Logger', `Connection lost due to error "${error}". Reconnecting.`); 57 | console.log('On Reconnecting...'); 58 | }); 59 | 60 | self.connection.onreconnected((connectionId) => { 61 | AppEvents.emit('Logger', `Reconnected successfully`); 62 | console.log('On Reconnected...'); 63 | }); 64 | } 65 | 66 | 67 | OnConnect(onSuccess, onError) { 68 | var self = this; 69 | self.connection.start() 70 | .then(function (data) { 71 | onSuccess({ url: self.url }); 72 | }) 73 | .catch(function (err) { 74 | onError(err) 75 | }); 76 | } 77 | 78 | OnSend(options, beforeInvoke, onError) { 79 | var methodArguments = new Array(); 80 | methodArguments = options.methodArguments; 81 | 82 | beforeInvoke(options); 83 | this.connection.invoke(options.methodName, ...methodArguments) 84 | .catch(function (err) { 85 | onError(err); 86 | }); 87 | } 88 | 89 | OnReceive(callback) { 90 | } 91 | 92 | OnDisconnect(onSuccess, onError) { 93 | this.connection.stop() 94 | .then(function () { 95 | onSuccess(); 96 | }) 97 | .catch(function (err) { 98 | onError(err); 99 | }); 100 | } 101 | 102 | HandleResponse(input) { 103 | AppEvents.emit('Logger', input.toString()); 104 | var output = this.ParseRespose(input); 105 | if(output !== null) { 106 | 107 | output.forEach((e) => { 108 | var jsonObj = JSON.parse(e); 109 | 110 | if(jsonObj !== null && jsonObj.hasOwnProperty('target')) { 111 | AppEvents.emit('ReceivedData', { "ClientMethod": jsonObj.target, "Data": jsonObj.arguments }); 112 | } 113 | }); 114 | } 115 | } 116 | 117 | ParseRespose(input) { 118 | 119 | if (typeof input !== "string") { 120 | console.log("Invalid input for JSON hub protocol. Expected a string."); 121 | return null; 122 | //throw new Error("Invalid input for JSON hub protocol. Expected a string."); 123 | } 124 | 125 | var separator = String.fromCharCode(0x1e); 126 | if (input[input.length - 1] !== separator) { 127 | console.log("Message is incomplete."); 128 | //throw new Error("Message is incomplete."); 129 | return null; 130 | } 131 | 132 | var messages = input.split(separator); 133 | messages.pop(); 134 | return messages; 135 | } 136 | } 137 | 138 | export { SignalRApp } -------------------------------------------------------------------------------- /src/js/components/srform.component.js: -------------------------------------------------------------------------------- 1 | import * as srFrom from './srform'; 2 | 3 | 4 | class SrFormComponent extends HTMLElement { 5 | constructor() { 6 | super(); 7 | } 8 | 9 | static get observedAttributes() { 10 | return ['type']; 11 | } 12 | get getType() { 13 | return this.getAttribute('type'); 14 | } 15 | 16 | connectedCallback() { 17 | this.render(); 18 | srFrom.Init(); 19 | } 20 | 21 | disconnectedCallback() { 22 | } 23 | 24 | attributeChangedCallback(attrName, oldVal, newVal) { 25 | this.render(); 26 | } 27 | 28 | render() { 29 | 30 | var divStyle = this.getType === "advance" ? "style='display:block'" : "style='display:none'"; 31 | this.innerHTML = ` 32 |11 | 12 | 13 | 14 |15 |33 | 241 |242 | `; 243 | } 244 | } 245 | 246 | if(!window.customElements.get("sr-form")) { 247 | window.customElements.define("sr-form", SrFormComponent); 248 | } 249 | -------------------------------------------------------------------------------- /src/js/components/srform.js: -------------------------------------------------------------------------------- 1 | import deleteImg from '../../images/delete.png'; 2 | import notificationSound from '../../assets/Notification.wav'; 3 | import { AppLogic } from './logic/app.logic'; 4 | import * as AppCommon from './logic/lib/app.common'; 5 | import * as Dialogbox from '../components/dialogbox/custompopup'; 6 | 7 | var isConnected = false; 8 | var transportType = "ws"; 9 | var skipNegotiation = false; 10 | //#region ConnectedEvent 11 | AppCommon.AppEvents.on('Init', () => { 12 | 13 | }); 14 | //#endregion 15 | 16 | //#region OnDisconnected 17 | AppCommon.AppEvents.on('OnDisconnected', () => { 18 | if (window.appLogic.GetCurrentView() !== true) { 19 | EnableMdlElement('protocol-support'); 20 | EnableMdlElement('skip-negotiation'); 21 | EnableMdlElement('chk-req-token') 22 | } 23 | }); 24 | //#endregion 25 | 26 | export function Init() { 27 | window.appLogic = new AppLogic(); 28 | //Connect Button Events 29 | document.getElementById('btn-connect') 30 | .addEventListener('click', 31 | function () { 32 | OnConnect(); 33 | }, 34 | false); 35 | 36 | //Disconnect Button Events 37 | document.getElementById('btn-disconnectbtn') 38 | .addEventListener('click', 39 | function () { 40 | OnDisconnect(); 41 | }, 42 | false); 43 | 44 | //Send Payload Button Events 45 | document.getElementById('btn-send-payload') 46 | .addEventListener('click', 47 | function () { 48 | SendPayload(); 49 | }, 50 | false); 51 | 52 | document.getElementById('chk-loggerView') 53 | .addEventListener('change', (event) => { 54 | if (event.target.checked) { 55 | document.getElementById('logger-container').style.display = "block"; 56 | } else { 57 | document.getElementById('logger-container').style.display = "none"; 58 | } 59 | }); 60 | 61 | document.getElementById('chk-skip-negotiation') 62 | .addEventListener('change', (event) => { 63 | if (event.target.checked) { 64 | skipNegotiation = true; 65 | } else { 66 | skipNegotiation = false; 67 | } 68 | }); 69 | 70 | const muteNotifcationElement = document.getElementById('chk-mute-notification'); 71 | var notifcationMute = window.localStorage.getItem('muteNotification'); 72 | console.log('1 Notification data-' + notifcationMute); 73 | 74 | if((!!notifcationMute) === false) { 75 | window.localStorage.setItem('muteNotification', 0); 76 | notifcationMute = 0; 77 | } 78 | 79 | muteNotifcationElement.checked = parseInt(notifcationMute) === 1; 80 | 81 | muteNotifcationElement.addEventListener('change', (event) => { 82 | if (event.target.checked) { 83 | window.localStorage.setItem('muteNotification', 1); 84 | } else { 85 | window.localStorage.setItem('muteNotification', 0); 86 | } 87 | }); 88 | 89 | document.getElementById('btn-clearlogs') 90 | .addEventListener('click', (event) => { 91 | document.getElementById("app-logs").innerHTML = ""; 92 | }, 93 | false); 94 | 95 | AppCommon.AppEvents.on('Logger', (message) => { 96 | var msg = "[" + new Date().toISOString() + "] :: " + message; 97 | var loggerElement = document.getElementById("app-logs"); 98 | var oldLogs = loggerElement.innerHTML; 99 | document.getElementById("app-logs").innerHTML = '' + msg + '
' + oldLogs; 100 | }); 101 | 102 | AppCommon.AppEvents.on('ConnectionFailed', (message) => { 103 | isConnected = false; 104 | //alert('Connection Failed: Not able to establised the connection. Please check the Url.'); 105 | Dialogbox.Alert('Not able to establised the connection. Please check the logs for more information.', 'Connection Failed'); 106 | AppCommon.AppEvents.off('ReceivedData', HandleResponse); 107 | }); 108 | 109 | AppCommon.AppEvents.on('OnConnected', OnConnected); 110 | 111 | NotConnected(); 112 | RigisterNavigationTabEvent(); 113 | 114 | document.getElementById('chk-req-token') 115 | .addEventListener('change', (event) => { 116 | if (event.target.checked) { 117 | document.getElementById('authHeader').disabled = false; 118 | window.appLogic.EnableAuth(); 119 | } else { 120 | window.appLogic.DisableAuth(); 121 | document.getElementById('authHeader').disabled = true; 122 | } 123 | }); 124 | 125 | } 126 | 127 | export function RigisterNavigationTabEvent() { 128 | 129 | var navLinkClass = document.getElementsByClassName('nav-link'); 130 | for (var i = 0; i < navLinkClass.length; i++) { 131 | navLinkClass[i].addEventListener('click', 132 | function () { 133 | OnTabChange(this.getAttribute('data-tab-type')); 134 | }, 135 | false); 136 | } 137 | } 138 | 139 | export function OnTabChange(tabName) { 140 | var appView = document.getElementById('appview'); 141 | var tabHeaderElement = appView.getElementsByTagName('h4')[0]; 142 | 143 | if (tabName == 'basic') { 144 | window.appLogic.SetCurrentViewAsBasic(); 145 | AdvanceViewElements(false); 146 | tabHeaderElement.innerText = "Basic"; 147 | } 148 | else { 149 | window.appLogic.SetCurrentViewAsAdvance(); 150 | AdvanceViewElements(true); 151 | tabHeaderElement.innerText = "Advance"; 152 | } 153 | } 154 | 155 | export function AdvanceViewElements(enable) { 156 | 157 | if (enable === true) { 158 | document.getElementById('protocol-support').style = 'display:block'; 159 | document.getElementById('auth-container').style = 'display:block'; 160 | document.getElementById('content-negotiation').style = 'display:block'; 161 | 162 | if (isConnected === true) { 163 | document.getElementById('chk-req-token').disabled = true; 164 | document.getElementById('authHeader').disabled = true; 165 | DisableMdlElement('protocol-support'); 166 | DisableMdlElement('skip-negotiation'); 167 | DisableMdlElement('chk-req-token') 168 | } 169 | else { 170 | document.getElementById('chk-req-token').disabled = false; 171 | if (window.appLogic.IsAuthEnabled() === true) { 172 | document.getElementById('authHeader').disabled = false; 173 | } 174 | EnableMdlElement('protocol-support'); 175 | EnableMdlElement('skip-negotiation'); 176 | EnableMdlElement('chk-req-token') 177 | } 178 | } 179 | else { 180 | document.getElementById('protocol-support').style = 'display:none'; 181 | document.getElementById('auth-container').style = 'display:none'; 182 | document.getElementById('content-negotiation').style = 'display:none'; 183 | } 184 | } 185 | 186 | export function AddArguments() { 187 | //Add Arguments Button Events 188 | var addArgBtnClass = document.getElementsByClassName('btn-add-argument'); 189 | for (var i = 0; i < addArgBtnClass.length; i++) { 190 | addArgBtnClass[i].addEventListener('click', AddArgumentsCallBack, false); 191 | } 192 | } 193 | 194 | export function AddArgumentsCallBack() { 195 | 196 | var parentDiv = document.getElementsByClassName('method-arguments'); 197 | 198 | for (var i = 0; i < parentDiv.length; i++) { 199 | 200 | var divElement = document.createElement('div'); 201 | divElement.setAttribute('class', 'container args-container row'); 202 | 203 | 204 | divElement.appendChild(GetTextBoxElement()); 205 | divElement.appendChild(GetImageElement()); 206 | divElement.appendChild(GetSelectElement()); 207 | 208 | // divElement.append(document.createElement('br')) 209 | //var hr = document.createElement('hr'); 210 | //hr.setAttribute('class', 'horizontal-line form-group col-sm-10'); 211 | //divElement.appendChild(hr); 212 | parentDiv[i].appendChild(divElement); 213 | } 214 | } 215 | 216 | export function GetSelectElement() { 217 | var div = document.createElement('div'); 218 | div.setAttribute('class', 'form-group col-sm-4'); 219 | 220 | var selectElement = document.createElement('select'); 221 | selectElement.setAttribute('class', 'req-content-type form-control'); 222 | 223 | var optionTxt = document.createElement('option'); 224 | var optionNum = document.createElement('option'); 225 | var optionJsonObj = document.createElement('option'); 226 | 227 | optionTxt.value = AppCommon.ContentType.TEXT 228 | optionTxt.text = "Text"; 229 | selectElement.add(optionTxt, null); 230 | 231 | optionNum.value = AppCommon.ContentType.NUMBER 232 | optionNum.text = "Number"; 233 | selectElement.add(optionNum, null); 234 | 235 | optionJsonObj.value = AppCommon.ContentType.JSON; 236 | optionJsonObj.text = "JSON"; 237 | selectElement.add(optionJsonObj, null); 238 | 239 | div.appendChild(selectElement); 240 | 241 | return div; 242 | } 243 | 244 | export function GetTextBoxElement() { 245 | 246 | var div = document.createElement('div'); 247 | div.setAttribute('class', 'form-group col-sm-11'); 248 | 249 | var inputTxtElement = document.createElement('textarea'); 250 | inputTxtElement.setAttribute("row", "1"); 251 | inputTxtElement.setAttribute("value", ""); 252 | inputTxtElement.setAttribute("class", "form-control req-arg-txt"); 253 | inputTxtElement.setAttribute("placeholder", "Request Payload"); 254 | 255 | div.appendChild(inputTxtElement); 256 | return div; 257 | } 258 | 259 | export function GetImageElement() { 260 | var div = document.createElement('div'); 261 | div.setAttribute('class', 'form-group col-sm-1 float-right'); 262 | 263 | var imgElement = document.createElement('img'); 264 | imgElement.src = deleteImg; 265 | imgElement.addEventListener('click', function () { 266 | this.parentElement.parentElement.remove(); 267 | }); 268 | div.appendChild(imgElement); 269 | return div; 270 | } 271 | 272 | export function ReadArguments() { 273 | var requestArgs = new Array(); 274 | var argsContainers = document.querySelectorAll('.args-container'); 275 | 276 | if (argsContainers.length == 0) { 277 | return requestArgs; 278 | } 279 | 280 | argsContainers.forEach((el) => { 281 | var textBox = el.querySelector('.req-arg-txt').value; 282 | var selectList = el.querySelector('.req-content-type').value; 283 | 284 | if (textBox !== "") { 285 | requestArgs.push({ cType: selectList, data: textBox }); 286 | } 287 | }); 288 | 289 | return requestArgs; 290 | } 291 | 292 | export function ReadAndFormatArguments() { 293 | var args = ReadArguments(); 294 | var requestArguments = new Array(); 295 | 296 | args.forEach((d) => { 297 | if (d.cType == AppCommon.ContentType.NUMBER) { 298 | var data = Number(d.data); 299 | if(isNaN(data)) { 300 | Dialogbox.Alert('Incorrect Data: ' + d.data + ' . Excepted data of type - ' + d.cType, 'Invalid Input'); 301 | throw 'Invalid Data' 302 | } 303 | requestArguments.push(data); 304 | } 305 | else if (d.cType == AppCommon.ContentType.JSON) { 306 | if(AppCommon.IsValidJSON(data)) { 307 | Dialogbox.Alert('Incorrect Data: ' + d.data + ' . Excepted data of type - ' + d.cType, 'Invalid Input'); 308 | throw 'Invalid Data' 309 | } 310 | requestArguments.push(JSON.parse(d.data)); 311 | } 312 | else if (d.cType == AppCommon.ContentType.TEXT) { 313 | requestArguments.push(d.data); 314 | } 315 | }); 316 | 317 | return requestArguments; 318 | } 319 | 320 | export function NotConnected() { 321 | console.log("Not Connected"); 322 | var onConnectClass = document.getElementsByClassName('onconnect'); 323 | 324 | for (var i = 0; i < onConnectClass.length; i++) { 325 | onConnectClass[i].style.display = "none"; 326 | } 327 | } 328 | 329 | export function buildConnection(url) { 330 | var option = { url: url, getToken: () => document.getElementById('authHeader').value }; 331 | option.transportType = transportType; 332 | option.skipNegotiation = skipNegotiation; 333 | window.appLogic.Init(option); 334 | } 335 | 336 | export function start() { 337 | window.appLogic.OnConnect(function(data) { 338 | AppCommon.AppEvents.emit('OnConnected', data); 339 | AppCommon.AppEvents.emit('Logger', "Connection established successfully with the server"); 340 | }, function(err) { 341 | AppCommon.AppEvents.emit('ConnectionFailed', err.toString()); 342 | AppCommon.AppEvents.emit('Logger', "ConnectionFailed-> " + err.toString()); 343 | }); 344 | } 345 | 346 | export function connectToServer(url) { 347 | buildConnection(url); 348 | start(); 349 | } 350 | 351 | function UrlValidation() { 352 | const urlElement = document.getElementById("inputUrl"); 353 | const errorElement = urlElement.nextElementSibling; 354 | 355 | if (AppCommon.IsValidUrl(urlElement.value)) { 356 | errorElement.innerText = ""; 357 | errorElement.className = "error"; 358 | return true; 359 | } else { 360 | errorElement.innerText = "Invalid Url"; 361 | errorElement.className = 'error active'; 362 | return false; 363 | } 364 | } 365 | 366 | function TextboxValidation(element, errorMessage) { 367 | const errorElement = element.nextElementSibling; 368 | 369 | if(!!element.value) { 370 | errorElement.innerText = ""; 371 | errorElement.className = "error"; 372 | return true; 373 | } else { 374 | errorElement.innerText = errorMessage; 375 | errorElement.className = 'error active'; 376 | return false; 377 | } 378 | } 379 | 380 | 381 | export function OnConnect() { 382 | 383 | //Add validation 384 | if(!UrlValidation()) { 385 | return; 386 | } 387 | 388 | var isAdvanceView = !window.appLogic.GetCurrentView(); 389 | if (isAdvanceView) { 390 | SetConnectionProtocol(); 391 | if(!ValidateTokenTextBox()) { 392 | return; 393 | } 394 | 395 | } 396 | 397 | var urlElement = document.getElementById("inputUrl"); 398 | connectToServer(urlElement.value); 399 | 400 | } 401 | 402 | export function OnConnected() { 403 | var isAdvanceView = !window.appLogic.GetCurrentView(); //true = basicView 404 | var urlElement = document.getElementById("inputUrl"); 405 | isConnected = true; 406 | 407 | DisableMdlElement('chk-req-token') 408 | AppCommon.ShowElementByClassName('onconnect'); 409 | 410 | AdvanceViewElements(isAdvanceView); 411 | //Hide Connect Button 412 | AppCommon.DisableElementByClassName('connectbtn'); 413 | AddArguments(); 414 | 415 | AppCommon.AppEvents.on('ReceivedData', HandleResponse); 416 | //Disable Url 417 | urlElement.disabled = true; 418 | } 419 | 420 | export function HandleResponse(data) { 421 | var responseDiv = document.querySelector("#inputResponseData"); 422 | responseDiv.innerText += JSON.stringify(data) + '\n'; 423 | responseDiv.scrollTop = responseDiv.scrollHeight; 424 | 425 | var isNotificationMute = window.localStorage.getItem('muteNotification'); 426 | 427 | if(parseInt(isNotificationMute) === 0) { 428 | let sound = new Audio(notificationSound); 429 | sound.play(); 430 | } 431 | } 432 | 433 | export function SetConnectionProtocol() { 434 | var elements = document.querySelectorAll(".protocol-support"); 435 | 436 | for (var i = 0; i < elements.length; i++) { 437 | if (elements[i].value === "ws" && elements[i].checked === true) { 438 | //WebSocket = undefined; 439 | transportType = "ws"; 440 | return; 441 | } 442 | else if (elements[i].value === "sse" && elements[i].checked === true) { 443 | //EventSource = undefined; 444 | transportType = "sse"; 445 | return; 446 | } 447 | else if (elements[i].value === "lp" && elements[i].checked === true) { 448 | transportType = "lp"; 449 | return; 450 | } 451 | } 452 | } 453 | 454 | export function OnDisconnect() { 455 | isConnected = false; 456 | Disconnect(); 457 | AppCommon.HideElementByClassName('onconnect'); 458 | 459 | Reset(); 460 | AppCommon.EnableElementByClassName('connectbtn'); 461 | NotConnected(); 462 | AdvanceViewElements(!window.appLogic.GetCurrentView()); 463 | //Enable URL textBix 464 | document.getElementById("inputUrl").disabled = false; 465 | AppCommon.AppEvents.off('ReceivedData', HandleResponse); 466 | } 467 | 468 | export function Reset() { 469 | //Clear Server Method Text 470 | document.getElementById('inputServerMethod').value = ""; 471 | 472 | var addArgBtnClass = document.getElementsByClassName('btn-add-argument'); 473 | for (var i = 0; i < addArgBtnClass.length; i++) { 474 | addArgBtnClass[i].removeEventListener('click', AddArgumentsCallBack, false); 475 | } 476 | document.getElementById('method-arguments').innerHTML = ""; 477 | var responseDiv = document.querySelector("#inputResponseData"); 478 | responseDiv.innerText = ""; 479 | } 480 | 481 | export function Disconnect() { 482 | window.appLogic.OnDisconnect(function() { 483 | AppCommon.AppEvents.emit('Logger', "Disconnected from the server"); 484 | AppCommon.AppEvents.emit('OnDisconnected'); 485 | }, 486 | function(err) { 487 | AppCommon.AppEvents.emit('Logger', err.toString()); 488 | }); 489 | } 490 | 491 | export function SendPayload() { 492 | 493 | const methodNameElement = document.getElementById("inputServerMethod"); 494 | var methodName = methodNameElement.value; 495 | if(!TextboxValidation(methodNameElement, "Please enter the Hub method name")) { 496 | return false; 497 | } 498 | 499 | var methodArguments = new Array(); 500 | 501 | methodArguments = ReadAndFormatArguments(); 502 | window.appLogic.OnSend({ methodName: methodName, methodArguments: methodArguments }, 503 | function(options) { 504 | AppCommon.AppEvents.emit('Logger', "Calling server method - " + options.methodName); 505 | }, 506 | function(err) { 507 | AppCommon.AppEvents.emit('Logger', err.toString()); 508 | Dialogbox.Alert(err.toString(), 'Error'); 509 | }); 510 | } 511 | 512 | function DisableMdlElement(className) { 513 | var el = document.getElementsByClassName(className); 514 | 515 | for (var i = 0; i < el.length; i++) { 516 | el[i].disabled = true; 517 | el[i].parentNode.classList.add("is-disabled"); 518 | } 519 | } 520 | 521 | function EnableMdlElement(className) { 522 | var el = document.getElementsByClassName(className); 523 | 524 | for (var i = 0; i < el.length; i++) { 525 | el[i].disabled = false; 526 | el[i].parentNode.classList.remove("is-disabled"); 527 | } 528 | } 529 | 530 | function ValidateTokenTextBox() { 531 | debugger; 532 | var isTokenReq = document.getElementById('chk-req-token').checked; 533 | var tokenTxtBox = document.getElementById('authHeader') 534 | if(isTokenReq) { 535 | if(!TextboxValidation(tokenTxtBox, "Please enter the Token")) { 536 | AppCommon.AppEvents.emit('Logger', "Please enter the Token"); 537 | return false; 538 | } 539 | } 540 | else { 541 | const errorElement = tokenTxtBox.nextElementSibling; 542 | errorElement.innerText = ""; 543 | errorElement.className = "error"; 544 | 545 | } 546 | return true; 547 | } -------------------------------------------------------------------------------- /src/js/main.js: -------------------------------------------------------------------------------- 1 | 2 | import 'material-design-lite/material.css' 3 | import 'material-design-lite/material.js' 4 | import '@webcomponents/webcomponentsjs/webcomponents-bundle';//WebComponent Pollyfill 5 | import 'bootstrap/dist/css/bootstrap.css' 6 | import 'bootstrap/dist/js/bootstrap.js' 7 | import '../css/main.css'; 8 | // import './components/custom.alertbox'; 9 | import './components/srform.component'; 10 | import './components/app.component'; -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | var assets = path.resolve(__dirname, 'src/assets'); 3 | const HtmlWebPackPlugin = require('html-webpack-plugin'); 4 | const MiniCssExtractPlugin = require("mini-css-extract-plugin"); 5 | 6 | module.exports = { 7 | entry: __dirname + "/src/js/main.js", 8 | output: { 9 | filename: 'main.js', 10 | path: path.resolve(__dirname, 'dist') 11 | }, 12 | module: { 13 | rules: [ 14 | { 15 | test: /\.js$/, 16 | exclude: /node_modules/, 17 | use: { 18 | loader: "babel-loader" 19 | } 20 | }, 21 | { 22 | test: /\.html$/, 23 | use: [ 24 | { 25 | loader: "html-loader", 26 | options: { minimize: true } 27 | } 28 | ] 29 | }, 30 | { 31 | test: /\.css$/, 32 | use: [MiniCssExtractPlugin.loader, "css-loader"] 33 | }, 34 | { 35 | //Image Loader code need to refactor 36 | test: /\.(png|jpg)$/, 37 | use: [{ 38 | loader: 'url-loader', 39 | options: { 40 | limit: 10000, 41 | name: './src/images/[name].[ext]', 42 | publicPath: './img/' 43 | } 44 | }] 45 | }, 46 | { 47 | //assets file Loader code need to refactor 48 | test: /\.(ogg|mp3|wav|mpe?g)$/i, 49 | loader: 'file-loader', 50 | include: assets, 51 | } 52 | ] 53 | }, 54 | plugins: [ 55 | new HtmlWebPackPlugin({ 56 | template: "./src/index.html", 57 | filename: "./index.html" 58 | }), 59 | new MiniCssExtractPlugin({ 60 | filename: "[name].css", 61 | chunkFilename: "[id].css" 62 | }) 63 | ] 64 | } --------------------------------------------------------------------------------