forked from jordanburke/angular-help-overlay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added closure and proper dependency injection
- Loading branch information
Jeff Thompson
committed
Jul 16, 2017
1 parent
1cef686
commit c4ed770
Showing
6 changed files
with
132 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "bower_components" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,65 @@ | ||
/*global angular:false */ | ||
!(function () { | ||
|
||
angular.module('angularHelpOverlay', []).directive('helpOverlay', ['$document', function ($document) { | ||
var noop = false; // Special flag in case we get an a chardinJs change event outside of our control. | ||
return { | ||
restrict: 'A', | ||
scope: { | ||
helpOverlay: '=', | ||
overlayStart: '&overlayStartCallback', | ||
overlayStop: '&overlayStopCallback' | ||
}, | ||
link: function (scope, element, attrs) { | ||
|
||
$document.on('chardinJs:start', function (event) { | ||
if (angular.isFunction(scope.overlayStart)) { | ||
scope.overlayStart(event); | ||
} | ||
|
||
if (scope.helpOverlay === false) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = true; | ||
}); | ||
} | ||
}); | ||
|
||
$document.on('chardinJs:stop', function (event) { | ||
if (angular.isFunction(scope.overlayStop)) { | ||
scope.overlayStop(event); | ||
} | ||
|
||
if (scope.helpOverlay === true) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = false; | ||
}); | ||
} | ||
}); | ||
|
||
scope.$watch('helpOverlay', function (newValue, oldValue) { | ||
if (newValue !== oldValue) { | ||
if (noop === true) { | ||
noop = false; | ||
} else if (newValue === true) { | ||
$(element).chardinJs('start'); | ||
} else if (newValue === false) { | ||
$(element).chardinJs('stop'); | ||
angular.module('angularHelpOverlay', []) | ||
.directive('helpOverlay', HelpOverlay); | ||
|
||
HelpOverlay.$inject = ['$document']; | ||
|
||
//angular.module('angularHelpOverlay', []).directive('helpOverlay', ['$document', function ($document) { | ||
|
||
function HelpOverlay($document) { | ||
var noop = false; // Special flag in case we get an a chardinJs change event outside of our control. | ||
return { | ||
restrict: 'A', | ||
//controller: HelpOverlayController, | ||
//controllerAs: 'vm', | ||
scope: { | ||
helpOverlay: '=', | ||
overlayStart: '&overlayStartCallback', | ||
overlayStop: '&overlayStopCallback' | ||
}, | ||
link: function (scope, element, attrs) { | ||
|
||
$(document).on('chardinJs:start', function (event) { | ||
if (angular.isFunction(scope.overlayStart)) { | ||
scope.overlayStart(event); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
}]); | ||
|
||
if (scope.helpOverlay === false) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = true; | ||
}); | ||
} | ||
}); | ||
|
||
$(document).on('chardinJs:stop', function (event) { | ||
if (angular.isFunction(scope.overlayStop)) { | ||
scope.overlayStop(event); | ||
} | ||
|
||
if (scope.helpOverlay === true) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = false; | ||
}); | ||
} | ||
}); | ||
|
||
scope.$watch('helpOverlay', function (newValue, oldValue) { | ||
if (newValue !== oldValue) { | ||
if (noop === true) { | ||
noop = false; | ||
} else if (newValue === true) { | ||
$(element).chardinJs('start'); | ||
} else if (newValue === false) { | ||
$(element).chardinJs('stop'); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
} | ||
|
||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,65 @@ | ||
/*global angular:false */ | ||
!(function () { | ||
|
||
angular.module('angularHelpOverlay', []).directive('helpOverlay', ['$document', function ($document) { | ||
var noop = false; // Special flag in case we get an a chardinJs change event outside of our control. | ||
return { | ||
restrict: 'A', | ||
scope: { | ||
helpOverlay: '=', | ||
overlayStart: '&overlayStartCallback', | ||
overlayStop: '&overlayStopCallback' | ||
}, | ||
link: function (scope, element, attrs) { | ||
|
||
$(document).on('chardinJs:start', function (event) { | ||
if (angular.isFunction(scope.overlayStart)) { | ||
scope.overlayStart(event); | ||
} | ||
|
||
if (scope.helpOverlay === false) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = true; | ||
}); | ||
} | ||
}); | ||
|
||
$(document).on('chardinJs:stop', function (event) { | ||
if (angular.isFunction(scope.overlayStop)) { | ||
scope.overlayStop(event); | ||
} | ||
|
||
if (scope.helpOverlay === true) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = false; | ||
}); | ||
} | ||
}); | ||
|
||
scope.$watch('helpOverlay', function (newValue, oldValue) { | ||
if (newValue !== oldValue) { | ||
if (noop === true) { | ||
noop = false; | ||
} else if (newValue === true) { | ||
$(element).chardinJs('start'); | ||
} else if (newValue === false) { | ||
$(element).chardinJs('stop'); | ||
angular.module('angularHelpOverlay', []) | ||
.directive('helpOverlay', HelpOverlay); | ||
|
||
HelpOverlay.$inject = ['$document']; | ||
|
||
//angular.module('angularHelpOverlay', []).directive('helpOverlay', ['$document', function ($document) { | ||
|
||
function HelpOverlay($document) { | ||
var noop = false; // Special flag in case we get an a chardinJs change event outside of our control. | ||
return { | ||
restrict: 'A', | ||
//controller: HelpOverlayController, | ||
//controllerAs: 'vm', | ||
scope: { | ||
helpOverlay: '=', | ||
overlayStart: '&overlayStartCallback', | ||
overlayStop: '&overlayStopCallback' | ||
}, | ||
link: function (scope, element, attrs) { | ||
|
||
$(document).on('chardinJs:start', function (event) { | ||
if (angular.isFunction(scope.overlayStart)) { | ||
scope.overlayStart(event); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
}]); | ||
|
||
if (scope.helpOverlay === false) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = true; | ||
}); | ||
} | ||
}); | ||
|
||
$(document).on('chardinJs:stop', function (event) { | ||
if (angular.isFunction(scope.overlayStop)) { | ||
scope.overlayStop(event); | ||
} | ||
|
||
if (scope.helpOverlay === true) { | ||
scope.$apply(function () { | ||
noop = true; | ||
scope.helpOverlay = false; | ||
}); | ||
} | ||
}); | ||
|
||
scope.$watch('helpOverlay', function (newValue, oldValue) { | ||
if (newValue !== oldValue) { | ||
if (noop === true) { | ||
noop = false; | ||
} else if (newValue === true) { | ||
$(element).chardinJs('start'); | ||
} else if (newValue === false) { | ||
$(element).chardinJs('stop'); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
} | ||
|
||
})(); |