From 65874f089b9e6f5e4b90e55e9b9d9f98d1e1af75 Mon Sep 17 00:00:00 2001 From: pewgeuges <73141620+pewgeuges@users.noreply.github.com> Date: Sat, 20 Feb 2021 03:50:52 +0000 Subject: [PATCH] =?UTF-8?q?update=202.5.6d4=20in=20case=20it=20is=20tested?= =?UTF-8?q?=20in=20the=20related=20forum=20topic.\nFull=20changelog:\n=3D?= =?UTF-8?q?=202.5.6=20=3D\n-=20Bugfix:=20Reference=20container:=20optional?= =?UTF-8?q?=20alternative=20expanding=20and=20collapsing=20without=20jQuer?= =?UTF-8?q?y=20for=20use=20with=20hard=20links,=20thanks=20to=20@hopper87i?= =?UTF-8?q?t=20@pkverma99=20issue=20reports.\n-=20Bugfix:=20Alternative=20?= =?UTF-8?q?tooltips:=20shrink=20width=20to=20short=20content.\n-=20Update:?= =?UTF-8?q?=20Documentation:=20slightly=20revise=20/=20update=20the=20plug?= =?UTF-8?q?in=E2=80=99s=20welcome=20page=20on=20WordPress.org.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2478015 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/init.php | 4 +-- class/settings.php | 2 +- class/task.php | 36 ++++++++++++++++---- footnotes.php | 6 ++-- readme.txt | 3 +- templates/public/footnote-alternative.html | 1 + templates/public/js-reference-container.html | 7 ++-- 7 files changed, 44 insertions(+), 15 deletions(-) diff --git a/class/init.php b/class/init.php index 61c0845..2eb6ff4 100644 --- a/class/init.php +++ b/class/init.php @@ -21,7 +21,7 @@ * @since 2.5.5 Update: Stylesheets: increase speed and energy efficiency by tailoring stylesheets to the needs of the instance, thanks to @docteurfitness design contribution. * @since 2.5.5 Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report. * @since 2.5.5 Bugfix: Libraries: optimize processes by loading external and internal scripts only if needed, thanks to @docteurfitness issue report. - * @since 2.5.6 Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * @since 2.5.6 Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. */ /** @@ -189,7 +189,7 @@ class MCI_Footnotes { /** * Enqueues the jQuery library registered by WordPress. * - * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. * * @since 2.5.6 * diff --git a/class/settings.php b/class/settings.php index 2856623..562e946 100644 --- a/class/settings.php +++ b/class/settings.php @@ -791,7 +791,7 @@ class MCI_Footnotes_Settings { /** * Settings container key to select the script mode for the reference container. * - * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. * * @since 2.5.6 * diff --git a/class/task.php b/class/task.php index 21acd02..4fae34f 100644 --- a/class/task.php +++ b/class/task.php @@ -7,7 +7,7 @@ * @since 1.5.0 * * - * @lastmodified 2021-02-19T2030+0100 + * @lastmodified 2021-02-20T0438+0100 * * @since 2.0.0 Bugfix: various. * @since 2.0.4 Bugfix: Referrers and backlinks: remove hard links to streamline browsing history, thanks to @theroninjedi47 bug report. @@ -79,7 +79,7 @@ * @since 2.5.4 Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report. * @since 2.5.4 Bugfix: Tooltips: fix display in Popup Maker popups by correcting a coding error. * @since 2.5.5 Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution. - * @since 2.5.6 Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * @since 2.5.6 Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. */ // If called directly, abort: @@ -828,7 +828,7 @@ class MCI_Footnotes_Task { * @since 2.2.5 * @date 2020-12-18T1113+0100 */ - // alternative tooltips: + // jQuery tooltips: if ( ! self::$a_bool_AlternativeTooltipsEnabled) { // tooltip position: @@ -838,13 +838,18 @@ class MCI_Footnotes_Task { } echo "}\r\n"; + // alternative tooltips: } else { echo "}\r\n"; - // position: + // dimensions: + $l_int_AlternativeTooltipWidth = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) ); echo ".footnote_tooltip.position {"; - echo " width: " . intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH)) . 'px;'; + echo " width: " . $l_int_AlternativeTooltipWidth . 'px;'; + // set also as max-width wrt short tooltip shrinking: + echo " max-width: " . $l_int_AlternativeTooltipWidth . 'px;'; + // position: $l_str_AlternativePosition = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION); $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X)); @@ -1650,6 +1655,21 @@ class MCI_Footnotes_Task { } else { $l_str_TooltipContent = ''; } + + /** + * Determine shrink width if alternative tooltips are enabled. + * + * @since 2.5.6 + */ + $l_str_TooltipStyle = ''; + if ( self::$a_bool_AlternativeTooltipsEnabled && self::$a_bool_TooltipsEnabled ) { + $l_int_TooltipLength = strlen( strip_tags( $l_str_TooltipContent ) ); + if ( $l_int_TooltipLength < 70 ) { + $l_str_TooltipStyle = ' style="width: '; + $l_str_TooltipStyle .= ( $l_int_TooltipLength * .7 ); + $l_str_TooltipStyle .= 'em;"'; + } + } // fill in 'templates/public/footnote.html': $l_obj_Template->replace( @@ -1664,6 +1684,7 @@ class MCI_Footnotes_Task { "index" => $l_int_Index, "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), "anchor-element" => $l_str_ReferrerAnchorElement, + "style" => $l_str_TooltipStyle, "text" => $l_str_TooltipContent, ) ); @@ -2267,12 +2288,15 @@ class MCI_Footnotes_Task { /** * Select the reference container template according to the script mode. * - * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. * * @since 2.5.6 * * @reporter @hopper87it * @link https://wordpress.org/support/topic/footnotes-wp-rocket/ + * + * @reporter @pkverma99 + * @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188 */ $l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE); diff --git a/footnotes.php b/footnotes.php index bfa5ac8..ef4848f 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.5.6d3 + Version: 2.5.6d4 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages @@ -18,10 +18,10 @@ * @since 2.1.4 * @since 2.5.3 (Hungarian) * @var str - * @lastmodified 2021-02-19T2055+0100 + * @lastmodified 2021-02-20T0438+0100 * @committer @pewgeuges */ -define( 'C_STR_FOOTNOTES_VERSION', '2.5.6d3' ); +define( 'C_STR_FOOTNOTES_VERSION', '2.5.6d4' ); /* LICENSE NOTICE diff --git a/readme.txt b/readme.txt index d5e79f1..d5ff8ee 100755 --- a/readme.txt +++ b/readme.txt @@ -78,7 +78,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == = 2.5.6 = -- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. +- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. +- Bugfix: Alternative tooltips: shrink width to short content. - Update: Documentation: slightly revise / update the plugin’s welcome page on WordPress.org. = 2.5.5 = diff --git a/templates/public/footnote-alternative.html b/templates/public/footnote-alternative.html index 5eb081b..50c5c2b 100644 --- a/templates/public/footnote-alternative.html +++ b/templates/public/footnote-alternative.html @@ -18,6 +18,7 @@ id="footnote_plugin_tooltip_text_[[post_id]]_[[container_id]]_[[note_id]]" class="footnote_tooltip position hidden" onmouseout="footnoteTooltipHide('footnote_plugin_tooltip_text_[[post_id]]_[[container_id]]_[[note_id]]')" + [[style]] >[[text]] diff --git a/templates/public/js-reference-container.html b/templates/public/js-reference-container.html index dd5f274..d1ec848 100644 --- a/templates/public/js-reference-container.html +++ b/templates/public/js-reference-container.html @@ -4,14 +4,17 @@ * * @since 2.5.6 * @type object - * @lastmodified 2021-02-19T1545+0100 + * @lastmodified 2021-02-20T0252+0100 * - * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it issue report. + * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. * * @since 2.5.6 * * @reporter @hopper87it * @link https://wordpress.org/support/topic/footnotes-wp-rocket/ + * + * @reporter @pkverma99 + * @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188 * * The heavy jQuery Core library from WordPress must not be deferred for * the jQuery reference container to work, and is detrimental to page speed.