diff --git a/class/init.php b/class/init.php index 0769879..dfb5df0 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.1d5' + '2.1.1d6' ); } diff --git a/class/settings.php b/class/settings.php index 7d09b00..41bafca 100644 --- a/class/settings.php +++ b/class/settings.php @@ -10,7 +10,9 @@ * v2.0.4 2020-11-02T2115+0100 * v2.0.7 2020-11-06T1342+0100 * v2.1.0 2020-11-08T2149+0100 - * V2.2.0 2020-11-11T1819+0100 ######## set to '' line 416 before release! ###################### + * V2.2.0 2020-11-11T1819+0100 + * + * Last modified: 2020-11-12T1936+0100 */ @@ -413,7 +415,7 @@ class MCI_Footnotes_Settings { self::C_STR_FOOTNOTES_STYLING_AFTER => ']', self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes', - self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'yes', + self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => '', // The mouse over content truncation should be enabled by default // to raise awareness of the functionality and to prevent the screen diff --git a/class/task.php b/class/task.php index e36beb7..55cd4b9 100644 --- a/class/task.php +++ b/class/task.php @@ -155,9 +155,9 @@ class MCI_Footnotes_Task { echo "\t\tdocument.getElementById(footnoteTooltipId).classList.add('shown');\r\n"; echo "\t}\r\n"; echo "\tfunction footnoteTooltipHide(footnoteTooltipId) { \r\n"; - echo "\t\tdocument.getElementById(footnoteTooltipId).classList.remove('shown');\r\n"; - echo "\t\tdocument.getElementById(footnoteTooltipId).classList.add('hidden');\r\n"; - echo "\t}\r\n"; + echo "\t\tdocument.getElementById(footnoteTooltipId).classList.remove('shown');\r\n"; + echo "\t\tdocument.getElementById(footnoteTooltipId).classList.add('hidden');\r\n"; + echo "\t}\r\n"; echo "\r\n"; }; } @@ -339,13 +339,17 @@ class MCI_Footnotes_Task { * @return string */ public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { - // post ID to make everything unique wrt archive view and infinite scroll + + // post ID to make everything unique wrt infinite scroll and archive view global $l_int_PostID; - $l_int_PostID = get_the_id(); + $l_int_PostID = get_the_id(); + // contains the index for the next footnote on this page - $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; + $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; + // contains the starting position for the lookup of a footnote - $l_int_PosStart = 0; + $l_int_PosStart = 0; + // get start and end tag for the footnotes short code $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); @@ -393,11 +397,14 @@ class MCI_Footnotes_Task { break; } // calculate the length of the footnote - $l_int_Length = $l_int_PosEnd - $l_int_PosStart; + $l_int_Length = $l_int_PosEnd - $l_int_PosStart; + // get footnote text - $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + // Text to be displayed instead of the footnote - $l_str_FootnoteReplaceText = ""; + $l_str_FootnoteReplaceText = ""; + // display the footnote as mouse-over box if (!$p_bool_HideFootnotesText) { $l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); @@ -405,7 +412,8 @@ class MCI_Footnotes_Task { // display only an excerpt of the footnotes text if enabled $l_str_ExcerptText = $l_str_FootnoteText; $l_bool_EnableExcerpt = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED)); - $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)); + $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)); + if ($l_bool_EnableExcerpt) { $l_str_DummyText = strip_tags($l_str_FootnoteText); if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) { @@ -451,7 +459,8 @@ class MCI_Footnotes_Task { } } // replace the footnote with the template - $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); + $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); + // add footnote only if not empty if (!empty($l_str_FootnoteText)) { // set footnote to the output box at the end @@ -476,9 +485,10 @@ class MCI_Footnotes_Task { * @return string */ public function ReferenceContainer() { - // post ID to make everything unique wrt archive view and infinite scroll + // post ID to make everything unique wrt infinite scroll and archive view global $l_int_PostID; - $l_int_PostID = get_the_id(); + $l_int_PostID = get_the_id(); + // no footnotes has been replaced on this page if (empty(self::$a_arr_Footnotes)) { return ""; @@ -501,6 +511,7 @@ class MCI_Footnotes_Task { // loop through all footnotes found in the page for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) { + // get footnote text $l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index]; // if footnote is empty, get to the next one @@ -508,26 +519,33 @@ class MCI_Footnotes_Task { continue; } // generate content of footnote index cell - $l_str_FirstFootnoteIndex = ($l_str_Index + 1); + $l_str_FirstFootnoteIndex = ($l_str_Index + 1); + // wrap each index # in a white-space:nowrap span $l_str_FootnoteArrowIndex = ''; // wrap the arrow in a @media print { display:hidden } span $l_str_FootnoteArrowIndex .= '' . $l_str_Arrow . ' '; // 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)); + $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 if ($l_str_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + // get all footnotes that I haven't passed yet for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count(self::$a_arr_Footnotes); $l_str_CheckIndex++) { + // check if a further footnote is the same as the actual one if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_str_CheckIndex]) { + // set the further footnote as empty so it won't be displayed later - self::$a_arr_Footnotes[$l_str_CheckIndex] = ""; + self::$a_arr_Footnotes[$l_str_CheckIndex] = ""; + // add the footnote index to the actual index - $l_str_FootnoteArrowIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $l_str_FootnoteArrowIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + $l_str_FootnoteIndex .= ', ' . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); } } diff --git a/css/public.css b/css/public.css index d18c9a0..2a09e90 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.1d5 + * Version: 2.1.1d6 * - * Last modified: 2020-11-12T1846+0100 + * Last modified: 2020-11-13T1746+0100 */ @@ -75,6 +75,9 @@ templates/public/footnote-alternative.html font-weight: normal; font-style: normal; } +.footnote_tooltip a { + word-wrap: anywhere; +} /* alternative tooltip implementation @@ -83,33 +86,33 @@ alternative tooltip implementation position: relative; } .footnote_tooltip.position { - display: unset; + 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; + 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; + 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 48c9af5..468e434 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.1d5 + * Version: 2.1.1d6 * - * Last modified: 2020-11-12T1846+0100 + * Last modified: 2020-11-13T1748+0100 */ diff --git a/footnotes.php b/footnotes.php index 4e2a0b9..f20ce90 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.1d5 + Version: 2.1.1d6 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages diff --git a/js/jquery.tools.js b/js/jquery.tools.js new file mode 100644 index 0000000..cc33d6d --- /dev/null +++ b/js/jquery.tools.js @@ -0,0 +1,431 @@ +/*! + * jQuery Tools v1.2.7 - The missing UI library for the Web + * + * toolbox/toolbox.expose.js + * toolbox/toolbox.flashembed.js + * toolbox/toolbox.history.js + * toolbox/toolbox.mousewheel.js + * tooltip/tooltip.js + * tooltip/tooltip.dynamic.js + * tooltip/tooltip.slide.js + * + * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. + * + * http://flowplayer.org/tools/ + * + * jquery.event.wheel.js - rev 1 + * Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) + * Liscensed under the MIT License (MIT-LICENSE.txt) + * http://www.opensource.org/licenses/mit-license.php + * Created: 2008-07-01 | Updated: 2008-07-14 + * + * ----- + * + * Added jQueryUI and checks whether jQuery.browser exists + * Following @vonpiernik + * 2020-10-26T2005+0100 + * + * Removed usage of jQuery browser check function 2020-11-12T0127+0100 + * ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + * See also on the Forum, lastly + * + * #1 (54) This was only a tweak to adjust width and height in Internet Explorer. + * + * #2 (226) This was only for very old Internet Explorer (older than IE8). + * + * #3 (266) This was only about a naming convention of Firefox: 'DOMMouseScroll' vs 'mousewheel', + * or 'mousemove' in very old Firefox (older than v1.9). + * When making jQuery.browser optional, an 'if(a.browser)' condition was added around. + * + * #4 (293) This disabled fade-in for Internet Explorer other than FadeIE. + * + * #5 (296) This disabled fade-out for Internet Explorer other than FadeIE. + * + * #6 (420) This disabled slide-fade for Internet Explorer. + * Browsers not supporting an effect simply don’t execute it, they won’t throw an error. + * + * Re-formatted minified file. Last modified: 2020-11-13T0444+0100 + */ +(function (a) { + a.tools = a.tools || {version: "v1.2.7"}; + var b; + b = a.tools.expose = {conf: {maskId: "exposeMask", loadSpeed: "slow", closeSpeed: "fast", closeOnClick: !0, closeOnEsc: !0, zIndex: 9998, opacity: .8, startOpacity: 0, color: "#fff", onLoad: null, onClose: null}}; + function c() { + /*if (a.browser && a.browser.msie) { + var b = a(document).height(), c = a(window).height(); + return[window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, b - c < 20 ? c : b] + }*/ + return[a(document).width(), a(document).height()] + } + + function d(b) { + if (b)return b.call(a.mask) + } + + var e, f, g, h, i; + a.mask = {load: function (j, k) { + if (g)return this; + typeof j == "string" && (j = {color: j}), j = j || h, h = j = a.extend(a.extend({}, b.conf), j), e = a("#" + j.maskId), e.length || (e = a("
").attr("id", j.maskId), a("body").append(e)); + var l = c(); + e.css({position: "absolute", top: 0, left: 0, width: l[0], height: l[1], display: "none", opacity: j.startOpacity, zIndex: j.zIndex}), j.color && e.css("backgroundColor", j.color); + if (d(j.onBeforeLoad) === !1)return this; + j.closeOnEsc && a(document).on("keydown.mask", function (b) { + b.keyCode == 27 && a.mask.close(b) + }), j.closeOnClick && e.on("click.mask", function (b) { + a.mask.close(b) + }), a(window).on("resize.mask", function () { + a.mask.fit() + }), k && k.length && (i = k.eq(0).css("zIndex"), a.each(k, function () { + var b = a(this); + /relative|absolute|fixed/i.test(b.css("position")) || b.css("position", "relative") + }), f = k.css({zIndex: Math.max(j.zIndex + 1, i == "auto" ? 0 : i)})), e.css({display: "block"}).fadeTo(j.loadSpeed, j.opacity, function () { + a.mask.fit(), d(j.onLoad), g = "full" + }), g = !0; + return this + }, close: function () { + if (g) { + if (d(h.onBeforeClose) === !1)return this; + e.fadeOut(h.closeSpeed, function () { + d(h.onClose), f && f.css({zIndex: i}), g = !1 + }), a(document).off("keydown.mask"), e.off("click.mask"), a(window).off("resize.mask") + } + return this + }, fit: function () { + if (g) { + var a = c(); + e.css({width: a[0], height: a[1]}) + } + }, getMask: function () { + return e + }, isLoaded: function (a) { + return a ? g == "full" : g + }, getConf: function () { + return h + }, getExposed: function () { + return f + }}, a.fn.mask = function (b) { + a.mask.load(b); + return this + }, a.fn.expose = function (b) { + a.mask.load(b, this); + return this + } +})(jQuery); +(function () { + var a = document.all, b = "http://www.adobe.com/go/getflashplayer", c = typeof jQuery == "function", d = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/, e = {width: "100%", height: "100%", id: "_" + ("" + Math.random()).slice(9), allowfullscreen: !0, allowscriptaccess: "always", quality: "high", version: [3, 0], onFail: null, expressInstall: null, w3c: !1, cachebusting: !1}; + window.attachEvent && window.attachEvent("onbeforeunload", function () { + __flash_unloadHandler = function () { + }, __flash_savedUnloadHandler = function () { + } + }); + function f(a, b) { + if (b)for (var c in b)b.hasOwnProperty(c) && (a[c] = b[c]); + return a + } + + function g(a, b) { + var c = []; + for (var d in a)a.hasOwnProperty(d) && (c[d] = b(a[d])); + return c + } + + window.flashembed = function (a, b, c) { + typeof a == "string" && (a = document.getElementById(a.replace("#", ""))); + if (a) { + typeof b == "string" && (b = {src: b}); + return new j(a, f(f({}, e), b), c) + } + }; + var h = f(window.flashembed, {conf: e, getVersion: function () { + var a, b; + try { + b = navigator.plugins["Shockwave Flash"].description.slice(16) + } catch (c) { + try { + a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"), b = a && a.GetVariable("$version") + } catch (e) { + try { + a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"), b = a && a.GetVariable("$version") + } catch (f) { + } + } + } + b = d.exec(b); + return b ? [b[1], b[3]] : [0, 0] + }, asString: function (a) { + if (a === null || a === undefined)return null; + var b = typeof a; + b == "object" && a.push && (b = "array"); + switch (b) { + case"string": + a = a.replace(new RegExp("([\"\\\\])", "g"), "\\$1"), a = a.replace(/^\s?(\d+\.?\d*)%/, "$1pct"); + return"\"" + a + "\""; + case"array": + return"[" + g(a,function (a) { + return h.asString(a) + }).join(",") + "]"; + case"function": + return"\"function()\""; + case"object": + var c = []; + for (var d in a)a.hasOwnProperty(d) && c.push("\"" + d + "\":" + h.asString(a[d])); + return"{" + c.join(",") + "}" + } + return String(a).replace(/\s/g, " ").replace(/\'/g, "\"") + }, getHTML: function (b, c) { + b = f({}, b); + var d = ""; + b.width = b.height = b.id = b.w3c = b.src = null, b.onFail = b.version = b.expressInstall = null; + for (var e in b)b[e] && (d += ""); + var g = ""; + if (c) { + for (var i in c)if (c[i]) { + var j = c[i]; + g += i + "=" + encodeURIComponent(/function|object/.test(typeof j) ? h.asString(j) : j) + "&" + } + g = g.slice(0, -1), d += "" + } + d += ""; + return d + }, isSupported: function (a) { + return i[0] > a[0] || i[0] == a[0] && i[1] >= a[1] + }}), i = h.getVersion(); + + function j(c, d, e) { + if (h.isSupported(d.version))c.innerHTML = h.getHTML(d, e); else if (d.expressInstall && h.isSupported([6, 65]))c.innerHTML = h.getHTML(f(d, {src: d.expressInstall}), {MMredirectURL: location.href, MMplayerType: "PlugIn", MMdoctitle: document.title}); else { + c.innerHTML.replace(/\s/g, "") || (c.innerHTML = "

Flash version " + d.version + " or greater is required

" + (i[0] > 0 ? "Your version is " + i : "You have no flash plugin installed") + "

" + (c.tagName == "A" ? "

Click here to download latest version

" : "

Download latest version from here

"), c.tagName == "A" && (c.onclick = function () { + location.href = b + })); + if (d.onFail) { + var g = d.onFail.call(this); + typeof g == "string" && (c.innerHTML = g) + } + } + a && (window[d.id] = document.getElementById(d.id)), f(this, {getRoot: function () { + return c + }, getOptions: function () { + return d + }, getConf: function () { + return e + }, getApi: function () { + return c.firstChild + }}) + } + + c && (jQuery.tools = jQuery.tools || {version: "v1.2.7"}, jQuery.tools.flashembed = {conf: e}, jQuery.fn.flashembed = function (a, b) { + return this.each(function () { + jQuery(this).data("flashembed", flashembed(this, a, b)) + }) + }) +})(); +(function (a) { + var b, c, d, e; + a.tools = a.tools || {version: "v1.2.7"}, a.tools.history = {init: function (g) { + e || (/*a.browser && a.browser.msie && a.browser.version < "8" ? c || (c = a("