From 191ef2b4c0ae1dea833269b778a963a4f203b057 Mon Sep 17 00:00:00 2001 From: poire-z Date: Thu, 14 Mar 2024 00:16:09 +0100 Subject: [PATCH] =?UTF-8?q?Book=20style=20tweak:=20add=20more=20suggestion?= =?UTF-8?q?s=20in=20"CSS=20=E2=89=A1"=20(#11533)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/reader/modules/readerstyletweak.lua | 209 ++++++++++++++++-- 1 file changed, 196 insertions(+), 13 deletions(-) diff --git a/frontend/apps/reader/modules/readerstyletweak.lua b/frontend/apps/reader/modules/readerstyletweak.lua index bb80a8e64..5dd6cef55 100644 --- a/frontend/apps/reader/modules/readerstyletweak.lua +++ b/frontend/apps/reader/modules/readerstyletweak.lua @@ -1,5 +1,6 @@ local BD = require("ui/bidi") local Blitbuffer = require("ffi/blitbuffer") +local ButtonDialog = require("ui/widget/buttondialog") local ButtonTable = require("ui/widget/buttontable") local CenterContainer = require("ui/widget/container/centercontainer") local CssTweaks = require("ui/data/css_tweaks") @@ -783,13 +784,125 @@ local BOOK_TWEAK_INPUT_HINT = T([[ %2]], _("You can add CSS snippets which will be applied only to this book."), BOOK_TWEAK_SAMPLE_CSS) local CSS_SUGGESTIONS = { - { "-cr-hint: footnote-inpage;", _("When set on a block element containing the target id of a href, this block element will be shown as an in-page footnote.")}, - { "-cr-hint: non-linear-combining;", _("Can be set on some specific DocFragments (ie. DocFragment[id*=16]) to ignore them in the linear pages flow.")}, - { "-cr-hint: toc-level1;", _("When set on an element, its text can be used to build the alternative table of contents.")}, - { "display: run-in !important;", _("When set on a block element, this element content will be inlined with the next block element.")}, - { "font-size: 1rem !important;", _("1rem will enforce your main font size.")}, - { "hyphens: none !important;", _("Disables hyphenation inside the targeted elements.")}, - { "text-indent: 1.2em !important;", _("1.2em is our default text indentation.")}, + { _("Long-press for info ⓘ"), _([[ +This popup menu provides a quick CSS cheat sheet, showing common selector syntax and classic CSS properties. +It also shows some KOReader-specific non-standard CSS features, that can be useful with e-books. + +Most of these CSS bits are used by our categorized Style tweaks in the top menu: look there and long-press on a style tweak to see its CSS code and a description of what it does. +If these are not enough to trigger what you want, you may need to adapt them: tap on their CSS code to copy it to the clipboard. You can then paste it here and edit it. + +Long-press on any item in this popup to get more information on what it does and what it can help solving. + +Tap on the item to insert it: you can then edit it and combine it with others.]]), true }, + + { _("Matching elements"), { + { "p.className", _([[ +p.className matches a

with class='className'. + +*.className matches any element with class='className'. + +p:not([class]) matches a

without any class= attribute.]])}, + { "aside > p", _([[ +aside > p matches a

children of an