mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SquashSRS3: Add console
This commit is contained in:
parent
9ed7565789
commit
de1c7522f0
55 changed files with 38494 additions and 86 deletions
45
trunk/research/console/js/bravo_alert/alert.js
Executable file
45
trunk/research/console/js/bravo_alert/alert.js
Executable file
|
@ -0,0 +1,45 @@
|
|||
angular.module('bravoUiAlert', [])
|
||||
.directive('bravoAlert', function () {
|
||||
return {
|
||||
restrict: "A",
|
||||
transclude: true,
|
||||
template: '<div ng-transclude></div>',
|
||||
scope: {
|
||||
alert_show: '=alertShow',
|
||||
on_close: '&bravoAlertClose',
|
||||
on_closed: '&bravoAlertClosed'
|
||||
},
|
||||
compile: function (elem, attr) {
|
||||
var manual = attr['alertShow'];
|
||||
return function (scope, elem, attr) {
|
||||
elem.on('click', function(event) {
|
||||
var obj = angular.element(event.target);
|
||||
if (obj.attr('data-dismiss')) {
|
||||
scope.on_destory();
|
||||
}
|
||||
});
|
||||
scope.on_destory = function () {
|
||||
if (!manual) {
|
||||
scope.on_close();
|
||||
elem.addClass('ng-hide');
|
||||
scope.on_closed();
|
||||
} else {
|
||||
scope.on_close();
|
||||
scope.alert_show = false;
|
||||
scope.$apply();
|
||||
}
|
||||
};
|
||||
scope.$watch('alert_show', function (nv, ov) {
|
||||
if (nv != ov) {
|
||||
if (!nv) {
|
||||
elem.addClass('ng-hide');
|
||||
scope.on_closed();
|
||||
} else {
|
||||
elem.removeClass('ng-hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue