diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 3737952..b01be16 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -207,7 +207,7 @@ abstract class MCI_Footnotes_LayoutEngine { 'mci-footnotes-admin-styles', plugins_url('../../css/settings.css', __FILE__), '', - '2.1.4d0' + '2.1.4d1' ); // UPDATE version # when making changes to settings.css, FOR CACHE BUSTING diff --git a/class/init.php b/class/init.php index 6d3489d..0a2c67e 100644 --- a/class/init.php +++ b/class/init.php @@ -160,7 +160,7 @@ class MCI_Footnotes { 'mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', - '2.1.4d0' + '2.1.4d1' ); } diff --git a/class/task.php b/class/task.php index 5b900d0..405310e 100644 --- a/class/task.php +++ b/class/task.php @@ -19,7 +19,7 @@ * 2.1.2: options for the other hooks 2020-11-19T1849+0100 * 2.1.4: fix line wrapping of URLs based on pattern, not link element 2020-11-25T0837+0100 * - * Last modified: 2020-11-25T0837+0100 + * Last modified: 2020-11-26T0036+0100 */ // If called directly, abort: @@ -448,7 +448,7 @@ class MCI_Footnotes_Task { // to prevent them from hanging out of the tooltip in non-Unicode-compliant user agents // spare however values of the href argument! // see public.css - $l_str_FootnoteText = preg_replace( '#(?$1', $l_str_FootnoteText ); + $l_str_FootnoteText = preg_replace( '#(?$1', $l_str_FootnoteText ); // Text to be displayed instead of the footnote $l_str_FootnoteReplaceText = ""; @@ -479,21 +479,26 @@ class MCI_Footnotes_Task { // define the HTML element to use for the referrers: if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS))) { - $l_str_Element = 'sup'; + $l_str_SupSpan = 'sup'; } else { - $l_str_Element = 'span'; + $l_str_SupSpan = 'span'; } + // determine whether the link element is used, see below + + // fill in 'templates/public/footnote.html': $l_obj_Template->replace( array( - "post_id" => $l_int_PostId, - "id" => $l_int_Index, - "element" => $l_str_Element, - "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), - "index" => $l_int_Index, - "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), - "text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "", + "post_id" => $l_int_PostId, + "id" => $l_int_Index, + "link-start" => '', + "link-end" => '', + "sup-span" => $l_str_SupSpan, + "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), + "index" => $l_int_Index, + "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), + "text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "", ) ); $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); @@ -551,16 +556,52 @@ class MCI_Footnotes_Task { */ public function ReferenceContainer() { - // post ID to make everything unique wrt infinite scroll and archive view: - global $l_int_PostId; - $l_int_PostId = get_the_id(); - - // no footnotes has been replaced on this page + // no footnotes have been replaced on this page: if (empty(self::$a_arr_Footnotes)) { return ""; } + /** + * INFINITE SCROLL / AUTOLOAD, ARCHIVE VIEW + * + * Multiple posts are appended to each other, functions and IDs must be disambiguated. + * Contributed by @docteurfitness + * @since 2.0.5 + * + * post ID to make everything unique wrt infinite scroll and archive view: + */ + global $l_int_PostId; + $l_int_PostId = get_the_id(); + + /** + * OPTIONAL LINK ELEMENT FOR FOOTNOTE REFERRERS AND BACKLINKS + * + * STYLING: + * Link color is preferred for referrers and backlinks. + * Setting a global link color is a common feature in WordPress themes. + * CSS does not support identifiers for link colors (color: link | hover | active | visited) + * These are only supported as pseudo-classes of the link element. + * Hence the link element must be present for styling purposes. + * But styling these elements with the link color is not universally preferred. + * If not, the very presence of the link elements may need to be avoided. + * + * FUNCTIONALITY: + * Although widely used for that purpose, hyperlinks are disliked for footnote linking. + * Browsers may need to be prevented from logging these clicks in the browsing history, + * as logging compromises the usability of the 'return to previous' button in browsers. + * For that purpose, and for scroll animation, this linking is performed by JavaScript. + * + * The link elements have been added and are present @since 2.0.0. + * Then the link addresses were removed @since 2.0.4. + * Then the presence of elements was made optional + * @since 2.1.4 + * 2020-11-25T1306+0100 + */ + $l_str_LinkSpan = true ? 'a' : 'span'; + // in progress ############################################## + + // FOOTNOTE INDEX BACKLINK SYMBOL // check if arrow is enabled: @@ -584,7 +625,7 @@ class MCI_Footnotes_Task { } else { - // if it is, set it to empty: + // if it is not, set arrow to empty: $l_str_Arrow = ""; $l_str_FootnoteArrow = ""; @@ -659,7 +700,8 @@ class MCI_Footnotes_Task { $l_str_FootnoteId = $l_str_FootnoteIndex; // in case the footnote is unique: - $l_str_FootnoteReference = 'get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); // resume composing the backlinks enumeration: - $l_str_FootnoteBacklinks .= ', get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); @@ -723,7 +766,7 @@ class MCI_Footnotes_Task { } // line wrapping of URLs already fixed, see: - // $l_str_FootnoteText = preg_replace( '#(?$1', $l_str_FootnoteText ); + // $l_str_FootnoteText = preg_replace( '#(?$1', $l_str_FootnoteText ); // replace all placeholders in 'templates/public/reference-container-body.html' // or in 'templates/public/reference-container-body-combi.html' @@ -737,6 +780,9 @@ class MCI_Footnotes_Task { // used in standard layout W/O COMBINED FOOTNOTES: "post_id" => $l_int_PostId, "id" => MCI_Footnotes_Convert::Index($l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), + "link-start" => $l_str_LinkSpan == 'a' ? '' : '', + "link-end" => $l_str_LinkSpan == 'a' ? '' : '', + "link-span" => $l_str_LinkSpan, // used in standard layout WITH COMBINED IDENTICALS TURNED ON: "pointer" => empty($l_str_BacklinkEvent) ? '' : ' pointer', @@ -751,7 +797,7 @@ class MCI_Footnotes_Task { $l_str_Body .= $l_obj_Template->getContent(); - // extra line breaks for page source legibility: + // extra line breaks for page source readability: $l_str_Body .= "\r\n\r\n"; $l_obj_Template->reload(); diff --git a/css/public.css b/css/public.css index ff9bf20..2c30a6c 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.4d0 + * Version: 2.1.4d1 * - * Last modified: 2020-11-25T0836+0100 + * Last modified: 2020-11-26T0037+0100 */ @@ -76,7 +76,9 @@ templates/public/footnote-alternative.html text-decoration: none !important; border-bottom: none !important; line-height: 0; - cursor: pointer; + cursor: pointer; + position: relative; + vertical-align: baseline; } .footnote_referrer:hover, .footnote_referrer a:hover, diff --git a/css/settings.css b/css/settings.css index c7dd877..51e6f6e 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.4d0 + * Version: 2.1.4d1 * - * Last modified: 2020-11-25T0837+0100 + * Last modified: 2020-11-26T0036+0100 */ diff --git a/footnotes.php b/footnotes.php index 50a7876..151e17f 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.4d0 + Version: 2.1.4d1 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages diff --git a/readme.txt b/readme.txt index 40b2c09..e0eac15 100755 --- a/readme.txt +++ b/readme.txt @@ -80,7 +80,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == -= 2.1.4d0 = += 2.1.4d1 = - Bugfix: Reference container, tooltips: fix line wrapping of URLs based on pattern, not link element = 2.1.3 = diff --git a/templates/public/footnote-alternative.html b/templates/public/footnote-alternative.html index fd26eec..67f8e69 100644 --- a/templates/public/footnote-alternative.html +++ b/templates/public/footnote-alternative.html @@ -2,12 +2,12 @@ class="footnote_referrer relative" onmouseover="footnoteTooltipShow('footnote_plugin_tooltip_text_[[post_id]]_[[id]]')" onmouseout="footnoteTooltipHide('footnote_plugin_tooltip_text_[[post_id]]_[[id]]')" - ><[[element]] + >[[link-start]]<[[sup-span]] id="footnote_plugin_tooltip_[[post_id]]_[[id]]" class="footnote_plugin_tooltip_text" onclick="footnote_moveToAnchor_[[post_id]]('footnote_plugin_reference_[[post_id]]_[[id]]');" - >[[before]][[index]][[after]][[before]][[index]][[after]][[link-end]]