js updates. captcha + change password base

This commit is contained in:
Malishev Dmitry 2011-12-13 13:09:47 +02:00
parent 52dad1d079
commit 80822252af
32 changed files with 1396 additions and 2034 deletions

View file

@ -4,8 +4,6 @@ window.jsonParse=function(){var r="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE
j){h=h.match(s);var e,c=h[0],l=false;if("{"===c)e={};else if("["===c)e=[];else{e=[];l=true}for(var b,d=[e],m=1-l,y=h.length;m<y;++m){c=h[m];var a;switch(c.charCodeAt(0)){default:a=d[0];a[b||a.length]=+c;b=void 0;break;case 34:c=c.substring(1,c.length-1);if(c.indexOf("\\")!==-1)c=c.replace(t,v);a=d[0];if(!b)if(a instanceof Array)b=a.length;else{b=c||w;break}a[b]=c;b=void 0;break;case 91:a=d[0];d.unshift(a[b||a.length]=[]);b=void 0;break;case 93:d.shift();break;case 102:a=d[0];a[b||a.length]=false;
b=void 0;break;case 110:a=d[0];a[b||a.length]=null;b=void 0;break;case 116:a=d[0];a[b||a.length]=true;b=void 0;break;case 123:a=d[0];d.unshift(a[b||a.length]={});b=void 0;break;case 125:d.shift();break}}if(l){if(d.length!==1)throw new Error;e=e[0]}else if(d.length)throw new Error;if(j){var p=function(n,o){var f=n[o];if(f&&typeof f==="object"){var i=null;for(var g in f)if(x.call(f,g)&&f!==n){var q=p(f,g);if(q!==void 0)f[g]=q;else{i||(i=[]);i.push(g)}}if(i)for(g=i.length;--g>=0;)delete f[i[g]]}return j.call(n,
o,f)};e=p({"":e},"")}return e}}();
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
@ -85,11 +83,8 @@ var App = {
Helpers: {},
Filters: {},
i18n: {},
HTML: {
Build: {}
},
View:{
HTML: { Build: {}},
View:{
// pages related views
Pages: {
USER: {},
@ -112,7 +107,7 @@ var App = {
CRON: {}
},
Cache: {
clear: function(){} // stub method, will be used later
clear: function() {} // stub method, will be used later
},
Pages: {
USER: {},
@ -124,17 +119,15 @@ var App = {
CRON: {}
},
Ref: {},
Tmp: {},
Tmp: { AJAX_SYNCRONOUS:{} },
Thread: {
run: function(delay, ref)
{
setTimeout(function()
{
run: function(delay, ref) {
setTimeout(function() {
ref();
}, delay*10);
}
},
Settings: {},
Settings: { VestaAbout: { version: '2-1', version_name: 'OGRE', company_email: 'support@vestacp.com', company_name: 'VestaCP' } },
Templates: {
Templator: null,
Tpl: {},
@ -147,7 +140,7 @@ var App = {
// Internals
Array.prototype.set = function(key, value)
{
var index = this[0][key];
var index = this[0][key];
this[1][index] = value;
}
Array.prototype.get = function(key){
@ -173,8 +166,29 @@ String.prototype.wrapperize = function(key, ns)
return tpl.finalize();
}
String.prototype.trim = function()
{
var str = this;
str = str.replace(/^\s+/, '');
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
}
App.Ajax.request = function(jedi_method, data, callback)
{
if ($.inArray(jedi_method, App.Settings.AJAX_SYNCRONOUS) != -1) {
if (App.Tmp.AJAX_SYNCRONOUS[jedi_method] == true) {
return false;
}
else {
App.Tmp.AJAX_SYNCRONOUS[jedi_method] = true;
}
}
App.Helpers.beforeAjax(jedi_method);
$.ajax({
url: App.Helpers.getBackendUrl(),
@ -184,22 +198,23 @@ App.Ajax.request = function(jedi_method, data, callback)
dataType: "text",
async: true,
success: function(reply)
{
{
if ($.inArray(jedi_method, App.Settings.AJAX_SYNCRONOUS) != -1) {
App.Tmp.AJAX_SYNCRONOUS[jedi_method] = false;
}
reply = reply.replace(/\\'/gi, '');
reply = reply.replace(/\'/gi, '');
reply = reply.replace(/\'/gi, '');
reply = jsonParse(reply);
if (reply.result == 'NOT_AUTHORISED') {
$('#content').html('<center><h1 style="font-size: 18px;color:red;">Not Authorized</h1></center>');
App.Helpers.afterAjax();
return App.Actions.authorize();
return App.Actions.authorize();
}
//timer.start();
callback && callback(reply);
App.Helpers.afterAjax();
//timer.stop(jedi_method);
},
error: function()
{
@ -218,16 +233,16 @@ timer.start = function()
timer.start_time = new Date();
}
timer.stop = function( msg )
timer.stop = function(msg)
{
timer.stop_time = new Date();
timer.print( msg );
timer.print(msg);
}
timer.print = function( msg )
timer.print = function(msg)
{
var passed = timer.stop_time - timer.start_time;
fb.info( (msg || '') + ': ' + passed / 1000 );
fb.info((msg || '') + ': ' + passed / 1000);
}