update
This commit is contained in:
parent
b7f7959df5
commit
62ee432fd5
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').controller('Aria2SettingsController', ['$scope', '$location', '$timeout', 'SweetAlert', 'translateFilter', 'ariaNgConstants', 'aria2AvailableOptions', 'aria2RpcService', function ($scope, $location, $timeout, SweetAlert, translateFilter, ariaNgConstants, aria2AvailableOptions, aria2RpcService) {
|
angular.module('ariaNg').controller('Aria2SettingsController', ['$scope', '$location', '$timeout', 'ariaNgConstants', 'aria2AvailableOptions', 'aria2RpcService', 'utils', function ($scope, $location, $timeout, ariaNgConstants, aria2AvailableOptions, aria2RpcService, utils) {
|
||||||
var location = $location.path().substring($location.path().lastIndexOf('/') + 1);
|
var location = $location.path().substring($location.path().lastIndexOf('/') + 1);
|
||||||
var pendingSaveRequest = {};
|
var pendingSaveRequest = {};
|
||||||
|
|
||||||
|
@ -25,12 +25,7 @@
|
||||||
} else if (location == 'advanced') {
|
} else if (location == 'advanced') {
|
||||||
return aria2AvailableOptions.advancedOptions;
|
return aria2AvailableOptions.advancedOptions;
|
||||||
} else {
|
} else {
|
||||||
SweetAlert.swal({
|
utils.alert('Type is illegal!');
|
||||||
title: translateFilter('Error'),
|
|
||||||
text: translateFilter('Type is illegal!'),
|
|
||||||
type: 'error',
|
|
||||||
confirmButtonText: translateFilter('OK')
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,15 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$rootScope.$on('$locationChangeStart', function (event) {
|
||||||
|
SweetAlert.close();
|
||||||
|
});
|
||||||
|
|
||||||
$rootScope.$on('$routeChangeStart', function (event, next, current) {
|
$rootScope.$on('$routeChangeStart', function (event, next, current) {
|
||||||
var location = $location.path();
|
var location = $location.path();
|
||||||
|
|
||||||
setNavbarSelected(location);
|
setNavbarSelected(location);
|
||||||
$document.unbind('keypress');
|
$document.unbind('keypress');
|
||||||
SweetAlert.close();
|
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').factory('utils', ['$location', '$base64', 'ariaNgConstants', function ($location, $base64, ariaNgConstants) {
|
angular.module('ariaNg').factory('utils', ['$location', '$timeout', '$base64', 'SweetAlert', 'translateFilter', 'ariaNgConstants', function ($location, $timeout, $base64, SweetAlert, translateFilter, ariaNgConstants) {
|
||||||
return {
|
return {
|
||||||
generateUniqueId: function () {
|
generateUniqueId: function () {
|
||||||
var sourceId = ariaNgConstants.appPrefix + '_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random();
|
var sourceId = ariaNgConstants.appPrefix + '_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random();
|
||||||
|
@ -9,6 +9,16 @@
|
||||||
|
|
||||||
return hashedId;
|
return hashedId;
|
||||||
},
|
},
|
||||||
|
alert: function (text) {
|
||||||
|
$timeout(function () {
|
||||||
|
SweetAlert.swal({
|
||||||
|
title: translateFilter('Error'),
|
||||||
|
text: translateFilter(text),
|
||||||
|
type: 'error',
|
||||||
|
confirmButtonText: translateFilter('OK')
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
replaceArray: function (sourceArray, targetArray, keyProperty) {
|
replaceArray: function (sourceArray, targetArray, keyProperty) {
|
||||||
if (!targetArray || !sourceArray || sourceArray.length != targetArray.length) {
|
if (!targetArray || !sourceArray || sourceArray.length != targetArray.length) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skin-aria-ng, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
|
.skin-aria-ng, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .sweet-alert {
|
||||||
font-family: 'Hiragino Sans GB', 'Microsoft YaHei', 'STHeiti', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
font-family: 'Hiragino Sans GB', 'Microsoft YaHei', 'STHeiti', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row tip"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Reference in a new issue