From b2e7b8b6005b0f4493bfd69e6f0a981bd16f09d9 Mon Sep 17 00:00:00 2001 From: Fabien LOISON Date: Mon, 23 Apr 2018 19:11:24 +0200 Subject: Highlight code in articles using highlight.js --- app/Resources/static/themes/_global/index.js | 4 +++- app/Resources/static/themes/_global/js/highlight.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 app/Resources/static/themes/_global/js/highlight.js (limited to 'app/Resources/static') diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index fddb476d..7f7e87c0 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js @@ -13,8 +13,10 @@ import './global.scss'; import './js/shortcuts/entry'; import './js/shortcuts/main'; -import { savePercent, retrievePercent } from './js/tools'; +/* Hightlight */ +import './js/highlight'; +import { savePercent, retrievePercent } from './js/tools'; /* ========================================================================== Annotations & Remember position diff --git a/app/Resources/static/themes/_global/js/highlight.js b/app/Resources/static/themes/_global/js/highlight.js new file mode 100644 index 00000000..4025fc14 --- /dev/null +++ b/app/Resources/static/themes/_global/js/highlight.js @@ -0,0 +1,8 @@ +import 'highlight.js/styles/atom-one-light.css'; +import * as hljs from 'highlight.js'; + +window.addEventListener('load', () => { + document.querySelectorAll('pre').forEach((node) => { + hljs.highlightBlock(node); + }); +}); -- cgit v1.2.3 From a6e5637507d9e55f131c1cb6fe2e9606127f9b1f Mon Sep 17 00:00:00 2001 From: Simounet Date: Mon, 21 May 2018 19:47:28 +0200 Subject: Fix overflow wrap issue --- app/Resources/static/themes/material/css/article.scss | 1 + app/Resources/static/themes/material/css/media_queries.scss | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'app/Resources/static') diff --git a/app/Resources/static/themes/material/css/article.scss b/app/Resources/static/themes/material/css/article.scss index 2d4ef4b4..75658a58 100644 --- a/app/Resources/static/themes/material/css/article.scss +++ b/app/Resources/static/themes/material/css/article.scss @@ -11,6 +11,7 @@ color: #424242; font-size: 18px; line-height: 1.7em; + overflow-wrap: break-word; h1, h2, diff --git a/app/Resources/static/themes/material/css/media_queries.scss b/app/Resources/static/themes/material/css/media_queries.scss index 69e3d47d..72584426 100644 --- a/app/Resources/static/themes/material/css/media_queries.scss +++ b/app/Resources/static/themes/material/css/media_queries.scss @@ -22,6 +22,16 @@ padding-left: 0; } + table { + display: block; + overflow: auto; + } + + iframe { + max-width: 100%; + height: auto; + } + .nav-panels .action { padding-right: 0.75rem; } -- cgit v1.2.3 From f136d288d6fbc57af680e9a738b023abbccf0d6d Mon Sep 17 00:00:00 2001 From: Simounet Date: Thu, 24 May 2018 08:27:15 +0200 Subject: Fix Firefox mobile unneeded resize Before that, on Firefox Mobile, when you were moving to the top or to the bottom of the page, you were stopped before to go to the opposite side. --- app/Resources/static/themes/_global/index.js | 2 +- app/Resources/static/themes/_global/js/tools.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app/Resources/static') diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index fddb476d..b810e5d7 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js @@ -65,7 +65,7 @@ $(document).ready(() => { retrievePercent(x.entryId); $(window).resize(() => { - retrievePercent(x.entryId); + retrievePercent(x.entryId, true); }); } }); diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js index 774f4539..7e5a2b27 100644 --- a/app/Resources/static/themes/_global/js/tools.js +++ b/app/Resources/static/themes/_global/js/tools.js @@ -19,14 +19,16 @@ function savePercent(id, percent) { return true; } -function retrievePercent(id) { +function retrievePercent(id, resized) { if (!supportsLocalStorage()) { return false; } const bheight = $(document).height(); const percent = localStorage[`wallabag.article.${id}.percent`]; const scroll = bheight * percent; - $('html,body').animate({ scrollTop: scroll }, 'fast'); + if (!resized) { + $('html,body').animate({ scrollTop: scroll }, 'fast'); + } return true; } -- cgit v1.2.3