From a9143a34b7c7649735c4e223ffa16db0eac27bc9 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Thu, 12 Nov 2020 18:17:28 +0000 Subject: [PATCH] development version 2.1.1d5: added CSS animation to alternative tooltip implementation IN RESPONSE TO USER ON THE SUPPORT FORUM git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2417401 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/init.php | 2 +- class/task.php | 56 ++++++++++++---------- css/public.css | 43 +++++++++++++---- css/settings.css | 4 +- footnotes.php | 2 +- readme.txt | 3 ++ templates/public/footnote-alternative.html | 14 +++--- 7 files changed, 81 insertions(+), 43 deletions(-) diff --git a/class/init.php b/class/init.php index 3f67ff7..0769879 100644 --- a/class/init.php +++ b/class/init.php @@ -151,7 +151,7 @@ class MCI_Footnotes { 'mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', - '2.1.1d4' + '2.1.1d5' ); } diff --git a/class/task.php b/class/task.php index 3a04954..e36beb7 100644 --- a/class/task.php +++ b/class/task.php @@ -5,15 +5,15 @@ * @filesource * @author Stefan Herndler * @since 1.5.0 - * + * * Edited for v2.0.0 and following. - * + * * Edited for v2.0.5: Autoload / infinite scroll support added thanks to code from * @docteurfitness - * + * * Edited for v2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100 * Edited for v2.1.0: Promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100 - * + * * Last modified 2020-11-08T2146+0100 */ @@ -60,15 +60,15 @@ class MCI_Footnotes_Task { * * @author Stefan Herndler * @since 1.5.0 - * + * * Edited for v2.0.5 through v2.0.7 2020-11-02T0330+0100..2020-11-06T1344+0100 - * - * Explicitly setting all priority to (default) "10" instead of lowest "PHP_INT_MAX", + * + * Explicitly setting all priority to (default) "10" instead of lowest "PHP_INT_MAX", * especially for the_content, makes the footnotes reference container display * beneath the content and above other features added by other plugins. * Requested by users: * Documentation: - * + * * But this change is suspected to cause issues and needs to be assessed! * See */ @@ -146,12 +146,18 @@ class MCI_Footnotes_Task { } echo '}'; ?> - + get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { echo '\r\n"; }; } @@ -421,13 +427,13 @@ class MCI_Footnotes_Task { ) ); $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); - + // reset the template $l_obj_Template->reload(); if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED))) { $l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y)); $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X)); - + // fill in the tooltip template templates/public/tooltip.html $l_obj_TemplateTooltip->replace( array( @@ -435,12 +441,12 @@ class MCI_Footnotes_Task { "id" => $l_str_Index, "position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), "offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, - "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0 + "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0, ) ); - if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { - $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); - } + if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) { + $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); + } $l_obj_TemplateTooltip->reload(); } } @@ -507,8 +513,9 @@ class MCI_Footnotes_Task { $l_str_FootnoteArrowIndex = ''; // wrap the arrow in a @media print { display:hidden } span $l_str_FootnoteArrowIndex .= '' . $l_str_Arrow . ' '; - // get the index; add support for legacy index placeholder: + // get the index: $l_str_FootnoteArrowIndex .= MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + // keep supporting legacy index placeholder: $l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); // check if it isn't the last footnote in the array @@ -525,19 +532,20 @@ class MCI_Footnotes_Task { } } } - + $l_str_FootnoteArrowIndex .= ''; - + // replace all placeholders in the template templates/public/reference-container-body.html // The individual arrow and index placeholders are for backcompat $l_obj_Template->replace( array( "post_id" => $l_int_PostID, "id" => MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), + "arrow-index" => $l_str_FootnoteArrowIndex, + "text" => $l_str_FootnoteText, + // Legacy placeholders: "arrow" => $l_str_Arrow, "index" => $l_str_FootnoteIndex, - "arrow-index" => $l_str_FootnoteArrowIndex, - "text" => $l_str_FootnoteText ) ); // extra line breaks for page source legibility: @@ -555,13 +563,13 @@ class MCI_Footnotes_Task { "label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), "button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', "style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', - "content" => $l_str_Body + "content" => $l_str_Body, ) ); // free all found footnotes if reference container will be displayed self::$a_arr_Footnotes = array(); - + return $l_obj_TemplateContainer->getContent(); } } diff --git a/css/public.css b/css/public.css index d45198f..d18c9a0 100755 --- a/css/public.css +++ b/css/public.css @@ -4,9 +4,9 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.1.1d4 + * Version: 2.1.1d5 * - * Last modified: 2020-11-12T0539+0100 + * Last modified: 2020-11-12T1846+0100 */ @@ -67,6 +67,7 @@ templates/public/footnote-alternative.html .footnote_tooltip { display: none; z-index: 999; + cursor: auto; text-align: left; padding: 12px; line-height: 1.2em; @@ -75,14 +76,40 @@ templates/public/footnote-alternative.html font-style: normal; } -.footnote_relative { - position: relative; +/* +alternative tooltip implementation +*/ +.footnote_referrer.relative { + position: relative; } -.footnote_tooltip_alternative { - position: absolute; +.footnote_tooltip.position { + display: unset; + position: absolute; bottom: 24px; - left: -50px; - width: 400px; + left: -50px; + width: 400px; +} +/* +fade-in parameters +*/ +.footnote_tooltip.shown { + visibility: visible; + opacity: 1; + transition-property: visibility opacity; + transition-duration: 200ms; + transition-timing-function: linear; + transition-delay: 0ms; +} +/* +fade-out parameters +*/ +.footnote_tooltip.hidden { + visibility: hidden; + opacity: 0; + transition-property: visibility opacity; + transition-duration: 200ms; + transition-timing-function: linear; + transition-delay: 400ms; } /* diff --git a/css/settings.css b/css/settings.css index 55a9800..48c9af5 100755 --- a/css/settings.css +++ b/css/settings.css @@ -4,9 +4,9 @@ * Created-Date: 15.05.14 * Created-Time: 16:21 * Since: 1.0 - * Version: 2.1.1d4 + * Version: 2.1.1d5 * - * Last modified: 2020-11-12T0539+0100 + * Last modified: 2020-11-12T1846+0100 */ diff --git a/footnotes.php b/footnotes.php index 834fc74..4e2a0b9 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,7 +4,7 @@ Plugin URI: https://wordpress.org/plugins/footnotes/ Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine. Author: Mark Cheret - Version: 2.1.1d4 + Version: 2.1.1d5 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages diff --git a/readme.txt b/readme.txt index f124cd2..1a99cc3 100755 --- a/readme.txt +++ b/readme.txt @@ -80,6 +80,9 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == += 2.1.1d5 = +- Add: UI: Tooltips: Alternative implementation: added CSS animation + = 2.1.1d4 = - Add: UI: Tooltips: added delay (400ms) before fade-out to improve usability of links and Read-on button - Update: Libraries: jQuery Tools: redacted jQuery.browser function use in js/jquery.tools.min.js diff --git a/templates/public/footnote-alternative.html b/templates/public/footnote-alternative.html index d94aa22..d8bbb1b 100644 --- a/templates/public/footnote-alternative.html +++ b/templates/public/footnote-alternative.html @@ -1,15 +1,15 @@ [[before]][[index]][[after]][[before]][[index]][[after]][[text]]