From eec1d1a3525519f6cb68a8a5aef238e871c2112d Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Thu, 14 Feb 2013 10:14:52 +0000 Subject: [PATCH] Add checkEmail function to Mibew.Utils --- src/messenger/webim/js/compiled/default/utils.js | 2 +- src/messenger/webim/js/compiled/default_app.js | 2 +- src/messenger/webim/js/source/default/utils.js | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/messenger/webim/js/compiled/default/utils.js b/src/messenger/webim/js/compiled/default/utils.js index 20471704..0e0b5858 100644 --- a/src/messenger/webim/js/compiled/default/utils.js +++ b/src/messenger/webim/js/compiled/default/utils.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(c){c.Utils={};c.Utils.toUpperCaseFirst=function(a){return"string"!=typeof a?!1:""===a?a:a.substring(0,1).toUpperCase()+a.substring(1)};c.Utils.toDashFormat=function(a){if("string"!=typeof a)return!1;a=a.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g);for(var b=0;b()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a)}})(Mibew); diff --git a/src/messenger/webim/js/compiled/default_app.js b/src/messenger/webim/js/compiled/default_app.js index c24ac506..8eadd8b7 100644 --- a/src/messenger/webim/js/compiled/default_app.js +++ b/src/messenger/webim/js/compiled/default_app.js @@ -47,7 +47,7 @@ else try{this.sendRequests(this.buffer),this.buffer=[]}catch(c){this.options.onU Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(c){c.Utils={};c.Utils.toUpperCaseFirst=function(a){return"string"!=typeof a?!1:""===a?a:a.substring(0,1).toUpperCase()+a.substring(1)};c.Utils.toDashFormat=function(a){if("string"!=typeof a)return!1;a=a.match(/((?:[A-Z]?[a-z]+)|(?:[A-Z][a-z]*))/g);for(var b=0;b()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a)}})(Mibew); /* This file is part of Mibew Messenger project. http://mibew.org diff --git a/src/messenger/webim/js/source/default/utils.js b/src/messenger/webim/js/source/default/utils.js index 0e236d03..f85c9a33 100644 --- a/src/messenger/webim/js/source/default/utils.js +++ b/src/messenger/webim/js/source/default/utils.js @@ -46,4 +46,13 @@ return parts.join('-'); } + /** + * Check if email address valid or not + * @param {String} email Address to check + * @returns {Boolean} true if address is valid and false otherwise + */ + Mibew.Utils.checkEmail = function(email) { + return /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email); + } + })(Mibew); \ No newline at end of file