Apply some customization

This commit is contained in:
uohlhv 2021-11-01 23:10:53 +08:00
parent 791b998489
commit 3c806a5b2b
6 changed files with 49 additions and 29 deletions

View File

@ -1875,7 +1875,7 @@ class Feeds extends Handler_Protected {
$sum = 0; $sum = 0;
for ($i = 0; $i < strlen($name); $i++) { for ($i = 0; $i < strlen($name); $i++) {
$sum += ord($name{$i}); $sum += ord($name[$i]);
} }
$sum %= count($colormap); $sum %= count($colormap);

View File

@ -190,7 +190,7 @@ img.img_card_preview {
} }
.toolbar-hide { .toolbar-hide {
visibility: hidden !important; visibility: visible !important;
} }
.dijitMenuPopup { .dijitMenuPopup {

View File

@ -205,7 +205,7 @@ function _color_unpack($hex, $normalize = false) {
if (strlen($hex) == 4) { if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
} $c = hexdec($hex); } $c = hexdec(ltrim($hex, '#'));
for ($i = 16; $i >= 0; $i -= 8) { for ($i = 16; $i >= 0; $i -= 8) {
$out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1); $out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1);
} return $out; } return $out;

View File

@ -431,7 +431,14 @@ define(["dojo/_base/declare"], function (declare) {
}); });
}, },
catchupCurrent: function(mode) { catchupCurrent: function(mode) {
this.catchupFeed(this.getActive(), this.activeIsCat(), mode); Headlines.select('unread');
Headlines.selectionToggleUnread({ no_error: 1 });
let _feeds = this;
setTimeout(function() {
if (_feeds.getActive() != undefined) {
_feeds.open({feed: _feeds.getActive(), is_cat: _feeds.activeIsCat()});
}
}, 1000);
}, },
catchupFeedInGroup: function(id) { catchupFeedInGroup: function(id) {
const title = this.getName(id); const title = this.getName(id);

View File

@ -1,6 +1,11 @@
'use strict'; 'use strict';
/* global __, ngettext */ /* global __, ngettext */
define(["dojo/_base/declare"], function (declare) { define(["dojo/_base/declare"], function (declare) {
function decodeHTMLEntities(text) {
var textArea = document.createElement('textarea');
textArea.innerHTML = text;
return textArea.value;
}
var img_preview_elem = document.createElement('div'); var img_preview_elem = document.createElement('div');
img_preview_elem.style.display = 'none'; img_preview_elem.style.display = 'none';
document.body.appendChild(img_preview_elem); document.body.appendChild(img_preview_elem);
@ -191,7 +196,7 @@ define(["dojo/_base/declare"], function (declare) {
//console.log("Article.getActive(): " + Article.getActive()); //console.log("Article.getActive(): " + Article.getActive());
//console.log("App.getInitParam('cdm_expanded'): " + App.getInitParam("cdm_expanded")); //console.log("App.getInitParam('cdm_expanded'): " + App.getInitParam("cdm_expanded"));
//console.log("App.getViewMode(): " + App.getViewMode()); //console.log("App.getViewMode(): " + App.getViewMode());
if (id != Article.getActiveHeadline() && ((event.ctrlKey || event.shiftKey) || App.getViewMode() == "full")) { if (id != Article.getActiveHeadline() && ((event.ctrlKey || event.shiftKey) || App.getViewMode() == "full")) {
Article.setActiveHeadline(id); Article.setActiveHeadline(id);
Article.openInNewWindow(id); Article.openInNewWindow(id);
@ -440,11 +445,11 @@ define(["dojo/_base/declare"], function (declare) {
if (App.isCombinedMode()) { if (App.isCombinedMode()) {
row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable"; row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable";
img_preview_elem.innerHTML = hl.content; img_preview_elem.innerHTML = decodeHTMLEntities(hl.content) + decodeHTMLEntities(hl.enclosures);
var img_preview_src = 'images/blank_icon.gif'; var img_preview_src = 'images/blank_icon.gif';
var imgs = img_preview_elem.querySelectorAll('img'); var imgs = img_preview_elem.querySelectorAll('img');
for (var i = 0; i < imgs.length; i++) { for (var i = 0; i < imgs.length; i++) {
if (imgs[i].src && imgs[i].src.match(/\.(thumb|jpeg|jpg|gif|png)(\?|$)/i) != null) { if (imgs[i].src) {
img_preview_src = imgs[i].src; img_preview_src = imgs[i].src;
break; break;
} }
@ -454,7 +459,7 @@ define(["dojo/_base/declare"], function (declare) {
const originally_from = Article.formatOriginallyFrom(hl); const originally_from = Article.formatOriginallyFrom(hl);
var author_display = hl.feed_title; var author_display = hl.feed_title;
if (hl.feed_title == "") if (hl.feed_title == "")
author_display = hl.author; author_display = hl.author;
this.fullArticles[hl.id] = `<div class="header"> this.fullArticles[hl.id] = `<div class="header">
@ -473,8 +478,8 @@ define(["dojo/_base/declare"], function (declare) {
&mdash; ${hl.author} &mdash; ${hl.author}
</span> </span>
${hl.labels} ${hl.labels}
<div class="right grid-right"> <div class="right grid-right">
<i class="material-icons icon-score" title="${hl.score}" score-id="score-content-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" score-id="score-content-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span class="updated" title="${hl.imported}">${hl.updated}</span> <span class="updated" title="${hl.imported}">${hl.updated}</span>
</div> </div>
@ -486,20 +491,20 @@ define(["dojo/_base/declare"], function (declare) {
<div id="slide-content-{hl.id}" class="content-inner" lang="${hl.lang ? hl.lang : 'en'}"> <div id="slide-content-{hl.id}" class="content-inner" lang="${hl.lang ? hl.lang : 'en'}">
[[CONTENT]] [[CONTENT]]
</div> </div>
<div class="intermediate"> <div class="intermediate">
${hl.enclosures} ${hl.enclosures}
</div> </div>
<div class="footer" onclick="event.stopPropagation()"> <div class="footer" onclick="event.stopPropagation()">
<div class="left"> <div class="left">
${hl.buttons_left} ${hl.buttons_left}
<i class="material-icons">label_outline</i> <i class="material-icons">label_outline</i>
<span id="ATSTR-${hl.id}">${hl.tags_str}</span> <span id="ATSTR-${hl.id}">${hl.tags_str}</span>
<a title="${__("Edit tags for this article")}" href="#" <a title="${__("Edit tags for this article")}" href="#"
onclick="Article.editTags(${hl.id})">(+)</a> onclick="Article.editTags(${hl.id})">(+)</a>
${comments} ${comments}
</div> </div>
<div class="right"> <div class="right">
${originally_from} ${originally_from}
${hl.buttons} ${hl.buttons}
@ -531,8 +536,8 @@ define(["dojo/_base/declare"], function (declare) {
&mdash; ${author_display} &mdash; ${author_display}
</a> </a>
${hl.labels} ${hl.labels}
<div class="right grid-right"> <div class="right grid-right">
<i class="material-icons icon-score" title="${hl.score}" score-id="score-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" score-id="score-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span class="updated" title="${hl.imported}">${hl.updated}</span> <span class="updated" title="${hl.imported}">${hl.updated}</span>
</div> </div>
@ -570,8 +575,8 @@ define(["dojo/_base/declare"], function (declare) {
&mdash; ${author_display} &mdash; ${author_display}
</a> </a>
${hl.labels} ${hl.labels}
<div class="right grid-right"> <div class="right grid-right">
<i class="material-icons icon-score" title="${hl.score}" score-id="score-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" score-id="score-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span class="updated" title="${hl.imported}">${hl.updated}</span> <span class="updated" title="${hl.imported}">${hl.updated}</span>
</div> </div>
@ -604,8 +609,8 @@ define(["dojo/_base/declare"], function (declare) {
&mdash; ${hl.author} &mdash; ${hl.author}
</span> </span>
${hl.labels} ${hl.labels}
<div class="right grid-right"> <div class="right grid-right">
<i class="material-icons icon-score" title="${hl.score}" score-id="score-content-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> <i class="material-icons icon-score" title="${hl.score}" score-id="score-content-${hl.id}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
<span class="updated" title="${hl.imported}">${hl.updated}</span> <span class="updated" title="${hl.imported}">${hl.updated}</span>
</div> </div>
@ -617,20 +622,20 @@ define(["dojo/_base/declare"], function (declare) {
<div id="slide-content-{hl.id}" class="content-inner" lang="${hl.lang ? hl.lang : 'en'}"> <div id="slide-content-{hl.id}" class="content-inner" lang="${hl.lang ? hl.lang : 'en'}">
[[CONTENT]] [[CONTENT]]
</div> </div>
<div class="intermediate"> <div class="intermediate">
${hl.enclosures} ${hl.enclosures}
</div> </div>
<div class="footer" onclick="event.stopPropagation()"> <div class="footer" onclick="event.stopPropagation()">
<div class="left"> <div class="left">
${hl.buttons_left} ${hl.buttons_left}
<i class="material-icons">label_outline</i> <i class="material-icons">label_outline</i>
<span id="ATSTR-${hl.id}">${hl.tags_str}</span> <span id="ATSTR-${hl.id}">${hl.tags_str}</span>
<a title="${__("Edit tags for this article")}" href="#" <a title="${__("Edit tags for this article")}" href="#"
onclick="Article.editTags(${hl.id})">(+)</a> onclick="Article.editTags(${hl.id})">(+)</a>
${comments} ${comments}
</div> </div>
<div class="right"> <div class="right">
${originally_from} ${originally_from}
${hl.buttons} ${hl.buttons}
@ -640,7 +645,7 @@ define(["dojo/_base/declare"], function (declare) {
</div>`; </div>`;
} }
} else { } else {
row = `<div class="hl ${row_class} ${Article.getScoreClass(hl.score)}" data-orig-feed-id="${hl.feed_id}" data-article-id="${hl.id}" id="RROW-${hl.id}" row = `<div class="hl ${row_class} ${Article.getScoreClass(hl.score)}" data-orig-feed-id="${hl.feed_id}" data-article-id="${hl.id}" id="RROW-${hl.id}"
data-score="${hl.score}" onmouseover="Article.mouseIn(${hl.id})" onmouseout="Article.mouseOut(${hl.id})"> data-score="${hl.score}" onmouseover="Article.mouseIn(${hl.id})" onmouseout="Article.mouseOut(${hl.id})">
<div class="left"> <div class="left">
<input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'> <input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'>
@ -753,9 +758,9 @@ define(["dojo/_base/declare"], function (declare) {
for (let i = 0; i < reply['headlines']['content'].length; i++) { for (let i = 0; i < reply['headlines']['content'].length; i++) {
const hl = reply['headlines']['content'][i]; const hl = reply['headlines']['content'][i];
$("headlines-frame").appendChild(this.render(reply['headlines'], hl)); $("headlines-frame").appendChild(this.render(reply['headlines'], hl));
//if (App.getViewMode() == "cards") { //if (App.getViewMode() == "cards") {
//Headlines.card_count++; //Headlines.card_count++;
//if (Headlines.card_count == 1) { //if (Headlines.card_count == 1) {
@ -1051,12 +1056,11 @@ define(["dojo/_base/declare"], function (declare) {
elem.innerHTML = ngettext("%d article selected", elem.innerHTML = ngettext("%d article selected",
"%d articles selected", count).replace("%d", count); "%d articles selected", count).replace("%d", count);
if (count > 0) { if (count > 0) {
changeStyle('.toolbar-hide', 'visibility', 'visible'); changeStyle('.toolbar-hide', 'visibility', 'visible');
document.getElementById('more-button').style.visibility = 'hidden'; document.getElementById('more-button').style.visibility = 'hidden';
Element.show(elem); Element.show(elem);
} else { } else {
changeStyle('.toolbar-hide', 'visibility', 'hidden');
document.getElementById('more-button').style.visibility = 'visible'; document.getElementById('more-button').style.visibility = 'visible';
Element.hide(elem); Element.hide(elem);
} }

View File

@ -567,6 +567,15 @@ require(["dojo/_base/kernel",
this.hotkey_actions["toggle_night_mode"] = function () { this.hotkey_actions["toggle_night_mode"] = function () {
App.toggleNightMode(); App.toggleNightMode();
}; };
this.hotkey_actions['mark_all_as_read'] = function () {
Headlines.select('unread');
Headlines.selectionToggleUnread({ no_error: 1 });
setTimeout(function() {
if (Feeds.getActive() != undefined) {
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()});
}
}, 1000);
};
}, },
onActionSelected: function(opid) { onActionSelected: function(opid) {
switch (opid) { switch (opid) {