From c8a6f45b93e19e8fc69eb0cd86ff1479f2c19d17 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 5 Jan 2017 21:02:20 -0500 Subject: [PATCH] Make search keyboard shortcut compatible with Firefox --- app/templates/keyboard_shortcuts.php | 1 + assets/css/app.css | 2 +- assets/css/app.min.css | 2 +- assets/js/app.min.js | 2 +- assets/js/src/event.js | 16 +++------------- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/templates/keyboard_shortcuts.php b/app/templates/keyboard_shortcuts.php index 51a4a38..667e56c 100644 --- a/app/templates/keyboard_shortcuts.php +++ b/app/templates/keyboard_shortcuts.php @@ -19,5 +19,6 @@
  • = z
  • = ?
  • = q
  • +
  • = /
  • diff --git a/assets/css/app.css b/assets/css/app.css index be61bba..1bdd89b 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -825,7 +825,7 @@ iframe { top: 0; left: 0; bottom: 0; - width: 300px; + width: 350px; overflow: auto; background: #f0f0f0; box-shadow: 2px 0 5px 0 #ccc; diff --git a/assets/css/app.min.css b/assets/css/app.min.css index bea47b8..beb5e28 100644 --- a/assets/css/app.min.css +++ b/assets/css/app.min.css @@ -1 +1 @@ -a:hover,body,h1,h2,h3{color:#333}code,pre,td,th{border:1px solid #ccc}p>code,textarea{padding:3px}a.btn,a:focus,a:hover{text-decoration:none}.logo,.nav-left,ul#grouplist{float:left}#grouplist span,#help-layer,.alert,.item p,.items .preview,.panel,pre{overflow:auto}@-ms-viewport{width:device-width}blockquote,body,figure,li,p,table,td,th,tr,ul{margin:0;padding:0;font-size:100%}table caption,td,th{padding-top:.5em;padding-bottom:.5em}body{padding-left:10px;padding-right:10px;margin:0 auto 30px;max-width:780px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;text-rendering:optimizeLegibility}blockquote,q{font-family:Georgia,serif}a{color:#36C}a:focus{outline:0;color:red;border:1px dotted #aaa}h1,h2,h3{font-weight:400}a.btn,form h3,table caption{font-weight:700}h2{font-size:1.6em}h3{font-size:1.2em}h5,h6{margin:0;padding:0}blockquote{border-left:4px solid #ddd;padding-left:25px;margin-left:20px;margin-top:20px;margin-bottom:20px;color:#888;line-height:1.4em}q{color:purple;font-style:italic}blockquote+p{color:#555;font-style:italic}figcaption{font-size:.8em;text-transform:uppercase;color:#777}table{width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed}table caption{font-size:1em;text-align:left}td,th{padding-left:5px}th{text-align:left}code,pre{background:#fcfcfc;font-family:monospace;color:#666;line-height:1.3em;border-radius:5px}.item,.items .preview{font-family:Georgia,serif}pre{padding:10px}pre>code{border:none}form{padding-top:5px;padding-bottom:5px;padding-left:15px;border-left:2px dotted #ddd}form h3:first-child{margin-top:0}label{cursor:pointer;display:block}input[type=checkbox]{border:1px solid #ccc;margin-right:.5em}input[type=email],input[type=tel],input[type=password],input[type=number],input[type=text]{border:1px solid #ccc;padding:3px;line-height:15px;width:250px;font-size:99%;margin-bottom:10px;margin-top:5px;-webkit-appearance:none}.form-help,select{margin-bottom:15px}input[type=email]:focus,input[type=tel]:focus,input[type=password]:focus,input[type=number]:focus,input[type=text]:focus,textarea:focus{color:#000;border-color:rgba(82,168,236,.8);outline:0;box-shadow:0 0 8px rgba(82,168,236,.6)}input[type=number]{width:40px}textarea{border:1px solid #ccc;width:400px;height:200px;font-size:99%}::-webkit-input-placeholder{color:#bbb;padding-top:2px}::-ms-input-placeholder{color:#bbb;padding-top:2px}::-moz-placeholder{color:#bbb;padding-top:2px}.form-actions{margin-top:30px}input.form-error,textarea.form-error{border:2px solid #b94a48}.form-errors{color:#b94a48;margin-left:15px;list-style-type:none}.form-help{font-size:.9em;color:brown}.hide{display:none}#grouplist span{float:left;opacity:.4;min-width:4em;margin-right:6px;text-align:center}#grouplist input[type=text]{width:150px}#grouplist input[type=checkbox]+span,#grouplist input[type=text]{padding:4px;margin-top:6px;margin-bottom:0}#grouplist input[type=checkbox]:checked+span{opacity:1}ul#grouplist li{margin-left:0}.alert,.panel{padding:8px 35px 8px 14px;margin-bottom:20px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:4px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-error,.panel-danger{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-normal,.panel-default{color:#333;background-color:#f0f0f0;border-color:#ddd}.alert-error a,.panel-danger a{color:#b94a48}#grouplist span,.btn{-webkit-appearance:none;display:inline-block;color:#333;border:1px solid #ccc;background:#efefef;padding:3px 8px;font-size:1.1em;cursor:pointer;border-radius:2px}.btn-red{border-color:#b0281a;background:#d14836;color:#fff}.btn-red:focus,.btn-red:hover,a.btn-red:hover{color:#fff;background:#c53727}.btn-blue{border-color:#3079ed;background:#4d90fe;color:#fff}.btn-blue:focus,.btn-blue:hover{border-color:#2f5bb7;background:#357ae8}article .bookmark-icon,article .read-icon{color:#aaa!important;font-weight:200!important;text-decoration:none!important}.items a,header a,nav .active a{text-decoration:none}article[data-item-bookmark="0"] .bookmark-icon:before{content:"☆"}article[data-item-bookmark="1"] .bookmark-icon:before{content:"★"}article[data-item-status=read] .read-icon:before{content:"✘"}article[data-item-status=unread] .read-icon:before{content:"✔"}span#nav-counter:not(:empty):before,span#page-counter:not(:empty):before{content:" ("}span.items-count:before{content:"("}span#nav-counter:not(:empty):after,span#page-counter:not(:empty):after,span.items-count:after{content:")"}@keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}@-webkit-keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}.loading-icon:before{content:"☀";animation-name:blinker;-webkit-animation-name:blinker;animation-duration:.5s;-webkit-animation-duration:.5s;animation-timing-function:ease-in-out;-webkit-animation-timing-function:ease-in-out;animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite}header{margin-bottom:50px;margin-top:10px}header ul{text-align:right;font-size:90%}header li{display:inline;padding-left:3%}header a{color:#777}nav .menu-more-switcher{color:#777;cursor:pointer}nav .active a{color:#333;font-weight:700}.logo{color:#000;letter-spacing:1px}.logo span{color:#396}.page-section{margin-top:30px}.page-header,.page-section{margin-bottom:30px}.page-header h2,.page-section h2{margin:0;padding:0;font-size:130%;border-bottom:1px dotted #ccc}.page-header ul{text-align:right;margin-top:2px}.page-header li{font-size:90%;display:inline;padding-right:5px}.page-header li:last-child{border:none;padding-right:0}#bottom-menu{border-bottom:1px dotted #ccc;padding-bottom:3px;font-size:.9em;text-align:right;padding-top:30px}.feed-last-checked{color:brown;font-size:.7em;font-weight:400}.item h2,.item h3,.items h2{font-weight:700}.feed-parsing-error{visibility:hidden}.items article[data-feed-error] .feed-parsing-error{visibility:visible;color:#000;font-size:.7em;font-weight:700}.items article{border:1px dotted #ddd;margin-bottom:20px;padding:5px;background-color:#fff}.items article[data-feed-error]{background-color:#fcf8e3;border-color:#fcf8e3}.items article[data-feed-disabled] *{color:#aaa}.items h2{font-size:100%;margin:0;padding:0 0 2px}.items a:focus,.items a:hover{text-decoration:underline}#menu-more a,.bookmarklet,.item h1 a{text-decoration:none}.item-menu,.items .preview{color:#aaa;font-size:70%}.items .preview{line-height:1.5em;font-size:100%}#item-content,.item{font-size:1.1em}.items #current-item{border:3px solid #bce;padding:3px}.items #current-item .preview,.items article:hover .preview{color:#555}.items article[data-item-status=read] h2 a{color:#666}.preview-full-content{overflow:auto;color:#666}.preview-full-content:not(:empty),p.preview:not(:empty){margin-top:15px}.preview-full-content img{max-width:100%;display:block;margin-top:10px;margin-bottom:10px}.item{padding-left:5px;padding-right:5px;padding-bottom:50px;color:#555;line-height:1.6em}.item p,.item pre,.item ul{margin-top:15px}.item p{margin-bottom:20px}.item ul{margin-left:25px}#item-content[dir=rtl] blockquote{border-right:4px solid #ddd;border-left:none;padding-right:25px;padding-left:0}#item-content figure img,#item-content img,#item-content>a img,#item-content>img,.item p img{margin-top:10px;margin-bottom:10px;display:block;max-width:100%}#item-content br+img,#item-content h1 img,#item-content h2 img,#item-content h3 img{display:inline;margin:0}.item h1 a{font-size:2.1em}#item-content a:visited{color:purple}.item nav a,.item nav a:visited,.item nav span{color:#333;font-family:sans-serif}.item nav{width:100%}.nav-left,.nav-right{width:50%;display:block}.item nav.bottom{border-top:1px dotted #ddd;padding-top:8px;margin-top:50px}.nav-left{text-align:left}.nav-right{text-align:right;margin-left:50%}.nav-left:before{content:"« "}.nav-right:after{content:" »"}ul.item-infos,ul.item-menu{margin:0;padding:0;color:#aaa}.item-menu li,ul.item-infos li{margin:0;padding-left:7px;padding-right:5px;display:inline;border-right:1px solid #ccc}.item-menu li:first-child,ul.item-infos li:first-child{padding-left:0}.item-menu li:last-child,ul.item-infos li:last-child{border:none}.item-menu a,ul.item-infos a{color:#aaa}ul.item-infos{margin-bottom:20px}#download-item{color:#000}#items-paging{margin-top:40px;margin-bottom:15px;font-size:80%;text-align:center}#item-content-enclosure{border-bottom:1px dashed #ccc;margin-bottom:20px;padding-bottom:10px}.items article .favicon{height:16px}section li{margin-left:15px;list-style-type:square}iframe,video{max-width:98%}.search{text-align:right}#search-opener{color:#777;font-size:87.5%;cursor:pointer;text-transform:lowercase}#menu-more li.active a,#search-opener:hover{color:#333}#search-form{border:0;padding:0}#search-form input{font-size:75%}#menu-more{padding-top:20px}#menu-more li{font-size:1.1em;padding-top:10px;padding-bottom:10px;border-bottom:1px dotted #ccc;list-style-type:none}#menu-more a{color:#777;display:block}#help-layer{position:fixed;top:0;left:0;bottom:0;width:300px;background:#f0f0f0;box-shadow:2px 0 5px 0 #ccc}#help-layer .panel{border:0}.btn-close{position:absolute;top:0;right:0;font:28px/1 sans-serif;color:#ccc;padding:0 .2em;margin:10px;cursor:pointer}.btn-close:hover{color:#999}#login{width:350px;margin:15% auto 0}#login form{border:none;margin-bottom:45px}#database-selector h4{margin:0 0 10px;padding:0;font-weight:400}.bookmarklet{font-size:.9em;font-weight:700;line-height:30px;padding:4px;color:#333;background:#fff;border:1px dotted #ccc;border-radius:4px;cursor:move}.bookmarklet:focus,.bookmarklet:hover{color:#396}#config-form{border-left:none;padding:0}#config-form h3{border-bottom:1px dotted #ccc}.options{border-left:3px dotted #eee;padding-left:20px}html[dir=rtl] .options,html[dir=rtl] form,html[dir=rtl] ul.item-infos li{border:none}html[dir=rtl] .nav-left:before,html[dir=rtl] .nav-right:after,html[dir=rtl] span.items-count:after,html[dir=rtl] span.items-count:before{content:""}@media only screen and (min-width:480px){.hide-desktop{display:none}.items h2{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.search{margin-top:-30px}}@media only screen and (max-width:480px){.hide-mobile,ul li.hide-mobile{display:none}.item-icons,.item-title{display:block}body{max-width:480px}header{margin-bottom:0}nav .active a{font-weight:400}.page{clear:both;padding-top:20px;overflow-x:hidden}.page li{margin-left:5px}.item{font-size:1em}.item h1{font-size:.75em}.item-infos{font-size:.9em;margin-bottom:5px}.item nav a{font-weight:700;text-decoration:none}.items .preview{color:#555}.item-menu li,ul.item-infos li{padding-left:0;padding-right:5px;border:none}section li{font-size:.85em}#search-form input{box-sizing:border-box;width:100%}.item-icons{float:right}.item-icons .bookmark-icon,.item-icons .read-icon{font-size:1.7em;margin-left:15px}.item-infos .bookmark-icon{font-size:2em}} \ No newline at end of file +a:hover,body,h1,h2,h3{color:#333}code,pre,td,th{border:1px solid #ccc}p>code,textarea{padding:3px}a.btn,a:focus,a:hover{text-decoration:none}.logo,.nav-left,ul#grouplist{float:left}#grouplist span,#help-layer,.alert,.item p,.items .preview,.panel,pre{overflow:auto}@-ms-viewport{width:device-width}blockquote,body,figure,li,p,table,td,th,tr,ul{margin:0;padding:0;font-size:100%}table caption,td,th{padding-top:.5em;padding-bottom:.5em}body{padding-left:10px;padding-right:10px;margin:0 auto 30px;max-width:780px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;text-rendering:optimizeLegibility}blockquote,q{font-family:Georgia,serif}a{color:#36C}a:focus{outline:0;color:red;border:1px dotted #aaa}h1,h2,h3{font-weight:400}a.btn,form h3,table caption{font-weight:700}h2{font-size:1.6em}h3{font-size:1.2em}h5,h6{margin:0;padding:0}blockquote{border-left:4px solid #ddd;padding-left:25px;margin-left:20px;margin-top:20px;margin-bottom:20px;color:#888;line-height:1.4em}q{color:purple;font-style:italic}blockquote+p{color:#555;font-style:italic}figcaption{font-size:.8em;text-transform:uppercase;color:#777}table{width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed}table caption{font-size:1em;text-align:left}td,th{padding-left:5px}th{text-align:left}code,pre{background:#fcfcfc;font-family:monospace;color:#666;line-height:1.3em;border-radius:5px}.item,.items .preview{font-family:Georgia,serif}pre{padding:10px}pre>code{border:none}form{padding-top:5px;padding-bottom:5px;padding-left:15px;border-left:2px dotted #ddd}form h3:first-child{margin-top:0}label{cursor:pointer;display:block}input[type=checkbox]{border:1px solid #ccc;margin-right:.5em}input[type=email],input[type=tel],input[type=password],input[type=number],input[type=text]{border:1px solid #ccc;padding:3px;line-height:15px;width:250px;font-size:99%;margin-bottom:10px;margin-top:5px;-webkit-appearance:none}.form-help,select{margin-bottom:15px}input[type=email]:focus,input[type=tel]:focus,input[type=password]:focus,input[type=number]:focus,input[type=text]:focus,textarea:focus{color:#000;border-color:rgba(82,168,236,.8);outline:0;box-shadow:0 0 8px rgba(82,168,236,.6)}input[type=number]{width:40px}textarea{border:1px solid #ccc;width:400px;height:200px;font-size:99%}::-webkit-input-placeholder{color:#bbb;padding-top:2px}::-ms-input-placeholder{color:#bbb;padding-top:2px}::-moz-placeholder{color:#bbb;padding-top:2px}.form-actions{margin-top:30px}input.form-error,textarea.form-error{border:2px solid #b94a48}.form-errors{color:#b94a48;margin-left:15px;list-style-type:none}.form-help{font-size:.9em;color:brown}.hide{display:none}#grouplist span{float:left;opacity:.4;min-width:4em;margin-right:6px;text-align:center}#grouplist input[type=text]{width:150px}#grouplist input[type=checkbox]+span,#grouplist input[type=text]{padding:4px;margin-top:6px;margin-bottom:0}#grouplist input[type=checkbox]:checked+span{opacity:1}ul#grouplist li{margin-left:0}.alert,.panel{padding:8px 35px 8px 14px;margin-bottom:20px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:4px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-error,.panel-danger{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-normal,.panel-default{color:#333;background-color:#f0f0f0;border-color:#ddd}.alert-error a,.panel-danger a{color:#b94a48}#grouplist span,.btn{-webkit-appearance:none;display:inline-block;color:#333;border:1px solid #ccc;background:#efefef;padding:3px 8px;font-size:1.1em;cursor:pointer;border-radius:2px}.btn-red{border-color:#b0281a;background:#d14836;color:#fff}.btn-red:focus,.btn-red:hover,a.btn-red:hover{color:#fff;background:#c53727}.btn-blue{border-color:#3079ed;background:#4d90fe;color:#fff}.btn-blue:focus,.btn-blue:hover{border-color:#2f5bb7;background:#357ae8}article .bookmark-icon,article .read-icon{color:#aaa!important;font-weight:200!important;text-decoration:none!important}.items a,header a,nav .active a{text-decoration:none}article[data-item-bookmark="0"] .bookmark-icon:before{content:"☆"}article[data-item-bookmark="1"] .bookmark-icon:before{content:"★"}article[data-item-status=read] .read-icon:before{content:"✘"}article[data-item-status=unread] .read-icon:before{content:"✔"}span#nav-counter:not(:empty):before,span#page-counter:not(:empty):before{content:" ("}span.items-count:before{content:"("}span#nav-counter:not(:empty):after,span#page-counter:not(:empty):after,span.items-count:after{content:")"}@keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}@-webkit-keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}.loading-icon:before{content:"☀";animation-name:blinker;-webkit-animation-name:blinker;animation-duration:.5s;-webkit-animation-duration:.5s;animation-timing-function:ease-in-out;-webkit-animation-timing-function:ease-in-out;animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite}header{margin-bottom:50px;margin-top:10px}header ul{text-align:right;font-size:90%}header li{display:inline;padding-left:3%}header a{color:#777}nav .menu-more-switcher{color:#777;cursor:pointer}nav .active a{color:#333;font-weight:700}.logo{color:#000;letter-spacing:1px}.logo span{color:#396}.page-section{margin-top:30px}.page-header,.page-section{margin-bottom:30px}.page-header h2,.page-section h2{margin:0;padding:0;font-size:130%;border-bottom:1px dotted #ccc}.page-header ul{text-align:right;margin-top:2px}.page-header li{font-size:90%;display:inline;padding-right:5px}.page-header li:last-child{border:none;padding-right:0}#bottom-menu{border-bottom:1px dotted #ccc;padding-bottom:3px;font-size:.9em;text-align:right;padding-top:30px}.feed-last-checked{color:brown;font-size:.7em;font-weight:400}.item h2,.item h3,.items h2{font-weight:700}.feed-parsing-error{visibility:hidden}.items article[data-feed-error] .feed-parsing-error{visibility:visible;color:#000;font-size:.7em;font-weight:700}.items article{border:1px dotted #ddd;margin-bottom:20px;padding:5px;background-color:#fff}.items article[data-feed-error]{background-color:#fcf8e3;border-color:#fcf8e3}.items article[data-feed-disabled] *{color:#aaa}.items h2{font-size:100%;margin:0;padding:0 0 2px}.items a:focus,.items a:hover{text-decoration:underline}#menu-more a,.bookmarklet,.item h1 a{text-decoration:none}.item-menu,.items .preview{color:#aaa;font-size:70%}.items .preview{line-height:1.5em;font-size:100%}#item-content,.item{font-size:1.1em}.items #current-item{border:3px solid #bce;padding:3px}.items #current-item .preview,.items article:hover .preview{color:#555}.items article[data-item-status=read] h2 a{color:#666}.preview-full-content{overflow:auto;color:#666}.preview-full-content:not(:empty),p.preview:not(:empty){margin-top:15px}.preview-full-content img{max-width:100%;display:block;margin-top:10px;margin-bottom:10px}.item{padding-left:5px;padding-right:5px;padding-bottom:50px;color:#555;line-height:1.6em}.item p,.item pre,.item ul{margin-top:15px}.item p{margin-bottom:20px}.item ul{margin-left:25px}#item-content[dir=rtl] blockquote{border-right:4px solid #ddd;border-left:none;padding-right:25px;padding-left:0}#item-content figure img,#item-content img,#item-content>a img,#item-content>img,.item p img{margin-top:10px;margin-bottom:10px;display:block;max-width:100%}#item-content br+img,#item-content h1 img,#item-content h2 img,#item-content h3 img{display:inline;margin:0}.item h1 a{font-size:2.1em}#item-content a:visited{color:purple}.item nav a,.item nav a:visited,.item nav span{color:#333;font-family:sans-serif}.item nav{width:100%}.nav-left,.nav-right{width:50%;display:block}.item nav.bottom{border-top:1px dotted #ddd;padding-top:8px;margin-top:50px}.nav-left{text-align:left}.nav-right{text-align:right;margin-left:50%}.nav-left:before{content:"« "}.nav-right:after{content:" »"}ul.item-infos,ul.item-menu{margin:0;padding:0;color:#aaa}.item-menu li,ul.item-infos li{margin:0;padding-left:7px;padding-right:5px;display:inline;border-right:1px solid #ccc}.item-menu li:first-child,ul.item-infos li:first-child{padding-left:0}.item-menu li:last-child,ul.item-infos li:last-child{border:none}.item-menu a,ul.item-infos a{color:#aaa}ul.item-infos{margin-bottom:20px}#download-item{color:#000}#items-paging{margin-top:40px;margin-bottom:15px;font-size:80%;text-align:center}#item-content-enclosure{border-bottom:1px dashed #ccc;margin-bottom:20px;padding-bottom:10px}.items article .favicon{height:16px}section li{margin-left:15px;list-style-type:square}iframe,video{max-width:98%}.search{text-align:right}#search-opener{color:#777;font-size:87.5%;cursor:pointer;text-transform:lowercase}#menu-more li.active a,#search-opener:hover{color:#333}#search-form{border:0;padding:0}#search-form input{font-size:75%}#menu-more{padding-top:20px}#menu-more li{font-size:1.1em;padding-top:10px;padding-bottom:10px;border-bottom:1px dotted #ccc;list-style-type:none}#menu-more a{color:#777;display:block}#help-layer{position:fixed;top:0;left:0;bottom:0;width:350px;background:#f0f0f0;box-shadow:2px 0 5px 0 #ccc}#help-layer .panel{border:0}.btn-close{position:absolute;top:0;right:0;font:28px/1 sans-serif;color:#ccc;padding:0 .2em;margin:10px;cursor:pointer}.btn-close:hover{color:#999}#login{width:350px;margin:15% auto 0}#login form{border:none;margin-bottom:45px}#database-selector h4{margin:0 0 10px;padding:0;font-weight:400}.bookmarklet{font-size:.9em;font-weight:700;line-height:30px;padding:4px;color:#333;background:#fff;border:1px dotted #ccc;border-radius:4px;cursor:move}.bookmarklet:focus,.bookmarklet:hover{color:#396}#config-form{border-left:none;padding:0}#config-form h3{border-bottom:1px dotted #ccc}.options{border-left:3px dotted #eee;padding-left:20px}html[dir=rtl] .options,html[dir=rtl] form,html[dir=rtl] ul.item-infos li{border:none}html[dir=rtl] .nav-left:before,html[dir=rtl] .nav-right:after,html[dir=rtl] span.items-count:after,html[dir=rtl] span.items-count:before{content:""}@media only screen and (min-width:480px){.hide-desktop{display:none}.items h2{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.search{margin-top:-30px}}@media only screen and (max-width:480px){.hide-mobile,ul li.hide-mobile{display:none}.item-icons,.item-title{display:block}body{max-width:480px}header{margin-bottom:0}nav .active a{font-weight:400}.page{clear:both;padding-top:20px;overflow-x:hidden}.page li{margin-left:5px}.item{font-size:1em}.item h1{font-size:.75em}.item-infos{font-size:.9em;margin-bottom:5px}.item nav a{font-weight:700;text-decoration:none}.items .preview{color:#555}.item-menu li,ul.item-infos li{padding-left:0;padding-right:5px;border:none}section li{font-size:.85em}#search-form input{box-sizing:border-box;width:100%}.item-icons{float:right}.item-icons .bookmark-icon,.item-icons .read-icon{font-size:1.7em;margin-left:15px}.item-infos .bookmark-icon{font-size:2em}} \ No newline at end of file diff --git a/assets/js/app.min.js b/assets/js/app.min.js index cdbf5b3..6ced423 100644 --- a/assets/js/app.min.js +++ b/assets/js/app.min.js @@ -1,2 +1,2 @@ -var Miniflux={};var DEBUG=false;Miniflux.App=function(){return{Log:function(message){if(DEBUG){console.log(message)}},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents();Miniflux.Event.ListenVisibilityEvents();Miniflux.Event.ListenTouchEvents();this.FrontendUpdateCheck()},FrontendUpdateCheck:function(){var request=new XMLHttpRequest;request.onload=function(){var response=JSON.parse(this.responseText);if(response.frontend_updatecheck_interval>0){Miniflux.App.Log("Frontend updatecheck interval in minutes: "+response.frontend_updatecheck_interval);Miniflux.Item.CheckForUpdates();setInterval(function(){Miniflux.Item.CheckForUpdates()},response.frontend_updatecheck_interval*60*1e3)}else{Miniflux.App.Log("Frontend updatecheck disabled")}};request.open("POST","?action=get-config",true);request.send(JSON.stringify(["frontend_updatecheck_interval"]))}}}();Miniflux.Feed=function(){var queue=[];var queue_length=5;var updateInterval=null;var feeds=[];return{Update:function(feed,callback){var itemsCounter=feed.querySelector("span.items-count");if(!itemsCounter)return;var feed_id=feed.getAttribute("data-feed-id");var heading=feed.querySelector("h2:first-of-type");heading.className="loading-icon";var request=new XMLHttpRequest;request.onload=function(){heading.className="";feed.removeAttribute("data-feed-error");var lastChecked=feed.querySelector(".feed-last-checked");if(lastChecked){lastChecked.innerHTML=lastChecked.getAttribute("data-after-update")}var response=JSON.parse(this.responseText);if(response.result){itemsCounter.innerHTML=response.items_count.items_unread+"/"+response.items_count.items_total}else{feed.setAttribute("data-feed-error","1");var errorMessageElement=feed.querySelector(".feed-parsing-error");if(errorMessageElement){errorMessageElement.innerHTML=response.feed.parsing_error_message}}if(callback){callback(response)}else{Miniflux.Item.CheckForUpdates()}};request.open("POST","?action=refresh-feed&feed_id="+feed_id,true);request.send()},UpdateAll:function(nb_concurrent_requests){feeds=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])"));if(nb_concurrent_requests){queue_length=nb_concurrent_requests}updateInterval=setInterval(function(){while(feeds.length>0&&queue.length=0)queue.splice(index,1);if(feeds.length===0&&queue.length===0){clearInterval(updateInterval);Miniflux.Item.CheckForUpdates()}}}}();Miniflux.Item=function(){var latest_feeds_items={};var unreadItems=false;var nbUnreadItems=function(){var navCounterElement=document.getElementById("nav-counter");if(navCounterElement){return parseInt(navCounterElement.textContent,10)||0}}();var nbPageItems=function(){var pageCounterElement=document.getElementById("page-counter");if(pageCounterElement){return parseInt(pageCounterElement.textContent,10)||0}}();function simulateMouseClick(element){var event=document.createEvent("MouseEvents");event.initEvent("mousedown",true,true);element.dispatchEvent(event);event=document.createEvent("MouseEvents");event.initEvent("mouseup",true,true);element.dispatchEvent(event);element.click()}function getItemID(item){return item.getAttribute("data-item-id")}function changeLabel(links){if(links.length===0){return}for(var i=0;i-1&&nbUnreadItems>0){window.location.href="?action=unread"}else if(nbPageItems===0){window.location.reload()}var pageCounterElement=document.getElementById("page-counter");if(pageCounterElement)pageCounterElement.textContent=nbPageItems||"";var navCounterElement=document.getElementById("nav-counter");navCounterElement.textContent=nbUnreadItems||"";var pageHeadingElement=document.querySelector("div.page-header h2:first-of-type");if(pageHeadingElement){pageHeading=pageHeadingElement.firstChild.nodeValue}else{var itemHeading=document.querySelector("article.item h1:first-of-type");if(itemHeading){document.title=itemHeading.textContent;return}}var sectionElement=document.querySelector("section.page");switch(sectionElement.getAttribute("data-item-page")){case"unread":document.title="Miniflux ("+nbUnreadItems+")";break;case"feed-items":document.title="("+nbPageItems+") "+pageHeading;break;default:if(pageCounterElement){document.title=pageHeading+" ("+nbPageItems+")"}else{document.title=pageHeading}break}}function markAsRead(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){showItemAsRead(item);updateCounters()}};request.open("POST","?action=mark-item-read&id="+item_id,true);request.send()}function markAsUnread(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){showItemAsUnread(item);updateCounters()}};request.open("POST","?action=mark-item-unread&id="+item_id,true);request.send()}function markAsRemoved(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){hideItem(item);if(item.getAttribute("data-item-status")==="unread")nbUnreadItems--;updateCounters()}};request.open("POST","?action=mark-item-removed&id="+item_id,true);request.send()}return{MarkAsRead:markAsRead,MarkAsUnread:markAsUnread,MarkAsRemoved:markAsRemoved,SwitchBookmark:function(item){var item_id=getItemID(item);var value=item.getAttribute("data-item-bookmark")==="1"?"0":"1";var request=new XMLHttpRequest;request.onload=function(){var sectionElement=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&§ionElement.getAttribute("data-item-page")==="bookmarks"){hideItem(item);updateCounters()}else{item.setAttribute("data-item-bookmark",value);changeBookmarkLabel(item)}};request.open("POST","?action=bookmark&id="+item_id+"&value="+value,true);request.send()},SwitchStatus:function(item){var status=item.getAttribute("data-item-status");if(status==="read"){markAsUnread(item)}else if(status==="unread"){markAsRead(item)}},Show:function(item){var link=item.querySelector("a.show");if(link)simulateMouseClick(link)},OpenOriginal:function(item){var link=item.querySelector("a.original");if(link){simulateMouseClick(link)}},DownloadContent:function(item){var container=document.getElementById("download-item");if(!container)return;container.innerHTML=" "+container.getAttribute("data-before-message");container.className="loading-icon";var request=new XMLHttpRequest;request.onload=function(){var response=JSON.parse(request.responseText);container.className="";if(response.result){var content=document.getElementById("item-content");if(content)content.innerHTML=response.content;container.innerHTML=container.getAttribute("data-after-message")}else{container.innerHTML=container.getAttribute("data-failure-message")}};var item_id=getItemID(item);request.open("POST","?action=download-item&id="+item_id,true);request.send()},MarkFeedAsRead:function(feed_id){var request=new XMLHttpRequest;request.onload=function(){var articles=document.getElementsByTagName("article");for(var i=0,ilen=articles.length;ilatest_feeds_items[feed_id]){latest_feeds_items[feed_id]=current_feed.updated;current_unread=true}}Miniflux.App.Log("first_run: "+first_run+", current_unread: "+current_unread+", response.nbUnread: "+response.nbUnread+", nbUnreadItems: "+nbUnreadItems);if(!document.hidden&&(response.nb_unread_items!==nbUnreadItems||unreadItems)){Miniflux.App.Log("Counter changed! Updating unread counter.");unreadItems=false;nbUnreadItems=response.nb_unread_items;updateCounters()}else if(document.hidden&&!first_run&¤t_unread){Miniflux.App.Log("New Unread! Updating pagetitle.");unreadItems=true;document.title="↻ "+document.title}else{Miniflux.App.Log("No update.")}Miniflux.App.Log("unreadItems: "+unreadItems)};request.open("GET","?action=latest-feeds-items",true);request.send()}}}();Miniflux.Event=function(){var queue=[];function isEventIgnored(e){if(e.keyCode!==63&&e.which!==63&&(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)){return true}var target=e.target||e.srcElement;return target.tagName==="INPUT"||target.tagName==="TEXTAREA"}return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(e){if(e.target.hasAttribute("data-action")&&e.target.className!=="original"){e.preventDefault()}};document.onmouseup=function(e){if(e.button===2){return}if(e.target.nodeName==="INPUT"&&e.target.className==="auto-select"){e.target.select();return}var action=e.target.getAttribute("data-action");if(action){Miniflux.Event.lastEventType="mouse";var currentItem=function(){var element=e.target;while(element&&element.parentNode){element=element.parentNode;if(element.tagName&&element.tagName.toLowerCase()==="article"){return element}}}();switch(action){case"refresh-all":Miniflux.Feed.UpdateAll(e.target.getAttribute("data-concurrent-requests"));break;case"refresh-feed":if(currentItem){Miniflux.Feed.Update(currentItem)}break;case"mark-read":if(currentItem){Miniflux.Item.MarkAsRead(currentItem)}break;case"mark-unread":if(currentItem){Miniflux.Item.MarkAsUnread(currentItem)}break;case"mark-removed":if(currentItem){Miniflux.Item.MarkAsRemoved(currentItem)}break;case"bookmark":if(currentItem){Miniflux.Item.SwitchBookmark(currentItem)}break;case"download-item":if(currentItem){Miniflux.Item.DownloadContent(currentItem)}break;case"mark-feed-read":var feed_id=document.getElementById("listing").getAttribute("data-feed-id");Miniflux.Item.MarkFeedAsRead(feed_id);break;case"close-help":Miniflux.Nav.CloseHelp();break;case"show-search":Miniflux.Nav.ShowSearch();break;case"toggle-menu-more":Miniflux.Nav.ToggleMenuMore();break}}}},ListenKeyboardEvents:function(){document.onkeypress=function(e){if(isEventIgnored(e)){return}Miniflux.Event.lastEventType="keyboard";queue.push(e.key||e.which);if(queue[0]==="g"||queue[0]===103){switch(queue[1]){case undefined:break;case"u":case 117:window.location.href="?action=unread";queue=[];break;case"b":case 98:window.location.href="?action=bookmarks";queue=[];break;case"h":case 104:window.location.href="?action=history";queue=[];break;case"s":case 115:window.location.href="?action=feeds";queue=[];break;case"p":case 112:window.location.href="?action=config";queue=[];break;default:queue=[];break}}else{queue=[];var currentItem=function(){return document.getElementById("current-item")}();switch(e.key||e.which){case"d":case 100:if(currentItem){Miniflux.Item.DownloadContent(currentItem)}break;case"p":case 112:case"k":case 107:Miniflux.Nav.SelectPreviousItem();break;case"n":case 110:case"j":case 106:Miniflux.Nav.SelectNextItem();break;case"v":case 118:if(currentItem){Miniflux.Item.OpenOriginal(currentItem)}break;case"o":case 111:if(currentItem){Miniflux.Item.Show(currentItem)}break;case"m":case 109:if(currentItem){Miniflux.Item.SwitchStatus(currentItem)}break;case"f":case 102:if(currentItem){Miniflux.Item.SwitchBookmark(currentItem)}break;case"h":case 104:Miniflux.Nav.OpenPreviousPage();break;case"l":case 108:Miniflux.Nav.OpenNextPage();break;case"r":case 114:Miniflux.Feed.UpdateAll();break;case"?":case 63:Miniflux.Nav.ShowHelp();break;case"Q":case 81:case"q":case 113:Miniflux.Nav.CloseHelp();break;case"z":case 122:Miniflux.Item.ToggleRTLMode();break}}};document.onkeydown=function(e){if(isEventIgnored(e)){return}Miniflux.Event.lastEventType="keyboard";switch(e.key||e.which){case"ArrowLeft":case"Left":case 37:Miniflux.Nav.SelectPreviousItem();break;case"ArrowRight":case"Right":case 39:Miniflux.Nav.SelectNextItem();break}};document.onkeyup=function(e){if(isEventIgnored(e)){return}Miniflux.Event.lastEventType="keyboard";switch(e.key||e.which){case"/":case 47:Miniflux.Nav.ShowSearch();break}}},ListenVisibilityEvents:function(){document.addEventListener("visibilitychange",function(){Miniflux.App.Log("document.visibilityState: "+document.visibilityState);if(!document.hidden&&Miniflux.Item.hasNewUnread()){Miniflux.App.Log("Need to update the unread counter with fresh values from the database");Miniflux.Item.CheckForUpdates()}})},ListenTouchEvents:function(){var touches=null;var resetTouch=function(){if(touches&&touches.element){touches.element.style.opacity=1;touches.element.style.transform=""}touches={touchstart:{x:-1,y:-1},touchmove:{x:-1,y:-1},touchend:false,direction:"undetermined",swipestarted:false,element:null}};var horizontalSwipe=function(){if(touches.touchstart.x>-1&&touches.touchmove.x>-1&&(touches.touchmove.x-touches.touchstart.x>30||touches.swipestarted)&&Math.abs(touches.touchmove.y-touches.touchstart.y)<75){touches.swipestarted=true;return touches.touchmove.x-touches.touchstart.x}return 0};var closest=function(el,fn){return el&&(fn(el)?el:closest(el.parentNode,fn))};var getTouchElement=function(){return touches.element?touches.element:closest(document.elementFromPoint(touches.touchstart.x,touches.touchstart.y),function(el){return el.tagName==="ARTICLE"})};var drawElement=function(){if(touches&&(touches.touchend===true||touches.touchstart.x==-1)){return}if(touches.element===null){touches.element=getTouchElement()}var swipedistance=horizontalSwipe();if(swipedistance>0){var element=getTouchElement();if(!element){resetTouch();return}touches.element.style.opacity=1-(swipedistance>75?.9:swipedistance/75*.9);touches.element.style.transform="translateX("+(swipedistance>75?75:swipedistance)+"px)";touches.element=element}window.requestAnimationFrame(drawElement)};var touchHandler=function(e){if(typeof e.touches!="undefined"&&e.touches.length<=1){var touch=e.touches[0];var swipedistance=null;var element=null;switch(e.type){case"touchstart":resetTouch();touches[e.type].x=touch.clientX;touches[e.type].y=touch.clientY;drawElement();break;case"touchmove":touches[e.type].x=touch.clientX;touches[e.type].y=touch.clientY;break;case"touchend":touches[e.type]=true;element=getTouchElement();swipedistance=horizontalSwipe();if(swipedistance>75){if(element){Miniflux.Item.MarkAsRead(element)}if(!element.getAttribute("data-hide")){resetTouch()}}else{resetTouch()}break;case"touchcancel":resetTouch();break;default:break}}else{resetTouch()}};resetTouch();document.addEventListener("touchstart",touchHandler,false);document.addEventListener("touchmove",touchHandler,false);document.addEventListener("touchend",touchHandler,false);document.addEventListener("touchcancel",touchHandler,false)}}}();Miniflux.Nav=function(){function scrollPageTo(item){var clientHeight=pageYOffset+document.documentElement.clientHeight;var itemPosition=item.offsetTop+item.offsetHeight;if(clientHeight-itemPosition<0||clientHeight-item.offsetTop>document.documentElement.clientHeight){window.scrollTo(0,item.offsetTop-10)}}function findNextItem(){var items=document.getElementsByTagName("article");if(!document.getElementById("current-item")){items[0].id="current-item";scrollPageTo(items[0])}else{for(var i=0,ilen=items.length;i=0;i--){if(items[i].id==="current-item"){if(i-1>=0){items[i].id="item-"+items[i].getAttribute("data-item-id");items[i-1].id="current-item";scrollPageTo(items[i-1])}break}}}}function isListing(){return!!document.getElementById("listing")}return{OpenNextPage:function(){var link=document.getElementById("next-page");if(link)link.click()},OpenPreviousPage:function(){var link=document.getElementById("previous-page");if(link)link.click()},SelectNextItem:function(){var link=document.getElementById("next-item");if(link){link.click()}else if(isListing()){findNextItem()}},SelectPreviousItem:function(){var link=document.getElementById("previous-item");if(link){link.click()}else if(isListing()){findPreviousItem()}},ShowHelp:function(){var help_layer=document.getElementById("help-layer");help_layer.removeAttribute("class")},CloseHelp:function(){var help_layer=document.getElementById("help-layer");help_layer.setAttribute("class","hide")},ShowSearch:function(){document.getElementById("search-opener").setAttribute("class","hide");document.getElementById("search-form").removeAttribute("class");document.getElementById("form-text").focus()},ToggleMenuMore:function(){var menu=document.getElementById("menu-more");if(menu.hasAttribute("class")){menu.removeAttribute("class")}else{menu.setAttribute("class","hide")}},IsListing:isListing}}(); +var Miniflux={};var DEBUG=false;Miniflux.App=function(){return{Log:function(message){if(DEBUG){console.log(message)}},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents();Miniflux.Event.ListenVisibilityEvents();Miniflux.Event.ListenTouchEvents();this.FrontendUpdateCheck()},FrontendUpdateCheck:function(){var request=new XMLHttpRequest;request.onload=function(){var response=JSON.parse(this.responseText);if(response.frontend_updatecheck_interval>0){Miniflux.App.Log("Frontend updatecheck interval in minutes: "+response.frontend_updatecheck_interval);Miniflux.Item.CheckForUpdates();setInterval(function(){Miniflux.Item.CheckForUpdates()},response.frontend_updatecheck_interval*60*1e3)}else{Miniflux.App.Log("Frontend updatecheck disabled")}};request.open("POST","?action=get-config",true);request.send(JSON.stringify(["frontend_updatecheck_interval"]))}}}();Miniflux.Feed=function(){var queue=[];var queue_length=5;var updateInterval=null;var feeds=[];return{Update:function(feed,callback){var itemsCounter=feed.querySelector("span.items-count");if(!itemsCounter)return;var feed_id=feed.getAttribute("data-feed-id");var heading=feed.querySelector("h2:first-of-type");heading.className="loading-icon";var request=new XMLHttpRequest;request.onload=function(){heading.className="";feed.removeAttribute("data-feed-error");var lastChecked=feed.querySelector(".feed-last-checked");if(lastChecked){lastChecked.innerHTML=lastChecked.getAttribute("data-after-update")}var response=JSON.parse(this.responseText);if(response.result){itemsCounter.innerHTML=response.items_count.items_unread+"/"+response.items_count.items_total}else{feed.setAttribute("data-feed-error","1");var errorMessageElement=feed.querySelector(".feed-parsing-error");if(errorMessageElement){errorMessageElement.innerHTML=response.feed.parsing_error_message}}if(callback){callback(response)}else{Miniflux.Item.CheckForUpdates()}};request.open("POST","?action=refresh-feed&feed_id="+feed_id,true);request.send()},UpdateAll:function(nb_concurrent_requests){feeds=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])"));if(nb_concurrent_requests){queue_length=nb_concurrent_requests}updateInterval=setInterval(function(){while(feeds.length>0&&queue.length=0)queue.splice(index,1);if(feeds.length===0&&queue.length===0){clearInterval(updateInterval);Miniflux.Item.CheckForUpdates()}}}}();Miniflux.Item=function(){var latest_feeds_items={};var unreadItems=false;var nbUnreadItems=function(){var navCounterElement=document.getElementById("nav-counter");if(navCounterElement){return parseInt(navCounterElement.textContent,10)||0}}();var nbPageItems=function(){var pageCounterElement=document.getElementById("page-counter");if(pageCounterElement){return parseInt(pageCounterElement.textContent,10)||0}}();function simulateMouseClick(element){var event=document.createEvent("MouseEvents");event.initEvent("mousedown",true,true);element.dispatchEvent(event);event=document.createEvent("MouseEvents");event.initEvent("mouseup",true,true);element.dispatchEvent(event);element.click()}function getItemID(item){return item.getAttribute("data-item-id")}function changeLabel(links){if(links.length===0){return}for(var i=0;i-1&&nbUnreadItems>0){window.location.href="?action=unread"}else if(nbPageItems===0){window.location.reload()}var pageCounterElement=document.getElementById("page-counter");if(pageCounterElement)pageCounterElement.textContent=nbPageItems||"";var navCounterElement=document.getElementById("nav-counter");navCounterElement.textContent=nbUnreadItems||"";var pageHeadingElement=document.querySelector("div.page-header h2:first-of-type");if(pageHeadingElement){pageHeading=pageHeadingElement.firstChild.nodeValue}else{var itemHeading=document.querySelector("article.item h1:first-of-type");if(itemHeading){document.title=itemHeading.textContent;return}}var sectionElement=document.querySelector("section.page");switch(sectionElement.getAttribute("data-item-page")){case"unread":document.title="Miniflux ("+nbUnreadItems+")";break;case"feed-items":document.title="("+nbPageItems+") "+pageHeading;break;default:if(pageCounterElement){document.title=pageHeading+" ("+nbPageItems+")"}else{document.title=pageHeading}break}}function markAsRead(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){showItemAsRead(item);updateCounters()}};request.open("POST","?action=mark-item-read&id="+item_id,true);request.send()}function markAsUnread(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){showItemAsUnread(item);updateCounters()}};request.open("POST","?action=mark-item-unread&id="+item_id,true);request.send()}function markAsRemoved(item){var item_id=getItemID(item);var request=new XMLHttpRequest;request.onload=function(){if(Miniflux.Nav.IsListing()){hideItem(item);if(item.getAttribute("data-item-status")==="unread")nbUnreadItems--;updateCounters()}};request.open("POST","?action=mark-item-removed&id="+item_id,true);request.send()}return{MarkAsRead:markAsRead,MarkAsUnread:markAsUnread,MarkAsRemoved:markAsRemoved,SwitchBookmark:function(item){var item_id=getItemID(item);var value=item.getAttribute("data-item-bookmark")==="1"?"0":"1";var request=new XMLHttpRequest;request.onload=function(){var sectionElement=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&§ionElement.getAttribute("data-item-page")==="bookmarks"){hideItem(item);updateCounters()}else{item.setAttribute("data-item-bookmark",value);changeBookmarkLabel(item)}};request.open("POST","?action=bookmark&id="+item_id+"&value="+value,true);request.send()},SwitchStatus:function(item){var status=item.getAttribute("data-item-status");if(status==="read"){markAsUnread(item)}else if(status==="unread"){markAsRead(item)}},Show:function(item){var link=item.querySelector("a.show");if(link)simulateMouseClick(link)},OpenOriginal:function(item){var link=item.querySelector("a.original");if(link){simulateMouseClick(link)}},DownloadContent:function(item){var container=document.getElementById("download-item");if(!container)return;container.innerHTML=" "+container.getAttribute("data-before-message");container.className="loading-icon";var request=new XMLHttpRequest;request.onload=function(){var response=JSON.parse(request.responseText);container.className="";if(response.result){var content=document.getElementById("item-content");if(content)content.innerHTML=response.content;container.innerHTML=container.getAttribute("data-after-message")}else{container.innerHTML=container.getAttribute("data-failure-message")}};var item_id=getItemID(item);request.open("POST","?action=download-item&id="+item_id,true);request.send()},MarkFeedAsRead:function(feed_id){var request=new XMLHttpRequest;request.onload=function(){var articles=document.getElementsByTagName("article");for(var i=0,ilen=articles.length;ilatest_feeds_items[feed_id]){latest_feeds_items[feed_id]=current_feed.updated;current_unread=true}}Miniflux.App.Log("first_run: "+first_run+", current_unread: "+current_unread+", response.nbUnread: "+response.nbUnread+", nbUnreadItems: "+nbUnreadItems);if(!document.hidden&&(response.nb_unread_items!==nbUnreadItems||unreadItems)){Miniflux.App.Log("Counter changed! Updating unread counter.");unreadItems=false;nbUnreadItems=response.nb_unread_items;updateCounters()}else if(document.hidden&&!first_run&¤t_unread){Miniflux.App.Log("New Unread! Updating pagetitle.");unreadItems=true;document.title="↻ "+document.title}else{Miniflux.App.Log("No update.")}Miniflux.App.Log("unreadItems: "+unreadItems)};request.open("GET","?action=latest-feeds-items",true);request.send()}}}();Miniflux.Event=function(){var queue=[];function isEventIgnored(e){if(e.keyCode!==63&&e.which!==63&&(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)){return true}var target=e.target||e.srcElement;return target.tagName==="INPUT"||target.tagName==="TEXTAREA"}return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(e){if(e.target.hasAttribute("data-action")&&e.target.className!=="original"){e.preventDefault()}};document.onmouseup=function(e){if(e.button===2){return}if(e.target.nodeName==="INPUT"&&e.target.className==="auto-select"){e.target.select();return}var action=e.target.getAttribute("data-action");if(action){Miniflux.Event.lastEventType="mouse";var currentItem=function(){var element=e.target;while(element&&element.parentNode){element=element.parentNode;if(element.tagName&&element.tagName.toLowerCase()==="article"){return element}}}();switch(action){case"refresh-all":Miniflux.Feed.UpdateAll(e.target.getAttribute("data-concurrent-requests"));break;case"refresh-feed":if(currentItem){Miniflux.Feed.Update(currentItem)}break;case"mark-read":if(currentItem){Miniflux.Item.MarkAsRead(currentItem)}break;case"mark-unread":if(currentItem){Miniflux.Item.MarkAsUnread(currentItem)}break;case"mark-removed":if(currentItem){Miniflux.Item.MarkAsRemoved(currentItem)}break;case"bookmark":if(currentItem){Miniflux.Item.SwitchBookmark(currentItem)}break;case"download-item":if(currentItem){Miniflux.Item.DownloadContent(currentItem)}break;case"mark-feed-read":var feed_id=document.getElementById("listing").getAttribute("data-feed-id");Miniflux.Item.MarkFeedAsRead(feed_id);break;case"close-help":Miniflux.Nav.CloseHelp();break;case"show-search":Miniflux.Nav.ShowSearch();break;case"toggle-menu-more":Miniflux.Nav.ToggleMenuMore();break}}}},ListenKeyboardEvents:function(){document.onkeypress=function(e){if(isEventIgnored(e)){return}Miniflux.Event.lastEventType="keyboard";queue.push(e.key||e.which);if(queue[0]==="g"||queue[0]===103){switch(queue[1]){case undefined:break;case"u":case 117:window.location.href="?action=unread";queue=[];break;case"b":case 98:window.location.href="?action=bookmarks";queue=[];break;case"h":case 104:window.location.href="?action=history";queue=[];break;case"s":case 115:window.location.href="?action=feeds";queue=[];break;case"p":case 112:window.location.href="?action=config";queue=[];break;default:queue=[];break}}else{queue=[];var currentItem=function(){return document.getElementById("current-item")}();switch(e.key||e.which){case"d":case 100:if(currentItem){Miniflux.Item.DownloadContent(currentItem)}break;case"p":case 112:case"k":case 107:Miniflux.Nav.SelectPreviousItem();break;case"n":case 110:case"j":case 106:Miniflux.Nav.SelectNextItem();break;case"v":case 118:if(currentItem){Miniflux.Item.OpenOriginal(currentItem)}break;case"o":case 111:if(currentItem){Miniflux.Item.Show(currentItem)}break;case"m":case 109:if(currentItem){Miniflux.Item.SwitchStatus(currentItem)}break;case"f":case 102:if(currentItem){Miniflux.Item.SwitchBookmark(currentItem)}break;case"h":case 104:Miniflux.Nav.OpenPreviousPage();break;case"l":case 108:Miniflux.Nav.OpenNextPage();break;case"r":case 114:Miniflux.Feed.UpdateAll();break;case"?":case 63:Miniflux.Nav.ShowHelp();break;case"Q":case 81:case"q":case 113:Miniflux.Nav.CloseHelp();break;case"z":case 122:Miniflux.Item.ToggleRTLMode();break}}};document.onkeydown=function(e){if(isEventIgnored(e)){return}Miniflux.Event.lastEventType="keyboard";switch(e.key||e.which){case"ArrowLeft":case"Left":case 37:Miniflux.Nav.SelectPreviousItem();break;case"ArrowRight":case"Right":case 39:Miniflux.Nav.SelectNextItem();break;case"/":case 191:e.preventDefault();e.stopPropagation();Miniflux.Nav.ShowSearch();break}}},ListenVisibilityEvents:function(){document.addEventListener("visibilitychange",function(){Miniflux.App.Log("document.visibilityState: "+document.visibilityState);if(!document.hidden&&Miniflux.Item.hasNewUnread()){Miniflux.App.Log("Need to update the unread counter with fresh values from the database");Miniflux.Item.CheckForUpdates()}})},ListenTouchEvents:function(){var touches=null;var resetTouch=function(){if(touches&&touches.element){touches.element.style.opacity=1;touches.element.style.transform=""}touches={touchstart:{x:-1,y:-1},touchmove:{x:-1,y:-1},touchend:false,direction:"undetermined",swipestarted:false,element:null}};var horizontalSwipe=function(){if(touches.touchstart.x>-1&&touches.touchmove.x>-1&&(touches.touchmove.x-touches.touchstart.x>30||touches.swipestarted)&&Math.abs(touches.touchmove.y-touches.touchstart.y)<75){touches.swipestarted=true;return touches.touchmove.x-touches.touchstart.x}return 0};var closest=function(el,fn){return el&&(fn(el)?el:closest(el.parentNode,fn))};var getTouchElement=function(){return touches.element?touches.element:closest(document.elementFromPoint(touches.touchstart.x,touches.touchstart.y),function(el){return el.tagName==="ARTICLE"})};var drawElement=function(){if(touches&&(touches.touchend===true||touches.touchstart.x==-1)){return}if(touches.element===null){touches.element=getTouchElement()}var swipedistance=horizontalSwipe();if(swipedistance>0){var element=getTouchElement();if(!element){resetTouch();return}touches.element.style.opacity=1-(swipedistance>75?.9:swipedistance/75*.9);touches.element.style.transform="translateX("+(swipedistance>75?75:swipedistance)+"px)";touches.element=element}window.requestAnimationFrame(drawElement)};var touchHandler=function(e){if(typeof e.touches!="undefined"&&e.touches.length<=1){var touch=e.touches[0];var swipedistance=null;var element=null;switch(e.type){case"touchstart":resetTouch();touches[e.type].x=touch.clientX;touches[e.type].y=touch.clientY;drawElement();break;case"touchmove":touches[e.type].x=touch.clientX;touches[e.type].y=touch.clientY;break;case"touchend":touches[e.type]=true;element=getTouchElement();swipedistance=horizontalSwipe();if(swipedistance>75){if(element){Miniflux.Item.MarkAsRead(element)}if(!element.getAttribute("data-hide")){resetTouch()}}else{resetTouch()}break;case"touchcancel":resetTouch();break;default:break}}else{resetTouch()}};resetTouch();document.addEventListener("touchstart",touchHandler,false);document.addEventListener("touchmove",touchHandler,false);document.addEventListener("touchend",touchHandler,false);document.addEventListener("touchcancel",touchHandler,false)}}}();Miniflux.Nav=function(){function scrollPageTo(item){var clientHeight=pageYOffset+document.documentElement.clientHeight;var itemPosition=item.offsetTop+item.offsetHeight;if(clientHeight-itemPosition<0||clientHeight-item.offsetTop>document.documentElement.clientHeight){window.scrollTo(0,item.offsetTop-10)}}function findNextItem(){var items=document.getElementsByTagName("article");if(!document.getElementById("current-item")){items[0].id="current-item";scrollPageTo(items[0])}else{for(var i=0,ilen=items.length;i=0;i--){if(items[i].id==="current-item"){if(i-1>=0){items[i].id="item-"+items[i].getAttribute("data-item-id");items[i-1].id="current-item";scrollPageTo(items[i-1])}break}}}}function isListing(){return!!document.getElementById("listing")}return{OpenNextPage:function(){var link=document.getElementById("next-page");if(link)link.click()},OpenPreviousPage:function(){var link=document.getElementById("previous-page");if(link)link.click()},SelectNextItem:function(){var link=document.getElementById("next-item");if(link){link.click()}else if(isListing()){findNextItem()}},SelectPreviousItem:function(){var link=document.getElementById("previous-item");if(link){link.click()}else if(isListing()){findPreviousItem()}},ShowHelp:function(){var help_layer=document.getElementById("help-layer");help_layer.removeAttribute("class")},CloseHelp:function(){var help_layer=document.getElementById("help-layer");help_layer.setAttribute("class","hide")},ShowSearch:function(){document.getElementById("search-opener").setAttribute("class","hide");document.getElementById("search-form").removeAttribute("class");document.getElementById("form-text").focus()},ToggleMenuMore:function(){var menu=document.getElementById("menu-more");if(menu.hasAttribute("class")){menu.removeAttribute("class")}else{menu.setAttribute("class","hide")}},IsListing:isListing}}(); Miniflux.App.Run(); diff --git a/assets/js/src/event.js b/assets/js/src/event.js index 8ac8e3d..b329a0f 100644 --- a/assets/js/src/event.js +++ b/assets/js/src/event.js @@ -251,20 +251,10 @@ Miniflux.Event = (function() { case 39: Miniflux.Nav.SelectNextItem(); break; - } - }; - - document.onkeyup = function(e) { - - if (isEventIgnored(e)) { - return; - } - - Miniflux.Event.lastEventType = "keyboard"; - - switch (e.key || e.which) { case '/': - case 47: + case 191: + e.preventDefault(); + e.stopPropagation(); Miniflux.Nav.ShowSearch(); break; }