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 windowHeight = $(window).height();
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight(); 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(); fixContentWrapperHeight();
}); });

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
(function () { (function () {
'use strict'; '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) { return function (array, type) {
if (!angular.isArray(array)) { if (!angular.isArray(array)) {
return array; return array;

View file

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

View file

@ -1,7 +1,7 @@
(function () { (function () {
'use strict'; '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) { return function (array, type) {
if (!angular.isArray(array)) { if (!angular.isArray(array)) {
return array; return array;

View file

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

View file

@ -1,7 +1,7 @@
(function () { (function () {
'use strict'; '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 units = [ 'B', 'KB', 'MB', 'GB' ];
var defaultFractionSize = 2; var defaultFractionSize = 2;