Compare commits

...

6 Commits

Author SHA1 Message Date
Alex Ling f7b8e2d852 Bump version to v0.17.1 2020-12-27 09:46:14 +00:00
Alex Ling 946017c8bd Fix function redeclaration 2020-12-27 09:42:06 +00:00
Alex Ling ec5256dabd Improve batch mark UX (#97) 2020-12-27 09:42:06 +00:00
Alex Ling 4e707076a1 By default use the system theme setting (#111) 2020-12-27 09:42:06 +00:00
Alex Ling 66a3cc268b Merge branch 'master' into dev 2020-12-26 09:34:23 +00:00
Alex Ling 96949905b9 Cache entry display names
This improves the title page load time (#116)
2020-12-26 09:32:03 +00:00
8 changed files with 19 additions and 35 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ The official docker images are available on [Dockerhub](https://hub.docker.com/r
### CLI ### CLI
``` ```
Mango - Manga Server and Web Reader. Version 0.17.0 Mango - Manga Server and Web Reader. Version 0.17.1
Usage: Usage:
-22
View File
@@ -22,28 +22,6 @@ const capitalize = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1); return str.charAt(0).toUpperCase() + str.slice(1);
}; };
/**
* Set an alpine.js property
*
* @function setProp
* @param {string} key - Key of the data property
* @param {*} prop - The data property
*/
const setProp = (key, prop) => {
$('#root').get(0).__x.$data[key] = prop;
};
/**
* Get an alpine.js property
*
* @function getProp
* @param {string} key - Key of the data property
* @return {*} The data property
*/
const getProp = (key) => {
return $('#root').get(0).__x.$data[key];
};
/** /**
* Get the thumbnail generation progress from the API * Get the thumbnail generation progress from the API
* *
+2 -2
View File
@@ -63,7 +63,7 @@ const validThemeSetting = (theme) => {
*/ */
const loadThemeSetting = () => { const loadThemeSetting = () => {
let str = localStorage.getItem('theme'); let str = localStorage.getItem('theme');
if (!str || !validThemeSetting(str)) str = 'light'; if (!str || !validThemeSetting(str)) str = 'system';
return str; return str;
}; };
@@ -88,7 +88,7 @@ const loadTheme = () => {
* @param {string} setting - A theme setting * @param {string} setting - A theme setting
*/ */
const saveThemeSetting = setting => { const saveThemeSetting = setting => {
if (!validThemeSetting(setting)) setting = 'light'; if (!validThemeSetting(setting)) setting = 'system';
localStorage.setItem('theme', setting); localStorage.setItem('theme', setting);
}; };
+1 -1
View File
@@ -1,5 +1,5 @@
name: mango name: mango
version: 0.17.0 version: 0.17.1
authors: authors:
- Alex Ling <hkalexling@gmail.com> - Alex Ling <hkalexling@gmail.com>
+11 -6
View File
@@ -3,7 +3,8 @@ require "../archive"
class Title class Title
property dir : String, parent_id : String, title_ids : Array(String), property dir : String, parent_id : String, title_ids : Array(String),
entries : Array(Entry), title : String, id : String, entries : Array(Entry), title : String, id : String,
encoded_title : String, mtime : Time encoded_title : String, mtime : Time,
entry_display_name_cache : Hash(String, String)?
def initialize(@dir : String, @parent_id, storage, def initialize(@dir : String, @parent_id, storage,
@library : Library) @library : Library)
@@ -129,13 +130,17 @@ class Title
end end
def display_name(entry_name) def display_name(entry_name)
dn = entry_name unless @entry_display_name_cache
TitleInfo.new @dir do |info| TitleInfo.new @dir do |info|
info_dn = info.entry_display_name[entry_name]? @entry_display_name_cache = info.entry_display_name
unless info_dn.nil? || info_dn.empty?
dn = info_dn
end end
end end
dn = entry_name
info_dn = @entry_display_name_cache.not_nil![entry_name]?
unless info_dn.nil? || info_dn.empty?
dn = info_dn
end
dn dn
end end
+1 -1
View File
@@ -7,7 +7,7 @@ require "option_parser"
require "clim" require "clim"
require "./plugin/*" require "./plugin/*"
MANGO_VERSION = "0.17.0" MANGO_VERSION = "0.17.1"
# From http://www.network-science.de/ascii/ # From http://www.network-science.de/ascii/
BANNER = %{ BANNER = %{
+2 -1
View File
@@ -35,7 +35,7 @@
onclick="location='<%= base_url %>book/<%= item.id %>'" onclick="location='<%= base_url %>book/<%= item.id %>'"
<% end %>> <% end %>>
<div class="uk-card uk-card-default" x-data="{selected: false, hover: false, disabled: true}" :class="{selected: selected}" <div class="uk-card uk-card-default" x-data="{selected: false, hover: false, disabled: true, selecting: false}" :class="{selected: selected}" @count.window="selecting = $event.detail.count > 0"
<% if page == "title" && item.is_a?(Entry) && item.err_msg.nil? %> <% if page == "title" && item.is_a?(Entry) && item.err_msg.nil? %>
x-init="disabled = false" x-init="disabled = false"
<% end %>> <% end %>>
@@ -45,6 +45,7 @@
class="grayscale" class="grayscale"
<% end %>> <% end %>>
<div class="uk-overlay-primary uk-position-cover" x-show="!disabled && (selected || hover)"> <div class="uk-overlay-primary uk-position-cover" x-show="!disabled && (selected || hover)">
<div class="uk-height-1-1 uk-width-1-1" x-show="selecting" @click.stop="selected = !selected; $dispatch(selected ? 'add' : 'remove')"></div>
<div class="uk-position-center"> <div class="uk-position-center">
<span class="fas fa-check-circle fa-3x" @click.stop="selected = !selected; $dispatch(selected ? 'add' : 'remove')" :style="`color:${selected && 'orange'};`"></span> <span class="fas fa-check-circle fa-3x" @click.stop="selected = !selected; $dispatch(selected ? 'add' : 'remove')" :style="`color:${selected && 'orange'};`"></span>
</div> </div>
+1 -1
View File
@@ -1,5 +1,5 @@
<div> <div>
<div id="select-bar" class="uk-card uk-card-body uk-card-default uk-margin-bottom" uk-sticky="offset:10" x-data="{count: 0}" @add.window="count++" @remove.window="count--" x-show="count > 0" style="border:orange;border-style:solid;" x-cloak data-id="<%= title.id %>"> <div id="select-bar" class="uk-card uk-card-body uk-card-default uk-margin-bottom" uk-sticky="offset:10" x-data="{count: 0}" @add.window="count++; $dispatch('count', {count: count})" @remove.window="count--; $dispatch('count', {count: count})" x-show="count > 0" style="border:orange;border-style:solid;" x-cloak data-id="<%= title.id %>">
<div class="uk-child-width-1-3" uk-grid> <div class="uk-child-width-1-3" uk-grid>
<div> <div>
<p x-text="count + ' items selected'" style="color:orange"></p> <p x-text="count + ' items selected'" style="color:orange"></p>