[ljcom] r10045: LJSUP-7911: SMS notification - Add Kazah...
Committer: dpetrov
LJSUP-7911: SMS notification - Add Kazahstan. Remove country code fieldU trunk/htdocs/js/editprofile.js
Modified: trunk/htdocs/js/editprofile.js
===================================================================
--- trunk/htdocs/js/editprofile.js 2011-02-15 11:11:38 UTC (rev 10044)
+++ trunk/htdocs/js/editprofile.js 2011-02-15 11:12:47 UTC (rev 10045)
@@ -6,7 +6,8 @@
function checkDEF(val)
{
- var def = parseInt(val.substr(0,3),10);
+ //var def = parseInt(val.substr(0,3),10);
+ var def = parseInt( val.replace( /^(\+7|7|8)/, '', val ).substr(0,3),10);
return ($.inArray(def, supportedDEF) > -1);
}
@@ -33,6 +34,7 @@
},
updateState: function() {
+ /*
var mask = /^\d{10}$/,
stripChars = "()\\- ";
@@ -53,7 +55,27 @@
{
state = 'unsupporteddef';
}
+ */
+ var mask = /^(\+7|7|8)\d{10}$/,
+ stripChars = "()\\- ";
+ var num = $.trim( this._number.val() ).replace(new RegExp("[" + stripChars + "]", "g"),"");
+
+ var state = 'correctnum';
+
+ if( num.length == 0 )
+ {
+ state = 'initial';
+ }
+ else if( !( mask.test( num ) ) )
+ {
+ state = 'badnum';
+ }
+ else if( !checkDEF( num ) )
+ {
+ state = 'unsupporteddef';
+ }
+
this._onUpdate( state );
}
}
@@ -118,6 +140,7 @@
}
break;
}
+ initial = false;
} );
this.ui.resendBtn.click(function()
