diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-23 00:44:27 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-23 00:44:27 +0200 |
commit | a0b6fad1ada52457c2c5022fcb7685c1fff16abb (patch) | |
tree | f3d89fcbb203dfa9b5ea2f92213567abf13bb813 /js/directive | |
parent | 7bcdc3d062996918c8cb59bf827a3db3229b8544 (diff) |
add most of the settings except import
Diffstat (limited to 'js/directive')
-rw-r--r-- | js/directive/NewsForwardClick.js | 19 | ||||
-rw-r--r-- | js/directive/NewsReadFile.js | 28 | ||||
-rw-r--r-- | js/directive/NewsScroll.js | 2 |
3 files changed, 48 insertions, 1 deletions
diff --git a/js/directive/NewsForwardClick.js b/js/directive/NewsForwardClick.js new file mode 100644 index 000000000..d5c43e442 --- /dev/null +++ b/js/directive/NewsForwardClick.js @@ -0,0 +1,19 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2014 + */ +app.directive('newsTriggerClick', () => { + 'use strict'; + + return (scope, elm, attr) => { + elm.click(() => { + $(attr.newsTriggerClick).trigger('click'); + }); + }; + +});
\ No newline at end of file diff --git a/js/directive/NewsReadFile.js b/js/directive/NewsReadFile.js new file mode 100644 index 000000000..d3ed5b80e --- /dev/null +++ b/js/directive/NewsReadFile.js @@ -0,0 +1,28 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2014 + */ +app.directive('newsReadFile', () => { + 'use strict'; + + return (scope, elm, attr) => { + + let file = elm[0].files[0]; + let reader = new FileReader(); + + reader.onload = (event) => { + elm[0].value = 0; + scope.$fileContent = event.target.result; + scope.$apply(attr.newsReadFile); // FIXME: is there a more flexible + // solution where we dont have to + // bind the file to scope? + }; + + reader.reasAsText(file); + }; +});
\ No newline at end of file diff --git a/js/directive/NewsScroll.js b/js/directive/NewsScroll.js index 043235bbf..126c79b11 100644 --- a/js/directive/NewsScroll.js +++ b/js/directive/NewsScroll.js @@ -99,7 +99,7 @@ app.directive('newsScroll', ($timeout) => { }, scope.newsScrollMarkReadTimeout*1000); } - }); + }; elem.on('scroll', scrollHandler); |