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