1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-08-17 00:31:42 +02:00
Files
.github
.tx
appinfo
bin
css
docs
img
js
admin
app
controller
directive
AppNavigationEntryUtils.js
ClickOutside.js
NewsAddFeed.js
NewsArticleActions.js
NewsAutoFocus.js
NewsBindUnsafeHtml.js
NewsDraggable.js
NewsDroppable.js
NewsFinishedTransition.js
NewsFocus.js
NewsInstantNotification.js
NewsOnActive.js
NewsPlayOne.js
NewsReadFile.js
NewsRefreshMasonry.js
NewsScroll.js
NewsSearch.js
NewsStickyMenu.js
NewsStopPropagation.js
NewsTimeout.js
NewsTitleUnreadCount.js
NewsToggleShow.js
NewsTriggerClick.js
filter
gui
plugin
service
tests
.jshintignore
.jshintrc
README.md
gulpfile.js
karma.conf.js
package-lock.json
package.json
protractor.conf.js
l10n
lib
screenshots
templates
tests
.editorconfig
.gitignore
.mailmap
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md
COPYING
Makefile
README.md
composer.json
composer.lock
mkdocs.yml
phpstan.neon.dist
phpunit.xml
Nextcloud-News/js/directive/ClickOutside.js
2021-04-08 23:17:31 +02:00

32 lines
854 B
JavaScript

/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Marco Nassabain <marco.nassabain@hotmail.com>
* @author Nicolas Wendling <nicolas.wendling1011@gmail.com>
* @author Jimmy Huynh <natorisaki@gmail.com>
* @author Aurélien David <dav.aurelien@gmail.com>
*/
app.directive('clickOutside', function ($document) {
'use strict';
return {
restrict: 'A',
scope: {
clickOutside: '&'
},
link: function (scope, el) {
$document.on('click', function (e) {
if (el !== e.target && !el[0].contains(e.target)) {
scope.$apply(function () {
scope.$eval(scope.clickOutside);
});
}
});
}
};
});