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);
@ -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;
} }
@ -1056,7 +1061,6 @@ define(["dojo/_base/declare"], function (declare) {
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) {