From 76873bfa374dce96c7b84b8cf5182c96e98823c1 Mon Sep 17 00:00:00 2001 From: Eryomin Oleg Date: Thu, 5 Oct 2023 23:52:31 +0300 Subject: [PATCH 1/3] Added cross-references to stubs --- EmbedHtmlArticleGalleyHeaderPlugin.inc.php | 9 ++++- js/articleHTML.js | 43 ++++++++++++++++++++++ templates/block.tpl | 22 +++++++++++ templates/display.tpl | 4 +- 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 js/articleHTML.js create mode 100644 templates/block.tpl diff --git a/EmbedHtmlArticleGalleyHeaderPlugin.inc.php b/EmbedHtmlArticleGalleyHeaderPlugin.inc.php index cb333e5..8669158 100644 --- a/EmbedHtmlArticleGalleyHeaderPlugin.inc.php +++ b/EmbedHtmlArticleGalleyHeaderPlugin.inc.php @@ -149,8 +149,15 @@ function articleViewCallback($hookName, $args) 'isFullWidth' => true, 'headerTemplatePath' => $this->getTemplateResource('header.tpl'), 'breadcrumbsTemplatePath' => $this->getTemplateResource('breadcrumbs_galley.tpl'), - 'footerTemplatePath' => $this->getTemplateResource('footer.tpl') + 'footerTemplatePath' => $this->getTemplateResource('footer.tpl'), + 'blockTemplatePath' => $this->getTemplateResource('block.tpl') )); + + $templateMgr->addJavaScript( + 'articleHTML', + $request->getBaseUrl() . '/' . $this->getPluginPath() . '/js/articleHTML.js' + ); + $templateMgr->display($this->getTemplateResource('display.tpl')); return true; } diff --git a/js/articleHTML.js b/js/articleHTML.js new file mode 100644 index 0000000..34035dc --- /dev/null +++ b/js/articleHTML.js @@ -0,0 +1,43 @@ +/** + * + * @file plugins/generic/embedHtmlArticleGalleyHeader/js/articleHTML.js + * + * Copyright (c) 2023 Belgorod State University + * Copyright (c) 2023 Eryomin Oleg + * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. + * + */ + +const heads = document.querySelectorAll("h1, h2, h3, h4, h5, h6"); +let paddings = new Map(); +let value = 0; +for (i = 1; i <= 6; i++){ + let key = "H" + i; + paddings.set(key, value); + value += 20; +} +const ul = document.getElementById("heads"); +heads.forEach((h, index) => { + let id = "head" + index; + h.id = id; + let li = document.createElement("li"); + li.style = "padding-left:" + paddings.get(h.tagName) + "px"; + let a = document.createElement("a"); + a.href = "#"; + a.id = index; + a.addEventListener("click", function() { + const id = "head" + this.id; + document.getElementById(id).scrollIntoView(); + }, false); + if (index !== 0) { + a.innerHTML = h.innerText; + } else { + a.innerHTML = "Article title"; + } + if (h.innerText !== "Contents"){ + if (h.innerText){ + li.append(a); + ul.append(li); + } + } +}); \ No newline at end of file diff --git a/templates/block.tpl b/templates/block.tpl new file mode 100644 index 0000000..4f9ce92 --- /dev/null +++ b/templates/block.tpl @@ -0,0 +1,22 @@ +{** + * plugins/generic/embedHtmlArticleGalley/display.tpl + * + * Copyright (c) 2023 Belgorod State University + * Copyright (c) 2023 Eryomin Oleg + * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. + *} + + + diff --git a/templates/display.tpl b/templates/display.tpl index 79a6889..9b105a9 100644 --- a/templates/display.tpl +++ b/templates/display.tpl @@ -9,6 +9,7 @@ *} {include file=$headerTemplatePath} {include file=$breadcrumbsTemplatePath} +
{if !$isLatestPublication}
@@ -61,7 +62,8 @@ {* END UZH CHANGE OJS-67 *}
- +
+ {include file=$blockTemplatePath} {call_hook name="Templates::Common::Footer::PageFooter"} {include file=$footerTemplatePath} From 2c556c8cc964e7e4bab1262924d4765d1ed95dbc Mon Sep 17 00:00:00 2001 From: Eryomin Oleg Date: Fri, 6 Oct 2023 12:01:38 +0300 Subject: [PATCH 2/3] Focus image --- EmbedHtmlArticleGalleyHeaderPlugin.inc.php | 4 ++++ css/style.css | 23 ++++++++++++++++++++++ js/articleHTML.js | 4 ++++ templates/display.tpl | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 css/style.css diff --git a/EmbedHtmlArticleGalleyHeaderPlugin.inc.php b/EmbedHtmlArticleGalleyHeaderPlugin.inc.php index 8669158..349f263 100644 --- a/EmbedHtmlArticleGalleyHeaderPlugin.inc.php +++ b/EmbedHtmlArticleGalleyHeaderPlugin.inc.php @@ -157,6 +157,10 @@ function articleViewCallback($hookName, $args) 'articleHTML', $request->getBaseUrl() . '/' . $this->getPluginPath() . '/js/articleHTML.js' ); + $templateMgr->addStyleSheet( + 'style', + $request->getBaseUrl() . '/' . $this->getPluginPath() . '/css/style.css' + ); $templateMgr->display($this->getTemplateResource('display.tpl')); return true; diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..ac877a5 --- /dev/null +++ b/css/style.css @@ -0,0 +1,23 @@ +#htmlContainer img { + max-width: 70%; +} +#htmlContainer img[tabindex="0"] { + cursor: zoom-in; +} + +#htmlContainer img[tabindex="0"]:focus { + position: fixed; z-index: 1000; + top: 0; left: 0; bottom: 0; right: 0; + width: auto; max-width: 100%; + height: auto; max-height: 100%; + margin: auto; + box-shadow: 0 0 200px #000, 0 0 0 1000px rgba(0,0,0,.3); + -webkit-box-shadow: 0 0 200px #000, 0 0 0 1000px rgba(0,0,0,.3); + -moz-box-shadow: 0 0 200px #000, 0 0 0 1000px rgba(0,0,0,.3); +} + +#htmlContainer img[tabindex="0"]:focus, /* Привязка на возврат фото в привычное состояние после клика на увеличенное */ +#htmlContainer img[tabindex="0"]:focus ~ * { + cursor: zoom-out; + pointer-events: none; +} \ No newline at end of file diff --git a/js/articleHTML.js b/js/articleHTML.js index 34035dc..caed3a8 100644 --- a/js/articleHTML.js +++ b/js/articleHTML.js @@ -9,6 +9,7 @@ */ const heads = document.querySelectorAll("h1, h2, h3, h4, h5, h6"); +const imgs = document.querySelectorAll("img"); let paddings = new Map(); let value = 0; for (i = 1; i <= 6; i++){ @@ -40,4 +41,7 @@ heads.forEach((h, index) => { ul.append(li); } } +}); +imgs.forEach((img) => { + img.tabIndex = "0"; }); \ No newline at end of file diff --git a/templates/display.tpl b/templates/display.tpl index 9b105a9..15d84c6 100644 --- a/templates/display.tpl +++ b/templates/display.tpl @@ -9,7 +9,7 @@ *} {include file=$headerTemplatePath} {include file=$breadcrumbsTemplatePath} -
+
{if !$isLatestPublication}
From b2e11e4bfcbffc1139055d5710903fc3252dcf2c Mon Sep 17 00:00:00 2001 From: Eryomin Oleg Date: Fri, 13 Oct 2023 23:46:30 +0300 Subject: [PATCH 3/3] Dowloads image --- images/download-icon-30.png | Bin 0 -> 415 bytes js/articleHTML.js | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 images/download-icon-30.png diff --git a/images/download-icon-30.png b/images/download-icon-30.png new file mode 100644 index 0000000000000000000000000000000000000000..4d3f6a2ee8804136f0365542aa0e580a5e9aa55c GIT binary patch literal 415 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX3?zBp#Z3TG%*9TgAsieWw;%dH0CHmkd_r8y z%gb9^TmS$6zkmP!`Sa%=K79D~>(_O4bz8P<>F@7fw{G3ZlP7CxYF4jaJ$drvs;a8p zyLWeXc3!w}Vdl)44Gj%v&YY>JsF*l$VtadgcXv0?oVRb^u3x`?>eQ*t&CTpZQ_FxB zaTa()7Bet#3xP1>rMq>1fP!Krt`Q~9MX8A;nfZANA(^?U3O^#;+PS>i|{A zfK&wMr0{Zda2&Jp9P8EaCBuld~LQcC=LWkcY4k+XB6+ZWsDb;m~U~$#0}^)22WQ%mvv4F FO#ljow*CMB literal 0 HcmV?d00001 diff --git a/js/articleHTML.js b/js/articleHTML.js index caed3a8..4f24ac2 100644 --- a/js/articleHTML.js +++ b/js/articleHTML.js @@ -9,7 +9,7 @@ */ const heads = document.querySelectorAll("h1, h2, h3, h4, h5, h6"); -const imgs = document.querySelectorAll("img"); +const imgs = document.getElementById("htmlContainer").querySelectorAll("img"); let paddings = new Map(); let value = 0; for (i = 1; i <= 6; i++){ @@ -44,4 +44,10 @@ heads.forEach((h, index) => { }); imgs.forEach((img) => { img.tabIndex = "0"; + let a = document.createElement("a"); + const icon = document.createElement("img"); + icon.src = "https://" + window.location.hostname + "/plugins/generic/embedHtmlArticleGalleyHeader/images/download-icon-30.png" + a.append(icon); + a.href = img.getAttribute("src"); + img.parentElement.append(a); }); \ No newline at end of file