refactor code

This commit is contained in:
MaysWind 2016-06-11 18:52:40 +08:00
parent 2164736834
commit e874477e94
10 changed files with 17 additions and 23 deletions

View file

@ -6,10 +6,10 @@
var windowHeight = $(window).height();
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
$(".content-body").css('height', windowHeight - neg);
$('.content-body').css('height', windowHeight - neg);
};
$(window, ".wrapper").resize(function () {
$(window, '.wrapper').resize(function () {
fixContentWrapperHeight();
});

View file

@ -33,9 +33,7 @@
scope.$apply();
});
scope.$watch(function () {
return scope.options;
}, function (value) {
scope.$watch('options', function (value) {
if (value) {
setOptions(value);
}
@ -94,9 +92,7 @@
}
};
scope.$watch(function () {
return scope.options;
}, function (value) {
scope.$watch('options', function (value) {
if (value) {
setOptions(value);
}

View file

@ -1,15 +1,15 @@
(function () {
'use strict';
angular.module("ariaNg").directive('ngPlaceholder', function () {
angular.module('ariaNg').directive('ngPlaceholder', function () {
return {
restrict: 'A',
scope: {
placeholder: '=ngPlaceholder'
},
link: function (scope, elem) {
link: function (scope, element) {
scope.$watch('placeholder', function () {
elem[0].placeholder = scope.placeholder;
element[0].placeholder = scope.placeholder;
});
}
};

View file

@ -1,10 +1,10 @@
(function () {
'use strict';
angular.module("ariaNg").directive('ngSetting', ['$timeout', 'ariaNgConstants', function ($timeout, ariaNgConstants) {
angular.module('ariaNg').directive('ngSetting', ['$timeout', 'ariaNgConstants', function ($timeout, ariaNgConstants) {
return {
restrict: 'E',
templateUrl: "views/setting.html",
templateUrl: 'views/setting.html',
require: '?ngModel',
replace: true,
scope: {
@ -127,10 +127,8 @@
scope.optionValue = value;
});
scope.$watch(function () {
return scope.option;
}, function (value) {
angular.element('[data-toggle="popover"]').popover();
scope.$watch('option', function () {
element.find('[data-toggle="popover"]').popover();
});
}
};

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('dateDuration', ['moment', function (moment) {
angular.module('ariaNg').filter('dateDuration', ['moment', function (moment) {
return function (duration, sourceUnit, format) {
var timespan = moment.duration(duration, sourceUnit);
var time = moment.utc(timespan.asMilliseconds());

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('fileOrderBy', ['orderByFilter', 'ariaNgCommonService', function (orderByFilter, ariaNgCommonService) {
angular.module('ariaNg').filter('fileOrderBy', ['orderByFilter', 'ariaNgCommonService', function (orderByFilter, ariaNgCommonService) {
return function (array, type) {
if (!angular.isArray(array)) {
return array;

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('percent', ['numberFilter', function (numberFilter) {
angular.module('ariaNg').filter('percent', ['numberFilter', function (numberFilter) {
return function (value, precision) {
var ratio = Math.pow(10, precision);
var result = parseInt(value * ratio) / ratio;

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('taskOrderBy', ['orderByFilter', 'ariaNgCommonService', function (orderByFilter, ariaNgCommonService) {
angular.module('ariaNg').filter('taskOrderBy', ['orderByFilter', 'ariaNgCommonService', function (orderByFilter, ariaNgCommonService) {
return function (array, type) {
if (!angular.isArray(array)) {
return array;

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('taskStatus', function () {
angular.module('ariaNg').filter('taskStatus', function () {
return function (task) {
if (!task) {
return '';

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module("ariaNg").filter('readableVolumn', ['numberFilter', function (numberFilter) {
angular.module('ariaNg').filter('readableVolumn', ['numberFilter', function (numberFilter) {
var units = [ 'B', 'KB', 'MB', 'GB' ];
var defaultFractionSize = 2;