mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 20:19:42 +08:00
Tab to spaces conversion.
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
(function() {
|
(function () {
|
||||||
var ajax = function(url, settings) {
|
var ajax = function (url, settings) {
|
||||||
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
|
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
|
||||||
settings = settings || {};
|
settings = settings || {};
|
||||||
xhr.open(settings.method || 'GET', url, true);
|
xhr.open(settings.method || 'GET', url, true);
|
||||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
xhr.onreadystatechange = function(state) {
|
xhr.onreadystatechange = function (state) {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
if (xhr.status == 200 && settings.success) {
|
if (xhr.status == 200 && settings.success) {
|
||||||
settings.success(xhr);
|
settings.success(xhr);
|
||||||
@ -21,7 +21,7 @@
|
|||||||
e.style.display = 'block';
|
e.style.display = 'block';
|
||||||
var url = e.getAttribute('data-url');
|
var url = e.getAttribute('data-url');
|
||||||
ajax(url, {
|
ajax(url, {
|
||||||
success: function(xhr) {
|
success: function (xhr) {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.innerHTML = xhr.responseText;
|
div.innerHTML = xhr.responseText;
|
||||||
e.parentNode.replaceChild(div, e);
|
e.parentNode.replaceChild(div, e);
|
||||||
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function (xhr) {
|
||||||
e.innerHTML = xhr.responseText;
|
e.innerHTML = xhr.responseText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -55,8 +55,8 @@ yii.gii = (function ($) {
|
|||||||
var filesSelector = 'a.' + $modal.data('action');
|
var filesSelector = 'a.' + $modal.data('action');
|
||||||
var $files = $(filesSelector);
|
var $files = $(filesSelector);
|
||||||
var index = $files.filter('[href="' + $link.attr('href') + '"]').index(filesSelector);
|
var index = $files.filter('[href="' + $link.attr('href') + '"]').index(filesSelector);
|
||||||
var $prev = $files.eq(index-1);
|
var $prev = $files.eq(index - 1);
|
||||||
var $next = $files.eq((index+1 == $files.length ? 0 : index+1));
|
var $next = $files.eq((index + 1 == $files.length ? 0 : index + 1));
|
||||||
$modal.find('.modal-previous').attr('href', $prev.attr('href')).data('title', $prev.data('title'));
|
$modal.find('.modal-previous').attr('href', $prev.attr('href')).data('title', $prev.data('title'));
|
||||||
$modal.find('.modal-next').attr('href', $next.attr('href')).data('title', $next.data('title'));
|
$modal.find('.modal-next').attr('href', $next.attr('href')).data('title', $next.data('title'));
|
||||||
}
|
}
|
||||||
@ -70,12 +70,12 @@ yii.gii = (function ($) {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#preview-modal').on('keydown', function(e) {
|
$('#preview-modal').on('keydown', function (e) {
|
||||||
if (e.keyCode === 37) {
|
if (e.keyCode === 37) {
|
||||||
$('.modal-previous').trigger('click');
|
$('.modal-previous').trigger('click');
|
||||||
} else if(e.keyCode === 39) {
|
} else if (e.keyCode === 39) {
|
||||||
$('.modal-next').trigger('click');
|
$('.modal-next').trigger('click');
|
||||||
} else if(e.keyCode === 82) {
|
} else if (e.keyCode === 82) {
|
||||||
$('.modal-refresh').trigger('click');
|
$('.modal-refresh').trigger('click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -95,12 +95,14 @@ yii.gii = (function ($) {
|
|||||||
return {
|
return {
|
||||||
autocomplete: function (counter, data) {
|
autocomplete: function (counter, data) {
|
||||||
var datum = new Bloodhound({
|
var datum = new Bloodhound({
|
||||||
datumTokenizer: function(d){return Bloodhound.tokenizers.whitespace(d.word);},
|
datumTokenizer: function (d) {
|
||||||
|
return Bloodhound.tokenizers.whitespace(d.word);
|
||||||
|
},
|
||||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||||
local: data
|
local: data
|
||||||
});
|
});
|
||||||
datum.initialize();
|
datum.initialize();
|
||||||
jQuery('.typeahead-'+counter).typeahead(null,{displayKey: 'word', source: datum.ttAdapter()});
|
jQuery('.typeahead-' + counter).typeahead(null, {displayKey: 'word', source: datum.ttAdapter()});
|
||||||
},
|
},
|
||||||
init: function () {
|
init: function () {
|
||||||
initHintBlocks();
|
initHintBlocks();
|
||||||
@ -109,7 +111,7 @@ yii.gii = (function ($) {
|
|||||||
initConfirmationCheckboxes();
|
initConfirmationCheckboxes();
|
||||||
|
|
||||||
// model generator: hide class name input when table name input contains *
|
// model generator: hide class name input when table name input contains *
|
||||||
$('#model-generator #generator-tablename').on('change', function () {
|
$('#model-generator #generator-tablename').on('change',function () {
|
||||||
$('#model-generator .field-generator-modelclass').toggle($(this).val().indexOf('*') == -1);
|
$('#model-generator .field-generator-modelclass').toggle($(this).val().indexOf('*') == -1);
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
|
|||||||
@ -121,7 +121,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function() {
|
data: function () {
|
||||||
return this.data('yiiActiveForm');
|
return this.data('yiiActiveForm');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -205,7 +205,7 @@
|
|||||||
$.each(attributes, function (i, attribute) {
|
$.each(attributes, function (i, attribute) {
|
||||||
var $input = findInput($form, attribute);
|
var $input = findInput($form, attribute);
|
||||||
if (attribute.validateOnChange) {
|
if (attribute.validateOnChange) {
|
||||||
$input.on('change.yiiActiveForm', function () {
|
$input.on('change.yiiActiveForm',function () {
|
||||||
validateAttribute($form, attribute, false);
|
validateAttribute($form, attribute, false);
|
||||||
}).on('blur.yiiActiveForm', function () {
|
}).on('blur.yiiActiveForm', function () {
|
||||||
if (attribute.status == 0 || attribute.status == 1) {
|
if (attribute.status == 0 || attribute.status == 1) {
|
||||||
@ -388,7 +388,7 @@
|
|||||||
if (type === 'checkbox' || type === 'radio') {
|
if (type === 'checkbox' || type === 'radio') {
|
||||||
var $realInput = $input.filter(':checked');
|
var $realInput = $input.filter(':checked');
|
||||||
if (!$realInput.length) {
|
if (!$realInput.length) {
|
||||||
$realInput = $form.find('input[type=hidden][name="'+$input.prop('name')+'"]');
|
$realInput = $form.find('input[type=hidden][name="' + $input.prop('name') + '"]');
|
||||||
}
|
}
|
||||||
return $realInput.val();
|
return $realInput.val();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
settings: settings
|
settings: settings
|
||||||
});
|
});
|
||||||
|
|
||||||
$e.on('click.yiiCaptcha', function() {
|
$e.on('click.yiiCaptcha', function () {
|
||||||
methods.refresh.apply($e);
|
methods.refresh.apply($e);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -50,7 +50,7 @@
|
|||||||
url: $e.data('yiiCaptcha').settings.refreshUrl,
|
url: $e.data('yiiCaptcha').settings.refreshUrl,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function(data) {
|
success: function (data) {
|
||||||
$e.attr('src', data.url);
|
$e.attr('src', data.url);
|
||||||
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
|
$('body').data(settings.hashKey, [data.hash1, data.hash2]);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function() {
|
data: function () {
|
||||||
return this.data('yiiCaptcha');
|
return this.data('yiiCaptcha');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -236,7 +236,7 @@ yii = (function ($) {
|
|||||||
return this.src.charAt(0) === '/' ? hostInfo + this.src : this.src;
|
return this.src.charAt(0) === '/' ? hostInfo + this.src : this.src;
|
||||||
}).toArray();
|
}).toArray();
|
||||||
$.ajaxPrefilter('script', function (options, originalOptions, xhr) {
|
$.ajaxPrefilter('script', function (options, originalOptions, xhr) {
|
||||||
if(options.dataType == 'jsonp') {
|
if (options.dataType == 'jsonp') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = options.url.charAt(0) === '/' ? hostInfo + options.url : options.url;
|
var url = options.url.charAt(0) === '/' ? hostInfo + options.url : options.url;
|
||||||
|
|||||||
Reference in New Issue
Block a user