diff options
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | css/news.min.css | 2 | ||||
-rw-r--r-- | css/news.min.css.map | 1 | ||||
-rw-r--r-- | db/newsmapper.php | 2 | ||||
-rw-r--r-- | js/.jshintignore | 3 | ||||
-rw-r--r-- | js/.jshintrc | 3 | ||||
-rw-r--r-- | js/Gruntfile.js | 241 | ||||
-rw-r--r-- | js/README.md | 43 | ||||
-rw-r--r-- | js/app/App.js | 2 | ||||
-rw-r--r-- | js/app/Config.js | 3 | ||||
-rw-r--r-- | js/build/app.js | 3178 | ||||
-rw-r--r-- | js/build/app.min.js | 6 | ||||
-rw-r--r-- | js/build/app.min.js.map | 1 | ||||
-rw-r--r-- | js/controller/AppController.js | 2 | ||||
-rw-r--r-- | js/gui/ExternSubscription.js | 2 | ||||
-rw-r--r-- | js/gulpfile.js | 93 | ||||
-rw-r--r-- | js/karma.conf.js | 5 | ||||
-rw-r--r-- | js/package.json | 24 | ||||
-rw-r--r-- | js/tests/unit/controller/AppControllerSpec.js | 2 | ||||
-rw-r--r-- | phpunit.integration.xml | 2 | ||||
-rw-r--r-- | phpunit.xml | 2 | ||||
-rw-r--r-- | templates/index.php | 11 |
22 files changed, 146 insertions, 3495 deletions
diff --git a/.travis.yml b/.travis.yml index 04ff6422c..a857a6c44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,18 +61,19 @@ before_script: - cd apps/news/js # install test deps - npm install --deps # npm install needs to run before sudo npm install because otherwise it fails because a tmp file exists in the home dir - - sudo npm -g install grunt-cli protractor + - sudo npm -g install gulp-cli protractor + - cd .. - wget https://scrutinizer-ci.com/ocular.phar script: # unit tests - - grunt php-unit + - phpunit - php ocular.phar code-coverage:upload --format=php-clover ../coverage.clover - - grunt js-unit - # integration tests - - grunt php-integration + - phpunit -c phpunit.integration.xml + - cd js + - gulp karma # acceptance tests - - webdriver-manager update + # - webdriver-manager update - sudo chown -R www-data:www-data ../../../data - sudo chmod -R a+rwx ../../../data #- grunt acceptance --verbose diff --git a/css/news.min.css b/css/news.min.css deleted file mode 100644 index 42615b5a5..000000000 --- a/css/news.min.css +++ /dev/null @@ -1,2 +0,0 @@ -#app-content #searchresults,#undo{display:none}#app-content .body a,#app-content .body h3,#app-content .heading a:hover,#app-content .subtitle a:hover,#app-settings-content a,#explore .explore-footer a,#explore h1 a:hover,#notification a,#undo a:hover{text-decoration:underline}#global-loading{width:100%;height:100%}#undo-container{position:fixed;top:0;width:100%;text-align:center;z-index:101;line-height:1.2}#undo{z-index:101;background-color:#fc4;border:0;padding:0 .7em .3em;position:relative;top:0;border-bottom-left-radius:1em;border-bottom-right-radius:1em}#undo a{font-weight:700}#searchbox{display:block!important}#app-content .no-feeds-available{text-align:center;color:#333;font-size:16pt;min-height:100%;height:100%;width:100%;display:table}#app-content .no-feeds-available p{vertical-align:middle;display:table-cell}#app-content-wrapper,#articles{height:100%}#app-content .podcast{height:30px;z-index:10000;background-color:#111}#app-content .podcast audio{display:block;float:left;width:calc(100% - 60px);height:30px;border-radius:0}#app-content .podcast a,#app-content .podcast button{display:block;float:left;height:30px;width:30px;border:0;border-radius:0;margin:0;background-color:transparent;background-repeat:no-repeat;background-position:center}#app-content .podcast-close{background-size:25px;background-image:url(../img/close.svg)}#app-content .podcast-download{transform:rotate(270deg);background-size:20px;background-image:url(../img/arrow-white.svg)}#app-content .podcast audio::-webkit-media-controls-enclosure{max-width:inherit}#app-content .podcast.fixed{position:absolute;right:0;left:0}#notification a{color:#00f}#notification li{display:block}#app-content.loading-content{background:url(../img/loading.gif) calc(50% - 16px) calc(50% - 16px) no-repeat;transition:none!important;-webkit-transition:none!important;-moz-webkit-transition:none!important}#app-content.loading-content #app-content-wrapper{display:none}#app-content:not(.explore) #articles:after{content:'';display:block;height:100%;background-repeat:no-repeat}#app-content .autopaging: #articles:after{content:'';background-image:url(../img/loading.gif);background-position:calc(50% - 16px) calc(50% - 16px);transition:none!important;-webkit-transition:none!important;-moz-webkit-transition:none!important}#app-content .finished-auto-paging #articles:after{background-image:-o-linear-gradient(top,#eee 0,#FEFEFE 100%);background-image:-moz-linear-gradient(top,#eee 0,#FEFEFE 100%);background-image:-webkit-linear-gradient(top,#eee 0,#FEFEFE 100%);background-image:-ms-linear-gradient(top,#eee 0,#FEFEFE 100%);background-image:linear-gradient(to top,#eee 0,#FEFEFE 100%)}.pull-to-refresh{height:0;overflow:hidden;text-align:center;background-image:-moz-linear-gradient(top,#eee 0,#fefefe 100%);background-image:-webkit-linear-gradient(top,#eee 0,#fefefe 100%);background-image:-ms-linear-gradient(top,#eee 0,#fefefe 100%);background-image:linear-gradient(top,#eee 0,#fefefe 100%)}.pull-to-refresh.show-pull-to-refresh{transition:all .5s ease;padding-top:10px;height:44px}#app-content .only-in-expanded{display:block}#app-content .compact .only-in-expanded,#app-content .only-in-compact{display:none}#app-content .compact .only-in-compact{display:block}#app-content .item{cursor:default;border-bottom:1px solid #eee;background-image:linear-gradient(top,#f8f8f8 0,#fff 84px)}#app-content .item:last-child{border-bottom:0}#app-content .utils{width:100%;line-height:52px;box-sizing:border-box;padding:15px 50px 0 15px}#app-content .compact .utils{cursor:pointer;padding-top:0}#app-content .utils ul{height:40px;list-style-type:none;display:flex;margin:0;padding:0}#app-content .open .utils ul{height:auto}#app-content .utils ul>li{min-width:0}#app-content .util-spacer{width:20px}#app-content .compact .util-spacer{width:19px}#app-content .utils li{line-height:40px;vertical-align:middle}#app-content .utils>ul>li:last-child{padding-right:0}#app-content .utils>ul>li:first-child{padding-left:0}#app-content .utils .util{padding:0 6px}#app-content .utils .external,#app-content .utils button{padding:0;margin:0;height:40px;width:40px;border:0;float:left;background-color:transparent;background-repeat:no-repeat;background-size:25px;background-position:center}#app-content .utils .external,#app-content .utils .icon-toggle,#app-content .utils .menu button{display:inline-block;opacity:.3}#app-content .utils .external:hover,#app-content .utils .icon-toggle.keep-unread,#app-content .utils .icon-toggle:hover,#app-content .utils .menu button:hover{opacity:1}#app-content .utils .star{background-image:url(../img/inactive_star.svg)}#app-content .utils .star:hover,#app-content .utils .starred{background-image:url(../img/active_star.svg)}#app-content .utils .more button{opacity:.3}#app-content .utils .more button:hover{opacity:1}#app-content .utils .more{position:relative}#app-content .article-actions{display:none;filter:drop-shadow(0 0 5px rgba(150, 150, 150, .75));-webkit-filter:drop-shadow(0 0 5px rgba(150, 150, 150, .75));-moz-filter:drop-shadow(0 0 5px rgba(150, 150, 150, .75));position:absolute;top:40px;border-radius:3px;z-index:1000;border:1px solid transparent;background-color:#fff;margin:0;padding:0}#app-content .article-actions ul{display:flex;float:left}#app-content .article-actions li{float:left;width:52px!important}#app-content #articles:not(.compact) .article-actions{left:6px}#app-content #articles:not(.compact) .article-actions:after,#app-content #articles:not(.compact) .article-actions:before{left:20px}#app-content #articles.compact .article-actions{right:-10px}#app-content #articles.compact .article-actions:after,#app-content #articles.compact .article-actions:before{right:9px}#app-content .article-actions:after,#app-content .article-actions:before{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}#app-content .article-actions:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:5px;margin-left:-5px}#app-content .article-actions:before{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:9px;margin-left:-9px}#app-content .utils .title{width:100%;padding-left:45px;background-position:10px 10px;background-size:20px 20px;background-repeat:no-repeat}#app-content .feed-view .utils .title{background:0 0!important;padding-left:10px}#app-content .utils .title h1 a{white-space:nowrap;overflow:hidden;width:100%;display:inline-block;color:#222;font-weight:700;font-size:16px;line-height:1.5;padding-top:8px;min-height:40px}#app-content .read .utils .title h1 a,#app-content .title .intro{font-weight:400;color:#777}#app-content .open .title .intro{display:none}#app-content .title .intro{font-size:10pt;margin-left:20px}#app-content .open .utils .title h1 a{overflow:auto;white-space:normal}#app-content .utils .date{padding:0 15px;margin-right:25px}#app-content .heading{padding:25px 0 10px}#app-content .heading h1{font-size:19px;max-width:770px;word-wrap:break-word}#app-content .heading a{font-weight:700;color:#222}#app-content .heading .date{float:right;display:inline-block;font-size:15px;padding:0 10px}#app-content .compact .article,#app-content .feed-view .source{display:none}#app-content .read .heading a{font-weight:400!important;color:#777}#app-content .article{min-height:69px;padding:0 50px 50px}#app-content .open .article{display:block}#app-content .subtitle{color:#777;font-size:15px;max-width:770px;padding-bottom:25px}#app-content .subtitle a{color:#777}#app-content .date{color:#777;white-space:nowrap}#app-content .author{color:#777;font-size:15px}#app-content .author a{color:inherit}#app-content .author a:hover{text-decoration:underline}#app-content .enclosure{padding:20px 0;max-width:770px;margin-bottom:15px}#app-content .enclosure audio,#app-content .enclosure img,#app-content .enclosure video{width:100%}#app-content .enclosure video{background-color:#000;margin-bottom:20px}#app-content .enclosure-error{line-height:1.5;height:40px}#app-content .body{max-width:770px;font-size:14px;clear:both;overflow-x:auto}#app-content .body p{line-height:1.5;margin:7px 0 14px}#app-content .body img,#app-content .body table{max-width:100%;height:auto;overflow:auto;word-wrap:break-word;white-space:normal}#app-content .body>div>:first-child>img:first-child,#app-content .body>div>img:first-child{padding:0 14px 0 0;float:left}#app-content .body h1,#app-content .body h2{font-size:17px;font-weight:700;color:#222;margin:21px 0 0}#app-content .body h3{font-size:15px;font-weight:700;color:#222;margin:21px 0 0}#app-content .body h4,#app-content .body h5,#app-content .body h6{font-weight:700}#app-content .body>div{margin:7px 0}#app-content .body a{color:#00f}#app-content .body ul{margin:7px 0;padding-left:14px;list-style-type:disc}#app-content .body ol{margin:7px 0;padding-left:21px}#app-content .body ul li{cursor:default;line-height:21px}#app-content .body pre{padding:7px 7px 7px 14px;background-color:#dadada;border:1px solid #ccc;margin:7px 0 14px;overflow-y:auto}#app-content .body pre::-webkit-scrollbar{height:10px}#app-content .body pre::-webkit-scrollbar-thumb{background:#333}#app-content .body pre::-webkit-scrollbar-track-piece{background:#ddd}#app-content .body code,#app-content .body pre{font-family:monospace;font-size:16px}#app-content .body blockquote{border-left:1px solid #d2d2d2;margin:25px 0;padding:0 0 0 15px;font-style:italic}#app-content .body em{font-style:italic;opacity:1}#app-content [dir=rtl]{text-align:right}#app-content .custom-heise-de .body p>span:first-child{display:inline-block;float:left;margin-right:10px;padding:6px 0}#app-content .custom-slashdot-org .body div>i{display:block;border-left:1px solid #d2d2d2;margin:25px 0;padding:0 0 0 15px}#app-content .custom-sueddeutsche-de .body img{float:none!important}#app-shortcuts table{border-collapse:collapse;width:100%;white-space:normal}#app-shortcuts tr:first-child{background-color:#f5f5f5}#app-shortcuts td,#app-shortcuts th{padding:10px}#app-shortcuts td{padding-right:15px}#app-shortcuts th{font-weight:700}#app-shortcuts td:first-child,#app-shortcuts th:first-child{text-align:right;font-weight:700;width:140px;-moz-box-sizing:content-box;box-sizing:content-box}@media (max-width:770px){#app-content .utils .date{display:none}#app-shortcuts th:first-child{padding-left:44px}}@media (max-width:600px){#app-content .article-actions ul{max-width:164px}#app-content .heading .date{display:none}#app-content .heading h1{margin-right:0}#app-content .utils{padding-right:15px}#app-content .article{padding-right:15px;padding-left:44px}}@media (max-width:340px){#app-content .article-actions{max-width:82px}}- #app-navigation .add-new .heading{height:44px;width:100%}#app-navigation .add-new .heading:hover{background-color:#ccc}#app-navigation .add-new .heading button{padding:0 0 0 44px;line-height:44px;width:100%;border:0;margin:0;text-align:left;font-weight:400;background-color:transparent;background-position:14px center}#app-navigation .add-new-popup{display:none;padding:10px;box-shadow:inset 0 0 10px #dedede;border-top:1px solid #dedede;border-bottom:1px solid #dedede}#app-navigation input.ng-invalid{border:1px solid #d14}#app-navigation .add-new-popup input,#app-navigation .add-new-popup select{width:100%;height:36px;padding:5px;margin-right:0}#app-navigation #new-feed [name=folderName],#app-navigation .add-new-popup select{width:calc(100% - 36px);border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;float:left}#app-navigation .add-new-popup .add-new-folder-primary{float:right;border-bottom-left-radius:0;border-top-left-radius:0;width:36px;height:36px;margin-left:0;margin-right:0}#app-navigation .add-new-popup .error{padding:0 0 10px}#app-navigation .icon-starred{background-image:url(../img/starred.png)}.icon-rss{background-image:url(../img/rss.svg)!important}.icon-full-text-enabled{background-image:url(../img/fulltext.svg);background-size:50%;opacity:.5}.icon-full-text-disabled{background-image:url(../img/nonfulltext.svg);background-size:50%;opacity:.5}#app-navigation .unread>a{font-weight:700}#app-navigation .entry-loading{background-image:url(../img/loading.gif)!important}#app-navigation input.entry-loading{background-size:20px}#app-navigation p.error{line-height:25px}#app-navigation .folder-rename-error{height:auto}#app-navigation .error-message{padding:15px;background-color:#DE1212;color:#fff;position:relative}#app-navigation .ui-state-disabled{opacity:1}#app-navigation .error-message .title{font-weight:700;padding-right:30px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#app-navigation .error-message button{top:0;right:0;position:absolute;margin:0;height:44px;width:44px;padding:15px;border:0;background-size:25px;background-color:transparent;background-image:url(../img/close.svg);background-repeat:no-repeat;background-position:right 5px top 5px;opacity:.9}#app-navigation .animate-show,#app-navigation .error-message button:hover{opacity:1}#app-navigation .animate-show.ng-hide-add,#app-navigation .animate-show.ng-hide-remove{transition:0s linear opacity}#app-navigation .animate-show.ng-hide-add-active,#app-navigation .animate-show.ng-hide-remove-active{transition:.2s linear opacity}#app-navigation .animate-show.ng-hide{opacity:0}#app-navigation .feed-no-ordering{transform:rotate(270deg)}#app-navigation .feed-reverse-ordering{transform:rotate(180deg)}#app-navigation .icon-pinned{background-image:url(../img/pinned.svg)}#app-navigation .icon-unpinned{background-image:url(../img/unpinned.svg)}#app-navigation .icon-updatemode-default{background-image:url(../img/updatemodedefault.svg)}#app-navigation .icon-updatemode-unread{background-image:url(../img/updatemodeunread.svg)}#app-navigation .updateerror a{background-color:orange!important}#app-navigation .add-new button,#app-navigation li a{opacity:1!important;color:#000!important}#app-navigation .active,#app-navigation .active a,#app-navigation li>a:hover{background-color:#ddd}#app-settings input[type=file]{position:absolute;left:-30000px}#app-settings .opened:hover{background-color:transparent!important}#app-settings-content{padding-bottom:25px}#app-settings-content h3{padding:5px 0;font-weight:700}#app-settings-content a{color:#00F}#app-settings-content p{padding:2px 2px 2px 10px}#app-settings-content label{display:block;padding-left:18px}#app-settings-content label input[type=checkbox]{margin-left:-18px;max-width:16px}.button-icon-label{background-position:10px center;background-size:16px;padding-left:25px}#app-settings .import-export h3{padding-top:15px;padding-bottom:5px}#app-settings .import-export a,#app-settings .import-export button{width:113px;height:30px;margin:0;vertical-align:middle;background-position:center}#explore,.explore #app-content-wrapper{height:100%}#app-settings .import-export a{display:inline-block}#app-settings .disabled{color:#aaa}#explore{width:100%;padding:45px 0 45px 45px}#explore .grid-item{float:left;width:300px;border-collapse:collapse;border:1px solid #ccc;margin:0 25px 25px 0}#explore h1{font-size:13pt;background-repeat:no-repeat;background-size:24px 24px;padding:5px 0 0 35px;background-position:0 center}#explore h1 a{word-wrap:break-word}#explore .category-wrapper{text-align:center}#explore .category{font-size:10pt;color:#fff;background-color:#1d2d44;padding:10px;font-weight:700}#explore .grid-item-content{padding:30px}#explore .explore-logo{text-align:center;margin-top:25px}#explore .explore-logo img{width:100%}#explore .explore-subscribe{padding-top:15px;text-align:right}#explore .explore-content{padding-top:25px}#explore .explore-filter{text-align:right;padding:0 30px 30px}#explore .explore-filter input,#explore .explore-filter select{margin-left:10px;display:inline-block}#explore .explore-filter input{width:200px}#explore .explore-footer{clear:both;margin:75px 0;text-align:center}#explore .explore-footer a{font-size:11pt;color:#00A} -/*# sourceMappingURL=news.min.css.map */
\ No newline at end of file diff --git a/css/news.min.css.map b/css/news.min.css.map deleted file mode 100644 index cdd407c15..000000000 --- a/css/news.min.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../css/content.css","../css/app.css","../css/settings.css","../css/explore.css","../css/custom.css","../css/shortcuts.css","../css/mobile.css","../css/navigation.css"],"names":[],"mappings":"AASA,4BCcA,MDbI,QAAS,KA0kBT,qBAlBA,sBA1II,8BAkDR,+BE/cA,wBCgFA,2BA7DA,oBHwCA,gBC/CI,cEuEH,gBAAiB,UFrGlB,gBACI,MAAO,KACP,OAAQ,KAGZ,gBACI,SAAU,MACV,IAAK,EACL,MAAO,KACP,WAAY,O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C,MAAO,KAGR,4BACC,YAAa,KACb,WAAY,MAGb,0BACC,YAAa,KAGd,yBACC,WAAY,MACZ,QACa,EADJ,KAAA,KAIV,+BACA,gCACC,YAAa,KACb,QAAS,aAGV,+BACC,MAAO,MAGR,yBACC,MAAO,KACP,OAAQ,KAAK,EACb,WAAY,OAGb,2BACC,UAAW,KACX,MAAO"}
\ No newline at end of file diff --git a/db/newsmapper.php b/db/newsmapper.php index fd0408f77..feef949e8 100644 --- a/db/newsmapper.php +++ b/db/newsmapper.php @@ -69,4 +69,4 @@ abstract class NewsMapper extends Mapper { return $this->findEntities($sql, $search, $limit, $offset); } -}
\ No newline at end of file +} diff --git a/js/.jshintignore b/js/.jshintignore new file mode 100644 index 000000000..eb5a16ccc --- /dev/null +++ b/js/.jshintignore @@ -0,0 +1,3 @@ +build/ +node_modules/ +vendor/ diff --git a/js/.jshintrc b/js/.jshintrc index 7835a8760..19894c5ea 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -47,6 +47,7 @@ "News": true, "t": true, "url": true, - "navigator": true + "navigator": true, + "oc_requesttoken": true } } diff --git a/js/Gruntfile.js b/js/Gruntfile.js deleted file mode 100644 index 19a2967d8..000000000 --- a/js/Gruntfile.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * 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 2012, 2014 - */ -module.exports = function (grunt) { - 'use strict'; - - // load needed modules - grunt.loadNpmTasks('grunt-php'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-phpunit'); - grunt.loadNpmTasks('grunt-wrap'); - grunt.loadNpmTasks('grunt-karma'); - grunt.loadNpmTasks('grunt-ng-annotate'); - grunt.loadNpmTasks('grunt-protractor-runner'); - grunt.loadNpmTasks('grunt-protractor-webdriver'); - - grunt.initConfig({ - meta: { - pkg: grunt.file.readJSON('package.json'), - version: '<%= meta.pkg.version %>', - production: 'build/' - }, - concat: { - options: { - // remove license headers - stripBanners: true - }, - dist: { - src: [ - 'app/App.js', - 'app/Config.js', - 'app/Run.js', - 'controller/**/*.js', - 'filter/**/*.js', - 'service/**/*.js', - 'gui/**/*.js', - 'plugin/**/*.js', - 'utility/**/*.js', - 'directive/**/*.js' - ], - dest: '<%= meta.production %>app.js' - } - }, - ngAnnotate: { - app: { - src: ['<%= meta.production %>app.js'], - dest: '<%= meta.production %>app.js' - } - }, - uglify: { - app: { - files: { - '<%= meta.production %>app.min.js': [ - '<%= meta.production %>app.js' - ] - } - }, - options: { - sourceMap: true - } - }, - cssmin: { - options: { - sourceMap: true - }, - news: { - files: { - '../css/news.min.css': [ - '../css/app.css', - '../css/content.css', - '../css/custom.css', - '../css/shortcuts.css', - '../css/mobile.css', - '../css/navigation.css', - '../css/settings.css', - '../css/explore.css' - ] - } - } - }, - wrap: { - basic: { - src: ['<%= meta.production %>app.js'], - dest: '<%= meta.production %>app.js', - options: { - wrapper: [ - '(function(navigator, window, document, angular, $, ' + - 'OC, csrfToken, url, undefined){' + - '\n\n\'use strict\';\n\n', - - '\n})(navigator, window, document, angular, jQuery, ' + - ' OC, oc_requesttoken, url);' - ] - } - } - }, - jshint: { - app: { - src: [ - 'Gruntfile.js', - 'app/App.js', - 'app/Config.js', - 'app/Run.js', - 'filter/**/*.js', - 'service/**/*.js', - 'controller/**/*.js', - 'directive/**/*.js', - 'tests/**/*.js', - 'gui/**/*.js', - 'plugin/**/*.js', - 'admin/**/*.js' - ] - }, - options: { - jshintrc: true - } - }, - watch: { - concat: { - files: [ - '../css/*.css', - '!../css/*.min.css', - 'admin/**/*.js', - 'tests/**/*.js', - 'app/**/*.js', - 'controller/**/*.js', - 'utility/**/*.js', - 'directive/**/*.js', - 'filter/**/*.js', - 'service/**/*.js', - 'gui/**/*.js', - 'plugin/**/*.js', - '../templates/**/*.php' - ], - tasks: ['default'], - options: { - livereload: true - } - }, - phpunit: { - files: [ - '../**/*.php' - ], - tasks: ['phpunit:unit'] - }, - phpintegration: { - files: [ - '../**/*.php' - ], - tasks: ['phpunit:integration'] - } - }, - karma: { - unit: { - configFile: 'karma.conf.js', - autoWatch: true - }, - continuous: { - configFile: 'karma.conf.js', - browsers: ['Firefox'], - singleRun: true, - } - }, - phpunit: { - unit: { - options: { - colors: true, - configuration: '../phpunit.xml' - } - }, - coverage: { - options: { - colors: true, - configuration: '../phpunit.xml', - coverageClover: '../coverage.clover' - } - }, - integration: { - options: { - colors: true, - configuration: '../phpunit.integration.xml' - } - }, - }, - /* jshint camelcase: false */ - protractor_webdriver: { - app: {} - }, - protractor: { - firefox: { - options: { - configFile: 'protractor.conf.js' - } - }, - }, - connect: { - server: { - options: { - base: 'tests/static/' - } - } - }, - php: { - dist: { - options: { - port: 8080, - keepalive: true, - open: true, - base: '../../../' - } - } - } - }); - - // make tasks available under simpler commands - grunt.registerTask('default', ['jshint', 'concat', 'wrap', 'ngAnnotate', - 'uglify', 'cssmin']); - grunt.registerTask('dev', ['watch:concat']); - grunt.registerTask('dev-js-unit', ['karma:unit']); - grunt.registerTask('dev-php-unit', ['watch:phpunit']); - grunt.registerTask('dev-php-integration', ['watch:phpintegration']); - - grunt.registerTask('js-unit', ['karma:continuous']); - grunt.registerTask('php-unit', ['phpunit:coverage']); - grunt.registerTask('php-integration', ['phpunit:integration']); - - grunt.registerTask('acceptance', ['protractor_webdriver', 'connect', - 'protractor']); - -}; diff --git a/js/README.md b/js/README.md index c03621fdc..2c25ce4ed 100644 --- a/js/README.md +++ b/js/README.md @@ -1,40 +1,17 @@ -# JavaScript && CSS Development -Before starting, install nodejs and grunt-cli: +# JavaScript +Before starting, install nodejs and gulp-cli: - sudo npm -g install grunt-cli + sudo npm -g install gulp-cli then run: npm install +## Tasks +The following tasks are available: -## Building -This sets up a watcher on file change and compiles CSS and JS: - - grunt dev - -If you don't want a watcher, just run: - - grunt - -## Testing -Watch mode: - - grunt php - grunt test - -Single run mode: - - grunt phpunit - grunt ci-unit - -### Running e2e tests -Install protractor and set up selenium: - - sudo npm install -g protractor - sudo webdriver-manager update - -then the tests can be started with: - - grunt e2e - +* **Build the JavaScript**: gulp +* **Watch for changes and build JavaScript**: gulp watch +* **Run JavaScript unit tests**: gulp karma +* **Watch for changes and run JavaScript unit tests**: gulp watch-karma +* **Watch for changes and run PHP unit tests**: gulp watch-phpuni diff --git a/js/app/App.js b/js/app/App.js index 2c8e71419..37266a438 100644 --- a/js/app/App.js +++ b/js/app/App.js @@ -9,4 +9,4 @@ */ /* jshint unused: false */ -var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']);
\ No newline at end of file +var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); diff --git a/js/app/Config.js b/js/app/Config.js index df7cc60e5..8c9c09290 100644 --- a/js/app/Config.js +++ b/js/app/Config.js @@ -37,7 +37,8 @@ app.config(function ($routeProvider, $provide, $httpProvider) { $window.location.href.split($window.location.pathname)[0]; if (config.url.indexOf(BASE_URL) === 0 || config.url.indexOf(domain) === 0) { - config.headers.requesttoken = csrfToken; + /*jshint camelcase: false */ + config.headers.requesttoken = oc_requesttoken; } return config || $q.when(config); diff --git a/js/build/app.js b/js/build/app.js deleted file mode 100644 index 1520622d5..000000000 --- a/js/build/app.js +++ /dev/null @@ -1,3178 +0,0 @@ -(function(navigator, window, document, angular, $, OC, csrfToken, url, undefined){ - -'use strict'; - - -/* jshint unused: false */ -var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); -app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvider, $provide, $httpProvider) { - 'use strict'; - - var feedType = { - FEED: 0, - FOLDER: 1, - STARRED: 2, - SUBSCRIPTIONS: 3, - SHARED: 4, - EXPLORE: 5 - }; - - // constants - $provide.constant('REFRESH_RATE', 60); // seconds - $provide.constant('ITEM_BATCH_SIZE', 40); // how many items should be - // fetched initially - $provide.constant('ITEM_AUTO_PAGE_SIZE', 20); - $provide.constant('BASE_URL', OC.generateUrl('/apps/news')); - $provide.constant('FEED_TYPE', feedType); - $provide.constant('MARK_READ_TIMEOUT', 0.5); - $provide.constant('SCROLL_TIMEOUT', 0.1); - - // make sure that the CSRF header is only sent to the ownCloud domain - $provide.factory('CSRFInterceptor', ["$q", "BASE_URL", "$window", function ($q, BASE_URL, $window) { - return { - request: function (config) { - var domain = - $window.location.href.split($window.location.pathname)[0]; - if (config.url.indexOf(BASE_URL) === 0 || - config.url.indexOf(domain) === 0) { - config.headers.requesttoken = csrfToken; - } - - return config || $q.when(config); - } - }; - }]); - var errorMessages = { - 0: t('news', 'Request failed, network connection unavailable!'), - 401: t('news', 'Request unauthorized. Are you logged in?'), - 403: t('news', 'Request forbidden. Are you an admin?'), - 412: t('news', 'Token expired or app not enabled! Reload the page!'), - 500: t('news', 'Internal server error! Please check your ' + - 'data/owncloud.log file for additional ' + - 'information!'), - 503: t('news', 'Request failed, ownCloud is in currently ' + - 'in maintenance mode!'), - }; - $provide.factory('ConnectionErrorInterceptor', ["$q", "$timeout", function ($q, $timeout) { - var timer; - return { - responseError: function (response) { - // status 0 is a network error - if (response.status in errorMessages) { - if (timer) { - $timeout.cancel(timer); - } - OC.Notification.hide(); - OC.Notification.showHtml(errorMessages[response.status]); - timer = $timeout(function () { - OC.Notification.hide(); - }, 5000); - } - return $q.reject(response); - } - }; - }]); - $httpProvider.interceptors.push('CSRFInterceptor'); - $httpProvider.interceptors.push('ConnectionErrorInterceptor'); - - // routing - var getItemResolve = function (type) { - return { - // request to items also returns feeds - data: /* @ngInject */ ["$http", "$route", "$q", "$location", "BASE_URL", "ITEM_BATCH_SIZE", "FEED_TYPE", "SettingsResource", "FeedResource", function ( - $http, $route, $q, $location, BASE_URL, ITEM_BATCH_SIZE, FEED_TYPE, - SettingsResource, FeedResource) { - - var showAll = SettingsResource.get('showAll'); - var oldestFirst = SettingsResource.get('oldestFirst'); - var search = $location.search().search || ''; - - var deferred = $q.defer(); - - // if those two values are null it means we did not receive - // the settings request from the server so dont query the server - if (showAll === null || oldestFirst === null) { - deferred.resolve({}); - } else { - var parameters = { - type: type, - limit: ITEM_BATCH_SIZE, - showAll: showAll, - oldestFirst: oldestFirst, - search: search - }; - - if ($route.current.params.id !== undefined) { - parameters.id = $route.current.params.id; - } - - // check if a custom ordering is set - if (type === FEED_TYPE.FEED) { - var feed = FeedResource.getById(parameters.id); - - // on intial load, the feed ordering is undefined - if (feed === undefined || feed.ordering === 2) { - parameters.oldestFirst = false; - } else if (feed.ordering === 1) { - parameters.oldestFirst = true; - } - } - - $http({ - url: BASE_URL + '/items', - method: 'GET', - params: parameters - }).success(function (data) { - deferred.resolve(data); - }); - } - - return deferred.promise; - }] - }; - }; - - var getExploreResolve = function () { - return { - sites: /* @ngInject */ ["$http", "$q", "BASE_URL", "$location", "Publisher", "SettingsResource", function ( - $http, $q, BASE_URL, $location, Publisher, SettingsResource) { - var deferred = $q.defer(); - - // always use the code from the url - var language = $location.search().lang; - if (!language) { - language = SettingsResource.get('language'); - } - - $http.get(BASE_URL + '/settings').then(function (data) { - Publisher.publishAll(data); - - // get url and strip trailing slashes - var url = SettingsResource.get('exploreUrl') - .replace(/\/+$/, ''); - - var exploreUrl = url + '/feeds.' + language + '.json'; - var defaultExploreUrl = url + '/feeds.en.json'; - return $http - .get(exploreUrl) - .catch(function () { - return $http.get(defaultExploreUrl); - }); - - }).then(function (data) { - deferred.resolve(data.data); - }).catch(function () { - deferred.reject(); - }); - - return deferred.promise; - }] - }; - }; - - $routeProvider - .when('/items', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getItemResolve(feedType.SUBSCRIPTIONS), - type: feedType.SUBSCRIPTIONS - }) - .when('/items/starred', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getItemResolve(feedType.STARRED), - type: feedType.STARRED - }) - .when('/items/feeds/:id', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getItemResolve(feedType.FEED), - type: feedType.FEED - }) - .when('/items/folders/:id', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getItemResolve(feedType.FOLDER), - type: feedType.FOLDER - }).when('/explore', { - controller: 'ExploreController as Explore', - templateUrl: 'explore.html', - resolve: getExploreResolve(), - type: feedType.EXPLORE - }).when('/shortcuts', { - templateUrl: 'shortcuts.html', - type: -1 - }); - -}]); - -app.run(["$rootScope", "$location", "$http", "$q", "$interval", "$route", "Loading", "ItemResource", "FeedResource", "FolderResource", "SettingsResource", "Publisher", "BASE_URL", "FEED_TYPE", "REFRESH_RATE", function ($rootScope, $location, $http, $q, $interval, $route, Loading, - ItemResource, FeedResource, FolderResource, SettingsResource, - Publisher, BASE_URL, FEED_TYPE, REFRESH_RATE) { - 'use strict'; - - // show Loading screen - Loading.setLoading('global', true); - - // listen to keys in returned queries to automatically distribute the - // incoming values to models - Publisher.subscribe(ItemResource).toChannels(['items', 'newestItemId', - 'starred']); - Publisher.subscribe(FolderResource).toChannels(['folders']); - Publisher.subscribe(FeedResource).toChannels(['feeds']); - Publisher.subscribe(SettingsResource).toChannels(['settings']); - - // load feeds, settings and last read feed - var settingsDeferred = $q.defer(); - $http.get(BASE_URL + '/settings').success(function (data) { - Publisher.publishAll(data); - settingsDeferred.resolve(); - }); - - var activeFeedDeferred = $q.defer(); - var path = $location.path(); - $http.get(BASE_URL + '/feeds/active').success(function (data) { - var url; - - switch (data.activeFeed.type) { - - case FEED_TYPE.FEED: - url = '/items/feeds/' + data.activeFeed.id; - break; - - case FEED_TYPE.FOLDER: - url = '/items/folders/' + data.activeFeed.id; - break; - - case FEED_TYPE.STARRED: - url = '/items/starred'; - break; - - case FEED_TYPE.EXPLORE: - url = '/explore'; - break; - - default: - url = '/items'; - } - - // only redirect if url is empty or faulty - if (!/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/ - .test(path)) { - $location.path(url); - } - - activeFeedDeferred.resolve(); - }); - - var feedDeferred = $q.defer(); - var feeds; - $http.get(BASE_URL + '/feeds').success(function (data) { - feeds = data; - feedDeferred.resolve(); - }); - - var folderDeferred = $q.defer(); - var folders; - $http.get(BASE_URL + '/folders').success(function (data) { - folders = data; - folderDeferred.resolve(); - }); - - $q.all([ - feedDeferred.promise, - folderDeferred.promise - ]).then(function () { - // first publish feeds to correctly update the folder resource unread - // cache - Publisher.publishAll(feeds); - Publisher.publishAll(folders); - if (feeds.feeds.length === 0 && folders.folders.length === 0) { - $location.path('/explore'); - } - }); - - // disable loading if all initial requests finished - $q.all( - [ - settingsDeferred.promise, - activeFeedDeferred.promise, - feedDeferred.promise, - folderDeferred.promise - ] - ) - .then(function () { - $route.reload(); - Loading.setLoading('global', false); - }); - - // refresh feeds and folders - $interval(function () { - $http.get(BASE_URL + '/feeds').success(function (data) { - Publisher.publishAll(data); - }); - $http.get(BASE_URL + '/folders').success(function (data) { - Publisher.publishAll(data); - }); - }, REFRESH_RATE * 1000); - - - $rootScope.$on('$routeChangeStart', function () { - Loading.setLoading('content', true); - }); - - $rootScope.$on('$routeChangeSuccess', function () { - Loading.setLoading('content', false); - }); - - // in case of wrong id etc show all items - $rootScope.$on('$routeChangeError', function () { - $location.path('/items'); - }); - -}]); -app.controller('AppController', -["Loading", "FeedResource", "FolderResource", function (Loading, FeedResource, FolderResource) { - 'use strict'; - - this.loading = Loading; - - this.isFirstRun = function () { - return FeedResource.size() === 0 && FolderResource.size() === 0; - }; - - this.play = function (item) { - this.playingItem = item; - }; -}]); -app.controller('ContentController', -["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", "$location", "FEED_TYPE", "ITEM_AUTO_PAGE_SIZE", "Loading", function (Publisher, FeedResource, ItemResource, SettingsResource, data, - $route, $routeParams, $location, FEED_TYPE, ITEM_AUTO_PAGE_SIZE, Loading) { - 'use strict'; - - ItemResource.clear(); - - // distribute data to models based on key - Publisher.publishAll(data); - - - this.isAutoPagingEnabled = true; - - // the interface should show a hint if there are not enough items sent so - // it's assumed that theres nothing to autpage - if (ItemResource.size() >= ITEM_AUTO_PAGE_SIZE) { - this.isNothingMoreToAutoPage = false; - } else { - this.isNothingMoreToAutoPage = true; - } - - this.getItems = function () { - return ItemResource.getAll(); - }; - - this.toggleStar = function (itemId) { - ItemResource.toggleStar(itemId); - }; - - this.toggleItem = function (item) { - // TODO: unittest - if (this.isCompactView()) { - item.show = !item.show; - } - }; - - this.isShowAll = function () { - return SettingsResource.get('showAll'); - }; - - this.markRead = function (itemId) { - var item = ItemResource.get(itemId); - - if (!item.keepUnread && item.unread === true) { - ItemResource.markItemRead(itemId); - FeedResource.markItemOfFeedRead(item.feedId); - } - }; - - this.getFeed = function (feedId) { - return FeedResource.getById(feedId); - }; - - this.toggleKeepUnread = function (itemId) { - var item = ItemResource.get(itemId); - if (!item.unread) { - FeedResource.markItemOfFeedUnread(item.feedId); - ItemResource.markItemRead(itemId, false); - } - - item.keepUnread = !item.keepUnread; - }; - - var self = this; - var getOrdering = function () { - var ordering = SettingsResource.get('oldestFirst'); - - if (self.isFeed()) { - var feed = FeedResource.getById($routeParams.id); - if (feed && feed.ordering === 1) { - ordering = true; - } else if (feed && feed.ordering === 2) { - ordering = false; - } - } - - return ordering; - }; - - this.orderBy = function () { - if (getOrdering()) { - return 'id'; - } else { - return '-id'; - } - }; - - this.isCompactView = function () { - return SettingsResource.get('compact'); - }; - - this.isCompactExpand = function () { - return SettingsResource.get('compactExpand'); - }; - - this.autoPagingEnabled = function () { - return this.isAutoPagingEnabled; - }; - - this.markReadEnabled = function () { - return !SettingsResource.get('preventReadOnScroll'); - }; - - this.scrollRead = function (itemIds) { - var ids = []; - var feedIds = []; - - itemIds.forEach(function (itemId) { - var item = ItemResource.get(itemId); - if (!item.keepUnread) { - ids.push(itemId); - feedIds.push(item.feedId); - } - }); - - if (ids.length > 0) { - FeedResource.markItemsOfFeedsRead(feedIds); - ItemResource.markItemsRead(ids); - } - }; - - this.isFeed = function () { - return $route.current.$$route.type === FEED_TYPE.FEED; - }; - - this.autoPage = function () { - if (this.isNothingMoreToAutoPage) { - return; - } - - // in case a subsequent autopage request comes in wait until - // the current one finished and execute a request immediately afterwards - if (!this.isAutoPagingEnabled) { - this.autoPageAgain = true; - return; - } - - this.isAutoPagingEnabled = false; - this.autoPageAgain = false; - - var type = $route.current.$$route.type; - var id = $routeParams.id; - var oldestFirst = getOrdering(); - var showAll = SettingsResource.get('showAll'); - var self = this; - var search = $location.search().search; - - Loading.setLoading('autopaging', true); - - ItemResource.autoPage(type, id, oldestFirst, showAll, search) - .success(function (data) { - Publisher.publishAll(data); - - if (data.items.length >= ITEM_AUTO_PAGE_SIZE) { - self.isAutoPagingEnabled = true; - } else { - self.isNothingMoreToAutoPage = true; - } - - if (self.isAutoPagingEnabled && self.autoPageAgain) { - self.autoPage(); - } - }).error(function () { - self.isAutoPagingEnabled = true; - }).finally(function () { - Loading.setLoading('autopaging', false); - }); - }; - - this.getRelativeDate = function (timestamp) { - if (timestamp !== undefined && timestamp !== '') { - var languageCode = SettingsResource.get('language'); - var date = - moment.unix(timestamp).locale(languageCode).fromNow() + ''; - return date; - } else { - return ''; - } - }; - - this.refresh = function () { - $route.reload(); - }; - - this.getMediaType = function (type) { - if (type && type.indexOf('audio') === 0) { - return 'audio'; - } else if (type && type.indexOf('video') === 0) { - return 'video'; - } else { - return undefined; - } - }; - -}]); -app.controller('ExploreController', -["sites", "$rootScope", "FeedResource", "SettingsResource", "$location", function (sites, $rootScope, FeedResource, SettingsResource, $location) { - 'use strict'; - - this.sites = sites; - // join all sites - this.feeds = Object.keys(sites).map(function (key) { - return [key, sites[key]]; - }).reduce(function (xs, x) { - var category = x[0]; - var feedList = x[1]; - feedList.forEach(function (feed) { - feed.category = category; - }); - return xs.concat(feedList); - }, []); - - this.feedExists = function (location) { - return FeedResource.getByLocation(location) !== undefined; - }; - - this.subscribeTo = function (location) { - $rootScope.$broadcast('addFeed', location); - }; - - this.isCategoryShown = function (data) { - return data.filter(function (element) { - return FeedResource.getByLocation(element.feed) === undefined; - }).length > 0; - }; - - this.getSupportedLanguageCodes = function () { - return SettingsResource.getSupportedLanguageCodes(); - }; - - this.getCurrentLanguageCode = function () { - var language = $location.search().lang; - if (!language) { - language = SettingsResource.get('language'); - } - return language; - }; - - this.showLanguage = function (languageCode) { - $location.url('/explore/?lang=' + languageCode); - }; - - this.selectedLanguageCode = this.getCurrentLanguageCode(); -}]); - -app.controller('NavigationController', -["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", "Publisher", "$rootScope", "$location", "$q", function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, - SettingsResource, Publisher, $rootScope, $location, $q) { - 'use strict'; - - this.feedError = ''; - this.showNewFolder = false; - this.renamingFolder = false; - this.addingFeed = false; - this.addingFolder = false; - this.folderError = ''; - this.renameError = ''; - this.feed = {}; - - var getRouteId = function () { - return parseInt($route.current.params.id, 10); - }; - - this.getLanguageCode = function () { - return SettingsResource.get('language'); - }; - - this.getFeeds = function () { - return FeedResource.getAll(); - }; - - this.getFolders = function () { - return FolderResource.getAll(); - }; - - this.markFolderRead = function (folderId) { - FeedResource.markFolderRead(folderId); - - FeedResource.getByFolderId(folderId).forEach(function (feed) { - ItemResource.markFeedRead(feed.id); - }); - }; - - this.markFeedRead = function (feedId) { - ItemResource.markFeedRead(feedId); - FeedResource.markFeedRead(feedId); - }; - - this.markRead = function () { - ItemResource.markRead(); - FeedResource.markRead(); - }; - - this.isShowAll = function () { - return SettingsResource.get('showAll'); - }; - - this.getFeedsOfFolder = function (folderId) { - return FeedResource.getByFolderId(folderId); - }; - - this.getUnreadCount = function () { - return FeedResource.getUnreadCount(); - }; - - this.isUnread = function () { - return this.getUnreadCount() > 0; - }; - - this.getFeedUnreadCount = function (feedId) { - var feed = FeedResource.getById(feedId); - if (feed !== undefined) { - return feed.unreadCount; - } else { - return 0; - } - }; - - this.isFeedUnread = function (feedId) { - return this.getFeedUnreadCount(feedId) > 0; - }; - - this.getFolderUnreadCount= function (folderId) { - return FeedResource.getFolderUnreadCount(folderId); - }; - - this.isFolderUnread = function (folderId) { - return this.getFolderUnreadCount(folderId) > 0; - }; - - this.getStarredCount = function () { - return ItemResource.getStarredCount(); - }; - - this.isStarredUnread = function () { - return this.getStarredCount() > 0; - }; - - this.toggleFolder = function (folderName) { - FolderResource.toggleOpen(folderName); - }; - - this.hasFeeds = function (folderId) { - return FeedResource.getFolderUnreadCount(folderId) !== undefined; - }; - - this.subFeedActive = function (folderId) { - var type = $route.current.$$route.type; - - if (type === FEED_TYPE.FEED) { - var feed = FeedResource.getById(getRouteId()); - - if (feed !== undefined && feed.folderId === folderId) { - return true; - } - } - - return false; - }; - - this.isSubscriptionsActive = function () { - return $route.current && - $route.current.$$route.type === FEED_TYPE.SUBSCRIPTIONS; - }; - - this.isStarredActive = function () { - return $route.current && - $route.current.$$route.type === FEED_TYPE.STARRED; - }; - - this.isExploreActive = function () { - return $route.current && - $route.current.$$route.type === FEED_TYPE.EXPLORE; - }; - - this.isFolderActive = function (folderId) { - return $route.current && - $route.current.$$route.type === FEED_TYPE.FOLDER && - getRouteId() === folderId; - }; - - this.isFeedActive = function (feedId) { - return $route.current && - $route.current.$$route.type === FEED_TYPE.FEED && - getRouteId() === feedId; - }; - - this.folderNameExists = function (folderName) { - folderName = folderName || ''; - return FolderResource.get(folderName.trim()) !== undefined; - }; - - this.feedUrlExists = function (url) { - url = url || ''; - url = url.trim(); - return FeedResource.get(url) !== undefined || - FeedResource.get('http://' + url) !== undefined; - }; - - this.createFeed = function (feed) { - var self = this; - this.showNewFolder = false; - this.addingFeed = true; - - var newFolder = feed.newFolder; - var existingFolder = feed.existingFolder || {id: 0}; - - // we dont need to create a new folder - if (newFolder === undefined || newFolder === '') { - // this is set to display the feed in any folder, even if the folder - // is closed or has no unread articles - existingFolder.getsFeed = true; - - FeedResource.create(feed.url, existingFolder.id, undefined) - .then(function (data) { - - Publisher.publishAll(data); - - // set folder as default - $location.path('/items/feeds/' + data.feeds[0].id + '/'); - - }).finally(function () { - existingFolder.getsFeed = undefined; - feed.url = ''; - self.addingFeed = false; - }); - - } else { - // create folder first and then the feed - FolderResource.create(newFolder).then(function (data) { - - Publisher.publishAll(data); - - // set the created folder on scope so its preselected for the - // next addition - feed.existingFolder = FolderResource.get(data.folders[0].name); - feed.newFolder = undefined; - self.createFeed(feed); - }); - } - }; - - this.createFolder = function (folder) { - var self = this; - this.addingFolder = true; - FolderResource.create(folder.name).then(function (data) { - Publisher.publishAll(data); - }).finally(function () { - self.addingFolder = false; - folder.name = ''; - }); - }; - - this.moveFeed = function (feedId, folderId) { - var reload = false; - var feed = FeedResource.getById(feedId); - - if (feed.folderId === folderId) { - return; - } - - if (this.isFolderActive(feed.folderId) || - this.isFolderActive(folderId)) { - reload = true; - } - - FeedResource.move(feedId, folderId); - - if (reload) { - $route.reload(); - } - }; - - this.renameFeed = function (feed) { - FeedResource.patch(feed.id, {title: feed.title}); - feed.editing = false; - }; - - this.renameFolder = function (folder, name) { - folder.renameError = ''; - this.renamingFolder = true; - var self = this; - - if (folder.name === name) { - folder.renameError = ''; - folder.editing = false; - this.renamingFolder = false; - } else { - FolderResource.rename(folder.name, name).then(function () { - folder.renameError = ''; - folder.editing = false; - }, function (message) { - folder.renameError = message; - }).finally(function () { - self.renamingFolder = false; - }); - } - }; - - this.reversiblyDeleteFeed = function (feed) { - FeedResource.reversiblyDelete(feed.id).finally(function () { - $route.reload(); - }); - }; - - this.undoDeleteFeed = function (feed) { - FeedResource.undoDelete(feed.id).finally(function () { - $route.reload(); - }); - }; - - this.deleteFeed = function (feed) { - FeedResource.delete(feed.url); - }; - - - this.reversiblyDeleteFolder = function (folder) { - $q.all( - FeedResource.reversiblyDeleteFolder(folder.id), - FolderResource.reversiblyDelete(folder.name) - ).finally(function () { - $route.reload(); - }); - }; - - this.undoDeleteFolder = function (folder) { - $q.all( - FeedResource.undoDeleteFolder(folder.id), - FolderResource.undoDelete(folder.name) - ).finally(function () { - $route.reload(); - }); - }; - - this.deleteFolder = function (folder) { - FeedResource.deleteFolder(folder.id); - FolderResource.delete(folder.name); - }; - - this.setOrdering = function (feed, ordering) { - FeedResource.patch(feed.id, {ordering: ordering}); - $route.reload(); - }; - - this.togglePinned = function (feedId) { - var feed = FeedResource.getById(feedId); - if (feed) { - return FeedResource.patch(feedId, {pinned: !feed.pinned}); - } - }; - - this.setUpdateMode = function (feedId, updateMode) { - return FeedResource.patch(feedId, {updateMode: updateMode}); - }; - - this.toggleFullText = function (feed) { - $rootScope.$broadcast('$routeChangeStart'); - FeedResource.toggleFullText(feed.id).finally(function () { - $rootScope.$broadcast('$routeChangeSuccess'); - $route.reload(); - }); - }; - - this.search = function (value) { - if (value === '') { - $location.search('search', null); - } else { - $location.search('search', value); - } - }; - - var self = this; - - $rootScope.$on('moveFeedToFolder', function (scope, data) { - self.moveFeed(data.feedId, data.folderId); - }); - - // based on the route we want to preselect a folder in the add new feed - // drop down - var setSelectedFolderForRoute = function () { - var type; - if ($route.current) { - type = $route.current.$$route.type; - } - - var folderId = 0; - - if (type === FEED_TYPE.FOLDER) { - folderId = getRouteId(); - } else if (type === FEED_TYPE.FEED) { - var feed = FeedResource.getById(getRouteId()); - - if (feed) { - folderId = feed.folderId; - } - } - - var folder; - if (folderId !== 0) { - folder = FolderResource.getById(folderId); - } - - self.feed.existingFolder = folder; - }; - - $rootScope.$on('$routeChangeSuccess', function () { - setSelectedFolderForRoute(); - }); - -}]); - -app.controller('SettingsController', -["$route", "$q", "SettingsResource", "ItemResource", "OPMLParser", "OPMLImporter", "Publisher", function ($route, $q, SettingsResource, ItemResource, OPMLParser, - OPMLImporter, Publisher) { - 'use strict'; - - this.isOPMLImporting = false; - this.isArticlesImporting = false; - this.opmlImportError = false; - this.articleImportError = false; - - var set = function (key, value) { - SettingsResource.set(key, value); - - if (['showAll', 'oldestFirst', 'compact'].indexOf(key) >= 0) { - $route.reload(); - } - }; - - this.toggleSetting = function (key) { - set(key, !this.getSetting(key)); - }; - - this.getSetting = function (key) { - return SettingsResource.get(key); - }; - - this.importOPML = function (content) { - this.opmlImportError = false; - this.articleImportError = false; - - try { - this.isOPMLImporting = false; - var parsedContent = OPMLParser.parse(content); - - var self = this; - var jobSize = 5; - - OPMLImporter.importFolders(parsedContent) - .then(function (feedQueue) { - return OPMLImporter.importFeedQueue(feedQueue, jobSize); - }).finally(function () { - self.isOPMLImporting = false; - }); - - } catch (error) { - console.error(error); - this.isOPMLImporting = false; - this.opmlImportError = true; - } - }; - - this.importArticles = function (content) { - this.opmlImportError = false; - this.articleImportError = false; - - try { - this.isArticlesImporting = true; - var articles = JSON.parse(content); - - var self = this; - ItemResource.importArticles(articles).success(function (data) { - Publisher.publishAll(data); - }).finally(function () { - self.isArticlesImporting = false; - }); - - } catch (error) { - console.error(error); - this.articleImportError = true; - this.isArticlesImporting = false; - } - }; - -}]); -app.filter('trustUrl', ["$sce", function ($sce) { - 'use strict'; - - return function (url) { - return $sce.trustAsResourceUrl(url); - }; -}]); -app.filter('unreadCountFormatter', function () { - 'use strict'; - - return function (unreadCount) { - if (unreadCount > 999) { - return '999+'; - } - return unreadCount; - }; -}); -app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Resource, $http, BASE_URL, $q) { - 'use strict'; - - var FeedResource = function ($http, BASE_URL, $q) { - Resource.call(this, $http, BASE_URL, 'url'); - this.ids = {}; - this.locations = {}; - this.unreadCount = 0; - this.folderUnreadCount = {}; - this.folderIds = {}; - this.$q = $q; - }; - - FeedResource.prototype = Object.create(Resource.prototype); - - FeedResource.prototype.receive = function (data) { - Resource.prototype.receive.call(this, data); - this.updateUnreadCache(); - this.updateFolderCache(); - }; - - FeedResource.prototype.clear = function () { - Resource.prototype.clear.call(this); - this.unreadCount = 0; - this.folderUnreadCount = {}; - this.folderIds = {}; - this.ids = {}; - this.locations = {}; - }; - - FeedResource.prototype.updateUnreadCache = function () { - this.unreadCount = 0; - this.folderUnreadCount = {}; - - var self = this; - this.values.forEach(function (feed) { - if (feed.unreadCount) { - self.unreadCount += feed.unreadCount; - } - if (feed.folderId !== undefined) { - self.folderUnreadCount[feed.folderId] = - self.folderUnreadCount[feed.folderId] || 0; - self.folderUnreadCount[feed.folderId] += feed.unreadCount; - } - }); - }; - - - FeedResource.prototype.updateFolderCache = function () { - this.folderIds = {}; - - var self = this; - this.values.forEach(function (feed) { - self.folderIds[feed.folderId] = - self.folderIds[feed.folderId] || []; - self.folderIds[feed.folderId].push(feed); - }); - }; - - - FeedResource.prototype.add = function (value) { - Resource.prototype.add.call(this, value); - if (value.id !== undefined) { - this.ids[value.id] = this.hashMap[value.url]; - } - if (value.location !== undefined) { - this.locations[value.location] = this.hashMap[value.url]; - } - }; - - - FeedResource.prototype.markRead = function () { - this.values.forEach(function (feed) { - feed.unreadCount = 0; - }); - - this.updateUnreadCache(); - }; - - - FeedResource.prototype.markFeedRead = function (feedId) { - this.ids[feedId].unreadCount = 0; - this.updateUnreadCache(); - }; - - - FeedResource.prototype.markFolderRead = function (folderId) { - this.values.forEach(function (feed) { - if (feed.folderId === folderId) { - feed.unreadCount = 0; - } - }); - - this.updateUnreadCache(); - }; - - - FeedResource.prototype.markItemOfFeedRead = function (feedId) { - this.ids[feedId].unreadCount -= 1; - this.updateUnreadCache(); - }; - - - FeedResource.prototype.markItemsOfFeedsRead = function (feedIds) { - var self = this; - feedIds.forEach(function (feedId) { - self.ids[feedId].unreadCount -= 1; - }); - - this.updateUnreadCache(); - }; - - - FeedResource.prototype.markItemOfFeedUnread = function (feedId) { - this.ids[feedId].unreadCount += 1; - this.updateUnreadCache(); - }; - - - FeedResource.prototype.getUnreadCount = function () { - return this.unreadCount; - }; - - - FeedResource.prototype.getFolderUnreadCount = function (folderId) { - return this.folderUnreadCount[folderId]; - }; - - - FeedResource.prototype.getByFolderId = function (folderId) { - return this.folderIds[folderId] || []; - }; - - - FeedResource.prototype.getById = function (feedId) { - return this.ids[feedId]; - }; - - - FeedResource.prototype.getByLocation = function (location) { - return this.locations[location]; - }; - - - FeedResource.prototype.move = function (feedId, folderId) { - var feed = this.getById(feedId); - feed.folderId = folderId; - - this.updateFolderCache(); - this.updateUnreadCache(); - - return this.patch(feedId, {folderId: folderId}); - - }; - - - FeedResource.prototype.create = function (url, folderId, title) { - url = url.trim(); - if (!url.startsWith('http')) { - url = 'https://' + url; - } - - if (title !== undefined) { - title = title.trim(); - } - - var feed = { - url: url, - folderId: folderId || 0, - title: title || url, - unreadCount: 0 - }; - - this.add(feed); - this.updateFolderCache(); - - var deferred = this.$q.defer(); - - this.http({ - method: 'POST', - url: this.BASE_URL + '/feeds', - data: { - url: url, - parentFolderId: folderId || 0, - title: title - } - }).success(function (data) { - deferred.resolve(data); - }).error(function (data) { - feed.faviconLink = ''; - feed.error = data.message; - deferred.reject(); - }); - - return deferred.promise; - }; - - - FeedResource.prototype.reversiblyDelete = function (id, updateCache, - isFolder) { - var feed = this.getById(id); - - // if a folder is deleted it does not have to trigger the delete - // attribute for the feed because the feed is not deleted, its just not - // displayed. Otherwise this causes the feed to also be deleted again - // because the folder destroys the feed's scope - if (feed && isFolder !== true) { - feed.deleted = true; - } - - if (updateCache !== false) { - this.updateUnreadCache(); - } - - return this.http.delete(this.BASE_URL + '/feeds/' + id); - }; - - - FeedResource.prototype.reversiblyDeleteFolder = function (folderId) { - var self = this; - var promises = []; - this.getByFolderId(folderId).forEach(function (feed) { - promises.push(self.reversiblyDelete(feed.id, false, true)); - }); - - this.updateUnreadCache(); - - var deferred = this.$q.all(promises); - return deferred.promise; - }; - - - FeedResource.prototype.delete = function (url, updateCache) { - var feed = this.get(url); - if (feed !== undefined && feed.id) { - delete this.ids[feed.id]; - } - - if (feed !== undefined && feed.location) { - delete this.locations[feed.location]; - } - - Resource.prototype.delete.call(this, url); - - if (updateCache !== false) { - this.updateUnreadCache(); - this.updateFolderCache(); - } - - return feed; - }; - - - FeedResource.prototype.deleteFolder = function (folderId) { - var self = this; - this.getByFolderId(folderId).forEach(function (feed) { - self.delete(feed.url, false); - }); - - this.updateUnreadCache(); - this.updateFolderCache(); - }; - - - FeedResource.prototype.undoDelete = function (id, updateCache) { - var feed = this.getById(id); - - if (feed) { - feed.deleted = false; - } - - if (updateCache !== false) { - this.updateUnreadCache(); - } - - return this.http.post(this.BASE_URL + '/feeds/' + id + '/restore'); - }; - - - FeedResource.prototype.undoDeleteFolder = function (folderId) { - var self = this; - var promises = []; - - this.getByFolderId(folderId).forEach(function (feed) { - promises.push(self.undoDelete(feed.id, false)); - }); - - this.updateUnreadCache(); - - var deferred = this.$q.all(promises); - return deferred.promise; - }; - - - FeedResource.prototype.setOrdering = function (feedId, ordering) { - var feed = this.getById(feedId); - - if (feed) { - feed.ordering = ordering; - var url = this.BASE_URL + '/feeds/' + feedId; - return this.http.patch(url, { - ordering: ordering - }); - } - }; - - - FeedResource.prototype.setPinned = function (feedId, isPinned) { - var feed = this.getById(feedId); - - if (feed) { - feed.pinned = isPinned; - var url = this.BASE_URL + '/feeds/' + feedId; - return this.http.patch(url, { - pinned: isPinned - }); - } - }; - - - FeedResource.prototype.patch = function (feedId, diff) { - var feed = this.getById(feedId); - - if (feed) { - Object.keys(diff).forEach(function(key) { - feed[key] = diff[key]; - }); - var url = this.BASE_URL + '/feeds/' + feedId; - return this.http.patch(url, diff); - } - }; - - - FeedResource.prototype.toggleFullText = function (feedId) { - var feed = this.getById(feedId); - - return this.patch(feedId, {fullTextEnabled: !feed.fullTextEnabled}); - }; - - - return new FeedResource($http, BASE_URL, $q); -}]); - -app.factory('FolderResource', ["Resource", "$http", "BASE_URL", "$q", function (Resource, $http, BASE_URL, $q) { - 'use strict'; - - var FolderResource = function ($http, BASE_URL, $q) { - Resource.call(this, $http, BASE_URL, 'name'); - this.deleted = null; - this.$q = $q; - this.ids = {}; - }; - - FolderResource.prototype = Object.create(Resource.prototype); - - - FolderResource.prototype.add = function (value) { - Resource.prototype.add.call(this, value); - if (value.id !== undefined) { - this.ids[value.id] = this.hashMap[value.name]; - } - }; - - FolderResource.prototype.clear = function () { - Resource.prototype.clear.call(this); - this.ids = {}; - }; - - FolderResource.prototype.delete = function (name) { - var folder = this.get(name); - if (folder !== undefined && folder.id) { - delete this.ids[folder.id]; - } - - Resource.prototype.delete.call(this, name); - - return folder; - }; - - FolderResource.prototype.toggleOpen = function (folderName) { - var folder = this.get(folderName); - folder.opened = !folder.opened; - - return this.http({ - url: this.BASE_URL + '/folders/' + folder.id + '/open', - method: 'POST', - data: { - folderId: folder.id, - open: folder.opened - } - }); - }; - - - FolderResource.prototype.rename = function (folderName, toFolderName) { - var folder = this.get(folderName); - var deferred = this.$q.defer(); - var self = this; - - this.http({ - url: this.BASE_URL + '/folders/' + folder.id + '/rename', - method: 'POST', - data: { - folderName: toFolderName - } - }).success(function () { - folder.name = toFolderName; - delete self.hashMap[folderName]; - self.hashMap[toFolderName] = folder; - - deferred.resolve(); - }).error(function (data) { - deferred.reject(data.message); - }); - - return deferred.promise; - }; - - FolderResource.prototype.getById = function (id) { - return this.ids[id]; - }; - - FolderResource.prototype.create = function (folderName) { - folderName = folderName.trim(); - var folder = { - name: folderName - }; - - this.add(folder); - - var deferred = this.$q.defer(); - - this.http({ - url: this.BASE_URL + '/folders', - method: 'POST', - data: { - folderName: folderName - } - }).success(function (data) { - deferred.resolve(data); - }).error(function (data) { - folder.error = data.message; - }); - - return deferred.promise; - }; - - - FolderResource.prototype.reversiblyDelete = function (name) { - var folder = this.get(name); - var id = folder.id; - folder.deleted = true; - return this.http.delete(this.BASE_URL + '/folders/' + id); - }; - - - FolderResource.prototype.undoDelete = function (name) { - var folder = this.get(name); - var id = folder.id; - folder.deleted = false; - return this.http.post(this.BASE_URL + '/folders/' + id + '/restore'); - }; - - - return new FolderResource($http, BASE_URL, $q); -}]); -app.factory('ItemResource', ["Resource", "$http", "BASE_URL", "ITEM_BATCH_SIZE", function (Resource, $http, BASE_URL, - ITEM_BATCH_SIZE) { - 'use strict'; - - var ItemResource = function ($http, BASE_URL, ITEM_BATCH_SIZE) { - Resource.call(this, $http, BASE_URL); - this.batchSize = ITEM_BATCH_SIZE; - this.clear(); - }; - - ItemResource.prototype = Object.create(Resource.prototype); - - ItemResource.prototype.clear = function () { - this.starredCount = 0; - this.lowestId = 0; - this.highestId = 0; - Resource.prototype.clear.call(this); - }; - - ItemResource.prototype.receive = function (value, channel) { - switch (channel) { - - case 'newestItemId': - this.newestItemId = value; - break; - - case 'starred': - this.starredCount = value; - break; - - default: - var self = this; - value.forEach(function (item) { - // initialize lowest and highest id - if (self.lowestId === 0) { - self.lowestId = item.id; - } - if (self.highestId === 0) { - self.highestId = item.id; - } - - if (item.id > self.highestId) { - self.highestId = item.id; - } - if (item.id < self.lowestId) { - self.lowestId = item.id; - } - }); - - Resource.prototype.receive.call(this, value, channel); - } - }; - - - ItemResource.prototype.getNewestItemId = function () { - return this.newestItemId; - }; - - - ItemResource.prototype.getStarredCount = function () { - return this.starredCount; - }; - - - ItemResource.prototype.star = function (itemId, isStarred) { - if (isStarred === undefined) { - isStarred = true; - } - - var it = this.get(itemId); - var url = this.BASE_URL + - '/items/' + it.feedId + '/' + it.guidHash + '/star'; - - it.starred = isStarred; - - if (isStarred) { - this.starredCount += 1; - } else { - this.starredCount -= 1; - } - - return this.http({ - url: url, - method: 'POST', - data: { - isStarred: isStarred - } - }); - }; - - - ItemResource.prototype.toggleStar = function (itemId) { - if (this.get(itemId).starred) { - this.star(itemId, false); - } else { - this.star(itemId, true); - } - }; - - - ItemResource.prototype.markItemRead = function (itemId, isRead) { - if (isRead === undefined) { - isRead = true; - } - - this.get(itemId).unread = !isRead; - - return this.http({ - url: this.BASE_URL + '/items/' + itemId + '/read', - method: 'POST', - data: { - isRead: isRead - } - }); - }; - - - ItemResource.prototype.markItemsRead = function (itemIds) { - var self = this; - - itemIds.forEach(function(itemId) { - self.get(itemId).unread = false; - }); - - return this.http({ - url: this.BASE_URL + '/items/read/multiple', - method: 'POST', - data: { - itemIds: itemIds - } - }); - }; - - - ItemResource.prototype.markFeedRead = function (feedId, read) { - if (read === undefined) { - read = true; - } - - var items = this.values.filter(function (element) { - return element.feedId === feedId; - }); - - items.forEach(function (item) { - item.unread = !read; - }); - - return this.http.post(this.BASE_URL + '/feeds/' + feedId + '/read', { - highestItemId: this.getNewestItemId() - }); - }; - - - ItemResource.prototype.markRead = function () { - this.values.forEach(function (item) { - item.unread = false; - }); - - return this.http({ - url: this.BASE_URL + '/items/read', - method: 'POST', - data: { - highestItemId: this.getNewestItemId() - } - }); - }; - - - ItemResource.prototype.autoPage = function (type, id, oldestFirst, - showAll, search) { - var offset; - - if (oldestFirst) { - offset = this.highestId; - } else { - offset = this.lowestId; - } - - return this.http({ - url: this.BASE_URL + '/items', - method: 'GET', - params: { - type: type, - id: id, - offset: offset, - limit: this.batchSize, - oldestFirst: oldestFirst, - showAll: showAll, - search: search - } - }); - }; - - - ItemResource.prototype.importArticles = function (json) { - return this.http({ - url: this.BASE_URL + '/feeds/import/articles', - method: 'POST', - data: { - json: json - } - }); - }; - - - return new ItemResource($http, BASE_URL, ITEM_BATCH_SIZE); -}]); -app.service('Loading', function () { - 'use strict'; - - this.loading = { - global: false, - content: false, - autopaging: false - }; - - this.setLoading = function (area, isLoading) { - this.loading[area] = isLoading; - }; - - this.isLoading = function (area) { - return this.loading[area]; - }; - -}); -app.service('OPMLImporter', ["FeedResource", "FolderResource", "Publisher", "$q", function (FeedResource, FolderResource, Publisher, - $q) { - 'use strict'; - var startFeedJob = function (queue) { - var deferred = $q.defer(); - - if (queue.length > 0) { - var feed = queue.pop(); - var url = feed.url; - var title = feed.title; - var folderId = 0; - var folderName = feed.folderName; - - if (folderName !== undefined && - FolderResource.get(folderName) !== undefined) { - var folder = FolderResource.get(folderName); - folder.opened = true; - folderId = folder.id; - - // display folder while adding the feed - folder.getsFeed = true; - folder.getsFeedCounter = folder.getsFeedCounter || 0; - folder.getsFeedCounter += 1; - } - - // make sure to not add already existing feeds - if (url !== undefined && FeedResource.get(url) === undefined) { - FeedResource.create(url, folderId, title) - .then(function (data) { - Publisher.publishAll(data); - }) - .finally(function () { - if (folderId !== 0) { - folder.getsFeedCounter -= 1; - - if (folder.getsFeedCounter === 0) { - folder.getsFeed = false; - } - } - startFeedJob(queue); - }); - } - } else { - deferred.resolve(); - } - - return deferred.promise; - }; - - this.importFolders = function (content) { - // assumption: folders are fast to create and we dont need a queue for - // them - var feedQueue = []; - var folderPromises = []; - content.folders.forEach(function (folder) { - if (folder.name !== undefined) { - // skip already created folders - if (FolderResource.get(folder.name) === undefined) { - var promise = FolderResource.create(folder.name) - .then(function (data) { - Publisher.publishAll(data); - }); - folderPromises.push(promise); - } - - folder.feeds.forEach(function (feed) { - feed.folderName = folder.name; - feedQueue.push(feed); - }); - } - }); - feedQueue = feedQueue.concat(content.feeds); - - var deferred = $q.defer(); - - $q.all(folderPromises).finally(function () { - deferred.resolve(feedQueue); - }); - - return deferred.promise; - }; - - this.importFeedQueue = function (feedQueue, jobSize) { - // queue feeds to prevent server slowdown - var deferred = $q.defer(); - - var jobPromises = []; - for (var i=0; i<jobSize; i+=1) { - jobPromises.push(startFeedJob(feedQueue)); - } - - $q.all(jobPromises).then(function () { - deferred.resolve(); - }); - - return deferred.promise; - }; - -}]); -app.service('OPMLParser', function () { - 'use strict'; - - var parseOutline = function (outline) { - var url = outline.attr('xmlUrl') || outline.attr('htmlUrl'); - var name = outline.attr('title') || outline.attr('text') || url; - - // folder - if (url === undefined) { - return { - type: 'folder', - name: name, - feeds: [] - }; - - // feed - } else { - return { - type: 'feed', - name: name, - url: url - }; - } - }; - - // there is only one level, so feeds in a folder in a folder should be - // attached to the root folder - var recursivelyParse = function (level, root, firstLevel) { - for (var i=0; i<level.length; i+=1) { - var outline = $(level[i]); - - var entry = parseOutline(outline); - - if (entry.type === 'feed') { - root.feeds.push(entry); - } else { - - // only first level should append folders - if (firstLevel) { - recursivelyParse(outline.children('outline'), entry, false); - root.folders.push(entry); - } else { - recursivelyParse(outline.children('outline'), root, false); - } - } - } - - return root; - }; - - this.parse = function (xml) { - xml = $.parseXML(xml); - var firstLevel = $(xml).find('body > outline'); - - var root = { - 'feeds': [], - 'folders': [] - }; - - return recursivelyParse(firstLevel, root, true); - }; - -}); -/*jshint undef:false*/ -app.service('Publisher', function () { - 'use strict'; - - this.channels = {}; - - this.subscribe = function (obj) { - var self = this; - - return { - toChannels: function (channels) { - channels.forEach(function (channel) { - self.channels[channel] = self.channels[channel] || []; - self.channels[channel].push(obj); - }); - } - }; - - }; - - this.publishAll = function (data) { - var self = this; - - Object.keys(data).forEach(function (channel) { - var listeners = self.channels[channel]; - if (listeners !== undefined) { - listeners.forEach(function (listener) { - listener.receive(data[channel], channel); - }); - } - }); - }; - -}); -app.factory('Resource', function () { - 'use strict'; - - var Resource = function (http, BASE_URL, id) { - this.id = id || 'id'; - this.values = []; - this.hashMap = {}; - this.http = http; - this.BASE_URL = BASE_URL; - }; - - - Resource.prototype.receive = function (objs) { - var self = this; - objs.forEach(function (obj) { - self.add(obj); - }); - }; - - - Resource.prototype.add = function (obj) { - var existing = this.hashMap[obj[this.id]]; - - if (existing === undefined) { - this.values.push(obj); - this.hashMap[obj[this.id]] = obj; - } else { - // copy values from new to old object if it exists already - Object.keys(obj).forEach(function (key) { - existing[key] = obj[key]; - }); - } - }; - - - Resource.prototype.size = function () { - return this.values.length; - }; - - - Resource.prototype.get = function (id) { - return this.hashMap[id]; - }; - - - Resource.prototype.delete = function (id) { - // find index of object that should be deleted - var self = this; - var deleteAtIndex = this.values.findIndex(function(element) { - return element[self.id] === id; - }); - - if (deleteAtIndex !== undefined) { - this.values.splice(deleteAtIndex, 1); - } - - if (this.hashMap[id] !== undefined) { - delete this.hashMap[id]; - } - }; - - - Resource.prototype.clear = function () { - this.hashMap = {}; - - // http://stackoverflow.com/questions/1232040 - // this is the fastes way to empty an array when you want to keep - // the reference around - while (this.values.length > 0) { - this.values.pop(); - } - }; - - - Resource.prototype.getAll = function () { - return this.values; - }; - - - return Resource; -}); -/*jshint unused:false*/ -app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL) { - 'use strict'; - - this.settings = { - language: 'en', - showAll: null, - compact: false, - oldestFirst: null, - preventReadOnScroll: false, - compactExpand: false, - exploreUrl: '' - }; - this.defaultLanguageCode = 'en'; - this.supportedLanguageCodes = [ - 'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en', 'en-ca', - 'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi', - 'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne', - 'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr', - 'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw' - ]; - - this.getSupportedLanguageCodes = function () { - return this.supportedLanguageCodes; - }; - - this.receive = function (data) { - var self = this; - Object.keys(data).forEach(function (key) { - var value = data[key]; - - if (key === 'language') { - value = self.processLanguageCode(value); - } - - self.settings[key] = value; - }); - }; - - this.get = function (key) { - return this.settings[key]; - }; - - this.set = function (key, value) { - this.settings[key] = value; - - return $http({ - url: BASE_URL + '/settings', - method: 'PUT', - data: { - language: this.settings.language, - showAll: this.settings.showAll, - compact: this.settings.compact, - oldestFirst: this.settings.oldestFirst, - compactExpand: this.settings.compactExpand, - preventReadOnScroll: this.settings.preventReadOnScroll - } - }); - }; - - this.processLanguageCode = function (languageCode) { - languageCode = languageCode.replace('_', '-').toLowerCase(); - - if (this.supportedLanguageCodes.indexOf(languageCode) < 0) { - languageCode = languageCode.split('-')[0]; - } - - if (this.supportedLanguageCodes.indexOf(languageCode) < 0) { - languageCode = this.defaultLanguageCode; - } - - return languageCode; - }; - -}]); - -/** - * This prefills the add feed section if an external link has ?subsribe_to - * filled out - */ -(function (window, document, navigator, url, $, undefined) { - 'use strict'; - - // register reader as feed reader in firefox - var location = window.location; - var storage = window.localStorage; - - // if isContentHandlerRegistered is not implemented (Firefox I'm looking - // at you) we use localstorage to prevent registering the feed reader twice - var registerHandler = function (mime, url, title) { - var registered = navigator.isContentHandlerRegistered; - - var isRegistered = function (mime, url) { - if (registered) { - return registered(mime, url) !== 'new'; - } else { - return storage.getItem('registeredHandler') === url; - } - }; - - if (navigator.registerContentHandler && !isRegistered(mime, url)) { - navigator.registerContentHandler(mime, subscribeUrl, title); - if (!registered) { - storage.setItem('registeredHandler', url); - } - } - }; - - var cleanUrl = location.protocol + '//' + location.host + location.pathname; - - var subscribeUrl = cleanUrl + '?subscribe_to=%s'; - var mimeType = 'application/vnd.mozilla.maybe.feed'; - var title = 'ownCloud News @ ' + cleanUrl; - - registerHandler(mimeType, subscribeUrl, title); - - - $(document).ready(function () { - var subscription = url('?subscribe_to'); - if (subscription && subscription !== 'undefined') { - $('#new-feed').show(); - - var input = $('input[ng-model="Navigation.feed.url"]'); - input.val(subscription); - input.trigger('input'); - - // hacky way to focus because initial loading of a feed - // steals the focus - setTimeout(function() { - input.focus(); - }, 1000); - } - }); - -})(window, document, navigator, url, $); - -/** - * Various fixes - */ -(function (window, document) { - 'use strict'; - - // If F5 is used to reload the page in Firefox, the content will sometimes - // be scrolled back to the position where it was before the reload which - // will cause new articles being marked as read - window.addEventListener('beforeunload', function () { - var content = document.querySelector('#app-content'); - content.scrollTo(0, 0); - }); - -})(window, document); -/** - * Code in here acts only as a click shortcut mechanism. That's why its not - * being put into a directive since it has to be tested with protractor - * anyways and theres no benefit from wiring it into the angular app - */ -(function (window, document, $) { - 'use strict'; - - var noInputFocused = function (element) { - return !( - element.is('input') || - element.is('select') || - element.is('textarea') || - element.is('checkbox') - ); - }; - - var noModifierKey = function (event) { - return !( - event.shiftKey || - event.altKey || - event.ctrlKey || - event.metaKey - ); - }; - - var markAllRead = function (navigationArea) { - var selector = '.active > .app-navigation-entry-menu .mark-read button'; - var button = navigationArea.find(selector); - if (button.length > 0) { - button.trigger('click'); - } - }; - - var isInScrollView = function (elem, scrollArea) { - // offset().top adds the navigation bar too so we have to subract it - var elemTop = elem.offset().top - scrollArea.offset().top; - var elemBottom = elemTop + elem.height(); - - var areaBottom = scrollArea.height(); - - return elemTop >= 0 && elemBottom < areaBottom; - }; - - var scrollToNavigationElement = function (elem, scrollArea, toTop) { - if (elem.length === 0 || (!toTop && isInScrollView(elem, scrollArea))) { - return; - } - scrollArea.scrollTop( - elem.offset().top - scrollArea.offset().top + scrollArea.scrollTop() - ); - }; - - var scrollToActiveNavigationEntry = function (navigationArea) { - var element = navigationArea.find('.active'); - scrollToNavigationElement(element, navigationArea.children('ul'), true); - }; - - var reloadFeed = function (navigationArea) { - navigationArea.find('.active > a:visible').trigger('click'); - }; - - var tryReload = function (navigationArea, scrollArea) { - if (scrollArea.scrollTop() === 0) { - var pullToRefresh = scrollArea.find('.pull-to-refresh'); - if (!pullToRefresh.hasClass('show-pull-to-refresh')) { - pullToRefresh.addClass('show-pull-to-refresh'); - } else if (pullToRefresh.hasClass('done')) { - reloadFeed(navigationArea); - } - } - }; - - var activateNavigationEntry = function (element, navigationArea) { - element.children('a:visible').trigger('click'); - scrollToNavigationElement(element, navigationArea.children('ul')); - }; - - var nextFeed = function (navigationArea) { - var current = navigationArea.find('.active'); - var elements = navigationArea.find('.explore-feed,' + - '.subscriptions-feed:visible,' + - '.starred-feed:visible,' + - '.feed:visible'); - - if (current.hasClass('folder')) { - while (current.length > 0) { - var subfeeds = current.find('.feed:visible'); - if (subfeeds.length > 0) { - activateNavigationEntry($(subfeeds[0]), navigationArea); - return; - } - current = current.next('.folder'); - } - - // no subfeed found - return; - } - - // FIXME: O(n) runtime. If someone creates a nice and not fugly solution - // please create a PR - for (var i=0; i<elements.length-1; i+=1) { - var element = elements[i]; - - if (element === current[0]) { - var next = elements[i+1]; - activateNavigationEntry($(next), navigationArea); - break; - } - } - }; - - var getParentFolder = function (current) { - return current.parent().parent('.folder'); - }; - - var selectFirstOrLastFolder = function (navigationArea, isLast) { - var folders = navigationArea.find('.folder:visible'); - - var index; - if (isLast) { - index = folders.length - 1; - } else { - index = 0; - } - - if (folders.length > 0) { - activateNavigationEntry($(folders[index]), navigationArea); - } - }; - - var previousFolder = function (navigationArea) { - var current = navigationArea.find('.active'); - - // cases: folder active, subfeed active, feed active, none active - if (current.hasClass('folder')) { - activateNavigationEntry(current.prevAll('.folder:visible').first(), - navigationArea); - } else if (current.hasClass('feed')) { - var parentFolder = getParentFolder(current); - if (parentFolder.length > 0) { - // first go to previous folder should select the parent folder - activateNavigationEntry(parentFolder, navigationArea); - } else { - selectFirstOrLastFolder(navigationArea, true); - } - } else { - selectFirstOrLastFolder(navigationArea, true); - } - }; - - var nextFolder = function (navigationArea) { - var current = navigationArea.find('.active'); - - // cases: folder active, subfeed active, feed active, none active - if (current.hasClass('folder')) { - activateNavigationEntry(current.nextAll('.folder:visible').first(), - navigationArea); - } else if (current.hasClass('feed')) { - var parentFolder = getParentFolder(current); - if (parentFolder.length > 0) { - activateNavigationEntry( - parentFolder.nextAll('.folder:visible').first(), - navigationArea - ); - } else { - selectFirstOrLastFolder(navigationArea); - } - } else { - selectFirstOrLastFolder(navigationArea); - } - }; - - var previousFeed = function (navigationArea) { - var current = navigationArea.find('.active'); - var elements = navigationArea.find('.explore-feed,' + - '.subscriptions-feed:visible,' + - '.starred-feed:visible,' + - '.feed:visible'); - - // special case: folder selected - if (current.hasClass('folder')) { - var previousFolder = current.prev('.folder'); - - while (previousFolder.length > 0) { - var subfeeds = previousFolder.find('.feed:visible'); - if (subfeeds.length > 0) { - activateNavigationEntry($(subfeeds[subfeeds.length-1]), - navigationArea); - return; - } - previousFolder = previousFolder.prev('.folder'); - } - - // no subfeed found try visible feeds - var feeds = current.siblings('.feed'); - - if (feeds.length > 0) { - activateNavigationEntry($(feeds[feeds.length-1]), - navigationArea); - return; - } - - - // no feed found, go to starred - var starred = $('.starred-feed:visible'); - if (starred.length > 0) { - activateNavigationEntry(starred, navigationArea); - } - - return; - } - - // FIXME: O(n) runtime. If someone creates a nice and not fugly solution - // please create a PR - for (var i=elements.length-1; i>0; i-=1) { - var element = elements[i]; - - if (element === current[0]) { - var previous = elements[i-1]; - activateNavigationEntry($(previous), navigationArea); - break; - } - } - }; - - var onActiveItem = function (scrollArea, callback) { - var items = scrollArea.find('.item'); - - items.each(function (index, item) { - item = $(item); - - // 130px of the item should be visible - if ((item.height() + item.position().top) > 30) { - callback(item); - - return false; - } - }); - - }; - - var toggleUnread = function (scrollArea) { - onActiveItem(scrollArea, function (item) { - item.find('.toggle-keep-unread').trigger('click'); - }); - }; - - var toggleStar = function (scrollArea) { - onActiveItem(scrollArea, function (item) { - item.find('.star').trigger('click'); - }); - }; - - var expandItem = function (scrollArea) { - onActiveItem(scrollArea, function (item) { - item.find('.utils').trigger('click'); - }); - }; - - var openLink = function (scrollArea) { - onActiveItem(scrollArea, function (item) { - item.trigger('click'); // mark read - window.open(item.find('.external:visible').attr('href'), '_blank'); - }); - }; - - var scrollToItem = function (scrollArea, item, expandItemInCompact) { - // if you go to the next article in compact view, it should - // expand the current one - scrollArea.scrollTop( - item.offset().top - scrollArea.offset().top + scrollArea.scrollTop() - ); - - if (expandItemInCompact) { - onActiveItem(scrollArea, function (item) { - if (!item.hasClass('open')) { - item.find('.utils').trigger('click'); - } - }); - } - }; - - var scrollToNextItem = function (scrollArea, expandItemInCompact) { - var items = scrollArea.find('.item'); - var jumped = false; - - items.each(function (index, item) { - item = $(item); - - // special treatment for items that have expand enabled: - // if you click next and the first item has not been expaned and - // is on the top, it should be expanded instead of the next one - if ((item.position().top === 0 && expandItemInCompact && - !item.hasClass('open')) || - item.position().top > 10) { - scrollToItem(scrollArea, item, expandItemInCompact); - - jumped = true; - - return false; - } - }); - - // in case this is the last item it should still scroll below the top - if (!jumped) { - scrollArea.scrollTop(scrollArea.prop('scrollHeight')); - } - - }; - - var scrollToPreviousItem = function (navigationArea, scrollArea, - expandItemInCompact) { - var items = scrollArea.find('.item'); - var jumped = false; - - items.each(function (index, item) { - item = $(item); - - if ((item.position().top + 10) >= 0) { - var previous = item.prev(); - - // if there are no items before the current one - if (previous.length > 0) { - scrollToItem(scrollArea, previous, expandItemInCompact); - } else { - tryReload(navigationArea, scrollArea); - scrollArea.scrollTop(0); - } - - jumped = true; - - return false; - } - }); - - // if there was no jump jump to the last element - if (!jumped && items.length > 0) { - scrollToItem(scrollArea, items.last()); - } - }; - - - $(document).keyup(function (event) { - var keyCode = event.keyCode; - var scrollArea = $('#app-content'); - var navigationArea = $('#app-navigation'); - var isCompactView = $('#articles.compact').length > 0; - var isExpandItem = $('#articles') - .attr('news-compact-expand') === 'true'; - var expandItemInCompact = isCompactView && isExpandItem; - - if (noInputFocused($(':focus')) && noModifierKey(event)) { - // j, n, right arrow - if ([74, 78, 39].indexOf(keyCode) >= 0) { - - event.preventDefault(); - scrollToNextItem(scrollArea, expandItemInCompact); - - // k, p, left arrow - } else if ([75, 80, 37].indexOf(keyCode) >= 0) { - - event.preventDefault(); - scrollToPreviousItem(navigationArea, scrollArea, - expandItemInCompact); - - // u - } else if ([85].indexOf(keyCode) >= 0) { - - event.preventDefault(); - toggleUnread(scrollArea); - - // e - } else if ([69].indexOf(keyCode) >= 0) { - - event.preventDefault(); - expandItem(scrollArea); - - // s, i, l - } else if ([73, 83, 76].indexOf(keyCode) >= 0) { - - event.preventDefault(); - toggleStar(scrollArea); - - // h - } else if ([72].indexOf(keyCode) >= 0) { - - event.preventDefault(); - toggleStar(scrollArea); - scrollToNextItem(scrollArea); - - // o - } else if ([79].indexOf(keyCode) >= 0) { - - event.preventDefault(); - openLink(scrollArea); - - // r - } else if ([82].indexOf(keyCode) >= 0) { - - event.preventDefault(); - reloadFeed(navigationArea); - - // f - } else if ([70].indexOf(keyCode) >= 0) { - - event.preventDefault(); - nextFeed(navigationArea); - - // d - } else if ([68].indexOf(keyCode) >= 0) { - - event.preventDefault(); - previousFeed(navigationArea); - - // c - } else if ([67].indexOf(keyCode) >= 0) { - - event.preventDefault(); - previousFolder(navigationArea); - - // a - } else if ([65].indexOf(keyCode) >= 0) { - - event.preventDefault(); - scrollToActiveNavigationEntry(navigationArea); - - // v - } else if ([86].indexOf(keyCode) >= 0) { - - event.preventDefault(); - nextFolder(navigationArea); - - // q - } else if ([81].indexOf(keyCode) >= 0) { - - event.preventDefault(); - $('#searchbox').focus(); - - // page up - } else if ([33].indexOf(keyCode) >= 0) { - - tryReload(navigationArea, scrollArea); - - } - - // everything with shift - } else if (noInputFocused($(':focus')) && event.shiftKey) { - - // shift + a - if ([65].indexOf(keyCode) >= 0) { - - event.preventDefault(); - markAllRead(navigationArea); - - } - } - }); - -}(window, document, $)); - -window.News = window.News || {}; - - -(function (window, document, $, exports, undefined) { - 'use strict'; - - var articleActionPlugins = []; - - exports.addArticleAction = function (action) { - articleActionPlugins.push(action); - }; - - exports.getArticleActionPlugins = function () { - return articleActionPlugins; - }; - -})(window, document, jQuery, window.News); - - -app.run(["$document", "$rootScope", function ($document, $rootScope) { - 'use strict'; - $document.click(function (event) { - $rootScope.$broadcast('documentClicked', event); - }); -}]); - -app.directive('appNavigationEntryUtils', function () { - 'use strict'; - return { - restrict: 'C', - link: function (scope, elm) { - var menu = elm.siblings('.app-navigation-entry-menu'); - var button = $(elm) - .find('.app-navigation-entry-utils-menu-button button'); - - button.click(function () { - menu.toggleClass('open'); - }); - - scope.$on('documentClicked', function (scope, event) { - if (event.target !== button[0]) { - menu.removeClass('open'); - } - }); - } - }; -}); -app.directive('newsAddFeed', ["$rootScope", "$timeout", function ($rootScope, $timeout) { - 'use strict'; - - return { - restrict: 'A', - link: function (scope, elem) { - $rootScope.$on('addFeed', function (_, url) { - - $timeout(function () { - if (elem.is(':animated')) { - elem.stop(true, true); - elem.show(); - } else if (!elem.is(':visible')) { - elem.slideDown(); - } - elem.find('[ng-model="Navigation.feed.url"]').focus(); - }); - - scope.Navigation.feed.url = url; - }); - } - }; -}]); -app.directive('newsArticleActions', function () { - 'use strict'; - return { - restrict: 'A', - scope: { - newsArticleActions: '=', - noPlugins: '=' - }, - link: function (scope, elem) { - var plugins = News.getArticleActionPlugins(); - - for (var i=0; i<plugins.length; i+=1) { - plugins[i](elem, scope.newsArticleActions); - } - - scope.noPlugins = plugins.length === 0; - } - }; -}); - -app.directive('newsAutoFocus', ["$timeout", function ($timeout) { - 'use strict'; - return function (scope, elem, attrs) { - var toFocus = elem; - - if (attrs.newsAutoFocus) { - toFocus = $(attrs.newsAutoFocus); - } - - // to combat $digest already in process error when route changes - $timeout(function () { - toFocus.focus(); - }, 0); - }; -}]); -app.directive('newsBindHtmlUnsafe', function () { - 'use strict'; - - return function (scope, elem, attr) { - scope.$watch(attr.newsBindHtmlUnsafe, function () { - elem.html(scope.$eval(attr.newsBindHtmlUnsafe)); - }); - }; -}); -app.directive('newsDraggable', function () { - 'use strict'; - - return function (scope, elem, attr) { - var options = scope.$eval(attr.newsDraggable); - - if (angular.isDefined(options)) { - elem.draggable(options); - } else { - elem.draggable(); - } - - attr.$observe('newsDraggableDisable', function (value) { - if (value === 'true') { - elem.draggable('disable'); - } else { - elem.draggable('enable'); - } - }); - }; -}); -app.directive('newsDroppable', ["$rootScope", function ($rootScope) { - 'use strict'; - - return function (scope, elem, attr) { - var details = { - accept: '.feed', - hoverClass: 'drag-and-drop', - greedy: true, - drop: function (event, ui) { - - $('.drag-and-drop').removeClass('drag-and-drop'); - - var data = { - folderId: parseInt(elem.data('id'), 10), - feedId: parseInt($(ui.draggable).data('id'), 10) - }; - - $rootScope.$broadcast('moveFeedToFolder', data); - scope.$apply(attr.droppable); - } - }; - - elem.droppable(details); - }; -}]); -app.directive('newsFinishedTransition', function () { - 'use strict'; - - return function (scope, elem, attrs) { - elem.on('transitionend', function () { - elem.addClass(attrs.newsFinishedTransition); - }); - }; - -}); -app.directive('newsFocus', ["$timeout", "$interpolate", function ($timeout, $interpolate) { - 'use strict'; - - return function (scope, elem, attrs) { - elem.click(function () { - var toReadd = $($interpolate(attrs.newsFocus)(scope)); - $timeout(function () { - toReadd.focus(); - }, 500); - }); - }; - -}]); -app.directive('newsInstantNotification', function () { - 'use strict'; - - return { - restrict: 'E', - link: function (scope, elem) { - elem.hide(); - - var notification = elem.html(); - OC.Notification.showHtml(notification); - } - }; - -}); -/** - * Pause playback on elements other than the current one - */ -app.directive('newsPlayOne', ["$rootScope", function ($rootScope) { - 'use strict'; - return { - restrict: 'A', - link: function (scope, elem) { - elem.on('play', function () { - $rootScope.$broadcast('playing', elem); - }); - - $rootScope.$on('playing', function (scope, args) { - if (args[0] !== elem[0]) { - elem[0].pause(); - } - }); - } - }; -}]); -app.directive('newsPullToRefresh', ["$rootScope", function ($rootScope) { - 'use strict'; - - var scrolled = false; - - return { - restrict: 'A', - scope: { - newsPullToRefresh: '=' - }, - link: function (scope, element) { - - // change in the route means the content is refreshed - // so reset the var - $rootScope.$on('$routeChangeStart', function () { - scrolled = false; - scope.newsPullToRefresh = false; - }); - - element.on('scroll', function () { - if (element.scrollTop() === 0 && scrolled) { - scope.newsPullToRefresh = true; - } - scrolled = true; - }); - } - }; -}]); -app.directive('newsReadFile', function () { - 'use strict'; - - return function (scope, elem, attr) { - - elem.change(function () { - - var file = elem[0].files[0]; - var reader = new FileReader(); - - reader.onload = function (event) { - // FIXME: is there a more flexible solution where we dont have - // to bind the file to scope? - scope.$fileContent = event.target.result; - scope.$apply(attr.newsReadFile); - }; - - reader.readAsText(file); - }); - }; -}); -app.directive('newsRefreshMasonry', ["$timeout", function ($timeout) { - 'use strict'; - var refresh = function (elem) { - $timeout(function () { - $timeout(function () { - elem.parent().masonry({ - itemSelector: '.grid-item', - gutter: 25, - columnWidth: 300 - }); - }); - }); - }; - - return function (scope, elem) { - if (scope.$last) { - refresh(elem); - } - }; -}]); -app.directive('newsScroll', ["$timeout", "ITEM_AUTO_PAGE_SIZE", "MARK_READ_TIMEOUT", "SCROLL_TIMEOUT", function ($timeout, ITEM_AUTO_PAGE_SIZE, - MARK_READ_TIMEOUT, SCROLL_TIMEOUT) { - 'use strict'; - var timer; - - // autopaging - var autoPage = function (limit, elem, scope) { - var counter = 0; - var articles = elem.find('.item'); - - for (var i = articles.length - 1; i >= 0; i -= 1) { - var item = $(articles[i]); - - - // if the counter is higher than the size it means - // that it didnt break to auto page yet and that - // there are more items, so break - if (counter >= limit) { - break; - } - - // this is only reached when the item is not is - // below the top and we didnt hit the factor yet so - // autopage and break - if (item.position().top < 0) { - scope.$apply(scope.newsScrollAutoPage); - break; - } - - counter += 1; - } - }; - - // mark read - var markRead = function (enabled, elem, scope) { - if (enabled) { - var ids = []; - var articles = elem.find('.item:not(.read)'); - - articles.each(function(index, article) { - var item = $(article); - - if (item.position().top <= -10) { - ids.push(parseInt(item.data('id'), 10)); - } else { - return false; - } - }); - - scope.itemIds = ids; - scope.$apply(scope.newsScrollMarkRead); - } - }; - - return { - restrict: 'A', - scope: { - 'newsScroll': '@', - 'newsScrollAutoPage': '&', - 'newsScrollMarkRead': '&', - 'newsScrollEnabledMarkRead': '=', - }, - link: function (scope, elem) { - var allowScroll = true; - var scrollArea = elem; - - if (scope.newsScroll) { - scrollArea = $(scope.newsScroll); - } - - var scrollHandler = function () { - // allow only one scroll event to trigger every 300ms - if (allowScroll) { - allowScroll = false; - - $timeout(function () { - allowScroll = true; - }, SCROLL_TIMEOUT*1000); - - autoPage(ITEM_AUTO_PAGE_SIZE, elem, scope); - - // dont stack mark read requests - if (timer) { - $timeout.cancel(timer); - } - - // allow user to undo accidental scroll - timer = $timeout(function () { - markRead(scope.newsScrollEnabledMarkRead, - elem, - scope); - timer = undefined; - }, MARK_READ_TIMEOUT*1000); - } - }; - - scrollArea.on('scroll', scrollHandler); - - // remove scroll handler if element is destroyed - scope.$on('$destroy', function () { - scrollArea.off('scroll', scrollHandler); - }); - } - }; -}]); -app.directive('newsSearch', ["$document", "$location", function ($document, $location) { - 'use strict'; - - return { - restrict: 'E', - scope: { - 'onSearch': '=' - }, - link: function (scope) { - var box = $('#searchbox'); - box.val($location.search().search); - - var doSearch = function () { - var value = box.val(); - scope.$apply(function () { - scope.onSearch(value); - }); - }; - - box.on('search keyup', function (event) { - if (event.type === 'search' || event.keyCode === 13) { - doSearch(); - } - }); - - // carry over search on route change - scope.$watch(function () { - return $location.search(); - }, function (search) { - if (search && search.search) { - box.val(search.search); - } else { - box.val(''); - } - }); - } - }; -}]); - -app.directive('newsStickyMenu', function () { - 'use strict'; - - return function (scope, elem, attr) { - var height = 40; - - $(attr.newsStickyMenu).scroll(function () { - var scrollHeight = $(this).scrollTop(); - - if (scrollHeight > height) { - elem.addClass('fixed'); - elem.css('top', scrollHeight); - } else { - elem.removeClass('fixed'); - } - }); - }; -}); -app.directive('newsStopPropagation', function () { - 'use strict'; - return { - restrict: 'A', - link: function (scope, element) { - element.bind('click', function (event) { - event.stopPropagation(); - }); - } - }; -}); -app.directive('newsTimeout', ["$timeout", "$rootScope", function ($timeout, $rootScope) { - 'use strict'; - - return { - restrict: 'A', - scope: { - 'newsTimeout': '&' - }, - link: function (scope, element) { - var destroyed = false; - var seconds = 7; - var timer = $timeout(scope.newsTimeout, seconds * 1000); - - // remove timeout if element is being removed by - // for instance clicking on the x button - scope.$on('$destroy', function () { - destroyed = true; - $timeout.cancel(timer); - }); - - // also delete the entry if undo is ignored and the url - // is changed - $rootScope.$on('$locationChangeStart', function () { - // $locationChangeStart triggers twice because of the trailing - // slash on the link which is kinda a hack to reload the route - // if you click on the link when the route is the same - $timeout.cancel(timer); - if (!destroyed) { - destroyed = true; - element.remove(); - scope.newsTimeout(); - } - }); - } - }; -}]); -app.directive('newsTitleUnreadCount', ["$window", function ($window) { - 'use strict'; - - var baseTitle = $window.document.title; - var titles = baseTitle.split('-'); - var appName = titles[0] || 'News'; - var ownCloudName = titles[1] || 'ownCloud'; - - return { - restrict: 'E', - scope: { - unreadCount: '@' - }, - link: function (scope, elem, attrs) { - attrs.$observe('unreadCount', function (value) { - if (value !== '0') { - $window.document.title = appName + - '(' + value + ') - ' + ownCloudName; - } else { - $window.document.title = appName + ' - ' + ownCloudName; - } - }); - } - }; - -}]); -app.directive('newsToggleShow', function () { - 'use strict'; - return { - restrict: 'A', - scope: { - 'newsToggleShow': '@' - }, - link: function (scope, elem) { - elem.click(function () { - var target = $(scope.newsToggleShow); - target.toggle(); - }); - } - }; -}); - -app.directive('newsTriggerClick', function () { - 'use strict'; - - return function (scope, elm, attr) { - elm.click(function () { - $(attr.newsTriggerClick).trigger('click'); - }); - }; - -}); - -})(navigator, window, document, angular, jQuery, OC, oc_requesttoken, url);
\ No newline at end of file diff --git a/js/build/app.min.js b/js/build/app.min.js index cd25ac495..b37202c7f 100644 --- a/js/build/app.min.js +++ b/js/build/app.min.js @@ -1,3 +1,3 @@ -!function(a,b,c,d,e,f,g,h,i){"use strict";var j=d.module("News",["ngRoute","ngSanitize","ngAnimate"]);j.config(["$routeProvider","$provide","$httpProvider",function(a,b,c){var d={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4,EXPLORE:5};b.constant("REFRESH_RATE",60),b.constant("ITEM_BATCH_SIZE",40),b.constant("ITEM_AUTO_PAGE_SIZE",20),b.constant("BASE_URL",f.generateUrl("/apps/news")),b.constant("FEED_TYPE",d),b.constant("MARK_READ_TIMEOUT",.5),b.constant("SCROLL_TIMEOUT",.1),b.factory("CSRFInterceptor",["$q","BASE_URL","$window",function(a,b,c){return{request:function(d){var e=c.location.href.split(c.location.pathname)[0];return(0===d.url.indexOf(b)||0===d.url.indexOf(e))&&(d.headers.requesttoken=g),d||a.when(d)}}}]);var e={0:t("news","Request failed, network connection unavailable!"),401:t("news","Request unauthorized. Are you logged in?"),403:t("news","Request forbidden. Are you an admin?"),412:t("news","Token expired or app not enabled! Reload the page!"),500:t("news","Internal server error! Please check your data/owncloud.log file for additional information!"),503:t("news","Request failed, ownCloud is in currently in maintenance mode!")};b.factory("ConnectionErrorInterceptor",["$q","$timeout",function(a,b){var c;return{responseError:function(d){return d.status in e&&(c&&b.cancel(c),f.Notification.hide(),f.Notification.showHtml(e[d.status]),c=b(function(){f.Notification.hide()},5e3)),a.reject(d)}}}]),c.interceptors.push("CSRFInterceptor"),c.interceptors.push("ConnectionErrorInterceptor");var h=function(a){return{data:["$http","$route","$q","$location","BASE_URL","ITEM_BATCH_SIZE","FEED_TYPE","SettingsResource","FeedResource",function(b,c,d,e,f,g,h,j,k){var l=j.get("showAll"),m=j.get("oldestFirst"),n=e.search().search||"",o=d.defer();if(null===l||null===m)o.resolve({});else{var p={type:a,limit:g,showAll:l,oldestFirst:m,search:n};if(c.current.params.id!==i&&(p.id=c.current.params.id),a===h.FEED){var q=k.getById(p.id);q===i||2===q.ordering?p.oldestFirst=!1:1===q.ordering&&(p.oldestFirst=!0)}b({url:f+"/items",method:"GET",params:p}).success(function(a){o.resolve(a)})}return o.promise}]}},j=function(){return{sites:["$http","$q","BASE_URL","$location","Publisher","SettingsResource",function(a,b,c,d,e,f){var g=b.defer(),h=d.search().lang;return h||(h=f.get("language")),a.get(c+"/settings").then(function(b){e.publishAll(b);var c=f.get("exploreUrl").replace(/\/+$/,""),d=c+"/feeds."+h+".json",g=c+"/feeds.en.json";return a.get(d)["catch"](function(){return a.get(g)})}).then(function(a){g.resolve(a.data)})["catch"](function(){g.reject()}),g.promise}]}};a.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.SUBSCRIPTIONS),type:d.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.STARRED),type:d.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FEED),type:d.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FOLDER),type:d.FOLDER}).when("/explore",{controller:"ExploreController as Explore",templateUrl:"explore.html",resolve:j(),type:d.EXPLORE}).when("/shortcuts",{templateUrl:"shortcuts.html",type:-1})}]),j.run(["$rootScope","$location","$http","$q","$interval","$route","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){g.setLoading("global",!0),l.subscribe(h).toChannels(["items","newestItemId","starred"]),l.subscribe(j).toChannels(["folders"]),l.subscribe(i).toChannels(["feeds"]),l.subscribe(k).toChannels(["settings"]);var p=d.defer();c.get(m+"/settings").success(function(a){l.publishAll(a),p.resolve()});var q=d.defer(),r=b.path();c.get(m+"/feeds/active").success(function(a){var c;switch(a.activeFeed.type){case n.FEED:c="/items/feeds/"+a.activeFeed.id;break;case n.FOLDER:c="/items/folders/"+a.activeFeed.id;break;case n.STARRED:c="/items/starred";break;case n.EXPLORE:c="/explore";break;default:c="/items"}/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/.test(r)||b.path(c),q.resolve()});var s,t=d.defer();c.get(m+"/feeds").success(function(a){s=a,t.resolve()});var u,v=d.defer();c.get(m+"/folders").success(function(a){u=a,v.resolve()}),d.all([t.promise,v.promise]).then(function(){l.publishAll(s),l.publishAll(u),0===s.feeds.length&&0===u.folders.length&&b.path("/explore")}),d.all([p.promise,q.promise,t.promise,v.promise]).then(function(){f.reload(),g.setLoading("global",!1)}),e(function(){c.get(m+"/feeds").success(function(a){l.publishAll(a)}),c.get(m+"/folders").success(function(a){l.publishAll(a)})},1e3*o),a.$on("$routeChangeStart",function(){g.setLoading("content",!0)}),a.$on("$routeChangeSuccess",function(){g.setLoading("content",!1)}),a.$on("$routeChangeError",function(){b.path("/items")})}]),j.controller("AppController",["Loading","FeedResource","FolderResource",function(a,b,c){this.loading=a,this.isFirstRun=function(){return 0===b.size()&&0===c.size()},this.play=function(a){this.playingItem=a}}]),j.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","$location","FEED_TYPE","ITEM_AUTO_PAGE_SIZE","Loading",function(a,b,c,d,e,f,g,h,j,k,l){c.clear(),a.publishAll(e),this.isAutoPagingEnabled=!0,c.size()>=k?this.isNothingMoreToAutoPage=!1:this.isNothingMoreToAutoPage=!0,this.getItems=function(){return c.getAll()},this.toggleStar=function(a){c.toggleStar(a)},this.toggleItem=function(a){this.isCompactView()&&(a.show=!a.show)},this.isShowAll=function(){return d.get("showAll")},this.markRead=function(a){var d=c.get(a);d.keepUnread||d.unread!==!0||(c.markItemRead(a),b.markItemOfFeedRead(d.feedId))},this.getFeed=function(a){return b.getById(a)},this.toggleKeepUnread=function(a){var d=c.get(a);d.unread||(b.markItemOfFeedUnread(d.feedId),c.markItemRead(a,!1)),d.keepUnread=!d.keepUnread};var m=this,n=function(){var a=d.get("oldestFirst");if(m.isFeed()){var c=b.getById(g.id);c&&1===c.ordering?a=!0:c&&2===c.ordering&&(a=!1)}return a};this.orderBy=function(){return n()?"id":"-id"},this.isCompactView=function(){return d.get("compact")},this.isCompactExpand=function(){return d.get("compactExpand")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!d.get("preventReadOnScroll")},this.scrollRead=function(a){var d=[],e=[];a.forEach(function(a){var b=c.get(a);b.keepUnread||(d.push(a),e.push(b.feedId))}),d.length>0&&(b.markItemsOfFeedsRead(e),c.markItemsRead(d))},this.isFeed=function(){return f.current.$$route.type===j.FEED},this.autoPage=function(){if(!this.isNothingMoreToAutoPage){if(!this.isAutoPagingEnabled)return void(this.autoPageAgain=!0);this.isAutoPagingEnabled=!1,this.autoPageAgain=!1;var b=f.current.$$route.type,e=g.id,i=n(),j=d.get("showAll"),m=this,o=h.search().search;l.setLoading("autopaging",!0),c.autoPage(b,e,i,j,o).success(function(b){a.publishAll(b),b.items.length>=k?m.isAutoPagingEnabled=!0:m.isNothingMoreToAutoPage=!0,m.isAutoPagingEnabled&&m.autoPageAgain&&m.autoPage()}).error(function(){m.isAutoPagingEnabled=!0})["finally"](function(){l.setLoading("autopaging",!1)})}},this.getRelativeDate=function(a){if(a!==i&&""!==a){var b=d.get("language"),c=moment.unix(a).locale(b).fromNow()+"";return c}return""},this.refresh=function(){f.reload()},this.getMediaType=function(a){return a&&0===a.indexOf("audio")?"audio":a&&0===a.indexOf("video")?"video":i}}]),j.controller("ExploreController",["sites","$rootScope","FeedResource","SettingsResource","$location",function(a,b,c,d,e){this.sites=a,this.feeds=Object.keys(a).map(function(b){return[b,a[b]]}).reduce(function(a,b){var c=b[0],d=b[1];return d.forEach(function(a){a.category=c}),a.concat(d)},[]),this.feedExists=function(a){return c.getByLocation(a)!==i},this.subscribeTo=function(a){b.$broadcast("addFeed",a)},this.isCategoryShown=function(a){return a.filter(function(a){return c.getByLocation(a.feed)===i}).length>0},this.getSupportedLanguageCodes=function(){return d.getSupportedLanguageCodes()},this.getCurrentLanguageCode=function(){var a=e.search().lang;return a||(a=d.get("language")),a},this.showLanguage=function(a){e.url("/explore/?lang="+a)},this.selectedLanguageCode=this.getCurrentLanguageCode()}]),j.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location","$q",function(a,b,c,d,e,f,g,h,j,k){this.feedError="",this.showNewFolder=!1,this.renamingFolder=!1,this.addingFeed=!1,this.addingFolder=!1,this.folderError="",this.renameError="",this.feed={};var l=function(){return parseInt(a.current.params.id,10)};this.getLanguageCode=function(){return f.get("language")},this.getFeeds=function(){return c.getAll()},this.getFolders=function(){return d.getAll()},this.markFolderRead=function(a){c.markFolderRead(a),c.getByFolderId(a).forEach(function(a){e.markFeedRead(a.id)})},this.markFeedRead=function(a){e.markFeedRead(a),c.markFeedRead(a)},this.markRead=function(){e.markRead(),c.markRead()},this.isShowAll=function(){return f.get("showAll")},this.getFeedsOfFolder=function(a){return c.getByFolderId(a)},this.getUnreadCount=function(){return c.getUnreadCount()},this.isUnread=function(){return this.getUnreadCount()>0},this.getFeedUnreadCount=function(a){var b=c.getById(a);return b!==i?b.unreadCount:0},this.isFeedUnread=function(a){return this.getFeedUnreadCount(a)>0},this.getFolderUnreadCount=function(a){return c.getFolderUnreadCount(a)},this.isFolderUnread=function(a){return this.getFolderUnreadCount(a)>0},this.getStarredCount=function(){return e.getStarredCount()},this.isStarredUnread=function(){return this.getStarredCount()>0},this.toggleFolder=function(a){d.toggleOpen(a)},this.hasFeeds=function(a){return c.getFolderUnreadCount(a)!==i},this.subFeedActive=function(d){var e=a.current.$$route.type;if(e===b.FEED){var f=c.getById(l());if(f!==i&&f.folderId===d)return!0}return!1},this.isSubscriptionsActive=function(){return a.current&&a.current.$$route.type===b.SUBSCRIPTIONS},this.isStarredActive=function(){return a.current&&a.current.$$route.type===b.STARRED},this.isExploreActive=function(){return a.current&&a.current.$$route.type===b.EXPLORE},this.isFolderActive=function(c){return a.current&&a.current.$$route.type===b.FOLDER&&l()===c},this.isFeedActive=function(c){return a.current&&a.current.$$route.type===b.FEED&&l()===c},this.folderNameExists=function(a){return a=a||"",d.get(a.trim())!==i},this.feedUrlExists=function(a){return a=a||"",a=a.trim(),c.get(a)!==i||c.get("http://"+a)!==i},this.createFeed=function(a){var b=this;this.showNewFolder=!1,this.addingFeed=!0;var e=a.newFolder,f=a.existingFolder||{id:0};e===i||""===e?(f.getsFeed=!0,c.create(a.url,f.id,i).then(function(a){g.publishAll(a),j.path("/items/feeds/"+a.feeds[0].id+"/")})["finally"](function(){f.getsFeed=i,a.url="",b.addingFeed=!1})):d.create(e).then(function(c){g.publishAll(c),a.existingFolder=d.get(c.folders[0].name),a.newFolder=i,b.createFeed(a)})},this.createFolder=function(a){var b=this;this.addingFolder=!0,d.create(a.name).then(function(a){g.publishAll(a)})["finally"](function(){b.addingFolder=!1,a.name=""})},this.moveFeed=function(b,d){var e=!1,f=c.getById(b);f.folderId!==d&&((this.isFolderActive(f.folderId)||this.isFolderActive(d))&&(e=!0),c.move(b,d),e&&a.reload())},this.renameFeed=function(a){c.patch(a.id,{title:a.title}),a.editing=!1},this.renameFolder=function(a,b){a.renameError="",this.renamingFolder=!0;var c=this;a.name===b?(a.renameError="",a.editing=!1,this.renamingFolder=!1):d.rename(a.name,b).then(function(){a.renameError="",a.editing=!1},function(b){a.renameError=b})["finally"](function(){c.renamingFolder=!1})},this.reversiblyDeleteFeed=function(b){c.reversiblyDelete(b.id)["finally"](function(){a.reload()})},this.undoDeleteFeed=function(b){c.undoDelete(b.id)["finally"](function(){a.reload()})},this.deleteFeed=function(a){c["delete"](a.url)},this.reversiblyDeleteFolder=function(b){k.all(c.reversiblyDeleteFolder(b.id),d.reversiblyDelete(b.name))["finally"](function(){a.reload()})},this.undoDeleteFolder=function(b){k.all(c.undoDeleteFolder(b.id),d.undoDelete(b.name))["finally"](function(){a.reload()})},this.deleteFolder=function(a){c.deleteFolder(a.id),d["delete"](a.name)},this.setOrdering=function(b,d){c.patch(b.id,{ordering:d}),a.reload()},this.togglePinned=function(a){var b=c.getById(a);return b?c.patch(a,{pinned:!b.pinned}):void 0},this.setUpdateMode=function(a,b){return c.patch(a,{updateMode:b})},this.toggleFullText=function(b){h.$broadcast("$routeChangeStart"),c.toggleFullText(b.id)["finally"](function(){h.$broadcast("$routeChangeSuccess"),a.reload()})},this.search=function(a){""===a?j.search("search",null):j.search("search",a)};var m=this;h.$on("moveFeedToFolder",function(a,b){m.moveFeed(b.feedId,b.folderId)});var n=function(){var e;a.current&&(e=a.current.$$route.type);var f=0;if(e===b.FOLDER)f=l();else if(e===b.FEED){var g=c.getById(l());g&&(f=g.folderId)}var h;0!==f&&(h=d.getById(f)),m.feed.existingFolder=h};h.$on("$routeChangeSuccess",function(){n()})}]),j.controller("SettingsController",["$route","$q","SettingsResource","ItemResource","OPMLParser","OPMLImporter","Publisher",function(a,b,c,d,e,f,g){this.isOPMLImporting=!1,this.isArticlesImporting=!1,this.opmlImportError=!1,this.articleImportError=!1;var h=function(b,d){c.set(b,d),["showAll","oldestFirst","compact"].indexOf(b)>=0&&a.reload()};this.toggleSetting=function(a){h(a,!this.getSetting(a))},this.getSetting=function(a){return c.get(a)},this.importOPML=function(a){this.opmlImportError=!1,this.articleImportError=!1;try{this.isOPMLImporting=!1;var b=e.parse(a),c=this,d=5;f.importFolders(b).then(function(a){return f.importFeedQueue(a,d)})["finally"](function(){c.isOPMLImporting=!1})}catch(g){console.error(g),this.isOPMLImporting=!1,this.opmlImportError=!0}},this.importArticles=function(a){this.opmlImportError=!1,this.articleImportError=!1;try{this.isArticlesImporting=!0;var b=JSON.parse(a),c=this;d.importArticles(b).success(function(a){g.publishAll(a)})["finally"](function(){c.isArticlesImporting=!1})}catch(e){console.error(e),this.articleImportError=!0,this.isArticlesImporting=!1}}}]),j.filter("trustUrl",["$sce",function(a){return function(b){return a.trustAsResourceUrl(b)}}]),j.filter("unreadCountFormatter",function(){return function(a){return a>999?"999+":a}}),j.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"url"),this.ids={},this.locations={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=d};return e.prototype=Object.create(a.prototype),e.prototype.receive=function(b){a.prototype.receive.call(this,b),this.updateUnreadCache(),this.updateFolderCache()},e.prototype.clear=function(){a.prototype.clear.call(this),this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.ids={},this.locations={}},e.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var a=this;this.values.forEach(function(b){b.unreadCount&&(a.unreadCount+=b.unreadCount),b.folderId!==i&&(a.folderUnreadCount[b.folderId]=a.folderUnreadCount[b.folderId]||0,a.folderUnreadCount[b.folderId]+=b.unreadCount)})},e.prototype.updateFolderCache=function(){this.folderIds={};var a=this;this.values.forEach(function(b){a.folderIds[b.folderId]=a.folderIds[b.folderId]||[],a.folderIds[b.folderId].push(b)})},e.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==i&&(this.ids[b.id]=this.hashMap[b.url]),b.location!==i&&(this.locations[b.location]=this.hashMap[b.url])},e.prototype.markRead=function(){this.values.forEach(function(a){a.unreadCount=0}),this.updateUnreadCache()},e.prototype.markFeedRead=function(a){this.ids[a].unreadCount=0,this.updateUnreadCache()},e.prototype.markFolderRead=function(a){this.values.forEach(function(b){b.folderId===a&&(b.unreadCount=0)}),this.updateUnreadCache()},e.prototype.markItemOfFeedRead=function(a){this.ids[a].unreadCount-=1,this.updateUnreadCache()},e.prototype.markItemsOfFeedsRead=function(a){var b=this;a.forEach(function(a){b.ids[a].unreadCount-=1}),this.updateUnreadCache()},e.prototype.markItemOfFeedUnread=function(a){this.ids[a].unreadCount+=1,this.updateUnreadCache()},e.prototype.getUnreadCount=function(){return this.unreadCount},e.prototype.getFolderUnreadCount=function(a){return this.folderUnreadCount[a]},e.prototype.getByFolderId=function(a){return this.folderIds[a]||[]},e.prototype.getById=function(a){return this.ids[a]},e.prototype.getByLocation=function(a){return this.locations[a]},e.prototype.move=function(a,b){var c=this.getById(a);return c.folderId=b,this.updateFolderCache(),this.updateUnreadCache(),this.patch(a,{folderId:b})},e.prototype.create=function(a,b,c){a=a.trim(),a.startsWith("http")||(a="https://"+a),c!==i&&(c=c.trim());var d={url:a,folderId:b||0,title:c||a,unreadCount:0};this.add(d),this.updateFolderCache();var e=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:a,parentFolderId:b||0,title:c}}).success(function(a){e.resolve(a)}).error(function(a){d.faviconLink="",d.error=a.message,e.reject()}),e.promise},e.prototype.reversiblyDelete=function(a,b,c){var d=this.getById(a);return d&&c!==!0&&(d.deleted=!0),b!==!1&&this.updateUnreadCache(),this.http["delete"](this.BASE_URL+"/feeds/"+a)},e.prototype.reversiblyDeleteFolder=function(a){var b=this,c=[];this.getByFolderId(a).forEach(function(a){c.push(b.reversiblyDelete(a.id,!1,!0))}),this.updateUnreadCache();var d=this.$q.all(c);return d.promise},e.prototype["delete"]=function(b,c){var d=this.get(b);return d!==i&&d.id&&delete this.ids[d.id],d!==i&&d.location&&delete this.locations[d.location],a.prototype["delete"].call(this,b),c!==!1&&(this.updateUnreadCache(),this.updateFolderCache()),d},e.prototype.deleteFolder=function(a){var b=this;this.getByFolderId(a).forEach(function(a){b["delete"](a.url,!1)}),this.updateUnreadCache(),this.updateFolderCache()},e.prototype.undoDelete=function(a,b){var c=this.getById(a);return c&&(c.deleted=!1),b!==!1&&this.updateUnreadCache(),this.http.post(this.BASE_URL+"/feeds/"+a+"/restore")},e.prototype.undoDeleteFolder=function(a){var b=this,c=[];this.getByFolderId(a).forEach(function(a){c.push(b.undoDelete(a.id,!1))}),this.updateUnreadCache();var d=this.$q.all(c);return d.promise},e.prototype.setOrdering=function(a,b){var c=this.getById(a);if(c){c.ordering=b;var d=this.BASE_URL+"/feeds/"+a;return this.http.patch(d,{ordering:b})}},e.prototype.setPinned=function(a,b){var c=this.getById(a);if(c){c.pinned=b;var d=this.BASE_URL+"/feeds/"+a;return this.http.patch(d,{pinned:b})}},e.prototype.patch=function(a,b){var c=this.getById(a);if(c){Object.keys(b).forEach(function(a){c[a]=b[a]});var d=this.BASE_URL+"/feeds/"+a;return this.http.patch(d,b)}},e.prototype.toggleFullText=function(a){var b=this.getById(a);return this.patch(a,{fullTextEnabled:!b.fullTextEnabled})},new e(b,c,d)}]),j.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"name"),this.deleted=null,this.$q=d,this.ids={}};return e.prototype=Object.create(a.prototype),e.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==i&&(this.ids[b.id]=this.hashMap[b.name])},e.prototype.clear=function(){a.prototype.clear.call(this),this.ids={}},e.prototype["delete"]=function(b){var c=this.get(b);return c!==i&&c.id&&delete this.ids[c.id],a.prototype["delete"].call(this,b),c},e.prototype.toggleOpen=function(a){var b=this.get(a);return b.opened=!b.opened,this.http({url:this.BASE_URL+"/folders/"+b.id+"/open",method:"POST",data:{folderId:b.id,open:b.opened}})},e.prototype.rename=function(a,b){var c=this.get(a),d=this.$q.defer(),e=this;return this.http({url:this.BASE_URL+"/folders/"+c.id+"/rename",method:"POST",data:{folderName:b}}).success(function(){c.name=b,delete e.hashMap[a],e.hashMap[b]=c,d.resolve()}).error(function(a){d.reject(a.message)}),d.promise},e.prototype.getById=function(a){return this.ids[a]},e.prototype.create=function(a){a=a.trim();var b={name:a};this.add(b);var c=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:a}}).success(function(a){c.resolve(a)}).error(function(a){b.error=a.message}),c.promise},e.prototype.reversiblyDelete=function(a){var b=this.get(a),c=b.id;return b.deleted=!0,this.http["delete"](this.BASE_URL+"/folders/"+c)},e.prototype.undoDelete=function(a){var b=this.get(a),c=b.id;return b.deleted=!1,this.http.post(this.BASE_URL+"/folders/"+c+"/restore")},new e(b,c,d)}]),j.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c),this.batchSize=d,this.clear()};return e.prototype=Object.create(a.prototype),e.prototype.clear=function(){this.starredCount=0,this.lowestId=0,this.highestId=0,a.prototype.clear.call(this)},e.prototype.receive=function(b,c){switch(c){case"newestItemId":this.newestItemId=b;break;case"starred":this.starredCount=b;break;default:var d=this;b.forEach(function(a){0===d.lowestId&&(d.lowestId=a.id),0===d.highestId&&(d.highestId=a.id),a.id>d.highestId&&(d.highestId=a.id),a.id<d.lowestId&&(d.lowestId=a.id)}),a.prototype.receive.call(this,b,c)}},e.prototype.getNewestItemId=function(){return this.newestItemId},e.prototype.getStarredCount=function(){return this.starredCount},e.prototype.star=function(a,b){b===i&&(b=!0);var c=this.get(a),d=this.BASE_URL+"/items/"+c.feedId+"/"+c.guidHash+"/star";return c.starred=b,b?this.starredCount+=1:this.starredCount-=1,this.http({url:d,method:"POST",data:{isStarred:b}})},e.prototype.toggleStar=function(a){this.get(a).starred?this.star(a,!1):this.star(a,!0)},e.prototype.markItemRead=function(a,b){return b===i&&(b=!0),this.get(a).unread=!b,this.http({url:this.BASE_URL+"/items/"+a+"/read",method:"POST",data:{isRead:b}})},e.prototype.markItemsRead=function(a){var b=this;return a.forEach(function(a){b.get(a).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:a}})},e.prototype.markFeedRead=function(a,b){b===i&&(b=!0);var c=this.values.filter(function(b){return b.feedId===a});return c.forEach(function(a){a.unread=!b}),this.http.post(this.BASE_URL+"/feeds/"+a+"/read",{highestItemId:this.getNewestItemId()})},e.prototype.markRead=function(){return this.values.forEach(function(a){a.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},e.prototype.autoPage=function(a,b,c,d,e){var f;return f=c?this.highestId:this.lowestId,this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:a,id:b,offset:f,limit:this.batchSize,oldestFirst:c,showAll:d,search:e}})},e.prototype.importArticles=function(a){return this.http({url:this.BASE_URL+"/feeds/import/articles",method:"POST",data:{json:a}})},new e(b,c,d)}]),j.service("Loading",function(){this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(a,b){this.loading[a]=b},this.isLoading=function(a){return this.loading[a]}}),j.service("OPMLImporter",["FeedResource","FolderResource","Publisher","$q",function(a,b,c,d){var e=function(f){var g=d.defer();if(f.length>0){var h=f.pop(),j=h.url,k=h.title,l=0,m=h.folderName;if(m!==i&&b.get(m)!==i){var n=b.get(m);n.opened=!0,l=n.id,n.getsFeed=!0,n.getsFeedCounter=n.getsFeedCounter||0,n.getsFeedCounter+=1}j!==i&&a.get(j)===i&&a.create(j,l,k).then(function(a){c.publishAll(a)})["finally"](function(){0!==l&&(n.getsFeedCounter-=1,0===n.getsFeedCounter&&(n.getsFeed=!1)),e(f)})}else g.resolve();return g.promise};this.importFolders=function(a){var e=[],f=[];a.folders.forEach(function(a){if(a.name!==i){if(b.get(a.name)===i){var d=b.create(a.name).then(function(a){c.publishAll(a)});f.push(d)}a.feeds.forEach(function(b){b.folderName=a.name,e.push(b)})}}),e=e.concat(a.feeds);var g=d.defer();return d.all(f)["finally"](function(){g.resolve(e)}),g.promise},this.importFeedQueue=function(a,b){for(var c=d.defer(),f=[],g=0;b>g;g+=1)f.push(e(a));return d.all(f).then(function(){c.resolve()}),c.promise}}]),j.service("OPMLParser",function(){var a=function(a){var b=a.attr("xmlUrl")||a.attr("htmlUrl"),c=a.attr("title")||a.attr("text")||b;return b===i?{type:"folder",name:c,feeds:[]}:{type:"feed",name:c,url:b}},b=function(c,d,f){for(var g=0;g<c.length;g+=1){var h=e(c[g]),i=a(h);"feed"===i.type?d.feeds.push(i):f?(b(h.children("outline"),i,!1),d.folders.push(i)):b(h.children("outline"),d,!1)}return d};this.parse=function(a){a=e.parseXML(a);var c=e(a).find("body > outline"),d={feeds:[],folders:[]};return b(c,d,!0)}}),j.service("Publisher",function(){this.channels={},this.subscribe=function(a){var b=this;return{toChannels:function(c){c.forEach(function(c){b.channels[c]=b.channels[c]||[],b.channels[c].push(a)})}}},this.publishAll=function(a){var b=this;Object.keys(a).forEach(function(c){var d=b.channels[c];d!==i&&d.forEach(function(b){b.receive(a[c],c)})})}}),j.factory("Resource",function(){var a=function(a,b,c){this.id=c||"id",this.values=[],this.hashMap={},this.http=a,this.BASE_URL=b};return a.prototype.receive=function(a){var b=this;a.forEach(function(a){b.add(a)})},a.prototype.add=function(a){var b=this.hashMap[a[this.id]];b===i?(this.values.push(a),this.hashMap[a[this.id]]=a):Object.keys(a).forEach(function(c){b[c]=a[c]})},a.prototype.size=function(){return this.values.length},a.prototype.get=function(a){return this.hashMap[a]},a.prototype["delete"]=function(a){var b=this,c=this.values.findIndex(function(c){return c[b.id]===a});c!==i&&this.values.splice(c,1),this.hashMap[a]!==i&&delete this.hashMap[a]},a.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},a.prototype.getAll=function(){return this.values},a}),j.service("SettingsResource",["$http","BASE_URL",function(a,b){this.settings={language:"en",showAll:null,compact:!1,oldestFirst:null,preventReadOnScroll:!1,compactExpand:!1,exploreUrl:""},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.getSupportedLanguageCodes=function(){return this.supportedLanguageCodes},this.receive=function(a){var b=this;Object.keys(a).forEach(function(c){var d=a[c];"language"===c&&(d=b.processLanguageCode(d)),b.settings[c]=d})},this.get=function(a){return this.settings[a]},this.set=function(c,d){return this.settings[c]=d,a({url:b+"/settings",method:"PUT",data:{language:this.settings.language,showAll:this.settings.showAll,compact:this.settings.compact,oldestFirst:this.settings.oldestFirst,compactExpand:this.settings.compactExpand,preventReadOnScroll:this.settings.preventReadOnScroll}})},this.processLanguageCode=function(a){return a=a.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(a)<0&&(a=a.split("-")[0]),this.supportedLanguageCodes.indexOf(a)<0&&(a=this.defaultLanguageCode),a}}]),function(a,b,c,d,e,f){var g=a.location,h=a.localStorage,i=function(a,b,d){var e=c.isContentHandlerRegistered,f=function(a,b){return e?"new"!==e(a,b):h.getItem("registeredHandler")===b};c.registerContentHandler&&!f(a,b)&&(c.registerContentHandler(a,k,d),e||h.setItem("registeredHandler",b))},j=g.protocol+"//"+g.host+g.pathname,k=j+"?subscribe_to=%s",l="application/vnd.mozilla.maybe.feed",m="ownCloud News @ "+j;i(l,k,m),e(b).ready(function(){var a=d("?subscribe_to");if(a&&"undefined"!==a){e("#new-feed").show();var b=e('input[ng-model="Navigation.feed.url"]');b.val(a),b.trigger("input"),setTimeout(function(){b.focus()},1e3)}})}(b,c,a,h,e),function(a,b){a.addEventListener("beforeunload",function(){var a=b.querySelector("#app-content");a.scrollTo(0,0)})}(b,c),function(a,b,c){var d=function(a){return!(a.is("input")||a.is("select")||a.is("textarea")||a.is("checkbox"))},e=function(a){return!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey)},f=function(a){var b=".active > .app-navigation-entry-menu .mark-read button",c=a.find(b);c.length>0&&c.trigger("click")},g=function(a,b){var c=a.offset().top-b.offset().top,d=c+a.height(),e=b.height();return c>=0&&e>d},h=function(a,b,c){0===a.length||!c&&g(a,b)||b.scrollTop(a.offset().top-b.offset().top+b.scrollTop())},i=function(a){var b=a.find(".active");h(b,a.children("ul"),!0)},j=function(a){a.find(".active > a:visible").trigger("click")},k=function(a,b){if(0===b.scrollTop()){var c=b.find(".pull-to-refresh");c.hasClass("show-pull-to-refresh")?c.hasClass("done")&&j(a):c.addClass("show-pull-to-refresh")}},l=function(a,b){a.children("a:visible").trigger("click"),h(a,b.children("ul"))},m=function(a){var b=a.find(".active"),d=a.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(b.hasClass("folder"))for(;b.length>0;){var e=b.find(".feed:visible");if(e.length>0)return void l(c(e[0]),a);b=b.next(".folder")}else for(var f=0;f<d.length-1;f+=1){var g=d[f];if(g===b[0]){var h=d[f+1];l(c(h),a);break}}},n=function(a){return a.parent().parent(".folder")},o=function(a,b){var d,e=a.find(".folder:visible");d=b?e.length-1:0,e.length>0&&l(c(e[d]),a)},p=function(a){var b=a.find(".active");if(b.hasClass("folder"))l(b.prevAll(".folder:visible").first(),a);else if(b.hasClass("feed")){var c=n(b);c.length>0?l(c,a):o(a,!0)}else o(a,!0)},q=function(a){var b=a.find(".active");if(b.hasClass("folder"))l(b.nextAll(".folder:visible").first(),a);else if(b.hasClass("feed")){var c=n(b);c.length>0?l(c.nextAll(".folder:visible").first(),a):o(a)}else o(a)},r=function(a){var b=a.find(".active"),d=a.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(b.hasClass("folder")){for(var e=b.prev(".folder");e.length>0;){var f=e.find(".feed:visible");if(f.length>0)return void l(c(f[f.length-1]),a);e=e.prev(".folder")}var g=b.siblings(".feed");if(g.length>0)return void l(c(g[g.length-1]),a);var h=c(".starred-feed:visible");return void(h.length>0&&l(h,a))}for(var i=d.length-1;i>0;i-=1){var j=d[i];if(j===b[0]){var k=d[i-1];l(c(k),a);break}}},s=function(a,b){var d=a.find(".item");d.each(function(a,d){return d=c(d),d.height()+d.position().top>30?(b(d),!1):void 0})},t=function(a){s(a,function(a){a.find(".toggle-keep-unread").trigger("click")})},u=function(a){s(a,function(a){a.find(".star").trigger("click")})},v=function(a){s(a,function(a){a.find(".utils").trigger("click")})},w=function(b){s(b,function(b){b.trigger("click"),a.open(b.find(".external:visible").attr("href"),"_blank")})},x=function(a,b,c){a.scrollTop(b.offset().top-a.offset().top+a.scrollTop()),c&&s(a,function(a){a.hasClass("open")||a.find(".utils").trigger("click")})},y=function(a,b){var d=a.find(".item"),e=!1;d.each(function(d,f){return f=c(f),0===f.position().top&&b&&!f.hasClass("open")||f.position().top>10?(x(a,f,b),e=!0,!1):void 0}),e||a.scrollTop(a.prop("scrollHeight"))},z=function(a,b,d){var e=b.find(".item"),f=!1;e.each(function(e,g){if(g=c(g),g.position().top+10>=0){var h=g.prev();return h.length>0?x(b,h,d):(k(a,b),b.scrollTop(0)),f=!0,!1}}),!f&&e.length>0&&x(b,e.last())};c(b).keyup(function(a){var b=a.keyCode,g=c("#app-content"),h=c("#app-navigation"),l=c("#articles.compact").length>0,n="true"===c("#articles").attr("news-compact-expand"),o=l&&n;d(c(":focus"))&&e(a)?[74,78,39].indexOf(b)>=0?(a.preventDefault(),y(g,o)):[75,80,37].indexOf(b)>=0?(a.preventDefault(),z(h,g,o)):[85].indexOf(b)>=0?(a.preventDefault(),t(g)):[69].indexOf(b)>=0?(a.preventDefault(),v(g)):[73,83,76].indexOf(b)>=0?(a.preventDefault(),u(g)):[72].indexOf(b)>=0?(a.preventDefault(),u(g),y(g)):[79].indexOf(b)>=0?(a.preventDefault(),w(g)):[82].indexOf(b)>=0?(a.preventDefault(),j(h)):[70].indexOf(b)>=0?(a.preventDefault(),m(h)):[68].indexOf(b)>=0?(a.preventDefault(),r(h)):[67].indexOf(b)>=0?(a.preventDefault(),p(h)):[65].indexOf(b)>=0?(a.preventDefault(),i(h)):[86].indexOf(b)>=0?(a.preventDefault(),q(h)):[81].indexOf(b)>=0?(a.preventDefault(), -c("#searchbox").focus()):[33].indexOf(b)>=0&&k(h,g):d(c(":focus"))&&a.shiftKey&&[65].indexOf(b)>=0&&(a.preventDefault(),f(h))})}(b,c,e),b.News=b.News||{},function(a,b,c,d,e){var f=[];d.addArticleAction=function(a){f.push(a)},d.getArticleActionPlugins=function(){return f}}(b,c,jQuery,b.News),j.run(["$document","$rootScope",function(a,b){a.click(function(a){b.$broadcast("documentClicked",a)})}]),j.directive("appNavigationEntryUtils",function(){return{restrict:"C",link:function(a,b){var c=b.siblings(".app-navigation-entry-menu"),d=e(b).find(".app-navigation-entry-utils-menu-button button");d.click(function(){c.toggleClass("open")}),a.$on("documentClicked",function(a,b){b.target!==d[0]&&c.removeClass("open")})}}}),j.directive("newsAddFeed",["$rootScope","$timeout",function(a,b){return{restrict:"A",link:function(c,d){a.$on("addFeed",function(a,e){b(function(){d.is(":animated")?(d.stop(!0,!0),d.show()):d.is(":visible")||d.slideDown(),d.find('[ng-model="Navigation.feed.url"]').focus()}),c.Navigation.feed.url=e})}}}]),j.directive("newsArticleActions",function(){return{restrict:"A",scope:{newsArticleActions:"=",noPlugins:"="},link:function(a,b){for(var c=News.getArticleActionPlugins(),d=0;d<c.length;d+=1)c[d](b,a.newsArticleActions);a.noPlugins=0===c.length}}}),j.directive("newsAutoFocus",["$timeout",function(a){return function(b,c,d){var f=c;d.newsAutoFocus&&(f=e(d.newsAutoFocus)),a(function(){f.focus()},0)}}]),j.directive("newsBindHtmlUnsafe",function(){return function(a,b,c){a.$watch(c.newsBindHtmlUnsafe,function(){b.html(a.$eval(c.newsBindHtmlUnsafe))})}}),j.directive("newsDraggable",function(){return function(a,b,c){var e=a.$eval(c.newsDraggable);d.isDefined(e)?b.draggable(e):b.draggable(),c.$observe("newsDraggableDisable",function(a){"true"===a?b.draggable("disable"):b.draggable("enable")})}}),j.directive("newsDroppable",["$rootScope",function(a){return function(b,c,d){var f={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(f,g){e(".drag-and-drop").removeClass("drag-and-drop");var h={folderId:parseInt(c.data("id"),10),feedId:parseInt(e(g.draggable).data("id"),10)};a.$broadcast("moveFeedToFolder",h),b.$apply(d.droppable)}};c.droppable(f)}}]),j.directive("newsFinishedTransition",function(){return function(a,b,c){b.on("transitionend",function(){b.addClass(c.newsFinishedTransition)})}}),j.directive("newsFocus",["$timeout","$interpolate",function(a,b){return function(c,d,f){d.click(function(){var d=e(b(f.newsFocus)(c));a(function(){d.focus()},500)})}}]),j.directive("newsInstantNotification",function(){return{restrict:"E",link:function(a,b){b.hide();var c=b.html();f.Notification.showHtml(c)}}}),j.directive("newsPlayOne",["$rootScope",function(a){return{restrict:"A",link:function(b,c){c.on("play",function(){a.$broadcast("playing",c)}),a.$on("playing",function(a,b){b[0]!==c[0]&&c[0].pause()})}}}]),j.directive("newsPullToRefresh",["$rootScope",function(a){var b=!1;return{restrict:"A",scope:{newsPullToRefresh:"="},link:function(c,d){a.$on("$routeChangeStart",function(){b=!1,c.newsPullToRefresh=!1}),d.on("scroll",function(){0===d.scrollTop()&&b&&(c.newsPullToRefresh=!0),b=!0})}}}]),j.directive("newsReadFile",function(){return function(a,b,c){b.change(function(){var d=b[0].files[0],e=new FileReader;e.onload=function(b){a.$fileContent=b.target.result,a.$apply(c.newsReadFile)},e.readAsText(d)})}}),j.directive("newsRefreshMasonry",["$timeout",function(a){var b=function(b){a(function(){a(function(){b.parent().masonry({itemSelector:".grid-item",gutter:25,columnWidth:300})})})};return function(a,c){a.$last&&b(c)}}]),j.directive("newsScroll",["$timeout","ITEM_AUTO_PAGE_SIZE","MARK_READ_TIMEOUT","SCROLL_TIMEOUT",function(a,b,c,d){var f,g=function(a,b,c){for(var d=0,f=b.find(".item"),g=f.length-1;g>=0;g-=1){var h=e(f[g]);if(d>=a)break;if(h.position().top<0){c.$apply(c.newsScrollAutoPage);break}d+=1}},h=function(a,b,c){if(a){var d=[],f=b.find(".item:not(.read)");f.each(function(a,b){var c=e(b);return c.position().top<=-10?void d.push(parseInt(c.data("id"),10)):!1}),c.itemIds=d,c.$apply(c.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScroll:"@",newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"="},link:function(j,k){var l=!0,m=k;j.newsScroll&&(m=e(j.newsScroll));var n=function(){l&&(l=!1,a(function(){l=!0},1e3*d),g(b,k,j),f&&a.cancel(f),f=a(function(){h(j.newsScrollEnabledMarkRead,k,j),f=i},1e3*c))};m.on("scroll",n),j.$on("$destroy",function(){m.off("scroll",n)})}}}]),j.directive("newsSearch",["$document","$location",function(a,b){return{restrict:"E",scope:{onSearch:"="},link:function(a){var c=e("#searchbox");c.val(b.search().search);var d=function(){var b=c.val();a.$apply(function(){a.onSearch(b)})};c.on("search keyup",function(a){("search"===a.type||13===a.keyCode)&&d()}),a.$watch(function(){return b.search()},function(a){a&&a.search?c.val(a.search):c.val("")})}}}]),j.directive("newsStickyMenu",function(){return function(a,b,c){var d=40;e(c.newsStickyMenu).scroll(function(){var a=e(this).scrollTop();a>d?(b.addClass("fixed"),b.css("top",a)):b.removeClass("fixed")})}}),j.directive("newsStopPropagation",function(){return{restrict:"A",link:function(a,b){b.bind("click",function(a){a.stopPropagation()})}}}),j.directive("newsTimeout",["$timeout","$rootScope",function(a,b){return{restrict:"A",scope:{newsTimeout:"&"},link:function(c,d){var e=!1,f=7,g=a(c.newsTimeout,1e3*f);c.$on("$destroy",function(){e=!0,a.cancel(g)}),b.$on("$locationChangeStart",function(){a.cancel(g),e||(e=!0,d.remove(),c.newsTimeout())})}}}]),j.directive("newsTitleUnreadCount",["$window",function(a){var b=a.document.title,c=b.split("-"),d=c[0]||"News",e=c[1]||"ownCloud";return{restrict:"E",scope:{unreadCount:"@"},link:function(b,c,f){f.$observe("unreadCount",function(b){"0"!==b?a.document.title=d+"("+b+") - "+e:a.document.title=d+" - "+e})}}}]),j.directive("newsToggleShow",function(){return{restrict:"A",scope:{newsToggleShow:"@"},link:function(a,b){b.click(function(){var b=e(a.newsToggleShow);b.toggle()})}}}),j.directive("newsTriggerClick",function(){return function(a,b,c){b.click(function(){e(c.newsTriggerClick).trigger("click")})}})}(navigator,window,document,angular,jQuery,OC,oc_requesttoken,url); -//# sourceMappingURL=app.min.js.map
\ No newline at end of file +var app=angular.module("News",["ngRoute","ngSanitize","ngAnimate"]);app.config(["$routeProvider","$provide","$httpProvider",function(e,n,r){"use strict";var i={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4,EXPLORE:5};n.constant("REFRESH_RATE",60),n.constant("ITEM_BATCH_SIZE",40),n.constant("ITEM_AUTO_PAGE_SIZE",20),n.constant("BASE_URL",OC.generateUrl("/apps/news")),n.constant("FEED_TYPE",i),n.constant("MARK_READ_TIMEOUT",.5),n.constant("SCROLL_TIMEOUT",.1),n.factory("CSRFInterceptor",["$q","BASE_URL","$window",function(e,t,n){return{request:function(r){var i=n.location.href.split(n.location.pathname)[0];return(0===r.url.indexOf(t)||0===r.url.indexOf(i))&&(r.headers.requesttoken=oc_requesttoken),r||e.when(r)}}}]);var o={0:t("news","Request failed, network connection unavailable!"),401:t("news","Request unauthorized. Are you logged in?"),403:t("news","Request forbidden. Are you an admin?"),412:t("news","Token expired or app not enabled! Reload the page!"),500:t("news","Internal server error! Please check your data/owncloud.log file for additional information!"),503:t("news","Request failed, ownCloud is in currently in maintenance mode!")};n.factory("ConnectionErrorInterceptor",["$q","$timeout",function(e,t){var n;return{responseError:function(r){return r.status in o&&(n&&t.cancel(n),OC.Notification.hide(),OC.Notification.showHtml(o[r.status]),n=t(function(){OC.Notification.hide()},5e3)),e.reject(r)}}}]),r.interceptors.push("CSRFInterceptor"),r.interceptors.push("ConnectionErrorInterceptor");var s=function(e){return{data:["$http","$route","$q","$location","BASE_URL","ITEM_BATCH_SIZE","FEED_TYPE","SettingsResource","FeedResource",function(t,n,r,i,o,s,a,u,d){var c=u.get("showAll"),l=u.get("oldestFirst"),f=i.search().search||"",h=r.defer();if(null===c||null===l)h.resolve({});else{var p={type:e,limit:s,showAll:c,oldestFirst:l,search:f};if(void 0!==n.current.params.id&&(p.id=n.current.params.id),e===a.FEED){var g=d.getById(p.id);void 0===g||2===g.ordering?p.oldestFirst=!1:1===g.ordering&&(p.oldestFirst=!0)}t({url:o+"/items",method:"GET",params:p}).success(function(e){h.resolve(e)})}return h.promise}]}},a=function(){return{sites:["$http","$q","BASE_URL","$location","Publisher","SettingsResource",function(e,t,n,r,i,o){var s=t.defer(),a=r.search().lang;return a||(a=o.get("language")),e.get(n+"/settings").then(function(t){i.publishAll(t);var n=o.get("exploreUrl").replace(/\/+$/,""),r=n+"/feeds."+a+".json",s=n+"/feeds.en.json";return e.get(r)["catch"](function(){return e.get(s)})}).then(function(e){s.resolve(e.data)})["catch"](function(){s.reject()}),s.promise}]}};e.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.SUBSCRIPTIONS),type:i.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.STARRED),type:i.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FEED),type:i.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FOLDER),type:i.FOLDER}).when("/explore",{controller:"ExploreController as Explore",templateUrl:"explore.html",resolve:a(),type:i.EXPLORE}).when("/shortcuts",{templateUrl:"shortcuts.html",type:-1})}]),app.run(["$rootScope","$location","$http","$q","$interval","$route","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(e,t,n,r,i,o,s,a,u,d,c,l,f,h,p){"use strict";s.setLoading("global",!0),l.subscribe(a).toChannels(["items","newestItemId","starred"]),l.subscribe(d).toChannels(["folders"]),l.subscribe(u).toChannels(["feeds"]),l.subscribe(c).toChannels(["settings"]);var g=r.defer();n.get(f+"/settings").success(function(e){l.publishAll(e),g.resolve()});var v=r.defer(),m=t.path();n.get(f+"/feeds/active").success(function(e){var n;switch(e.activeFeed.type){case h.FEED:n="/items/feeds/"+e.activeFeed.id;break;case h.FOLDER:n="/items/folders/"+e.activeFeed.id;break;case h.STARRED:n="/items/starred";break;case h.EXPLORE:n="/explore";break;default:n="/items"}/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/.test(m)||t.path(n),v.resolve()});var y,E=r.defer();n.get(f+"/feeds").success(function(e){y=e,E.resolve()});var C,F=r.defer();n.get(f+"/folders").success(function(e){C=e,F.resolve()}),r.all([E.promise,F.promise]).then(function(){l.publishAll(y),l.publishAll(C),0===y.feeds.length&&0===C.folders.length&&t.path("/explore")}),r.all([g.promise,v.promise,E.promise,F.promise]).then(function(){o.reload(),s.setLoading("global",!1)}),i(function(){n.get(f+"/feeds").success(function(e){l.publishAll(e)}),n.get(f+"/folders").success(function(e){l.publishAll(e)})},1e3*p),e.$on("$routeChangeStart",function(){s.setLoading("content",!0)}),e.$on("$routeChangeSuccess",function(){s.setLoading("content",!1)}),e.$on("$routeChangeError",function(){t.path("/items")})}]),app.controller("AppController",["Loading","FeedResource","FolderResource",function(e,t,n){"use strict";this.loading=e,this.isFirstRun=function(){return 0===t.size()&&0===n.size()},this.play=function(e){this.playingItem=e}}]),app.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","$location","FEED_TYPE","ITEM_AUTO_PAGE_SIZE","Loading",function(e,t,n,r,i,o,s,a,u,d,c){"use strict";n.clear(),e.publishAll(i),this.isAutoPagingEnabled=!0,n.size()>=d?this.isNothingMoreToAutoPage=!1:this.isNothingMoreToAutoPage=!0,this.getItems=function(){return n.getAll()},this.toggleStar=function(e){n.toggleStar(e)},this.toggleItem=function(e){this.isCompactView()&&(e.show=!e.show)},this.isShowAll=function(){return r.get("showAll")},this.markRead=function(e){var r=n.get(e);r.keepUnread||r.unread!==!0||(n.markItemRead(e),t.markItemOfFeedRead(r.feedId))},this.getFeed=function(e){return t.getById(e)},this.toggleKeepUnread=function(e){var r=n.get(e);r.unread||(t.markItemOfFeedUnread(r.feedId),n.markItemRead(e,!1)),r.keepUnread=!r.keepUnread};var l=this,f=function(){var e=r.get("oldestFirst");if(l.isFeed()){var n=t.getById(s.id);n&&1===n.ordering?e=!0:n&&2===n.ordering&&(e=!1)}return e};this.orderBy=function(){return f()?"id":"-id"},this.isCompactView=function(){return r.get("compact")},this.isCompactExpand=function(){return r.get("compactExpand")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!r.get("preventReadOnScroll")},this.scrollRead=function(e){var r=[],i=[];e.forEach(function(e){var t=n.get(e);t.keepUnread||(r.push(e),i.push(t.feedId))}),r.length>0&&(t.markItemsOfFeedsRead(i),n.markItemsRead(r))},this.isFeed=function(){return o.current.$$route.type===u.FEED},this.autoPage=function(){if(!this.isNothingMoreToAutoPage){if(!this.isAutoPagingEnabled)return void(this.autoPageAgain=!0);this.isAutoPagingEnabled=!1,this.autoPageAgain=!1;var t=o.current.$$route.type,i=s.id,u=f(),l=r.get("showAll"),h=this,p=a.search().search;c.setLoading("autopaging",!0),n.autoPage(t,i,u,l,p).success(function(t){e.publishAll(t),t.items.length>=d?h.isAutoPagingEnabled=!0:h.isNothingMoreToAutoPage=!0,h.isAutoPagingEnabled&&h.autoPageAgain&&h.autoPage()}).error(function(){h.isAutoPagingEnabled=!0})["finally"](function(){c.setLoading("autopaging",!1)})}},this.getRelativeDate=function(e){if(void 0!==e&&""!==e){var t=r.get("language"),n=moment.unix(e).locale(t).fromNow()+"";return n}return""},this.refresh=function(){o.reload()},this.getMediaType=function(e){return e&&0===e.indexOf("audio")?"audio":e&&0===e.indexOf("video")?"video":void 0}}]),app.controller("ExploreController",["sites","$rootScope","FeedResource","SettingsResource","$location",function(e,t,n,r,i){"use strict";this.sites=e,this.feeds=Object.keys(e).map(function(t){return[t,e[t]]}).reduce(function(e,t){var n=t[0],r=t[1];return r.forEach(function(e){e.category=n}),e.concat(r)},[]),this.feedExists=function(e){return void 0!==n.getByLocation(e)},this.subscribeTo=function(e){t.$broadcast("addFeed",e)},this.isCategoryShown=function(e){return e.filter(function(e){return void 0===n.getByLocation(e.feed)}).length>0},this.getSupportedLanguageCodes=function(){return r.getSupportedLanguageCodes()},this.getCurrentLanguageCode=function(){var e=i.search().lang;return e||(e=r.get("language")),e},this.showLanguage=function(e){i.url("/explore/?lang="+e)},this.selectedLanguageCode=this.getCurrentLanguageCode()}]),app.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location","$q",function(e,t,n,r,i,o,s,a,u,d){"use strict";this.feedError="",this.showNewFolder=!1,this.renamingFolder=!1,this.addingFeed=!1,this.addingFolder=!1,this.folderError="",this.renameError="",this.feed={};var c=function(){return parseInt(e.current.params.id,10)};this.getLanguageCode=function(){return o.get("language")},this.getFeeds=function(){return n.getAll()},this.getFolders=function(){return r.getAll()},this.markFolderRead=function(e){n.markFolderRead(e),n.getByFolderId(e).forEach(function(e){i.markFeedRead(e.id)})},this.markFeedRead=function(e){i.markFeedRead(e),n.markFeedRead(e)},this.markRead=function(){i.markRead(),n.markRead()},this.isShowAll=function(){return o.get("showAll")},this.getFeedsOfFolder=function(e){return n.getByFolderId(e)},this.getUnreadCount=function(){return n.getUnreadCount()},this.isUnread=function(){return this.getUnreadCount()>0},this.getFeedUnreadCount=function(e){var t=n.getById(e);return void 0!==t?t.unreadCount:0},this.isFeedUnread=function(e){return this.getFeedUnreadCount(e)>0},this.getFolderUnreadCount=function(e){return n.getFolderUnreadCount(e)},this.isFolderUnread=function(e){return this.getFolderUnreadCount(e)>0},this.getStarredCount=function(){return i.getStarredCount()},this.isStarredUnread=function(){return this.getStarredCount()>0},this.toggleFolder=function(e){r.toggleOpen(e)},this.hasFeeds=function(e){return void 0!==n.getFolderUnreadCount(e)},this.subFeedActive=function(r){var i=e.current.$$route.type;if(i===t.FEED){var o=n.getById(c());if(void 0!==o&&o.folderId===r)return!0}return!1},this.isSubscriptionsActive=function(){return e.current&&e.current.$$route.type===t.SUBSCRIPTIONS},this.isStarredActive=function(){return e.current&&e.current.$$route.type===t.STARRED},this.isExploreActive=function(){return e.current&&e.current.$$route.type===t.EXPLORE},this.isFolderActive=function(n){return e.current&&e.current.$$route.type===t.FOLDER&&c()===n},this.isFeedActive=function(n){return e.current&&e.current.$$route.type===t.FEED&&c()===n},this.folderNameExists=function(e){return e=e||"",void 0!==r.get(e.trim())},this.feedUrlExists=function(e){return e=e||"",e=e.trim(),void 0!==n.get(e)||void 0!==n.get("http://"+e)},this.createFeed=function(e){var t=this;this.showNewFolder=!1,this.addingFeed=!0;var i=e.newFolder,o=e.existingFolder||{id:0};void 0===i||""===i?(o.getsFeed=!0,n.create(e.url,o.id,void 0).then(function(e){s.publishAll(e),u.path("/items/feeds/"+e.feeds[0].id+"/")})["finally"](function(){o.getsFeed=void 0,e.url="",t.addingFeed=!1})):r.create(i).then(function(n){s.publishAll(n),e.existingFolder=r.get(n.folders[0].name),e.newFolder=void 0,t.createFeed(e)})},this.createFolder=function(e){var t=this;this.addingFolder=!0,r.create(e.name).then(function(e){s.publishAll(e)})["finally"](function(){t.addingFolder=!1,e.name=""})},this.moveFeed=function(t,r){var i=!1,o=n.getById(t);o.folderId!==r&&((this.isFolderActive(o.folderId)||this.isFolderActive(r))&&(i=!0),n.move(t,r),i&&e.reload())},this.renameFeed=function(e){n.patch(e.id,{title:e.title}),e.editing=!1},this.renameFolder=function(e,t){e.renameError="",this.renamingFolder=!0;var n=this;e.name===t?(e.renameError="",e.editing=!1,this.renamingFolder=!1):r.rename(e.name,t).then(function(){e.renameError="",e.editing=!1},function(t){e.renameError=t})["finally"](function(){n.renamingFolder=!1})},this.reversiblyDeleteFeed=function(t){n.reversiblyDelete(t.id)["finally"](function(){e.reload()})},this.undoDeleteFeed=function(t){n.undoDelete(t.id)["finally"](function(){e.reload()})},this.deleteFeed=function(e){n["delete"](e.url)},this.reversiblyDeleteFolder=function(t){d.all(n.reversiblyDeleteFolder(t.id),r.reversiblyDelete(t.name))["finally"](function(){e.reload()})},this.undoDeleteFolder=function(t){d.all(n.undoDeleteFolder(t.id),r.undoDelete(t.name))["finally"](function(){e.reload()})},this.deleteFolder=function(e){n.deleteFolder(e.id),r["delete"](e.name)},this.setOrdering=function(t,r){n.patch(t.id,{ordering:r}),e.reload()},this.togglePinned=function(e){var t=n.getById(e);return t?n.patch(e,{pinned:!t.pinned}):void 0},this.setUpdateMode=function(e,t){return n.patch(e,{updateMode:t})},this.toggleFullText=function(t){a.$broadcast("$routeChangeStart"),n.toggleFullText(t.id)["finally"](function(){a.$broadcast("$routeChangeSuccess"),e.reload()})},this.search=function(e){""===e?u.search("search",null):u.search("search",e)};var l=this;a.$on("moveFeedToFolder",function(e,t){l.moveFeed(t.feedId,t.folderId)});var f=function(){var i;e.current&&(i=e.current.$$route.type);var o=0;if(i===t.FOLDER)o=c();else if(i===t.FEED){var s=n.getById(c());s&&(o=s.folderId)}var a;0!==o&&(a=r.getById(o)),l.feed.existingFolder=a};a.$on("$routeChangeSuccess",function(){f()})}]),app.controller("SettingsController",["$route","$q","SettingsResource","ItemResource","OPMLParser","OPMLImporter","Publisher",function(e,t,n,r,i,o,s){"use strict";this.isOPMLImporting=!1,this.isArticlesImporting=!1,this.opmlImportError=!1,this.articleImportError=!1;var a=function(t,r){n.set(t,r),["showAll","oldestFirst","compact"].indexOf(t)>=0&&e.reload()};this.toggleSetting=function(e){a(e,!this.getSetting(e))},this.getSetting=function(e){return n.get(e)},this.importOPML=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isOPMLImporting=!1;var t=i.parse(e),n=this,r=5;o.importFolders(t).then(function(e){return o.importFeedQueue(e,r)})["finally"](function(){n.isOPMLImporting=!1})}catch(s){console.error(s),this.isOPMLImporting=!1,this.opmlImportError=!0}},this.importArticles=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isArticlesImporting=!0;var t=JSON.parse(e),n=this;r.importArticles(t).success(function(e){s.publishAll(e)})["finally"](function(){n.isArticlesImporting=!1})}catch(i){console.error(i),this.articleImportError=!0,this.isArticlesImporting=!1}}}]),app.filter("trustUrl",["$sce",function(e){"use strict";return function(t){return e.trustAsResourceUrl(t)}}]),app.filter("unreadCountFormatter",function(){"use strict";return function(e){return e>999?"999+":e}}),app.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"url"),this.ids={},this.locations={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=r};return i.prototype=Object.create(e.prototype),i.prototype.receive=function(t){e.prototype.receive.call(this,t),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.clear=function(){e.prototype.clear.call(this),this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.ids={},this.locations={}},i.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var e=this;this.values.forEach(function(t){t.unreadCount&&(e.unreadCount+=t.unreadCount),void 0!==t.folderId&&(e.folderUnreadCount[t.folderId]=e.folderUnreadCount[t.folderId]||0,e.folderUnreadCount[t.folderId]+=t.unreadCount)})},i.prototype.updateFolderCache=function(){this.folderIds={};var e=this;this.values.forEach(function(t){e.folderIds[t.folderId]=e.folderIds[t.folderId]||[],e.folderIds[t.folderId].push(t)})},i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.url]),void 0!==t.location&&(this.locations[t.location]=this.hashMap[t.url])},i.prototype.markRead=function(){this.values.forEach(function(e){e.unreadCount=0}),this.updateUnreadCache()},i.prototype.markFeedRead=function(e){this.ids[e].unreadCount=0,this.updateUnreadCache()},i.prototype.markFolderRead=function(e){this.values.forEach(function(t){t.folderId===e&&(t.unreadCount=0)}),this.updateUnreadCache()},i.prototype.markItemOfFeedRead=function(e){this.ids[e].unreadCount-=1,this.updateUnreadCache()},i.prototype.markItemsOfFeedsRead=function(e){var t=this;e.forEach(function(e){t.ids[e].unreadCount-=1}),this.updateUnreadCache()},i.prototype.markItemOfFeedUnread=function(e){this.ids[e].unreadCount+=1,this.updateUnreadCache()},i.prototype.getUnreadCount=function(){return this.unreadCount},i.prototype.getFolderUnreadCount=function(e){return this.folderUnreadCount[e]},i.prototype.getByFolderId=function(e){return this.folderIds[e]||[]},i.prototype.getById=function(e){return this.ids[e]},i.prototype.getByLocation=function(e){return this.locations[e]},i.prototype.move=function(e,t){var n=this.getById(e);return n.folderId=t,this.updateFolderCache(),this.updateUnreadCache(),this.patch(e,{folderId:t})},i.prototype.create=function(e,t,n){e=e.trim(),e.startsWith("http")||(e="https://"+e),void 0!==n&&(n=n.trim());var r={url:e,folderId:t||0,title:n||e,unreadCount:0};this.add(r),this.updateFolderCache();var i=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:e,parentFolderId:t||0,title:n}}).success(function(e){i.resolve(e)}).error(function(e){r.faviconLink="",r.error=e.message,i.reject()}),i.promise},i.prototype.reversiblyDelete=function(e,t,n){var r=this.getById(e);return r&&n!==!0&&(r.deleted=!0),t!==!1&&this.updateUnreadCache(),this.http["delete"](this.BASE_URL+"/feeds/"+e)},i.prototype.reversiblyDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.reversiblyDelete(e.id,!1,!0))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype["delete"]=function(t,n){var r=this.get(t);return void 0!==r&&r.id&&delete this.ids[r.id],void 0!==r&&r.location&&delete this.locations[r.location],e.prototype["delete"].call(this,t),n!==!1&&(this.updateUnreadCache(),this.updateFolderCache()),r},i.prototype.deleteFolder=function(e){var t=this;this.getByFolderId(e).forEach(function(e){t["delete"](e.url,!1)}),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.undoDelete=function(e,t){var n=this.getById(e);return n&&(n.deleted=!1),t!==!1&&this.updateUnreadCache(),this.http.post(this.BASE_URL+"/feeds/"+e+"/restore")},i.prototype.undoDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.undoDelete(e.id,!1))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype.setOrdering=function(e,t){var n=this.getById(e);if(n){n.ordering=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{ordering:t})}},i.prototype.setPinned=function(e,t){var n=this.getById(e);if(n){n.pinned=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{pinned:t})}},i.prototype.patch=function(e,t){var n=this.getById(e);if(n){Object.keys(t).forEach(function(e){n[e]=t[e]});var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,t)}},i.prototype.toggleFullText=function(e){var t=this.getById(e);return this.patch(e,{fullTextEnabled:!t.fullTextEnabled})},new i(t,n,r)}]),app.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"name"),this.deleted=null,this.$q=r,this.ids={}};return i.prototype=Object.create(e.prototype),i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.name])},i.prototype.clear=function(){e.prototype.clear.call(this),this.ids={}},i.prototype["delete"]=function(t){var n=this.get(t);return void 0!==n&&n.id&&delete this.ids[n.id],e.prototype["delete"].call(this,t),n},i.prototype.toggleOpen=function(e){var t=this.get(e);return t.opened=!t.opened,this.http({url:this.BASE_URL+"/folders/"+t.id+"/open",method:"POST",data:{folderId:t.id,open:t.opened}})},i.prototype.rename=function(e,t){var n=this.get(e),r=this.$q.defer(),i=this;return this.http({url:this.BASE_URL+"/folders/"+n.id+"/rename",method:"POST",data:{folderName:t}}).success(function(){n.name=t,delete i.hashMap[e],i.hashMap[t]=n,r.resolve()}).error(function(e){r.reject(e.message)}),r.promise},i.prototype.getById=function(e){return this.ids[e]},i.prototype.create=function(e){e=e.trim();var t={name:e};this.add(t);var n=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:e}}).success(function(e){n.resolve(e)}).error(function(e){t.error=e.message}),n.promise},i.prototype.reversiblyDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!0,this.http["delete"](this.BASE_URL+"/folders/"+n)},i.prototype.undoDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!1,this.http.post(this.BASE_URL+"/folders/"+n+"/restore")},new i(t,n,r)}]),app.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n),this.batchSize=r,this.clear()};return i.prototype=Object.create(e.prototype),i.prototype.clear=function(){this.starredCount=0,this.lowestId=0,this.highestId=0,e.prototype.clear.call(this)},i.prototype.receive=function(t,n){switch(n){case"newestItemId":this.newestItemId=t;break;case"starred":this.starredCount=t;break;default:var r=this;t.forEach(function(e){0===r.lowestId&&(r.lowestId=e.id),0===r.highestId&&(r.highestId=e.id),e.id>r.highestId&&(r.highestId=e.id),e.id<r.lowestId&&(r.lowestId=e.id)}),e.prototype.receive.call(this,t,n)}},i.prototype.getNewestItemId=function(){return this.newestItemId},i.prototype.getStarredCount=function(){return this.starredCount},i.prototype.star=function(e,t){void 0===t&&(t=!0);var n=this.get(e),r=this.BASE_URL+"/items/"+n.feedId+"/"+n.guidHash+"/star";return n.starred=t,t?this.starredCount+=1:this.starredCount-=1,this.http({url:r,method:"POST",data:{isStarred:t}})},i.prototype.toggleStar=function(e){this.get(e).starred?this.star(e,!1):this.star(e,!0)},i.prototype.markItemRead=function(e,t){return void 0===t&&(t=!0),this.get(e).unread=!t,this.http({url:this.BASE_URL+"/items/"+e+"/read",method:"POST",data:{isRead:t}})},i.prototype.markItemsRead=function(e){var t=this;return e.forEach(function(e){t.get(e).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:e}})},i.prototype.markFeedRead=function(e,t){void 0===t&&(t=!0);var n=this.values.filter(function(t){return t.feedId===e});return n.forEach(function(e){e.unread=!t}),this.http.post(this.BASE_URL+"/feeds/"+e+"/read",{highestItemId:this.getNewestItemId()})},i.prototype.markRead=function(){return this.values.forEach(function(e){e.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},i.prototype.autoPage=function(e,t,n,r,i){var o;return o=n?this.highestId:this.lowestId,this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:e,id:t,offset:o,limit:this.batchSize,oldestFirst:n,showAll:r,search:i}})},i.prototype.importArticles=function(e){return this.http({url:this.BASE_URL+"/feeds/import/articles",method:"POST",data:{json:e}})},new i(t,n,r)}]),app.service("Loading",function(){"use strict";this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(e,t){this.loading[e]=t},this.isLoading=function(e){return this.loading[e]}}),app.service("OPMLImporter",["FeedResource","FolderResource","Publisher","$q",function(e,t,n,r){"use strict";var i=function(o){var s=r.defer();if(o.length>0){var a=o.pop(),u=a.url,d=a.title,c=0,l=a.folderName;if(void 0!==l&&void 0!==t.get(l)){var f=t.get(l);f.opened=!0,c=f.id,f.getsFeed=!0,f.getsFeedCounter=f.getsFeedCounter||0,f.getsFeedCounter+=1}void 0!==u&&void 0===e.get(u)&&e.create(u,c,d).then(function(e){n.publishAll(e)})["finally"](function(){0!==c&&(f.getsFeedCounter-=1,0===f.getsFeedCounter&&(f.getsFeed=!1)),i(o)})}else s.resolve();return s.promise};this.importFolders=function(e){var i=[],o=[];e.folders.forEach(function(e){if(void 0!==e.name){if(void 0===t.get(e.name)){var r=t.create(e.name).then(function(e){n.publishAll(e)});o.push(r)}e.feeds.forEach(function(t){t.folderName=e.name,i.push(t)})}}),i=i.concat(e.feeds);var s=r.defer();return r.all(o)["finally"](function(){s.resolve(i)}),s.promise},this.importFeedQueue=function(e,t){for(var n=r.defer(),o=[],s=0;t>s;s+=1)o.push(i(e));return r.all(o).then(function(){n.resolve()}),n.promise}}]),app.service("OPMLParser",function(){"use strict";var e=function(e){var t=e.attr("xmlUrl")||e.attr("htmlUrl"),n=e.attr("title")||e.attr("text")||t;return void 0===t?{type:"folder",name:n,feeds:[]}:{type:"feed",name:n,url:t}},t=function(n,r,i){for(var o=0;o<n.length;o+=1){var s=$(n[o]),a=e(s);"feed"===a.type?r.feeds.push(a):i?(t(s.children("outline"),a,!1),r.folders.push(a)):t(s.children("outline"),r,!1)}return r};this.parse=function(e){e=$.parseXML(e);var n=$(e).find("body > outline"),r={feeds:[],folders:[]};return t(n,r,!0)}}),app.service("Publisher",function(){"use strict";this.channels={},this.subscribe=function(e){var t=this;return{toChannels:function(n){n.forEach(function(n){t.channels[n]=t.channels[n]||[],t.channels[n].push(e)})}}},this.publishAll=function(e){var t=this;Object.keys(e).forEach(function(n){var r=t.channels[n];void 0!==r&&r.forEach(function(t){t.receive(e[n],n)})})}}),app.factory("Resource",function(){"use strict";var e=function(e,t,n){this.id=n||"id",this.values=[],this.hashMap={},this.http=e,this.BASE_URL=t};return e.prototype.receive=function(e){var t=this;e.forEach(function(e){t.add(e)})},e.prototype.add=function(e){var t=this.hashMap[e[this.id]];void 0===t?(this.values.push(e),this.hashMap[e[this.id]]=e):Object.keys(e).forEach(function(n){t[n]=e[n]})},e.prototype.size=function(){return this.values.length},e.prototype.get=function(e){return this.hashMap[e]},e.prototype["delete"]=function(e){var t=this,n=this.values.findIndex(function(n){return n[t.id]===e});void 0!==n&&this.values.splice(n,1),void 0!==this.hashMap[e]&&delete this.hashMap[e]},e.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},e.prototype.getAll=function(){return this.values},e}),app.service("SettingsResource",["$http","BASE_URL",function(e,t){"use strict";this.settings={language:"en",showAll:null,compact:!1,oldestFirst:null,preventReadOnScroll:!1,compactExpand:!1,exploreUrl:""},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.getSupportedLanguageCodes=function(){return this.supportedLanguageCodes},this.receive=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n];"language"===n&&(r=t.processLanguageCode(r)),t.settings[n]=r})},this.get=function(e){return this.settings[e]},this.set=function(n,r){return this.settings[n]=r,e({url:t+"/settings",method:"PUT",data:{language:this.settings.language,showAll:this.settings.showAll,compact:this.settings.compact,oldestFirst:this.settings.oldestFirst,compactExpand:this.settings.compactExpand,preventReadOnScroll:this.settings.preventReadOnScroll}})},this.processLanguageCode=function(e){return e=e.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(e)<0&&(e=e.split("-")[0]),this.supportedLanguageCodes.indexOf(e)<0&&(e=this.defaultLanguageCode),e}}]),function(e,t,n,r,i,o){"use strict";var s=e.location,a=e.localStorage,u=function(e,t,r){var i=n.isContentHandlerRegistered,o=function(e,t){return i?"new"!==i(e,t):a.getItem("registeredHandler")===t};n.registerContentHandler&&!o(e,t)&&(n.registerContentHandler(e,t,r),i||a.setItem("registeredHandler",t))},d=s.protocol+"//"+s.host+s.pathname,c=d+"?subscribe_to=%s",l="application/vnd.mozilla.maybe.feed",f="ownCloud News @ "+d;u(l,c,f),i(t).ready(function(){var e=r("?subscribe_to");if(e&&"undefined"!==e){i("#new-feed").show();var t=i('input[ng-model="Navigation.feed.url"]');t.val(e),t.trigger("input"),setTimeout(function(){t.focus()},1e3)}})}(window,document,navigator,url,$),function(e,t){"use strict";e.addEventListener("beforeunload",function(){var e=t.querySelector("#app-content");e.scrollTo(0,0)})}(window,document),function(e,t,n){"use strict";var r=function(e){return!(e.is("input")||e.is("select")||e.is("textarea")||e.is("checkbox"))},i=function(e){return!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)},o=function(e){var t=".active > .app-navigation-entry-menu .mark-read button",n=e.find(t);n.length>0&&n.trigger("click")},s=function(e,t){var n=e.offset().top-t.offset().top,r=n+e.height(),i=t.height();return n>=0&&i>r},a=function(e,t,n){0===e.length||!n&&s(e,t)||t.scrollTop(e.offset().top-t.offset().top+t.scrollTop())},u=function(e){var t=e.find(".active");a(t,e.children("ul"),!0)},d=function(e){e.find(".active > a:visible").trigger("click")},c=function(e,t){if(0===t.scrollTop()){var n=t.find(".pull-to-refresh");n.hasClass("show-pull-to-refresh")?n.hasClass("done")&&d(e):n.addClass("show-pull-to-refresh")}},l=function(e,t){e.children("a:visible").trigger("click"),a(e,t.children("ul"))},f=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder"))for(;t.length>0;){var i=t.find(".feed:visible");if(i.length>0)return void l(n(i[0]),e);t=t.next(".folder")}else for(var o=0;o<r.length-1;o+=1){var s=r[o];if(s===t[0]){var a=r[o+1];l(n(a),e);break}}},h=function(e){return e.parent().parent(".folder")},p=function(e,t){var r,i=e.find(".folder:visible");r=t?i.length-1:0,i.length>0&&l(n(i[r]),e)},g=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.prevAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n,e):p(e,!0)}else p(e,!0)},v=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.nextAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n.nextAll(".folder:visible").first(),e):p(e)}else p(e)},m=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder")){for(var i=t.prev(".folder");i.length>0;){var o=i.find(".feed:visible");if(o.length>0)return void l(n(o[o.length-1]),e);i=i.prev(".folder")}var s=t.siblings(".feed");if(s.length>0)return void l(n(s[s.length-1]),e);var a=n(".starred-feed:visible");return void(a.length>0&&l(a,e))}for(var u=r.length-1;u>0;u-=1){var d=r[u];if(d===t[0]){var c=r[u-1];l(n(c),e);break}}},y=function(e,t){var r=e.find(".item");r.each(function(e,r){return r=n(r),r.height()+r.position().top>30?(t(r),!1):void 0})},E=function(e){y(e,function(e){e.find(".toggle-keep-unread").trigger("click")})},C=function(e){y(e,function(e){e.find(".star").trigger("click")})},F=function(e){y(e,function(e){e.find(".utils").trigger("click")})},I=function(t){y(t,function(t){t.trigger("click"),e.open(t.find(".external:visible").attr("href"),"_blank")})},w=function(e,t,n){e.scrollTop(t.offset().top-e.offset().top+e.scrollTop()),n&&y(e,function(e){e.hasClass("open")||e.find(".utils").trigger("click")})},R=function(e,t){var r=e.find(".item"),i=!1;r.each(function(r,o){return o=n(o),0===o.position().top&&t&&!o.hasClass("open")||o.position().top>10?(w(e,o,t),i=!0,!1):void 0}),i||e.scrollTop(e.prop("scrollHeight"))},b=function(e,t,r){var i=t.find(".item"),o=!1;i.each(function(i,s){if(s=n(s),s.position().top+10>=0){var a=s.prev();return a.length>0?w(t,a,r):(c(e,t),t.scrollTop(0)),o=!0,!1}}),!o&&i.length>0&&w(t,i.last())};n(t).keyup(function(e){var t=e.keyCode,s=n("#app-content"),a=n("#app-navigation"),l=n("#articles.compact").length>0,h="true"===n("#articles").attr("news-compact-expand"),p=l&&h;r(n(":focus"))&&i(e)?[74,78,39].indexOf(t)>=0?(e.preventDefault(),R(s,p)):[75,80,37].indexOf(t)>=0?(e.preventDefault(),b(a,s,p)):[85].indexOf(t)>=0?(e.preventDefault(), +E(s)):[69].indexOf(t)>=0?(e.preventDefault(),F(s)):[73,83,76].indexOf(t)>=0?(e.preventDefault(),C(s)):[72].indexOf(t)>=0?(e.preventDefault(),C(s),R(s)):[79].indexOf(t)>=0?(e.preventDefault(),I(s)):[82].indexOf(t)>=0?(e.preventDefault(),d(a)):[70].indexOf(t)>=0?(e.preventDefault(),f(a)):[68].indexOf(t)>=0?(e.preventDefault(),m(a)):[67].indexOf(t)>=0?(e.preventDefault(),g(a)):[65].indexOf(t)>=0?(e.preventDefault(),u(a)):[86].indexOf(t)>=0?(e.preventDefault(),v(a)):[81].indexOf(t)>=0?(e.preventDefault(),n("#searchbox").focus()):[33].indexOf(t)>=0&&c(a,s):r(n(":focus"))&&e.shiftKey&&[65].indexOf(t)>=0&&(e.preventDefault(),o(a))})}(window,document,$),window.News=window.News||{},function(e,t,n,r,i){"use strict";var o=[];r.addArticleAction=function(e){o.push(e)},r.getArticleActionPlugins=function(){return o}}(window,document,jQuery,window.News),app.run(["$document","$rootScope",function(e,t){"use strict";e.click(function(e){t.$broadcast("documentClicked",e)})}]),app.directive("appNavigationEntryUtils",function(){"use strict";return{restrict:"C",link:function(e,t){var n=t.siblings(".app-navigation-entry-menu"),r=$(t).find(".app-navigation-entry-utils-menu-button button");r.click(function(){n.toggleClass("open")}),e.$on("documentClicked",function(e,t){t.target!==r[0]&&n.removeClass("open")})}}}),app.directive("newsAddFeed",["$rootScope","$timeout",function(e,t){"use strict";return{restrict:"A",link:function(n,r){e.$on("addFeed",function(e,i){t(function(){r.is(":animated")?(r.stop(!0,!0),r.show()):r.is(":visible")||r.slideDown(),r.find('[ng-model="Navigation.feed.url"]').focus()}),n.Navigation.feed.url=i})}}}]),app.directive("newsArticleActions",function(){"use strict";return{restrict:"A",scope:{newsArticleActions:"=",noPlugins:"="},link:function(e,t){for(var n=News.getArticleActionPlugins(),r=0;r<n.length;r+=1)n[r](t,e.newsArticleActions);e.noPlugins=0===n.length}}}),app.directive("newsAutoFocus",["$timeout",function(e){"use strict";return function(t,n,r){var i=n;r.newsAutoFocus&&(i=$(r.newsAutoFocus)),e(function(){i.focus()},0)}}]),app.directive("newsBindHtmlUnsafe",function(){"use strict";return function(e,t,n){e.$watch(n.newsBindHtmlUnsafe,function(){t.html(e.$eval(n.newsBindHtmlUnsafe))})}}),app.directive("newsDraggable",function(){"use strict";return function(e,t,n){var r=e.$eval(n.newsDraggable);angular.isDefined(r)?t.draggable(r):t.draggable(),n.$observe("newsDraggableDisable",function(e){"true"===e?t.draggable("disable"):t.draggable("enable")})}}),app.directive("newsDroppable",["$rootScope",function(e){"use strict";return function(t,n,r){var i={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(i,o){$(".drag-and-drop").removeClass("drag-and-drop");var s={folderId:parseInt(n.data("id"),10),feedId:parseInt($(o.draggable).data("id"),10)};e.$broadcast("moveFeedToFolder",s),t.$apply(r.droppable)}};n.droppable(i)}}]),app.directive("newsFinishedTransition",function(){"use strict";return function(e,t,n){t.on("transitionend",function(){t.addClass(n.newsFinishedTransition)})}}),app.directive("newsFocus",["$timeout","$interpolate",function(e,t){"use strict";return function(n,r,i){r.click(function(){var r=$(t(i.newsFocus)(n));e(function(){r.focus()},500)})}}]),app.directive("newsInstantNotification",function(){"use strict";return{restrict:"E",link:function(e,t){t.hide();var n=t.html();OC.Notification.showHtml(n)}}}),app.directive("newsPlayOne",["$rootScope",function(e){"use strict";return{restrict:"A",link:function(t,n){n.on("play",function(){e.$broadcast("playing",n)}),e.$on("playing",function(e,t){t[0]!==n[0]&&n[0].pause()})}}}]),app.directive("newsPullToRefresh",["$rootScope",function(e){"use strict";var t=!1;return{restrict:"A",scope:{newsPullToRefresh:"="},link:function(n,r){e.$on("$routeChangeStart",function(){t=!1,n.newsPullToRefresh=!1}),r.on("scroll",function(){0===r.scrollTop()&&t&&(n.newsPullToRefresh=!0),t=!0})}}}]),app.directive("newsReadFile",function(){"use strict";return function(e,t,n){t.change(function(){var r=t[0].files[0],i=new FileReader;i.onload=function(t){e.$fileContent=t.target.result,e.$apply(n.newsReadFile)},i.readAsText(r)})}}),app.directive("newsRefreshMasonry",["$timeout",function(e){"use strict";var t=function(t){e(function(){e(function(){t.parent().masonry({itemSelector:".grid-item",gutter:25,columnWidth:300})})})};return function(e,n){e.$last&&t(n)}}]),app.directive("newsScroll",["$timeout","ITEM_AUTO_PAGE_SIZE","MARK_READ_TIMEOUT","SCROLL_TIMEOUT",function(e,t,n,r){"use strict";var i,o=function(e,t,n){for(var r=0,i=t.find(".item"),o=i.length-1;o>=0;o-=1){var s=$(i[o]);if(r>=e)break;if(s.position().top<0){n.$apply(n.newsScrollAutoPage);break}r+=1}},s=function(e,t,n){if(e){var r=[],i=t.find(".item:not(.read)");i.each(function(e,t){var n=$(t);return n.position().top<=-10?void r.push(parseInt(n.data("id"),10)):!1}),n.itemIds=r,n.$apply(n.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScroll:"@",newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"="},link:function(a,u){var d=!0,c=u;a.newsScroll&&(c=$(a.newsScroll));var l=function(){d&&(d=!1,e(function(){d=!0},1e3*r),o(t,u,a),i&&e.cancel(i),i=e(function(){s(a.newsScrollEnabledMarkRead,u,a),i=void 0},1e3*n))};c.on("scroll",l),a.$on("$destroy",function(){c.off("scroll",l)})}}}]),app.directive("newsSearch",["$document","$location",function(e,t){"use strict";return{restrict:"E",scope:{onSearch:"="},link:function(e){var n=$("#searchbox");n.val(t.search().search);var r=function(){var t=n.val();e.$apply(function(){e.onSearch(t)})};n.on("search keyup",function(e){("search"===e.type||13===e.keyCode)&&r()}),e.$watch(function(){return t.search()},function(e){e&&e.search?n.val(e.search):n.val("")})}}}]),app.directive("newsStickyMenu",function(){"use strict";return function(e,t,n){var r=40;$(n.newsStickyMenu).scroll(function(){var e=$(this).scrollTop();e>r?(t.addClass("fixed"),t.css("top",e)):t.removeClass("fixed")})}}),app.directive("newsStopPropagation",function(){"use strict";return{restrict:"A",link:function(e,t){t.bind("click",function(e){e.stopPropagation()})}}}),app.directive("newsTimeout",["$timeout","$rootScope",function(e,t){"use strict";return{restrict:"A",scope:{newsTimeout:"&"},link:function(n,r){var i=!1,o=7,s=e(n.newsTimeout,1e3*o);n.$on("$destroy",function(){i=!0,e.cancel(s)}),t.$on("$locationChangeStart",function(){e.cancel(s),i||(i=!0,r.remove(),n.newsTimeout())})}}}]),app.directive("newsTitleUnreadCount",["$window",function(e){"use strict";var t=e.document.title,n=t.split("-"),r=n[0]||"News",i=n[1]||"ownCloud";return{restrict:"E",scope:{unreadCount:"@"},link:function(t,n,o){o.$observe("unreadCount",function(t){"0"!==t?e.document.title=r+"("+t+") - "+i:e.document.title=r+" - "+i})}}}]),app.directive("newsToggleShow",function(){"use strict";return{restrict:"A",scope:{newsToggleShow:"@"},link:function(e,t){t.click(function(){var t=$(e.newsToggleShow);t.toggle()})}}}),app.directive("newsTriggerClick",function(){"use strict";return function(e,t,n){t.click(function(){$(n.newsTriggerClick).trigger("click")})}}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFwcC5qcyIsIkNvbmZpZy5qcyIsIlJ1bi5qcyIsIkFwcENvbnRyb2xsZXIuanMiLCJDb250ZW50Q29udHJvbGxlci5qcyIsIkV4cGxvcmVDb250cm9sbGVyLmpzIiwiTmF2aWdhdGlvbkNvbnRyb2xsZXIuanMiLCJTZXR0aW5nc0NvbnRyb2xsZXIuanMiLCJUcnVzdFVybC5qcyIsIlVucmVhZENvdW50Rm9ybWF0dGVyLmpzIiwiRmVlZFJlc291cmNlLmpzIiwiRm9sZGVyUmVzb3VyY2UuanMiLCJJdGVtUmVzb3VyY2UuanMiLCJMb2FkaW5nLmpzIiwiT1BNTEltcG9ydGVyLmpzIiwiT1BNTFBhcnNlci5qcyIsIlB1Ymxpc2hlci5qcyIsIlJlc291cmNlLmpzIiwiU2V0dGluZ3NSZXNvdXJjZS5qcyIsIkV4dGVyblN1YnNjcmlwdGlvbi5qcyIsIkZpeGVzLmpzIiwiS2V5Ym9hcmRTaG9ydGN1dHMuanMiLCJBcnRpY2xlQWN0aW9uUGx1Z2luLmpzIiwiQXBwTmF2aWdhdGlvbkVudHJ5VXRpbHMuanMiLCJOZXdzQWRkRmVlZC5qcyIsIk5ld3NBcnRpY2xlQWN0aW9ucy5qcyIsIk5ld3NBdXRvRm9jdXMuanMiLCJOZXdzQmluZFVuc2FmZUh0bWwuanMiLCJOZXdzRHJhZ2dhYmxlLmpzIiwiTmV3c0Ryb3BwYWJsZS5qcyIsIk5ld3NGaW5pc2hlZFRyYW5z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kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgkd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lKVswXTtcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnVybC5pbmRleE9mKEJBU0VfVVJMKSA9PT0gMCB8fFxuICAgICAgICAgICAgICAgICAgICBjb25maWcudXJsLmluZGV4T2YoZG9tYWluKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAvKmpzaGludCBjYW1lbGNhc2U6IGZhbHNlICovXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5oZWFkZXJzLnJlcXVlc3R0b2tlbiA9IG9jX3JlcXVlc3R0b2tlbjtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gY29uZmlnIHx8ICRxLndoZW4oY29uZmlnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9XSk7XG4gICAgdmFyIGVycm9yTWVzc2FnZXMgPSB7XG4gICAgICAgIDA6IHQoJ25ld3MnLCAnUmVxdWVzdCBmYWlsZWQsIG5ldHdvcmsgY29ubmVjdGlvbiB1bmF2YWlsYWJsZSEnKSxcbiAgICAgICAgNDAxOiB0KCduZXdzJywgJ1JlcXVlc3QgdW5hdXRob3JpemVkLiBBcmUgeW91IGxvZ2dlZCBpbj8nKSxcbiAgICAgICAgNDAzOiB0KCduZXdzJywgJ1JlcXVlc3QgZm9yYmlkZGVuLiBBcmUgeW91IGFuIGFkbWluPycpLFxuICAgICAgICA0MTI6IHQoJ25ld3MnLCAnVG9rZW4gZXhwaXJlZCBvciBhcHAgbm90IGVuYWJsZWQhIFJlbG9hZCB0aGUgcGFnZSEnKSxcbiAgICAgICAgNTAwOiB0KCduZXdzJywgJ0ludGVybmFsIHNlcnZlciBlcnJvciEgUGxlYXNlIGNoZWNrIHlvdXIgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICdkYXRhL293bmNsb3VkLmxvZyBmaWxlIGZvciBhZGRpdGlvbmFsICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAnaW5mb3JtYXRpb24hJyksXG4gICAgICAgIDUwMzogdCgnbmV3cycsICdSZXF1ZXN0IGZhaWxlZCwgb3duQ2xvdWQgaXMgaW4gY3VycmVudGx5ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAnaW4gbWFpbnRlbmFuY2UgbW9kZSEnKSxcbiAgICB9O1xuICAgICRwcm92aWRlLmZhY3RvcnkoJ0Nvbm5lY3Rpb25FcnJvckludGVyY2VwdG9yJywgW1wiJHFcIiwgXCIkdGltZW91dFwiLCBmdW5jdGlvbiAoJHEsICR0aW1lb3V0KSB7XG4gICAgICAgIHZhciB0aW1lcjtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHJlc3BvbnNlRXJyb3I6IGZ1bmN0aW9uIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIC8vIHN0YXR1cyAwIGlzIGEgbmV0d29yayBlcnJvclxuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgaW4gZXJyb3JNZXNzYWdlcykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGltZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0LmNhbmNlbCh0aW1lcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgT0MuTm90aWZpY2F0aW9uLmhpZGUoKTtcbiAgICAgICAgICAgICAgICAgICAgT0MuTm90aWZpY2F0aW9uLnNob3dIdG1sKGVycm9yTWVzc2FnZXNbcmVzcG9uc2Uuc3RhdHVzXSk7XG4gICAgICAgICAgICAgICAgICAgIHRpbWVyID0gJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgT0MuTm90aWZpY2F0aW9uLmhpZGUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSwgNTAwMCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVyb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wgJyc7XG5cbiAgICAgICAgICAgICAgICB2YXIgZGVmZXJyZWQgPSAkcS5kZWZlcigpO1xuXG4gICAgICAgICAgICAgICAgLy8gaWYgdGhvc2UgdHdvIHZhbHVlcyBhcmUgbnVsbCBpdCBtZWFucyB3ZSBkaWQgbm90IHJlY2VpdmVcbiAgICAgICAgICAgICAgICAvLyB0aGUgc2V0dGluZ3MgcmVxdWVzdCBmcm9tIHRoZSBzZXJ2ZXIgc28gZG9udCBxdWVyeSB0aGUgc2VydmVyXG4gICAgICAgICAgICAgICAgaWYgKHNob3dBbGwgPT09IG51bGwgfHwgb2xkZXN0Rmlyc3QgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZSh7fSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmFtZXRlcnMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlLFxuICAgICAgICAgICAgICAgICAgICAgICAgbGltaXQ6IElURU1fQkFUQ0hfU0laRSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dBbGw6IHNob3dBbGwsXG4gICAgICAgICAgICAgICAgICAgICAgICBvbGRlc3RGaXJzdDogb2xkZXN0Rmlyc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2g6IHNlYXJjaFxuICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICgkcm91dGUuY3VycmVudC5wYXJhbXMuaWQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVycy5pZCA9ICRyb3V0ZS5jdXJyZW50LnBhcmFtcy5pZDtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGlmIGEgY3VzdG9tIG9yZGVyaW5nIGlzIHNldFxuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gRkVFRF9UWVBFLkZFRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmZWVkID0gRmVlZFJlc291cmNlLmdldEJ5SWQocGFyYW1ldGVycy5pZCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9uIGludGlhbCBsb2FkLCB0aGUgZmVlZCBvcmRlcmluZyBpcyB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmZWVkID09PSB1bmRlZmluZWQgfHwgZmVlZC5vcmRlcmluZyA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMub2xkZXN0Rmlyc3QgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZmVlZC5vcmRlcmluZyA9PT0gMSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMub2xkZXN0Rmlyc3QgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgJGh0dHAoe1xuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAgQkFTRV9VUkwgKyAnL2l0ZW1zJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IHBhcmFtZXRlcnNcbiAgICAgICAgICAgICAgICAgICAgfSkuc3VjY2VzcyhmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgICAgICAgICB9XVxuICAgICAgICB9O1xuICAgIH07XG5cbiAgICB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ycpO1xuXG4gICAgICAgICAgICAgICAgICAgIHZhciBleHBsb3JlVXJsID0gdXJsICsgJy9mZWVkcy4nICsgbGFuZ3VhZ2UgKyAnLmpzb24nO1xuICAgICAgICAgICAgICAgICAgICB2YXIgZGVmYXVsdEV4cGxvcmVVcmwgPSB1cmwgKyAnL2ZlZWRzLmVuLmpzb24nO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGh0dHBcbiAgICAgICAgICAgICAgICAgICAgICAgIC5nZXQoZXhwbG9yZVVybClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRodHRwLmdldChkZWZhdWx0RXhwbG9yZVVybCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShkYXRhLmRhdGEpO1xuICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVqZWN0KCk7XG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gZGVmZXJyZWQucHJvbWlzZTtcbiAgICAgICAgICAgIH1dXG4gICAgICAgIH07XG4gICAgfTtcblxuICAgICRyb3V0ZVByb3ZpZGVyXG4gICAgICAgIC53aGVuKCcvaXRlbXMnLCB7XG4gICAgICAgICAgICBjb250cm9sbGVyOiAnQ29udGVudENvbnRyb2xsZXIgYXMgQ29udGVudCcsXG4gICAgICAgICAgICB0ZW1wbGF0ZVVybDogJ2NvbnRlbnQuaHRtbCcsXG4gICAgICAgICAgICByZXNvbHZlOiBnZXRJdGVtUmVzb2x2ZShmZWVkVHlwZS5TVUJTQ1JJUFRJT05TKSxcbiAgICAgICAgICAgIHR5cGU6IGZlZWRUeXBlLlNVQlNDUklQVElPTlNcbiAgICAgICAgfSlcbiAgICAgICAgLndoZW4oJy9pdGVtcy9zdGFycmVkJywge1xuICAgICAgICAgICAgY29udHJvbGxlcjogJ0NvbnRlbnRDb250cm9sbGVyIGFzIENvbnRlbnQnLFxuICAgICAgICAgICAgdGVtcGxhdGVVcmw6ICdjb250ZW50Lmh0bWwnLFxuICAgICAgICAgICAgcmVzb2x2ZTogZ2V0SXRlbVJlc29sdmUoZmVlZFR5cGUuU1RBUlJFRCksXG4gICAgICAgICAgICB0eXBlOiBmZWVkVHlwZS5TVEFSUkVEXG4gICAgICAgIH0pXG4gICAgICAgIC53aGVuKCcvaXRlbXMvZmVlZHMvOmlkJywge1xuICAgICAgICAgICAgY29udHJvbGxlcjogJ0NvbnRlbnRDb250cm9sbGVyIGFzIENvbnRlbnQnLFxuICAgICAgICAgICAgdGVtcGxhdGVVcmw6ICdjb250ZW50Lmh0bWwnLFxuICAgICAgICAgICAgcmVzb2x2ZTogZ2V0SXRlbVJlc29sdmUoZmVlZFR5cGUuRkVFRCksXG4gICAgICAgICAgICB0eXBlOiBmZWVkVHlwZS5GRUVEXG4gICAgICAgIH0pXG4gICAgICAgIC53aGVuKCcvaXRlbXMvZm9sZGVycy86aWQnLCB7XG4gICAgICAgICAgICBjb250cm9sbGVyOiAnQ29udGVudENvbnRyb2xsZXIgYXMgQ29udGVudCcsXG4gICAgICAgICAgICB0ZW1wbGF0ZVVybDogJ2NvbnRlbnQuaHRtbCcsXG4gICAgICAgICAgICByZXNvbHZlOiBnZXRJdGVtUmVzb2x2ZShmZWVkVHlwZS5GT0xERVIpLFxuICAgICAgICAgICAgdHlwZTogZmVlZFR5cGUuRk9MREVSXG4gICAgICAgIH0pLndoZW4oJy9leHBsb3JlJywge1xuICAgICAgICAgICAgY29udHJvbGxlcjogJ0V4cGxvcmVDb250cm9sbGVyIGFzIEV4cGxvcmUnLFxuICAgICAgICAgICAgdGVtcGxhdGVVcmw6ICd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1xuICAgICAgICAgICAgdGhpcy5pc09QTUxJbXBvcnRpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMub3BtbEltcG9ydEVycm9yID0gdHJ1ZTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB0aGlzLmltcG9ydEFydGljbGVzID0gZnVuY3Rpb24gKGNvbnRlbnQpIHtcbiAgICAgICAgdGhpcy5vcG1sSW1wb3J0RXJyb3IgPSBmYWxzZTtcbiAgICAgICAgdGhpcy5hcnRpY2xlSW1wb3J0RXJyb3IgPSBmYWxzZTtcblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgdGhpcy5pc0FydGljbGVzSW1wb3J0aW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHZhciBhcnRpY2xlcyA9IEpTT04ucGFyc2UoY29udGVudCk7XG5cbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgICAgIEl0ZW1SZXNvdXJjZS5pbXBvcnRBcnRpY2xlcyhhcnRpY2xlcykuc3VjY2VzcyhmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgIFB1Ymxpc2hlci5wdWJsaXNoQWxsKGRhdGEpO1xuICAgICAgICAgICAgfSkuZmluYWxseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5pc0FydGljbGVzSW1wb3J0aW5nID0gZmFsc2U7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvcik7XG4gICAgICAgICAgICB0aGlzLmFydGljbGVJbXBvcnRFcnJvciA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmlzQXJ0aWNsZXNJbXBvcnRpbmcgPSBmYWxzZTtcbiAgICAgICAgfVxuICAgIH07XG5cbn1dKTsiLCIvKipcbiAqIG93bkNsb3VkIC0gTmV3c1xuICpcbiAqIFRoaXMgZmlsZSBpcyBsaWNlbnNlZCB1b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NvdXJjZS5wcm90b3R5cGUucmVjZWl2ZS5jYWxsKHRoaXMsIGRhdGEpO1xuICAgICAgICB0aGlzLnVwZGF0ZVVucmVhZENhY2hlKCk7XG4gICAgICAgIHRoaXMudXBkYXRlRm9sZGVyQ2FjaGUoKTtcbiAgICB9O1xuXG4gICAgRmVlZFJlc291cmNlLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgUmVzb3VyY2UucHJvdG90eXBlLmNsZWFyLmNhbGwodGhpcyk7XG4gICAgICAgIHRoaXMudW5yZWFkQ291bnQgPSAwO1xuICAgICAgICB0aGlzLmZvbGRlclVucmVhZENvdW50ID0ge307XG4gICAgICAgIHRoaXMuZm9sZGVySWRzID0ge307XG4gICAgICAgIHRoaXMuaWRzID0ge307XG4gICAgICAgIHRoaXMubG9jYXRpb25zID0ge307XG4gICAgfTtcblxuICAgIEZlZWRSZXNvdXJjZS5wcm90b3R5cGUudXBkYXRlVW5yZWFkQ2FjaGUgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHRoaXMudW5yZWFkQ291bnQgPSAwO1xuICAgICAgICB0aGlzLmZvbGRlclVucmVhZENvdW50ID0ge307XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLnZhbHVlcy5mb3JFYWNoKGZ1bmN0aW9uIChmZWVkKSB7XG4gICAgICAgICAgICBpZiAoZmVlZC51bnJlYWRDb3VudCkge1xuICAgICAgICAgICAgICAgIHNlbGYudW5yZWFkQ291bnQgKz0gZmVlZC51bnJlYWRDb3VudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChmZWVkLmZvbGRlcklkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmZvbGRlclVucmVhZENvdW50W2ZlZWQuZm9sZGVySWRdID1cbiAgICAgICAgICAgICAgICAgICAgc2VsZi5mb2xkZXJVbnJlYWRDb3VudFtmZWVkLmZvbGRl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XG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5hZGQoZmVlZCk7XG4gICAgICAgIHRoaXMudXBkYXRlRm9sZGVyQ2FjaGUoKTtcblxuICAgICAgICB2YXIgZGVmZXJyZWQgPSB0aGlzLiRxLmRlZmVyKCk7XG5cbiAgICAgICAgdGhpcy5odHRwKHtcbiAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgdXJsOiB0aGlzLkJBU0VfVVJMICsgJy9mZWVkcycsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXG4gICAgICAgICAgICAgICAgcGFyZW50Rm9sZGVySWQ6IGZvbGRlcklkIHx8IDAsXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pLnN1Y2Nlc3MoZnVuY3Rpb24gKGRhdGEpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoZGF0YSk7XG4gICAgICAgIH0pLmVycm9yKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICBmZWVkLmZhdmljb25MaW5rID0gJyc7XG4gICAgICAgICAgICBmZWVkLmVycm9yID0gZGF0YS5tZXNzYWdlO1xuICAgICAgICAgICAgZGVmZXJyZWQucmVqZWN0KCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuICAgIH07XG5cblxuICAgIEZlZWRSZXNvdXJjZS5wcm90b3R5cGUucmV2ZXJzaWJseURlbGV0ZSA9IGZ1bmN0aW9uIChpZCwgdXBkYXRlQ2FjaGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRm9sZGVyKSB7XG4gICAgICAgIHZhciBmZWVkID0gdGhpcy5nZXRCeUlkKGlkKTtcblxuICAgICAgICAvLyBpZiBhIGZvbGRlciBpcyBkZWxldGVkI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JyArIGZvbGRlci5pZCArICcvcmVuYW1lJyxcbiAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgZGF0YToge1xuICAgICAgICAgICAgICAgIGZvbGRlck5hbWU6IHRvRm9sZGVyTmFtZVxuICAgICAgICAgICAgfVxuICAgICAgICB9KS5zdWNjZXNzKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGZvbGRlci5uYW1lID0gdG9Gb2xkZXJOYW1lO1xuICAgICAgICAgICAgZGVsZXRlIHNlbGYuaGFzaE1hcFtmb2xkZXJOYW1lXTtcbiAgICAgICAgICAgIHNlbGYuaGFzaE1hcFt0b0ZvbGRlck5hbWVdID0gZm9sZGVyO1xuXG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKCk7XG4gICAgICAgIH0pLmVycm9yKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QoZGF0YS5tZXNzYWdlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgfTtcblxuICAgIEZvbGRlclJlc291cmNlLnByb3RvdHlwZS5nZXRCeUlkID0gZnVuY3Rpb24gKGlkKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmlkc1tpZF07XG4gICAgfTtcblxuICAgIEZvbGRlclJlc291cmNlLnByb3RvdHlwZS5jcmVhdGUgPSBmdW5jdGlvbiAoZm9sZGVyTmFtZSkge1xuICAgICAgICBmb2xkZXJOYW1lID0gZm9sZGVyTmFtZS50cmltKCk7XG4gICAgICAgIHZhciBmb2xkZXIgPSB7XG4gICAgICAgICAgICBuYW1lOiBmb2xkZXJOYW1lXG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5hZGQoZm9sZGVyKTtcblxuICAgICAgICB2YXIgZGVmZXJyZWQgPSB0aGlzLiRxLmRlZmVyKCk7XG5cbiAgICAgICAgdGhpcy5odHRwKHtcbiAgICAg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LmNsZWFyID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB0aGlzLnN0YXJyZWRDb3VudCA9IDA7XG4gICAgICAgIHRoaXMubG93ZXN0SWQgPSAwO1xuICAgICAgICB0aGlzLmhpZ2hlc3RJZCA9IDA7XG4gICAgICAgIFJlc291cmNlLnByb3RvdHlwZS5jbGVhci5jYWxsKHRoaXMpO1xuICAgIH07XG5cbiAgICBJdGVtUmVzb3VyY2UucHJvdG90eXBlLnJlY2VpdmUgPSBmdW5jdGlvbiAodmFsdWUsIGNoYW5uZWwpIHtcbiAgICAgICAgc3dpdGNoIChjaGFubmVsKSB7XG5cbiAgICAgICAgY2FzZSAnbmV3ZXN0SXRlbUlkJzpcbiAgICAgICAgICAgIHRoaXMubmV3ZXN0SXRlbUlkID0gdmFsdWU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdzdGFycmVkJzpcbiAgICAgICAgICAgIHRoaXMuc3RhcnJlZENvdW50ID0gdmFsdWU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICAgICAgdmFsdWUuZm9yRWFjaChmdW5jdGlvbiAoaXRlbSkge1xuICAgICAgICAgICAgICAgIC8vIGluaXRpYWxpemUgbG93ZXN0IGFuZCBoaWdoZXN0IGlkXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYubG93ZXN0SWQgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5sb3dlc3RJZCA9IGl0ZW0uaWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmhpZ2hlc3RJZCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmhpZ2hlc3RJZCA9IGl0ZW0uaWQ7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW0uaWQgPiBzZWxmLmhpZ2h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gICAgICAgIHVybDogdGhpcy5CQVNFX1VSTCArICcvaXRlbXMnLFxuICAgICAgICAgICAgbWV0aG9kOiAnR0VUJyxcbiAgICAgICAgICAgIHBhcmFtczoge1xuICAgICAgICAgICAgICAgIHR5cGU6IHR5cGUsXG4gICAgICAgICAgICAgICAgaWQ6IGlkLFxuICAgICAgICAgICAgICAgIG9mZnNldDogb2Zmc2V0LFxuICAgICAgICAgICAgICAgIGxpbWl0OiB0aGlzLmJhdGNoU2l6ZSxcbiAgICAgICAgICAgICAgICBvbGRlc3RGaXJzdDogb2xkZXN0Rmlyc3QsXG4gICAgICAgICAgICAgICAgc2hvd0FsbDogc2hvd0FsbCxcbiAgICAgICAgICAgICAgICBzZWFyY2g6IHNlYXJjaFxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9O1xuXG5cbiAgICBJdGVtUmVzb3VyY2UucHJvdG90eXBlLmltcG9ydEFydGljbGVzID0gZnVuY3Rpb24gKGpzb24pIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuaHR0cCh7XG4gICAgICAgICAgICB1cmw6IHRoaXMuQkFTRV9VUkwgKyAnL2ZlZWRzL2ltcG9ydC9hcnRpY2xlcycsXG4gICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgICAgICBqc29uOiBqc29uXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH07XG5cblxuICAgIHJldHVybiBuZXcgSXRlbVJlc291cmNlKCRodHRwLCBCQVNFX1VSTCwgSVRFTV9CQVRDSF9TSVpFKTtcbn1dKTsiLCIvKipcbiAqIG93bkNsb3VkIC0gTmV3c1xuICpcbiAqIFRoaXMgZmlsZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgQWZmZXJvIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgdmVyc2lvbiAzIG9yXG4gKiBsYXRlci4gU2VlIHRoZSBDT1BZSU5HIGZpbGUuXG4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9uIChGZWVkUmVzb3VyY2UsIEZvbGRlclJlc291cmNlLCBQdWJsaXNoZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRxKSB7XG4gICAgJ3VzZSBzdHJpY3QnO1xuICAgIHZhciBzdGFydEZlZWRKb2IgPSBmdW5jdGlvbiAocXVldWUpIHtcbiAgICAgICAgdmFyIGRlZmVycmVkID0gJHEuZGVmZXIoKTtcblxuICAgICAgICBpZiAocXVldWUubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgdmFyIGZlZWQgPSBxdWV1ZS5wb3AoKTtcbiAgICAgICAgICAgIHZhciB1cmwgPSBmZWVkLnVybDtcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGZlZWQudGl0bGU7XG4gICAgICAgICAgICB2YXIgZm9sZGVySWQgPSAwO1xuICAgICAgICAgICAgdmFyIGZvbGRlck5hbWUgPSBmZWVkLmZvbGRlck5hbWU7XG5cbiAgICAgICAgICAgIGlmIChmb2xkZXJOYW1lICE9PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICBGb2xkZXJSZXNvdXJjZS5nZXQoZm9sZGVyTmFtZSkgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHZhciBmb2xkZXIgPSBGb2xkZXJSZXNvdXJjZS5nZXQoZm9sZGVyTmFtZSk7XG4gICAgICAgICAgICAgICAgZm9sZGVyLm9wZW5lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgZm9sZGVySWQgPSBmb2xkZXIuaWQ7XG5cbiAgICAgICAgICAgICAgICAvLyBkaXNwbGF5IGZvbGRlciB3aGlsZSBhZGRpbmcgdGhlIGZlZWRcbiAgICAgICAgICAgICAgICBmb2xkZXIuZ2V0c0ZlZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGZvbGRlci5nZXRzRmVlZENvdW50ZXIgPSBmb2xkZXIuZ2V0c0ZlZWRDb3VudGVyIHx8IDA7XG4gICAgICAgICAgICAgICAgZm9sZGVyLmdldHNGZWVkQ291bnRlciArPSAxO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBtYWtlIHN1cmUgdG8gbm90IGFkZCBhbHJlYWR5IGV4aXN0aW5nIGZlZWRzXG4gICAgICAgICAgICBpZiAodXJsICE9PSB1bmRlZmluZWQgJiYgRmVlZFJlc291cmNlLmdldCh1cmwpID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBGZWVkUmVzb3VyY2UuY3JlYXRlKHVybCwgZm9sZGVySWQsIHRpdGxlKVxuICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIFB1Ymxpc2hlci5wdWJsaXNoQWxsKGRhdGEpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLmZpbmFsbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZm9sZGVySWQgIT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvbGRlci5nZXRzRmVlZENvdW50ZXIgLT0gMTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvbGRlci5nZXRzRmVlZENvdW50ZXIgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXIuZ2V0c0ZlZWQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBzdGFydEZlZWRKb2IocXVldWUpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZSgpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgfTtcblxuICAgIHRoaXMuaW1wb3J0Rm9sZGVycyA9IGZ1bmN0aW9uIChjb250ZW50KSB7XG4gICAgICAgIC8vIGFzc3VtcHRpb246IGZvbGRlcnMgYXJlIGZhc3QgdG8gY3JlYXRlIGFuZCB3ZSBkb250IG5lZWQgYSBxdWV1ZSBmb3JcbiAgICAgICAgLy8gdGhlbVxuICAgICAgICB2YXIgZmVlZFF1ZXVlID0gW107XG4gICAgICAgIHZhciBmb2xkZXJQcm9taXNlcyA9IFtdO1xuICAgICAgICBjb250ZW50LmZvbGRlcnMuZm9yRWFjaChmdW5jdGlvbiAoZm9sZGVyKSB7XG4gICAgICAgICAgICBpZiAoZm9sZGVyLm5hbWUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIC8vIHNraXAgYWxyZWFkeSBjcmVhdGVkIGZvbGRlcnNcbiAgICAgICAgICAgICAgICBpZiAoRm9sZGVyUmVzb3VyY2UuZ2V0KGZvbGRlci5uYW1lKSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBwcm9taXNlID0gRm9sZGVyUmVzb3VyY2UuY3JlYXRlKGZvbGRlci5uYW1lKVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgUHVibGlzaGVyLnB1Ymxpc2hBbGwoZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBmb2xkZXJQcm9taXNlcy5wdXNoKHByb21pc2UpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGZvbGRlci5mZWVkcy5mb3JFYWNoKGZ1bmN0aW9uIChmZWVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGZlZWQuZm9sZGVyTmFtZSA9IGZvbGRlci5uYW1lO1xuICAgICAgICAgICAgICAgICAgICBmZWVkUXVldWUucHVzaChmZWVkKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICAg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hvciBCZXJuaGFyZCBQb3NzZWx0IDxkZXZAYmVybmhhcmQtcG9zc2VsdC5jb20+XG4gKiBAY29weXJpZ2h0IEJlcm5oYXJkIFBvc3NlbHQgMjAxNFxuICovXG5hcHAuc2VydmljZSgnT1BNTFBhcnNlcicsIGZ1bmN0aW9uICgpIHtcbiAgICAndXNlIHN0cmljdCc7XG5cbiAgICB2YXIgcGFyc2VPdXRsaW5lID0gZnVuY3Rpb24gKG91dGxpbmUpIHtcbiAgICAgICAgdmFyIHVybCA9IG91dGxpbmUuYXR0cigneG1sVXJsJykgfHwgb3V0bGluZS5hdHRyKCdodG1sVXJsJyk7XG4gICAgICAgIHZhciBuYW1lID0gb3V0bGluZS5hdHRyKCd0aXRsZScpIHx8IG91dGxpbmUuYXR0cigndGV4dCcpIHx8IHVybDtcblxuICAgICAgICAvLyBmb2xkZXJcbiAgICAgICAgaWYgKHVybCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdmb2xkZXInLFxuICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgICAgZmVlZHM6IFtdXG4gICAgICAgICAgICB9O1xuXG4gICAgICAgIC8vIGZlZWRcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgdHlwZTogJ2ZlZWQnLFxuICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgICAgdXJsOiB1cmxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgLy8gdGhlcmUgaXMgb25seSBvbmUgbGV2ZWwsIHNvIGZlZWRzIGluIGEgZm9sZGVyIGluIGEgZm9sZGVyIHNob3VsZCBiZVxuICAgIC8vIGF0dGFjaGVkIHRvIHRoZSByb290IGZvbGRlclxuICAgIHZhciByZWN1cnNpdmVseVBhcnNlID0gZnVuY3Rpb24gKGxldmVsLCByb290LCBmaXJzdExldmVsKSB7XG4gICAgICAgIGZvciAodmFyIGk9MDsgaTxsZXZlbC5sZW5ndGg7IGkrPTEpIHtcbiAgICAgICAgICAgIHZhciBvdXRsaW5lID0gJChsZXZlbFtpXSk7XG5cbiAgICAgICAgICAgIHZhciBlbnRyeSA9IHBhcnNlT3V0bGluZShvdXRsaW5lKTtcblxuICAgICAgICAgICAgaWYgKGVudHJ5LnR5cGUgPT09ICdmZWVkJykge1xuICAgICAgICAgICAgICAgIHJvb3QuZmVlZHMucHVzaChlbnRyeSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgLy8gb25seSBmaXJzdCBsZXZlbCBzaG91bGQgYXBwZW5kIGZvbGRlcnNcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RMZXZlbCkge1xuICAgICAgICAgICAgICAgICAgICByZWN1cnNpdmVseVBhcnNlKG91dGxpbmUuY2hpbGRyZW4oJ291dGxpbmUnKSwgZW50cnksIGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgcm9vdC5mb2xkZXJzLnB1c2goZW50cnkpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlY3Vyc2l2ZWx5UGFyc2Uob3V0bGluZS5jaGlsZHJlbignb3V0bGluZScpLCByb290LCBmYWxzZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHJvb3Q7XG4gICAgfTtcblxuICAgIHRoaXMucGFyc2UgPSBmdW5jdGlvbiAoeG1sKSB7XG4gICAgICAgIHhtbCA9ICQucGFyc2VYTUwoeG1sKTtcbiAgICAgICAgdmFyIGZpcnN0TGV2ZWwgPSAkKHhtbCkuZmluZCgnYm9keSA+IG91dGxpbmUnKTtcblxuICAgICAgICB2YXIgcm9vdCA9IHtcbiAgICAgICAgICAgICdmZWVkcyc6IFtdLFxuICA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AgIHRoaXMudmFsdWVzID0gW107XG4gICAgICAgIHRoaXMuaGFzaE1hcCA9IHt9O1xuICAgICAgICB0aGlzLmh0dHAgPSBodHRwO1xuICAgICAgICB0aGlzLkJBU0VfVVJMID0gQkFTRV9VUkw7XG4gICAgfTtcblxuXG4gICAgUmVzb3VyY2UucHJvdG90eXBlLnJlY2VpdmUgPSBmdW5jdGlvbiAob2Jqcykge1xuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIG9ianMuZm9yRWFjaChmdW5jdGlvbiAob2JqKSB7XG4gICAgICAgICAgICBzZWxmLmFkZChvYmopO1xuICAgICAgICB9KTtcbiAgICB9O1xuXG5cbiAgICBSZXNvdXJjZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKG9iaikge1xuICAgICAgICB2YXIgZXhpc3RpbmcgPSB0aGlzLmhhc2hNYXBbb2JqW3RoaXMuaWRdXTtcblxuICAgICAgICBpZiAoZXhpc3RpbmcgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgdGhpcy52YWx1ZXMucHVzaChvYmopO1xuICAgICAgICAgICAgdGhpcy5oYXNoTWFwW29ialt0aGlzLmlkXV0gPSBvYmo7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBjb3B5IHZhbHVlcyBmcm9tIG5ldyB0byBvbGQgb2JqZWN0IGlmIGl0IGV4aXN0cyBhbHJlYWR5XG4gICAgICAgICAgICBPYmplY3Qua2V5cyhvYmopLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIGV4aXN0aW5nW2tleV0gPSBvYmpba2V5XTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfTtcblxuXG4gICAgUmVzb3VyY2UucHJvdG90eXBlLnNpemUgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnZhbHVlcy5sZW5ndGg7XG4gICAgfTtcblxuXG4gICAgUmVzb3VyY2U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JlZnJlc2gnKTtcbiAgICAgICAgICAgIGlmICghcHVsbFRvUmVmcmVzaC5oYXNDbGFzcygnc2hvdy1wdWxsLXRvLXJlZnJlc2gnKSkge1xuICAgICAgICAgICAgICAgIHB1bGxUb1JlZnJlc2guYWRkQ2xhc3MoJ3Nob3ctcHVsbC10by1yZWZyZXNoJyk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHB1bGxUb1JlZnJlc2guaGFzQ2xhc3MoJ2RvbmUnKSkge1xuICAgICAgICAgICAgICAgIHJlbG9hZEZlZWQobmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIHZhciBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeSA9IGZ1bmN0aW9uIChlbGVtZW50LCBuYXZpZ2F0aW9uQXJlYSkge1xuICAgICAgICBlbGVtZW50LmNoaWxkcmVuKCdhOnZpc2libGUnKS50cmlnZ2VyKCdjbGljaycpO1xuICAgICAgICBzY3JvbGxUb05hdmlnYXRpb25FbGVtZW50KGVsZW1lbnQsIG5hdmlnYXRpb25BcmVhLmNoaWxkcmVuKCd1bCcpKTtcbiAgICB9O1xuXG4gICAgdmFyIG5leHRGZWVkID0gZnVuY3Rpb24gKG5hdmlnYXRpb25BcmVhKSB7XG4gICAgICAgIHZhciBjdXJyZW50ID0gbmF2aWdhdGlvbkFyZWEuZmluZCgnLmFjdGl2ZScpO1xuICAgICAgICB2YXIgZWxlbWVudHMgPSBuYXZpZ2F0aW9uQXJlYS5maW5kKCcuZXhwbG9yZS1mZWVkLCcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuc3Vic2NyaXB0aW9ucy1mZWVkOnZpc2libGUsJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5zdGFycmVkLWZlZWQ6dmlzaWJsZSwnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLmZlZWQ6dmlzaWJsZScpO1xuXG4gICAgICAgIGlmIChjdXJyZW50Lmhhc0NsYXNzKCdmb2xkZXInKSkge1xuICAgICAgICAgICAgd2hpbGUgKGN1cnJlbnQubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHZhciBzdWJmZWVkcyA9IGN1cnJlbnQuZmluZCgnLmZlZWQ6dmlzaWJsZScpO1xuICAgICAgICAgICAgICAgIGlmIChzdWJmZWVkcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGl2YXRlTmF2aWdhdGlvbkVudHJ5KCQoc3ViZmVlZHNbMF0pLCBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY3VycmVudCA9IGN1cnJlbnQubmV4dCgnLmZvbGRlcicpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBubyBzdWJmZWVkIGZvdW5kXG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBGSVhNRTogTyhuKSBydW50aW1lLiBJZiBzb21lb25lIGNyZWF0ZXMgYSBuaWNlIGFuZCBub3QgZnVnbHkgc29sdXRpb25cbiAgICAgICAgLy8gcGxlYXNlIGNyZWF0ZSBhIFBSXG4gICAgICAgIGZvciAodmFyIGk9MDsgaTxlbGVtZW50cy5sZW5ndGgtMTsgaSs9MSkge1xuICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBlbGVtZW50c1tpXTtcblxuICAgICAgICAgICAgaWYgKGVsZW1lbnQgPT09IGN1cnJlbnRbMF0pIHtcbiAgICAgICAgICAgICAgICB2YXIgbmV4dCA9IGVsZW1lbnRzW2krMV07XG4gICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoJChuZXh0KSwgbmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgICAgI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kVudHJ5KGN1cnJlbnQubmV4dEFsbCgnLmZvbGRlcjp2aXNpYmxlJykuZmlyc3QoKSxcbiAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgIH0gZWxzZSBpZiAoY3VycmVudC5oYXNDbGFzcygnZmVlZCcpKSB7XG4gICAgICAgICAgICB2YXIgcGFyZW50Rm9sZGVyID0gZ2V0UGFyZW50Rm9sZGVyKGN1cnJlbnQpO1xuICAgICAgICAgICAgaWYgKHBhcmVudEZvbGRlci5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoXG4gICAgICAgICAgICAgICAgICAgIHBhcmVudEZvbGRlci5uZXh0QWxsKCcuZm9sZGVyOnZpc2libGUnKS5maXJzdCgpLFxuICAgICAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uQXJlYVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHNlbGVjdEZpcnN0T3JMYXN0Rm9sZGVyKG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHNlbGVjdEZpcnN0T3JMYXN0Rm9sZGVyKG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB2YXIgcHJldmlvdXNGZWVkID0gZnVuY3Rpb24gKG5hdmlnYXRpb25BcmVhKSB7XG4gICAgICAgIHZhciBjdXJyZW50ID0gbmF2aWdhdGlvbkFyZWEuZmluZCgnLmFjdGl2ZScpO1xuICAgICAgICB2YXIgZWxlbWVudHMgPSBuYXZpZ2F0aW9uQXJlYS5maW5kKCcuZXhwbG9yZS1mZWVkLCcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuc3Vic2NyaXB0aW9ucy1mZWVkOnZpc2libGUsJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5zdGFycmVkLWZlZWQ6dmlzaWJsZSwnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLmZlZWQ6dmlzaWJsZScpO1xuXG4gICAgICAgIC8vIHNwZWNpYWwgY2FzZTogZm9sZGVyIHNlbGVjdGVkXG4gICAgICAgIGlmIChjdXJyZW50Lmhhc0NsYXNzKCdmb2xkZXInKSkge1xuICAgICAgICAgICAgdmFyIHByZXZpb3VzRm9sZGVyID0gY3VycmVudC5wcmV2KCcuZm9sZGVyJyk7XG5cbiAgICAgICAgICAgIHdoaWxlIChwcmV2aW91c0ZvbGRlci5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN1YmZlZWRzID0gcHJldmlvdXNGb2xkZXIuZmluZCgnLmZlZWQ6dmlzaWJsZScpO1xuICAgICAgICAgICAgICAgIGlmIChzdWJmZWVkcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGFjdGl2YXRlTmF2aWdhdGlvbkVudHJ5KCQoc3ViZmVlZHNbc3ViZmVlZHMubGVuZ3RoLTFdKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwcmV2aW91c0ZvbGRlciA9IHByZXZpb3VzRm9sZGVyLnByZXYoJy5mb2xkZXInKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gbm8gc3ViZmVlZCBmb3VuZCB0cnkgdmlzaWJsZSBmZWVkc1xuICAgICAgICAgICAgdmFyIGZlZWRzID0gY3VycmVudC5zaWJsaW5ncygnLmZlZWQnKTtcblxuICAgICAgICAgICAgaWYgKGZlZWRzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeSgkKGZlZWRzW2ZlZWRzLmxlbmd0aC0xXSksXG4gICAgICAgICAgICAgICAgICAgIG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgLy8gbm8gZmVlZCBmb3VuZCwgZ28gdG8gc3RhcnJlZFxuICAgICAgICAgICAgdmFyIHN0YXJyZWQgPSAkKCcuc3RhcnJlZC1mZWVkOnZpc2libGUnKTtcbiAgICAgICAgICAgIGlmIChzdGFycmVkLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeShzdGFycmVkLCBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEZJWE1FOiBPKG4pIHJ1bnRpbWUuIElmIHNvbWVvbmUgY3JlYXRlcyBhIG5pY2UgYW5kIG5vdCBmdWdseSBzb2x1dGlvblxuICAgICAgICAvLyBwbGVhc2UgY3JlYXRlIGEgUFJcbiAgICAgICAgZm9yICh2YXIgaT1lbGVtZW50cy5sZW5ndGgtMTsgaT4wOyBpLT0xKSB7XG4gICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldO1xuXG4gICAgICAgICAgICBpZiAoZWxlbWVudCA9PT0gY3VycmVudFswXSkge1xuICAgICAgICAgICAgICAgIHZhciBwcmV2aW91cyA9IGVsZW1lbnRzW2ktMV07XG4gICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoJChwcmV2aW91cyksIG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB2YXIgb25BY3RpdmVJdGVtID0gZnVuY3Rpb24gKHNjcm9sbEFyZWEsIGNhbGxiY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lnaHQgYXJyb3dcbiAgICAgICAgICAgIGlmIChbNzQsIDc4LCAzOV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHNjcm9sbFRvTmV4dEl0ZW0oc2Nyb2xsQXJlYSwgZXhwYW5kSXRlbUluQ29tcGFjdCk7XG5cbiAgICAgICAgICAgIC8vIGssIHAsIGxlZnQgYXJyb3dcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzc1LCA4MCwgMzddLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBzY3JvbGxUb1ByZXZpb3VzSXRlbShuYXZpZ2F0aW9uQXJlYSwgc2Nyb2xsQXJlYSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBhbmRJdGVtSW5Db21wYWN0KTtcblxuICAgICAgICAgICAgLy8gdVxuICAgICAgICAgICAgfSBlbHNlIGlmIChbODVdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICB0b2dnbGVVbnJlYWQoc2Nyb2xsQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGVcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzY5XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgZXhwYW5kSXRlbShzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgLy8gcywgaSwgbFxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNzMsIDgzLCA3Nl0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHRvZ2dsZVN0YXIoc2Nyb2xsQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGhcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzcyXS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgdG9nZ2xlU3RhcihzY3JvbGxBcmVhKTtcbiAgICAgICAgICAgICAgICBzY3JvbGxUb05leHRJdGVtKHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICAvLyBvXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs3OV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIG9wZW5MaW5rKHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICAvLyByXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs4Ml0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHJlbG9hZEZlZWQobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyBmXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs3MF0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIG5leHRGZWVkKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gZFxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNjhdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBwcmV2aW91c0ZlZWQobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyBjXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs2N10uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHByZXZpb3VzRm9sZGVyKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gYVxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNjVdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBzY3JvbGxUb0FjdGl2ZU5hdmlnYXRpb25FbnRyeShuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIHZcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzg2XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgbmV4dEZvbGRlcihuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIHFcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzgxXS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgJCgnI3NlYXJjaGJveCcpLmZvY3VzKCk7XG5cbiAgICAgICAgICAgIC8vIHBhZ2UgdXBcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzMzXS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIHRyeVJlbG9hZChuYXZpZ2F0aW9uQXJlYSwgc2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mRleCwgYXJ0aWNsZSkge1xuICAgICAgICAgICAgICAgIHZhciBpdGVtID0gJChhcnRpY2xlKTtcblxuICAgICAgICAgICAgICAgIGlmIChpdGVtLnBvc2l0aW9uKCkudG9wIDw9IC0xMCkge1xuICAgICAgICAgICAgICAgICAgICBpZHMucHVzaChwYXJzZUludChpdGVtLmRhdGEoJ2lkJyksIDEwKSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBzY29wZS5pdGVtSWRzID0gaWRzO1xuICAgICAgICAgICAgc2NvcGUuJGFwcGx5KHNjb3BlLm5ld3NTY3JvbGxNYXJrUmVhZCk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgcmV0dXJuIHtcbiAgICAgICAgcmVzdHJpY3Q6ICdBJyxcbiAgICAgICAgc2NvcGU6IHtcbiAgICAgICAgICAgICduZXdzU2Nyb2xsJzogJ0AnLFxuICAgICAgICAgICAgJ25ld3NTY3JvbGxBdXRvUGFnZSc6ICcmJyxcbiAgICAgICAgICAgICduZXdzU2Nyb2xsTWFya1JlYWQnOiAnJicsXG4gICAgICAgICAgICAnbmV3c1Njcm9sbEVuYWJsZWRNYXJrUmVhZCc6ICc9JyxcbiAgICAgICAgfSxcbiAgICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtKSB7XG4gICAgICAgICAgICB2YXIgYWxsb3dTY3JvbGwgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIHNjcm9sbEFyZWEgPSBlbGVtO1xuXG4gICAgICAgICAgICBpZiAoc2NvcGUubmV3c1Njcm9sbCkge1xuICAgICAgICAgICAgICAgIHNjcm9sbEFyZWEgPSAkKHNjb3BlLm5ld3NTY3JvbGwpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgc2Nyb2xsSGFuZGxlciA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAvLyBhbGxvdyBvbmx5IG9uZSBzY3JvbGwgZXZlbnQgdG8gdHJpZ2dlciBldmVyeSAzMDBtc1xuICAgICAgICAgICAgICAgIGlmIChhbGxvd1Njcm9sbCkge1xuICAgICAgICAgICAgICAgICAgICBhbGxvd1Njcm9sbCA9IGZhbHNlO1xuXG4gICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93U2Nyb2xsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSwgU0NST0xMX1RJTUVPVVQqMTAwMCk7XG5cbiAgICAgICAgICAgICAgICAgICAgYXV0b1BhZ2UoSVRFTV9BVVRPX1BBR0VfU0laRSwgZWxlbSwgc2NvcGUpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIGRvbnQgc3RhY2sgbWFyayByZWFkIHJlcXVlc3RzXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aW1lcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQuY2FuY2VsKHRpbWVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIC8vIGFsbG93IHVzZXIgdG8gdW5kbyBhY2NpZGVudGFsIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICB0aW1lciA9ICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmtSZWFkKHNjb3BlLm5ld3NTY3JvbGxFbmFibGVkTWFya1JlYWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGltZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIH0sIE1BUktfUkVBRF9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gICAgICAgIHZhciBib3ggPSAkKCcjc2VhcmNoYm94Jyk7XG4gICAgICAgICAgICBib3gudmFsKCRsb2NhdGlvbi5zZWFyY2goKS5zZWFyY2gpO1xuXG4gICAgICAgICAgICB2YXIgZG9TZWFyY2ggPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gYm94LnZhbCgpO1xuICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLm9uU2VhcmNoKHZhbHVlKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIGJveC5vbignc2VhcmNoIGtleXVwJywgZnVuY3Rpb24gKGV2ZW50KSB7XG4gICAgICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICdzZWFyY2gnIHx8IGV2ZW50LmtleUNvZGUgPT09IDEzKSB7XG4gICAgICAgICAgICAgICAgICAgIGRvU2VhcmNoKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIC8vIGNhcnJ5IG92ZXIgc2VhcmNoIG9uIHJvdXRlIGNoYW5nZVxuICAgICAgICAgICAgc2NvcGUuJHdhdGNoKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJGxvY2F0aW9uLnNlYXJjaCgpO1xuICAgICAgICAgICAgfSwgZnVuY3Rpb24gKHNlYXJjaCkge1xuICAgICAgICAgICAgICAgIGlmIChzZWFyY2ggJiYgc2VhcmNoLnNlYXJjaCkge1xuICAgICAgICAgICAgICAgICAgICBib3gudmFsKHNlYXJjaC5zZWFyY2gpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGJveC52YWwoJycpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgf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XG4gICAgfTtcblxufSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 diff --git a/js/build/app.min.js.map b/js/build/app.min.js.map deleted file mode 100644 index a223cfe02..000000000 --- a/js/build/app.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["app.js"],"names":["navigator","window","document","angular","$","OC","csrfToken","url","undefined","app","module","config","$routeProvider","$provide","$httpProvider","feedType","FEED","FOLDER","STARRED","SUBSCRIPTIONS","SHARED","EXPLORE","constant","generateUrl","factory","$q","BASE_URL","$window","request","domain","location","href","split","pathname","indexOf","headers","requesttoken","when","errorMessages",0,"t",401,403,412,500,503,"$timeout","timer","responseError","response","status","cancel","Notification","hide","showHtml","reject","interceptors","push","getItemResolve","type","data","$http","$route","$location","ITEM_BATCH_SIZE","FEED_TYPE","SettingsResource","FeedResource","showAll","get","oldestFirst","search","deferred","defer","resolve","parameters","limit","current","params","id","feed","getById","ordering","method","success","promise","getExploreResolve","sites","Publisher","language","lang","then","publishAll","replace","exploreUrl","defaultExploreUrl","controller","templateUrl","run","$rootScope","$interval","Loading","ItemResource","FolderResource","REFRESH_RATE","setLoading","subscribe","toChannels","settingsDeferred","activeFeedDeferred","path","activeFeed","test","feeds","feedDeferred","folders","folderDeferred","all","length","reload","$on","this","loading","isFirstRun","size","play","item","playingItem","$routeParams","ITEM_AUTO_PAGE_SIZE","clear","isAutoPagingEnabled","isNothingMoreToAutoPage","getItems","getAll","toggleStar","itemId","toggleItem","isCompactView","show","isShowAll","markRead","keepUnread","unread","markItemRead","markItemOfFeedRead","feedId","getFeed","toggleKeepUnread","markItemOfFeedUnread","self","getOrdering","isFeed","orderBy","isCompactExpand","autoPagingEnabled","markReadEnabled","scrollRead","itemIds","ids","feedIds","forEach","markItemsOfFeedsRead","markItemsRead","$$route","autoPage","autoPageAgain","items","error","getRelativeDate","timestamp","languageCode","date","moment","unix","locale","fromNow","refresh","getMediaType","Object","keys","map","key","reduce","xs","x","category","feedList","concat","feedExists","getByLocation","subscribeTo","$broadcast","isCategoryShown","filter","element","getSupportedLanguageCodes","getCurrentLanguageCode","showLanguage","selectedLanguageCode","feedError","showNewFolder","renamingFolder","addingFeed","addingFolder","folderError","renameError","getRouteId","parseInt","getLanguageCode","getFeeds","getFolders","markFolderRead","folderId","getByFolderId","markFeedRead","getFeedsOfFolder","getUnreadCount","isUnread","getFeedUnreadCount","unreadCount","isFeedUnread","getFolderUnreadCount","isFolderUnread","getStarredCount","isStarredUnread","toggleFolder","folderName","toggleOpen","hasFeeds","subFeedActive","isSubscriptionsActive","isStarredActive","isExploreActive","isFolderActive","isFeedActive","folderNameExists","trim","feedUrlExists","createFeed","newFolder","existingFolder","getsFeed","create","name","createFolder","folder","moveFeed","move","renameFeed","patch","title","editing","renameFolder","rename","message","reversiblyDeleteFeed","reversiblyDelete","undoDeleteFeed","undoDelete","deleteFeed","reversiblyDeleteFolder","undoDeleteFolder","deleteFolder","setOrdering","togglePinned","pinned","setUpdateMode","updateMode","toggleFullText","value","scope","setSelectedFolderForRoute","OPMLParser","OPMLImporter","isOPMLImporting","isArticlesImporting","opmlImportError","articleImportError","set","toggleSetting","getSetting","importOPML","content","parsedContent","parse","jobSize","importFolders","feedQueue","importFeedQueue","console","importArticles","articles","JSON","$sce","trustAsResourceUrl","Resource","call","locations","folderUnreadCount","folderIds","prototype","receive","updateUnreadCache","updateFolderCache","values","add","hashMap","startsWith","http","parentFolderId","faviconLink","updateCache","isFolder","deleted","promises","post","setPinned","isPinned","diff","fullTextEnabled","opened","open","toFolderName","batchSize","starredCount","lowestId","highestId","channel","newestItemId","getNewestItemId","star","isStarred","it","guidHash","starred","isRead","read","highestItemId","offset","json","service","global","autopaging","area","isLoading","startFeedJob","queue","pop","getsFeedCounter","folderPromises","jobPromises","i","parseOutline","outline","attr","recursivelyParse","level","root","firstLevel","entry","children","xml","parseXML","find","channels","obj","listeners","listener","objs","existing","deleteAtIndex","findIndex","splice","settings","compact","preventReadOnScroll","compactExpand","defaultLanguageCode","supportedLanguageCodes","processLanguageCode","toLowerCase","storage","localStorage","registerHandler","mime","registered","isContentHandlerRegistered","isRegistered","getItem","registerContentHandler","subscribeUrl","setItem","cleanUrl","protocol","host","mimeType","ready","subscription","input","val","trigger","setTimeout","focus","addEventListener","querySelector","scrollTo","noInputFocused","is","noModifierKey","event","shiftKey","altKey","ctrlKey","metaKey","markAllRead","navigationArea","selector","button","isInScrollView","elem","scrollArea","elemTop","top","elemBottom","height","areaBottom","scrollToNavigationElement","toTop","scrollTop","scrollToActiveNavigationEntry","reloadFeed","tryReload","pullToRefresh","hasClass","addClass","activateNavigationEntry","nextFeed","elements","subfeeds","next","getParentFolder","parent","selectFirstOrLastFolder","isLast","index","previousFolder","prevAll","first","parentFolder","nextFolder","nextAll","previousFeed","prev","siblings","previous","onActiveItem","callback","each","position","toggleUnread","expandItem","openLink","scrollToItem","expandItemInCompact","scrollToNextItem","jumped","prop","scrollToPreviousItem","last","keyup","keyCode","isExpandItem","preventDefault","News","exports","articleActionPlugins","addArticleAction","action","getArticleActionPlugins","jQuery","$document","click","directive","restrict","link","elm","menu","toggleClass","target","removeClass","_","stop","slideDown","Navigation","newsArticleActions","noPlugins","plugins","attrs","toFocus","newsAutoFocus","$watch","newsBindHtmlUnsafe","html","$eval","options","newsDraggable","isDefined","draggable","$observe","details","accept","hoverClass","greedy","drop","ui","$apply","droppable","on","newsFinishedTransition","$interpolate","toReadd","newsFocus","notification","args","pause","scrolled","newsPullToRefresh","change","file","files","reader","FileReader","onload","$fileContent","result","newsReadFile","readAsText","masonry","itemSelector","gutter","columnWidth","$last","MARK_READ_TIMEOUT","SCROLL_TIMEOUT","counter","newsScrollAutoPage","enabled","article","newsScrollMarkRead","newsScroll","newsScrollEnabledMarkRead","allowScroll","scrollHandler","off","onSearch","box","doSearch","newsStickyMenu","scroll","scrollHeight","css","bind","stopPropagation","newsTimeout","destroyed","seconds","remove","baseTitle","titles","appName","ownCloudName","newsToggleShow","toggle","newsTriggerClick","oc_requesttoken"],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,MAAM,WACP,GAAIO,GAASre,EAAE2Q,EAAM6S,eACrBnF,GAAOoF,eAMvBpjB,EAAI0d,UAAU,mBAAoB,WAG9B,MAAO,UAAUpN,EAAOuN,EAAKnI,GACzBmI,EAAIJ,MAAM,WACN9d,EAAE+V,EAAK2N,kBAAkB7K,QAAQ,eAM1CjZ,UAAWC,OAAQC,SAAUC,QAAS6d,OAAS3d,GAAI0jB,gBAAiBxjB","file":"app.min.js"}
\ No newline at end of file diff --git a/js/controller/AppController.js b/js/controller/AppController.js index 31a288540..bb40b80fa 100644 --- a/js/controller/AppController.js +++ b/js/controller/AppController.js @@ -20,4 +20,4 @@ function (Loading, FeedResource, FolderResource) { this.play = function (item) { this.playingItem = item; }; -});
\ No newline at end of file +}); diff --git a/js/gui/ExternSubscription.js b/js/gui/ExternSubscription.js index e6bc59d2e..84fa650db 100644 --- a/js/gui/ExternSubscription.js +++ b/js/gui/ExternSubscription.js @@ -33,7 +33,7 @@ }; if (navigator.registerContentHandler && !isRegistered(mime, url)) { - navigator.registerContentHandler(mime, subscribeUrl, title); + navigator.registerContentHandler(mime, url, title); if (!registered) { storage.setItem('registeredHandler', url); } diff --git a/js/gulpfile.js b/js/gulpfile.js new file mode 100644 index 000000000..497fd6959 --- /dev/null +++ b/js/gulpfile.js @@ -0,0 +1,93 @@ +/** + * 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 2012, 2014 + */ + +'use strict'; + +let gulp = require('gulp'), + ngAnnotate = require('gulp-ng-annotate'), + uglify = require('gulp-uglify'), + jshint = require('gulp-jshint'), + KarmaServer = require('karma').Server, + phpunit = require('gulp-phpunit'), + concat = require('gulp-concat'), + sourcemaps = require('gulp-sourcemaps'); + +/** + * Configuration + */ +let phpunitConfig = __dirname + '/../phpunit.xml'; +let karmaConfig = __dirname + '/karma.conf.js'; +let destinationFolder = __dirname + '/build/'; +let sources = [ + 'app/App.js', 'app/Config.js', 'app/Run.js', + 'controller/**/*.js', + 'filter/**/*.js', + 'service/**/*.js', + 'gui/**/*.js', + 'plugin/**/*.js', + 'utility/**/*.js', + 'directive/**/*.js' +]; + +let testSources = [ + 'tests/**/*.js' +]; + +let phpSources = [ + '../*/**.php', + '!../js/*/**', + '!../vendor/*/**' +]; + +gulp.task('default', ['lint'], () => { + return gulp.src(sources) + .pipe(ngAnnotate()) + .pipe(sourcemaps.init()) + .pipe(concat('app.min.js')) + .pipe(uglify()) + .pipe(sourcemaps.write()) + .pipe(gulp.dest(destinationFolder)); +}); + +gulp.task('lint', () => { + return gulp.src('*/**.js') + .pipe(jshint()) + .pipe(jshint.reporter('jshint-stylish')) + .pipe(jshint.reporter('fail')); +}); + +gulp.task('watch', () => { + gulp.watch(sources.concat(testSources).concat('*.js'), ['default']); +}); + +gulp.task('karma', (done) => { + new KarmaServer({ + configFile: karmaConfig, + singleRun: true + }, done).start(); +}) + +gulp.task('watch-karma', (done) => { + new KarmaServer({ + configFile: karmaConfig, + autoWatch: true + }, done).start(); +}) + +gulp.task('phpunit', () => { + gulp.src(phpSources) + .pipe(phpunit('phpunit', { + configurationFile: phpunitConfig + })); +}); + +gulp.task('watch-phpunit', () => { + gulp.watch(phpSources, ['phpunit']); +}); diff --git a/js/karma.conf.js b/js/karma.conf.js index c1e255735..f9b427825 100644 --- a/js/karma.conf.js +++ b/js/karma.conf.js @@ -10,15 +10,10 @@ module.exports = function (config) { // (eg. files, exclude) basePath: '', - // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], - preprocessors: { - 'build/app.js': ['coverage'] - }, - // list of files / patterns to load in the browser files: [ 'vendor/js-url/url.min.js', diff --git a/js/package.json b/js/package.json index 6ad26a3fc..09a2b6eeb 100644 --- a/js/package.json +++ b/js/package.json @@ -24,21 +24,15 @@ }, "homepage": "https://github.com/owncloud/news", "devDependencies": { - "grunt": "^0.4.5", - "grunt-cachebuster": "^0.1.5", - "grunt-contrib-concat": "^0.5.1", - "grunt-contrib-connect": "^0.11.2", - "grunt-contrib-cssmin": "^0.14.0", - "grunt-contrib-jshint": "^0.12.0", - "grunt-contrib-uglify": "^0.11.0", - "grunt-contrib-watch": "^0.6.1", - "grunt-karma": "^0.12.1", - "grunt-ng-annotate": "^1.0.1", - "grunt-php": "^1.5.1", - "grunt-phpunit": "^0.3.6", - "grunt-protractor-runner": "^3.0.0", - "grunt-protractor-webdriver": "^0.2.5", - "grunt-wrap": "^0.3.0", + "gulp": "^3.9.1", + "gulp-concat": "^2.6.0", + "gulp-jshint": "^2.0.0", + "gulp-ng-annotate": "^1.1.0", + "gulp-phpunit": "^0.12.1", + "gulp-sourcemaps": "^1.6.0", + "gulp-uglify": "^1.5.2", + "jshint": "^2.9.1", + "jshint-stylish": "^2.1.0", "karma": "^0.13.19", "karma-chrome-launcher": "^0.2.2", "karma-coverage": "^0.5.3", diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js index a54b3b034..6ceb0e849 100644 --- a/js/tests/unit/controller/AppControllerSpec.js +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -53,4 +53,4 @@ describe('AppController', function () { expect(location.path).not.toHaveBeenCalled(); })); -});
\ No newline at end of file +}); diff --git a/phpunit.integration.xml b/phpunit.integration.xml index eba04489b..3a43fe58b 100644 --- a/phpunit.integration.xml +++ b/phpunit.integration.xml @@ -1,4 +1,4 @@ -<phpunit bootstrap="tests/bootstrap.php"> +<phpunit bootstrap="tests/bootstrap.php" colors="true"> <testsuites> <testsuite name="integration"> <directory>./tests/integration</directory> diff --git a/phpunit.xml b/phpunit.xml index 6a9499665..bd2b01caf 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,4 +1,4 @@ -<phpunit bootstrap="tests/bootstrap.php"> +<phpunit bootstrap="tests/bootstrap.php" colors="true"> <testsuites> <testsuite name="unit"> <directory>./tests/unit</directory> diff --git a/templates/index.php b/templates/index.php index 1958428a5..d6c713aaa 100644 --- a/templates/index.php +++ b/templates/index.php @@ -13,7 +13,16 @@ script('news', [ 'build/app.min', ]); -style('news', 'news.min'); +style('news', [ + 'app', + 'content', + 'custom', + 'explore', + 'mobile', + 'navigation', + 'settings', + 'shortcuts' +]); // load plugin scripts and styles foreach (Plugin::getStyles() as $appName => $fileName) { |