From 6706ba811e962982f27b3e173bb45ffe10844e1a Mon Sep 17 00:00:00 2001
From: pewgeuges <73141620+pewgeuges@users.noreply.github.com>
Date: Tue, 2 Feb 2021 04:40:41 +0000
Subject: [PATCH] development version for urgent bugfix test in response to
Forum (2.5.4d1)
git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2466893 b8457f37-d9ea-0310-8a92-e5e31aec5664
---
class/init.php | 71 +-
class/task.php | 16 +-
css/public.css | 2 +-
footnotes.php | 4 +-
js/jquery.tools.js | 936 +++++++++++++++----------
js/jquery.tools.min.js | 14 +-
readme.txt | 31 +-
templates/dashboard/editor-button.html | 88 +--
8 files changed, 677 insertions(+), 485 deletions(-)
diff --git a/class/init.php b/class/init.php
index b9acca2..001e527 100644
--- a/class/init.php
+++ b/class/init.php
@@ -5,16 +5,17 @@
* @filesource
* @author Stefan Herndler
* @since 1.5.0 12.09.14 10:56
+ *
*
- * Edited:
- * 1.6.5 replace deprecated function create_function()
- * 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
- * 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
- * 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
- * 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
- * 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
+ * @edit 1.6.5 Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution
+ * @edit 1.6.5 Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
+ * @edit 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution
+ * @edit 2.0.3 add versioning of public.css for cache busting 2020-10-29T1413+0100
+ * @edit 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
+ * @edit 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
+ * @edit 2.1.4 optionally enqueue an extra style sheet 2020-12-04T2231+0100
*
- * Last modified: 2020-12-08T1927+0100
+ * Last modified: 2021-01-31T0755+0100
*/
@@ -40,9 +41,16 @@ class MCI_Footnotes {
*
* @author Stefan Herndler
* @since 1.5.0
+ *
+ *
+ * Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution
+ * @since 1.6.5
+ *
+ * @contributor @felipelavinz
+ * @source https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
*/
public function run() {
- // register language
+ // register language
MCI_Footnotes_Language::registerHooks();
// register Button hooks
MCI_Footnotes_WYSIWYG::registerHooks();
@@ -68,13 +76,26 @@ class MCI_Footnotes {
* @author Stefan Herndler
* @since 1.5.0
*
- * Edited for 1.6.5: replaced deprecated function create_function()
+ *
+ * Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
+ * @since 1.6.5
+ *
+ * @contributor @felipelavinz
+ * @source https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
+ *
+ * @reporter @psykonevro
+ * @bugreport https://wordpress.org/support/topic/bug-function-create_function-is-deprecated/
+ * @bugreport https://wordpress.org/support/topic/deprecated-function-create_function-14/
+ *
+ * @reporter @daliasued
+ * @bugreport https://wordpress.org/support/topic/deprecated-function-create_function-14/#post-13312853
*
- * Contributed by Felipe Lavín Z. Thankfully acknowledged.
- *
- * create_function() was deprecated in PHP 7.2:
- *
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 - }}) - } + 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 = "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)) - }) - }) + 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("").attr("src", "javascript:false;").hide().get(0), a("body").append(c), setInterval(function () { - var d = c.contentWindow.document, e = d.location.hash; - b !== e && a(window).trigger("hash", e) - }, 100), f(location.hash || "#")) :*/ setInterval(function () { - var c = location.hash; - c !== b && a(window).trigger("hash", c) - }, 100), d = d ? d.add(g) : g, g.click(function (b) { - var d = a(this).attr("href"); - c && f(d); - if (d.slice(0, 1) != "#") { - location.href = "#" + d; - return b.preventDefault() - } - }), e = !0) - }}; - function f(a) { - if (a) { - var b = c.contentWindow.document; - b.open().close(), b.location.hash = a - } - } + var b, c, d, e; + a.tools = a.tools || {version: "v1.2.7"}, a.tools.history = {init: function (g) { - a(window).on("hash", function (c, e) { - e ? d.filter(function () { - var b = a(this).attr("href"); - return b == e || b == e.replace("#", "") - }).trigger("history", [e]) : d.eq(0).trigger("history", [e]), b = e - }), a.fn.history = function (b) { - a.tools.history.init(this); - return this.on("history", b) - } + /** + * REDACT DEPRECATED jQuery.browser() + * + * #2 This was only for very old Internet Explorer (older than IE8). + */ + + e || (/*a.browser && a.browser.msie && a.browser.version < "8" ? c || (c = a("").attr("src", "javascript:false;").hide().get(0), a("body").append(c), setInterval(function () { + var d = c.contentWindow.document, e = d.location.hash; + b !== e && a(window).trigger("hash", e) + }, 100), f(location.hash || "#")) :*/ setInterval(function () { + var c = location.hash; + c !== b && a(window).trigger("hash", c) + }, 100), d = d ? d.add(g) : g, g.click(function (b) { + var d = a(this).attr("href"); + c && f(d); + if (d.slice(0, 1) != "#") { + location.href = "#" + d; + return b.preventDefault() + } + }), e = !0) + }}; + function f(a) { + if (a) { + var b = c.contentWindow.document; + b.open().close(), b.location.hash = a + } + } + + a(window).on("hash", function (c, e) { + e ? d.filter(function () { + var b = a(this).attr("href"); + return b === e || b === e.replace("#", "") + }).trigger("history", [e]) : d.eq(0).trigger("history", [e]), b = e + }), a.fn.history = function (b) { + a.tools.history.init(this); + return this.on("history", b) + } })(jQuery); + (function (a) { - a.fn.mousewheel = function (a) { - return this[a ? "on" : "trigger"]("wheel", a) - }, a.event.special.wheel = {setup: function () { - a.event.add(this, b, c, {}) - }, teardown: function () { - a.event.remove(this, b, c) - }}; - var b = /*a.browser.mozilla ? "DOMMouseScroll" + (a.browser.version < "1.9" ? " mousemove" : "") :*/ "mousewheel"; + a.fn.mousewheel = function (a) { + return this[a ? "on" : "trigger"]("wheel", a) + }, a.event.special.wheel = {setup: function () { + a.event.add(this, b, c, {}) + }, teardown: function () { + a.event.remove(this, b, c) + }}; - function c(b) { - switch (b.type) { - case"mousemove": - return a.extend(b.data, {clientX: b.clientX, clientY: b.clientY, pageX: b.pageX, pageY: b.pageY}); - case"DOMMouseScroll": - a.extend(b, b.data), b.delta = -b.detail / 3; - break; - case"mousewheel": - b.delta = b.wheelDelta / 120 - } - b.type = "wheel"; - return a.event.handle.call(this, b, b.delta) - } + /** + * REDACT DEPRECATED jQuery.browser() + * + * #3 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. + */ + + var b = /*a.browser.mozilla ? "DOMMouseScroll" + (a.browser.version < "1.9" ? " mousemove" : "") :*/ "mousewheel"; + + function c(b) { + switch (b.type) { + case"mousemove": + return a.extend(b.data, {clientX: b.clientX, clientY: b.clientY, pageX: b.pageX, pageY: b.pageY}); + case"DOMMouseScroll": + a.extend(b, b.data), b.delta = -b.detail / 3; + break; + case"mousewheel": + b.delta = b.wheelDelta / 120 + } + b.type = "wheel"; + return a.event.handle.call(this, b, b.delta) + } })(jQuery); + (function (a) { - a.tools = a.tools || {version: "v1.2.7"}, a.tools.tooltip = {conf: {effect: "toggle", fadeOutSpeed: "fast", predelay: 0, delay: 30, opacity: 1, tip: 0, fadeIE: !1, position: ["top", "center"], offset: [0, 0], relative: !1, cancelDefault: !0, events: {def: "mouseenter,mouseleave", input: "focus,blur", widget: "focus mouseenter,blur mouseleave", tooltip: "mouseenter,mouseleave"}, layout: "", tipClass: "tooltip"}, addEffect: function (a, c, d) { - b[a] = [c, d] - }}; - var b = {toggle: [function (a) { - var b = this.getConf(), c = this.getTip(), d = b.opacity; - d < 1 && c.css({opacity: d}), c.show(), a.call() - }, function (a) { - this.getTip().hide(), a.call() - }], fade: [function (b) { - var c = this.getConf(); - /*!(a.browser && a.browser.msie) || c.fadeIE ?*/ this.getTip().fadeTo(c.fadeInSpeed, c.opacity, b) /*: (this.getTip().show(), b())*/ - }, function (b) { - var c = this.getConf(); - /*!(a.browser && a.browser.msie) || c.fadeIE ?*/ this.getTip().fadeOut(c.fadeOutSpeed, b) /*: (this.getTip().hide(), b())*/ - }]}; + a.tools = a.tools || {version: "v1.2.7"}, a.tools.tooltip = {conf: {effect: "toggle", fadeOutSpeed: "fast", predelay: 0, delay: 30, opacity: 1, tip: 0, fadeIE: !1, position: ["top", "center"], offset: [0, 0], relative: !1, cancelDefault: !0, events: {def: "mouseenter,mouseleave", input: "focus,blur", widget: "focus mouseenter,blur mouseleave", tooltip: "mouseenter,mouseleave"}, layout: "", tipClass: "tooltip"}, addEffect: function (a, c, d) { + b[a] = [c, d] + }}; + var b = {toggle: [function (a) { + var b = this.getConf(), c = this.getTip(), d = b.opacity; + d < 1 && c.css({opacity: d}), c.show(), a.call() + }, function (a) { + this.getTip().hide(), a.call() + }], fade: [function (b) { + var c = this.getConf(); - function c(b, c, d) { - var e = d.relative ? b.position().top : b.offset().top, f = d.relative ? b.position().left : b.offset().left, g = d.position[0]; - e -= c.outerHeight() - d.offset[0], f += b.outerWidth() + d.offset[1], /iPad/i.test(navigator.userAgent) && (e -= a(window).scrollTop()); - var h = c.outerHeight() + b.outerHeight(); - g == "center" && (e += h / 2), g == "bottom" && (e += h), g = d.position[1]; - var i = c.outerWidth() + b.outerWidth(); - g == "center" && (f -= i / 2), g == "left" && (f -= i); - return{top: e, left: f} - } + /** + * REDACT DEPRECATED jQuery.browser() + * + * #4 This disabled fade-in for Internet Explorer other than FadeIE. + */ - function d(d, e) { - var f = this, g = d.add(f), h, i = 0, j = 0, k = d.attr("title"), l = d.attr("data-tooltip"), m = b[e.effect], n, o = d.is(":input"), p = o && d.is(":checkbox, :radio, select, :button, :submit"), q = d.attr("type"), r = e.events[q] || e.events[o ? p ? "widget" : "input" : "def"]; - if (!m)throw"Nonexistent effect \"" + e.effect + "\""; - r = r.split(/,\s*/); - if (r.length != 2)throw"Tooltip: bad events configuration for " + q; - d.on(r[0],function (a) { - clearTimeout(i), e.predelay ? j = setTimeout(function () { - f.show(a) - }, e.predelay) : f.show(a) - }).on(r[1], function (a) { - clearTimeout(j), e.delay ? i = setTimeout(function () { - f.hide(a) - }, e.delay) : f.hide(a) - }), k && e.cancelDefault && (d.removeAttr("title"), d.data("title", k)), a.extend(f, {show: function (b) { - if (!h) { - l ? h = a(l) : e.tip ? h = a(e.tip).eq(0) : k ? h = a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k) : (h = d.next(), h.length || (h = d.parent().next())); - if (!h.length)throw"Cannot find tooltip for " + d - } - if (f.isShown())return f; - h.stop(!0, !0); - var o = c(d, h, e); - e.tip && h.html(d.data("title")), b = a.Event(), b.type = "onBeforeShow", g.trigger(b, [o]); - if (b.isDefaultPrevented())return f; - o = c(d, h, e), h.css({position: "absolute", top: o.top, left: o.left}), n = !0, m[0].call(f, function () { - b.type = "onShow", n = "full", g.trigger(b) - }); - var p = e.events.tooltip.split(/,\s*/); - h.data("__set") || (h.off(p[0]).on(p[0], function () { - clearTimeout(i), clearTimeout(j) - }), p[1] && !d.is("input:not(:checkbox, :radio), textarea") && h.off(p[1]).on(p[1], function (a) { - a.relatedTarget != d[0] && d.trigger(r[1].split(" ")[0]) - }), e.tip || h.data("__set", !0)); - return f - }, hide: function (c) { - if (!h || !f.isShown())return f; - c = a.Event(), c.type = "onBeforeHide", g.trigger(c); - if (!c.isDefaultPrevented()) { - n = !1, b[e.effect][1].call(f, function () { - c.type = "onHide", g.trigger(c) - }); - return f - } - }, isShown: function (a) { - return a ? n == "full" : n - }, getConf: function () { - return e - }, getTip: function () { - return h - }, getTrigger: function () { - return d - }}), a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","), function (b, c) { - a.isFunction(e[c]) && a(f).on(c, e[c]), f[c] = function (b) { - b && a(f).on(c, b); - return f - } - }) - } + /*!(a.browser && a.browser.msie) || c.fadeIE ?*/ this.getTip().fadeTo(c.fadeInSpeed, c.opacity, b) /*: (this.getTip().show(), b())*/ + }, function (b) { + var c = this.getConf(); - a.fn.tooltip = function (b) { - var c = this.data("tooltip"); - if (c)return c; - b = a.extend(!0, {}, a.tools.tooltip.conf, b), typeof b.position == "string" && (b.position = b.position.split(/,?\s/)), this.each(function () { - c = new d(a(this), b), a(this).data("tooltip", c) - }); - return b.api ? c : this - } + /** + * REDACT DEPRECATED jQuery.browser() + * + * #5 This disabled fade-out for Internet Explorer other than FadeIE. + */ + + /*!(a.browser && a.browser.msie) || c.fadeIE ?*/ this.getTip().fadeOut(c.fadeOutSpeed, b) /*: (this.getTip().hide(), b())*/ + }]}; + + function c(b, c, d) { + var e = d.relative ? b.position().top : b.offset().top, f = d.relative ? b.position().left : b.offset().left, g = d.position[0]; + e -= c.outerHeight() - d.offset[0], f += b.outerWidth() + d.offset[1], /iPad/i.test(navigator.userAgent) && (e -= a(window).scrollTop()); + var h = c.outerHeight() + b.outerHeight(); + g === "center" && (e += h / 2), g === "bottom" && (e += h), g = d.position[1]; + var i = c.outerWidth() + b.outerWidth(); + g === "center" && (f -= i / 2), g === "left" && (f -= i); + return{top: e, left: f} + } + + function d(d, e) { + var f = this, g = d.add(f), h, i = 0, j = 0, k = d.attr("title"), l = d.attr("data-tooltip"), m = b[e.effect], n, o = d.is(":input"), p = o && d.is(":checkbox, :radio, select, :button, :submit"), q = d.attr("type"), r = e.events[q] || e.events[o ? p ? "widget" : "input" : "def"]; + if (!m)throw"Nonexistent effect \"" + e.effect + "\""; + r = r.split(/,\s*/); + if (r.length != 2)throw"Tooltip: bad events configuration for " + q; + d.on(r[0],function (a) { + clearTimeout(i), e.predelay ? j = setTimeout(function () { + f.show(a) + }, e.predelay) : f.show(a) + }).on(r[1], function (a) { + clearTimeout(j), e.delay ? i = setTimeout(function () { + f.hide(a) + }, e.delay) : f.hide(a) + }), k && e.cancelDefault && (d.removeAttr("title"), d.data("title", k)), a.extend(f, {show: function (b) { + if (!h) { + l ? h = a(l) : e.tip ? h = a(e.tip).eq(0) : k ? h = a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k) : (h = d.next(), h.length || (h = d.parent().next())); + if (!h.length)throw"Cannot find tooltip for " + d + } + if (f.isShown())return f; + h.stop(!0, !0); + var o = c(d, h, e); + e.tip && h.html(d.data("title")), b = a.Event(), b.type = "onBeforeShow", g.trigger(b, [o]); + if (b.isDefaultPrevented())return f; + o = c(d, h, e), h.css({position: "absolute", top: o.top, left: o.left}), n = !0, m[0].call(f, function () { + b.type = "onShow", n = "full", g.trigger(b) + }); + var p = e.events.tooltip.split(/,\s*/); + h.data("__set") || (h.off(p[0]).on(p[0], function () { + clearTimeout(i), clearTimeout(j) + }), p[1] && !d.is("input:not(:checkbox, :radio), textarea") && h.off(p[1]).on(p[1], function (a) { + a.relatedTarget != d[0] && d.trigger(r[1].split(" ")[0]) + }), e.tip || h.data("__set", !0)); + return f + }, hide: function (c) { + if (!h || !f.isShown())return f; + c = a.Event(), c.type = "onBeforeHide", g.trigger(c); + if (!c.isDefaultPrevented()) { + n = !1, b[e.effect][1].call(f, function () { + c.type = "onHide", g.trigger(c) + }); + return f + } + }, isShown: function (a) { + return a ? n === "full" : n + }, getConf: function () { + return e + }, getTip: function () { + return h + }, getTrigger: function () { + return d + }}), a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","), function (b, c) { + + /** + * REPLACE DEPRECATED FUNCTION jQuery.isFunction() + * + * Update: Libraries: jQuery Tools: replace deprecated function jQuery.isFunction(), thanks to @a223123131 bug report + * @edit 2.5.4 + * @datestamp 2021-01-27T1911+0100 + * @accountable @pewgeuges + * + * @reporter @a223123131 + * @bugreport https://wordpress.org/support/topic/deprecated-jquery-code-9/ + * + * The official fix is to replace it with the typeof operator. + * @link https://api.jquery.com/jquery.isfunction/ + * + * That requires to double-check the absence of problem with + * the use of typeof. + * @see Douglas Crockford, JavaScript: The Good Parts + */ + + typeof (e[c]) === "function" && a(f).on(c, e[c]), f[c] = function (b) { + b && a(f).on(c, b); + return f + } + }) + } + + a.fn.tooltip = function (b) { + var c = this.data("tooltip"); + if (c)return c; + b = a.extend(!0, {}, a.tools.tooltip.conf, b), typeof b.position === "string" && (b.position = b.position.split(/,?\s/)), this.each(function () { + c = new d(a(this), b), a(this).data("tooltip", c) + }); + return b.api ? c : this + } })(jQuery); + (function (a) { - var b = a.tools.tooltip; - b.dynamic = {conf: {classNames: "top right bottom left"}}; - function c(b) { - var c = a(window), d = c.width() + c.scrollLeft(), e = c.height() + c.scrollTop(); - return[b.offset().top <= c.scrollTop(), d <= b.offset().left + b.width(), e <= b.offset().top + b.height(), c.scrollLeft() >= b.offset().left] - } + var b = a.tools.tooltip; + b.dynamic = {conf: {classNames: "top right bottom left"}}; + function c(b) { + var c = a(window), d = c.width() + c.scrollLeft(), e = c.height() + c.scrollTop(); + return[b.offset().top <= c.scrollTop(), d <= b.offset().left + b.width(), e <= b.offset().top + b.height(), c.scrollLeft() >= b.offset().left] + } - function d(a) { - var b = a.length; - while (b--)if (a[b])return!1; - return!0 - } + function d(a) { + var b = a.length; + while (b--)if (a[b])return!1; + return!0 + } - a.fn.dynamic = function (e) { - typeof e == "number" && (e = {speed: e}), e = a.extend({}, b.dynamic.conf, e); - var f = a.extend(!0, {}, e), g = e.classNames.split(/\s/), h; - this.each(function () { - var b = a(this).tooltip().onBeforeShow(function (b, e) { - var i = this.getTip(), j = this.getConf(); - h || (h = [j.position[0], j.position[1], j.offset[0], j.offset[1], a.extend({}, j)]), a.extend(j, h[4]), j.position = [h[0], h[1]], j.offset = [h[2], h[3]], i.css({visibility: "hidden", position: "absolute", top: e.top, left: e.left}).show(); - var k = a.extend(!0, {}, f), l = c(i); - if (!d(l)) { - l[2] && (a.extend(j, k.top), j.position[0] = "top", i.addClass(g[0])), l[3] && (a.extend(j, k.right), j.position[1] = "right", i.addClass(g[1])), l[0] && (a.extend(j, k.bottom), j.position[0] = "bottom", i.addClass(g[2])), l[1] && (a.extend(j, k.left), j.position[1] = "left", i.addClass(g[3])); - if (l[0] || l[2])j.offset[0] *= -1; - if (l[1] || l[3])j.offset[1] *= -1 - } - i.css({visibility: "visible"}).hide() - }); - b.onBeforeShow(function () { - var a = this.getConf(), b = this.getTip(); - setTimeout(function () { - a.position = [h[0], h[1]], a.offset = [h[2], h[3]] - }, 0) - }), b.onHide(function () { - var a = this.getTip(); - a.removeClass(e.classNames) - }), ret = b - }); - return e.api ? ret : this - } + a.fn.dynamic = function (e) { + typeof e === "number" && (e = {speed: e}), e = a.extend({}, b.dynamic.conf, e); + var f = a.extend(!0, {}, e), g = e.classNames.split(/\s/), h; + this.each(function () { + var b = a(this).tooltip().onBeforeShow(function (b, e) { + var i = this.getTip(), j = this.getConf(); + h || (h = [j.position[0], j.position[1], j.offset[0], j.offset[1], a.extend({}, j)]), a.extend(j, h[4]), j.position = [h[0], h[1]], j.offset = [h[2], h[3]], i.css({visibility: "hidden", position: "absolute", top: e.top, left: e.left}).show(); + var k = a.extend(!0, {}, f), l = c(i); + if (!d(l)) { + l[2] && (a.extend(j, k.top), j.position[0] = "top", i.addClass(g[0])), l[3] && (a.extend(j, k.right), j.position[1] = "right", i.addClass(g[1])), l[0] && (a.extend(j, k.bottom), j.position[0] = "bottom", i.addClass(g[2])), l[1] && (a.extend(j, k.left), j.position[1] = "left", i.addClass(g[3])); + if (l[0] || l[2])j.offset[0] *= -1; + if (l[1] || l[3])j.offset[1] *= -1 + } + i.css({visibility: "visible"}).hide() + }); + b.onBeforeShow(function () { + var a = this.getConf(), b = this.getTip(); + setTimeout(function () { + a.position = [h[0], h[1]], a.offset = [h[2], h[3]] + }, 0) + }), b.onHide(function () { + var a = this.getTip(); + a.removeClass(e.classNames) + }), ret = b + }); + return e.api ? ret : this + } })(jQuery); + (function (a) { - var b = a.tools.tooltip; - a.extend(b.conf, {direction: "up", bounce: !1, slideOffset: 10, slideInSpeed: 200, slideOutSpeed: 200, slideFade: true /*!(a.browser && a.browser.msie)*/}); - var c = {up: ["-", "top"], down: ["+", "top"], left: ["-", "left"], right: ["+", "left"]}; - b.addEffect("slide", function (a) { - var b = this.getConf(), d = this.getTip(), e = b.slideFade ? {opacity: b.opacity} : {}, f = c[b.direction] || c.up; - e[f[1]] = f[0] + "=" + b.slideOffset, b.slideFade && d.css({opacity: 0}), d.show().animate(e, b.slideInSpeed, a) - }, function (b) { - var d = this.getConf(), e = d.slideOffset, f = d.slideFade ? {opacity: 0} : {}, g = c[d.direction] || c.up, h = "" + g[0]; - d.bounce && (h = h == "+" ? "-" : "+"), f[g[1]] = h + "=" + e, this.getTip().animate(f, d.slideOutSpeed, function () { - a(this).hide(), b.call() - }) - }) + var b = a.tools.tooltip; + + /** + * REDACT DEPRECATED jQuery.browser() + * + * #6 This disabled slide-fade for Internet Explorer. + * Browsers not supporting an effect simply don’t execute it, they won’t throw an error. + */ + + a.extend(b.conf, {direction: "up", bounce: !1, slideOffset: 10, slideInSpeed: 200, slideOutSpeed: 200, slideFade: true /*!(a.browser && a.browser.msie)*/}); + var c = {up: ["-", "top"], down: ["+", "top"], left: ["-", "left"], right: ["+", "left"]}; + b.addEffect("slide", function (a) { + var b = this.getConf(), d = this.getTip(), e = b.slideFade ? {opacity: b.opacity} : {}, f = c[b.direction] || c.up; + e[f[1]] = f[0] + "=" + b.slideOffset, b.slideFade && d.css({opacity: 0}), d.show().animate(e, b.slideInSpeed, a) + }, function (b) { + var d = this.getConf(), e = d.slideOffset, f = d.slideFade ? {opacity: 0} : {}, g = c[d.direction] || c.up, h = "" + g[0]; + d.bounce && (h = h === "+" ? "-" : "+"), f[g[1]] = h + "=" + e, this.getTip().animate(f, d.slideOutSpeed, function () { + a(this).hide(), b.call() + }) + }) })(jQuery); diff --git a/js/jquery.tools.min.js b/js/jquery.tools.min.js index 74252b0..dcd9078 100644 --- a/js/jquery.tools.min.js +++ b/js/jquery.tools.min.js @@ -20,14 +20,8 @@ * Created: 2008-07-01 | Updated: 2008-07-14 * * ----- - * - * Added jQueryUI and checks whether jQuery.browser exists - * Following @vonpiernikClick here to download latest version
":"Download latest version from here
"),"A"==c.tagName&&(c.onclick=function(){location.href=b})),d.onFail){var g=d.onFail.call(this);"string"==typeof g&&(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;function f(a){if(a){var b=c.contentWindow.document;b.open().close(),b.location.hash=a}}a.tools=a.tools||{version:"v1.2.7"},a.tools.history={init:function(g){e||(setInterval((function(){var c=location.hash;c!==b&&a(window).trigger("hash",c)}),100),d=d?d.add(g):g,g.click((function(b){var d=a(this).attr("href");if("#"!=d.slice(0,1))return location.href="#"+d,b.preventDefault()})),e=!0)}},a(window).on("hash",(function(c,e){e?d.filter((function(){var b=a(this).attr("href");return b==e||b==e.replace("#","")})).trigger("history",[e]):d.eq(0).trigger("history",[e]),b=e})),a.fn.history=function(b){return a.tools.history.init(this),this.on("history",b)}}(jQuery),function(a){a.fn.mousewheel=function(a){return this[a?"on":"trigger"]("wheel",a)},a.event.special.wheel={setup:function(){a.event.add(this,b,c,{})},teardown:function(){a.event.remove(this,b,c)}};var b="mousewheel";function c(b){switch(b.type){case"mousemove":return a.extend(b.data,{clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY});case"DOMMouseScroll":a.extend(b,b.data),b.delta=-b.detail/3;break;case"mousewheel":b.delta=b.wheelDelta/120}return b.type="wheel",a.event.handle.call(this,b,b.delta)}}(jQuery),function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b)},function(b){var c=this.getConf();this.getTip().fadeOut(c.fadeOutSpeed,b)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();"center"==g&&(e+=h/2),"bottom"==g&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();return"center"==g&&(f-=i/2),"left"==g&&(f-=i),{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw'Nonexistent effect "'+e.effect+'"';if(2!=(r=r.split(/,\s*/)).length)throw"Tooltip: bad events configuration for "+q;d.on(r[0],(function(a){clearTimeout(i),e.predelay?j=setTimeout((function(){f.show(a)}),e.predelay):f.show(a)})).on(r[1],(function(a){clearTimeout(j),e.delay?i=setTimeout((function(){f.hide(a)}),e.delay):f.hide(a)})),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h&&(l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next()).length||(h=d.parent().next()),!h.length))throw"Cannot find tooltip for "+d;if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);if(e.tip&&h.html(d.data("title")),(b=a.Event()).type="onBeforeShow",g.trigger(b,[o]),b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,(function(){b.type="onShow",n="full",g.trigger(b)}));var p=e.events.tooltip.split(/,\s*/);return h.data("__set")||(h.off(p[0]).on(p[0],(function(){clearTimeout(i),clearTimeout(j)})),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],(function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])})),e.tip||h.data("__set",!0)),f},hide:function(c){return h&&f.isShown()?((c=a.Event()).type="onBeforeHide",g.trigger(c),c.isDefaultPrevented()?void 0:(n=!1,b[e.effect][1].call(f,(function(){c.type="onHide",g.trigger(c)})),f)):f},isShown:function(a){return a?"full"==n:n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),(function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){return b&&a(f).on(c,b),f}}))}a.fn.tooltip=function(b){var c=this.data("tooltip");return c||("string"==typeof(b=a.extend(!0,{},a.tools.tooltip.conf,b)).position&&(b.position=b.position.split(/,?\s/)),this.each((function(){c=new d(a(this),b),a(this).data("tooltip",c)})),b.api?c:this)}}(jQuery),function(a){var b=a.tools.tooltip;function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){for(var b=a.length;b--;)if(a[b])return!1;return!0}b.dynamic={conf:{classNames:"top right bottom left"}},a.fn.dynamic=function(e){"number"==typeof e&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;return this.each((function(){var b=a(this).tooltip().onBeforeShow((function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);d(l)||(l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3])),(l[0]||l[2])&&(j.offset[0]*=-1),(l[1]||l[3])&&(j.offset[1]*=-1)),i.css({visibility:"visible"}).hide()}));b.onBeforeShow((function(){var a=this.getConf(),b=this.getTip();setTimeout((function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]}),0)})),b.onHide((function(){var a;this.getTip().removeClass(e.classNames)})),ret=b})),e.api?ret:this}}(jQuery),function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!0});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",(function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)}),(function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h="+"==h?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,(function(){a(this).hide(),b.call()}))}))}(jQuery); +!function(a){var b,e,f,g,h,i;function c(){return[a(document).width(),a(document).height()]}function d(b){if(b)return b.call(a.mask)}a.tools=a.tools||{version:"v1.2.7"},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}},a.mask={load:function(j,k){if(g)return this;"string"===typeof j&&(j={color:j}),j=j||h,h=j=a.extend(a.extend({},b.conf),j),(e=a("#"+j.maskId)).length||(e=a("").attr("id",j.maskId),a("body").append(e));var l=c();return 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),!1===d(j.onBeforeLoad)?this:(j.closeOnEsc&&a(document).on("keydown.mask",(function(b){27===b.keyCode&&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,"auto"===i?0:i)})),e.css({display:"block"}).fadeTo(j.loadSpeed,j.opacity,(function(){a.mask.fit(),d(j.onLoad),g="full"})),g=!0,this)},close:function(){if(g){if(!1===d(h.onBeforeClose))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?"full"===g:g},getConf:function(){return h},getExposed:function(){return f}},a.fn.mask=function(b){return a.mask.load(b),this},a.fn.expose=function(b){return a.mask.load(b,this),this}}(jQuery),function(){var a=document.all,b="http://www.adobe.com/go/getflashplayer",c="function"===typeof jQuery,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};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.attachEvent&&window.attachEvent("onbeforeunload",(function(){__flash_unloadHandler=function(){},__flash_savedUnloadHandler=function(){}})),window.flashembed=function(a,b,c){if("string"===typeof a&&(a=document.getElementById(a.replace("#",""))),a)return"string"===typeof b&&(b={src:b}),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{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"))&&a.GetVariable("$version")}catch(e){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"))&&a.GetVariable("$version")}catch(f){}}}return(b=d.exec(b))?[b[1],b[3]]:[0,0]},asString:function(a){if(null===a)return null;var b=typeof a;switch("object"===b&&a.push&&(b="array"),b){case"string":return'"'+(a=(a=a.replace(new RegExp('(["\\\\])',"g"),"\\$1")).replace(/^\s?(\d+\.?\d*)%/,"$1pct"))+'"';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){var 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 if(c.innerHTML.replace(/\s/g,"")||(c.innerHTML="Click here to download latest version
":"Download latest version from here
"),"A"===c.tagName&&(c.onclick=function(){location.href=b})),d.onFail){var g=d.onFail.call(this);"string"===typeof g&&(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;function f(a){if(a){var b=c.contentWindow.document;b.open().close(),b.location.hash=a}}a.tools=a.tools||{version:"v1.2.7"},a.tools.history={init:function(g){e||(setInterval((function(){var c=location.hash;c!==b&&a(window).trigger("hash",c)}),100),d=d?d.add(g):g,g.click((function(b){var d=a(this).attr("href");if("#"!=d.slice(0,1))return location.href="#"+d,b.preventDefault()})),e=!0)}},a(window).on("hash",(function(c,e){e?d.filter((function(){var b=a(this).attr("href");return b===e||b===e.replace("#","")})).trigger("history",[e]):d.eq(0).trigger("history",[e]),b=e})),a.fn.history=function(b){return a.tools.history.init(this),this.on("history",b)}}(jQuery),function(a){a.fn.mousewheel=function(a){return this[a?"on":"trigger"]("wheel",a)},a.event.special.wheel={setup:function(){a.event.add(this,b,c,{})},teardown:function(){a.event.remove(this,b,c)}};var b="mousewheel";function c(b){switch(b.type){case"mousemove":return a.extend(b.data,{clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY});case"DOMMouseScroll":a.extend(b,b.data),b.delta=-b.detail/3;break;case"mousewheel":b.delta=b.wheelDelta/120}return b.type="wheel",a.event.handle.call(this,b,b.delta)}}(jQuery),function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b)},function(b){var c=this.getConf();this.getTip().fadeOut(c.fadeOutSpeed,b)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();"center"===g&&(e+=h/2),"bottom"===g&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();return"center"===g&&(f-=i/2),"left"===g&&(f-=i),{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw'Nonexistent effect "'+e.effect+'"';if(2!=(r=r.split(/,\s*/)).length)throw"Tooltip: bad events configuration for "+q;d.on(r[0],(function(a){clearTimeout(i),e.predelay?j=setTimeout((function(){f.show(a)}),e.predelay):f.show(a)})).on(r[1],(function(a){clearTimeout(j),e.delay?i=setTimeout((function(){f.hide(a)}),e.delay):f.hide(a)})),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h&&(l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next()).length||(h=d.parent().next()),!h.length))throw"Cannot find tooltip for "+d;if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);if(e.tip&&h.html(d.data("title")),(b=a.Event()).type="onBeforeShow",g.trigger(b,[o]),b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,(function(){b.type="onShow",n="full",g.trigger(b)}));var p=e.events.tooltip.split(/,\s*/);return h.data("__set")||(h.off(p[0]).on(p[0],(function(){clearTimeout(i),clearTimeout(j)})),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],(function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])})),e.tip||h.data("__set",!0)),f},hide:function(c){return h&&f.isShown()?((c=a.Event()).type="onBeforeHide",g.trigger(c),c.isDefaultPrevented()?void 0:(n=!1,b[e.effect][1].call(f,(function(){c.type="onHide",g.trigger(c)})),f)):f},isShown:function(a){return a?"full"===n:n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),(function(b,c){typeof(e[c])==="function"&&a(f).on(c,e[c]),f[c]=function(b){return b&&a(f).on(c,b),f}}))}a.fn.tooltip=function(b){var c=this.data("tooltip");return c||("string"===typeof(b=a.extend(!0,{},a.tools.tooltip.conf,b)).position&&(b.position=b.position.split(/,?\s/)),this.each((function(){c=new d(a(this),b),a(this).data("tooltip",c)})),b.api?c:this)}}(jQuery),function(a){var b=a.tools.tooltip;function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){for(var b=a.length;b--;)if(a[b])return!1;return!0}b.dynamic={conf:{classNames:"top right bottom left"}},a.fn.dynamic=function(e){"number"===typeof e&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;return this.each((function(){var b=a(this).tooltip().onBeforeShow((function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);d(l)||(l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3])),(l[0]||l[2])&&(j.offset[0]*=-1),(l[1]||l[3])&&(j.offset[1]*=-1)),i.css({visibility:"visible"}).hide()}));b.onBeforeShow((function(){var a=this.getConf(),b=this.getTip();setTimeout((function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]}),0)})),b.onHide((function(){var a;this.getTip().removeClass(e.classNames)})),ret=b})),e.api?ret:this}}(jQuery),function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!0});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",(function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)}),(function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h="+"===h?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,(function(){a(this).hide(),b.call()}))}))}(jQuery); diff --git a/readme.txt b/readme.txt index 3e4be6f..53610b7 100755 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ === footnotes === -Contributors: mark.cheret, lolzim, dartiss, docteurfitness, martinneumannat, misfist, rumperuu, spaceling, pewgeuges +Contributors: mark.cheret, lolzim, dartiss, docteurfitness, felipelavinz, martinneumannat, misfist, rumperuu, spaceling, vonpiernik, pewgeuges Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing Requires at least: 3.9 Tested up to: 5.6 @@ -79,8 +79,11 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == -= 2.5.4 = += 2.5.4d1 = +- Update: Libraries: jQuery Tools: replace deprecated function jQuery.isFunction(), thanks to @a223123131 bug report - Bugfix: Tooltips: fix display in Popup Maker popups +- Bugfix: Libraries: jQuery Tools: replace discouraged double equals sign with recommended triple equals sign +- Bugfix: Editor button: Text editor button: try to fix uncaught reference error of “QTags is not defined”, thanks to @dpartridge bug report = 2.5.3 = - Bugfix: URL wrap: exclude URL pattern as folder name in Wayback Machine URL, thanks to @rumperuu bug report @@ -246,8 +249,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** = 2.1.1 = - Bugfix: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report - Bugfix: Dashboard: priority level setting for the_content hook, thanks to @imeson bug report -- Update: Libraries: jQuery Tools: redact jQuery.browser function use in js/jquery.tools.min.js -- Update: Libraries: jQuery Tools: complete minification +- Update: Libraries: jQuery Tools: redact (comment out) all 6 instances of deprecated function jQuery.browser(), thanks to @bjrnet21 @cconser @vyassuresh @spaceling @widecast @olivlyon @maxident bug reports +- Bugfix: Libraries: jQuery Tools: complete minification - Bugfix: Libraries: make script loads depend on tooltip implementation option - Bugfix: Libraries: jQuery UI: properly pick the libraries registered by WordPress needed for tooltips - Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report @@ -265,8 +268,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** = 2.1.0 = - Add: Tooltips: Read-on button: Label: configurable instead of localizable -- Bugfix: Referrers: disabled bottom border for theme compatibility -- Update: Accessibility: added 'speaker-mute' class to reference container +- Bugfix: Referrers: disable bottom border for theme compatibility +- Update: Accessibility: add 'speaker-mute' class to reference container - Bugfix: Dashboard: Layout: added named selectors to limit applicability of styles - UPDATE: REMOVED the_post hook, the plugin stopped supporting this hook @@ -281,12 +284,12 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** = 2.0.6 = - Bugfix: Infinite scroll: debug autoload by adding post ID, thanks to @docteurfitness code contribution -- Bugfix: Referrers: deleted vertical align tweaks, for cross-theme and user agent compatibility -- Bugfix: Reference container: fixed line breaking behavior in footnote # clusters +- Bugfix: Referrers: delete vertical align tweaks, for cross-theme and user agent compatibility +- Bugfix: Reference container: fix line breaking behavior in footnote # clusters - Bugfix: Reference container: auto-extending column to fit widest, to fix display with short note texts - Bugfix: Reference container: IDs: slightly increased left padding -- Bugfix: Translations: fixed spelling error and erroneously changed word in en_GB and en_US -- Bugfix: Typesetting: discarded the dot after footnote numbers as not localizable (should be optional) +- Bugfix: Translations: fix spelling error and erroneously changed word in en_GB and en_US +- Bugfix: Typesetting: discard the dot after footnote numbers as not localizable (should be optional) - Bugfix: Reference container: Collapse button fully clickable, not sign only - Bugfix: Reference container: Collapse button 'collapse' with minus sign not hyphen-minus - Update: Tooltips: set display predelay to 0 for responsiveness (was 800 since 2.0.0, 400 before) @@ -296,7 +299,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** = 2.0.5 = - Bugfix: Reference container: fix relative position through priority level, thanks to @june01 @imeson bug reports, thanks to @spaceling code contribution -- Bugfix: Public style sheet: Reference container: unset width of text column to fix site issues +- Bugfix: Reference container: unset width of text column to fix site issues - Update: Enable all hooks by default to prevent footnotes from seeming broken in post titles - Bugfix: Restore cursor shape pointer over 'Continue reading' button after hyperlink removal - Bugfix: Settings style sheet: unenqueue to fix input boxes on public pages (enqueued for 2.0.4) @@ -335,7 +338,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** - Major contributions taken from WordPress user pewgeuges, all details here https://github.com/media-competence-institute/footnotes/blob/master/README.md: - Update: **symbol for backlinks** removed - Update: hyperlink moved to the reference number -- Update: Upgrade jQuery library +- Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution +- Update: Libraries: jQuery Tools: add condition whether deprecated function jQuery.browser() exists, thanks to @vonpiernik code contribution - Update: Account for disruptive PHP change - Bugfix: footnote links script independent - Bugfix: Get the “Continue reading” link to work in the mouse-over box @@ -350,7 +354,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** - Beginning of translation to French = 1.6.5 = -- Update: Fix for deprecated PHP function create_function() (man thanks to Felipe Lavín Z.) +- Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution +- Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution - Update: The CSS had been modified in order to show the tooltip numbers a little less higher than text - Bugfix: Fixed error on demo in backend diff --git a/templates/dashboard/editor-button.html b/templates/dashboard/editor-button.html index b1c8695..5b79bdb 100644 --- a/templates/dashboard/editor-button.html +++ b/templates/dashboard/editor-button.html @@ -1,41 +1,49 @@ \ No newline at end of file + /** + * adds a tag in at the beginning and at the end of a selected text in the specific text area + * @param string elementID + * @param string openTag + * @param string closeTag + */ + function MCI_Footnotes_wrapText(elementID, openTag, closeTag) { + var textArea = jQuery('#' + elementID); + var len = textArea.val().length; + var start = textArea[0].selectionStart; + var end = textArea[0].selectionEnd; + var selectedText = textArea.val().substring(start, end); + var replacement = openTag + selectedText + closeTag; + textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len)); + } + /** + * adds a new button to the plain text editor + * + * @edit 2.5.4d1 try to fix uncaught reference error of “QTags is not defined” + * + * @reporter @dpartridge + * @bugreport https://wordpress.org/support/topic/qtags-addbutton/ + */ + if ( QTags ) { + QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback ); + } + + /** + * callback function when the button is clicked + * executes a ajax call to get the start and end tag for the footnotes and + * adds them in before and after the selected text + */ + function MCI_Footnotes_text_editor_callback() { + jQuery.ajax({ + type: 'POST', + url: '/wp-admin/admin-ajax.php', + data: { + action: 'footnotes_getTags' + }, + success: function(data, textStatus, XMLHttpRequest){ + var l_arr_Tags = JSON.parse(data); + MCI_Footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']); + }, + error: function(MLHttpRequest, textStatus, errorThrown){ + } + }); + } +