From dcceefd84f3444050438851e7518be0a3d59de94 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Wed, 25 Oct 2017 12:39:26 -0700 Subject: [PATCH] resources: Remove deprecated 'jquery.appear' module Change-Id: Ifce63eb64c94203acb049d3f588e75f18123f12e --- RELEASE-NOTES-1.31 | 2 + resources/Resources.php | 4 - resources/lib/jquery/jquery.appear.js | 138 -------------------------- 3 files changed, 2 insertions(+), 142 deletions(-) delete mode 100644 resources/lib/jquery/jquery.appear.js diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 5e2df5ff27..2f2ba8f86c 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -34,6 +34,8 @@ production. * The deprecated 'jquery.autoEllipsis' module was removed. Use the CSS text-overflow property instead. * The deprecated 'jquery.placeholder' module was removed. +* The deprecated 'jquery.appear' module was removed. Use the + 'mediawiki.viewport' module instead. * … === Bug fixes in 1.31 === diff --git a/resources/Resources.php b/resources/Resources.php index 9acc0ef810..940dbe4bd2 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -151,10 +151,6 @@ return [ 'messages' => [ 'brackets', 'word-separator' ], 'targets' => [ 'mobile', 'desktop' ], ], - 'jquery.appear' => [ - 'deprecated' => 'Please use "mediawiki.viewport" instead.', - 'scripts' => 'resources/lib/jquery/jquery.appear.js', - ], 'jquery.async' => [ 'scripts' => 'resources/lib/jquery/jquery.async.js', ], diff --git a/resources/lib/jquery/jquery.appear.js b/resources/lib/jquery/jquery.appear.js deleted file mode 100644 index 4f77886cda..0000000000 --- a/resources/lib/jquery/jquery.appear.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * jQuery.appear - * http://code.google.com/p/jquery-appear/ - * - * Copyright (c) 2009 Michael Hixson - * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) -*/ -(function($) { - - $.fn.appear = function(fn, options) { - - var settings = $.extend({ - - //arbitrary data to pass to fn - data: undefined, - - //call fn only on the first appear? - one: true - - }, options); - - return this.each(function() { - - var t = $(this); - - //whether the element is currently visible - t.appeared = false; - - if (!fn) { - - //trigger the custom event - t.trigger('appear', settings.data); - return; - } - - var w = $(window); - - //fires the appear event when appropriate - var check = function() { - - //is the element hidden? - if (!t.is(':visible')) { - - //it became hidden - t.appeared = false; - return; - } - - //is the element inside the visible window? - var a = w.scrollLeft(); - var b = w.scrollTop(); - var o = t.offset(); - var x = o.left; - var y = o.top; - - if (y + t.height() >= b && - y <= b + w.height() && - x + t.width() >= a && - x <= a + w.width()) { - - //trigger the custom event - if (!t.appeared) t.trigger('appear', settings.data); - - } else { - - //it scrolled out of view - t.appeared = false; - } - }; - - //create a modified fn with some additional logic - var modifiedFn = function() { - - //mark the element as visible - t.appeared = true; - - //is this supposed to happen only once? - if (settings.one) { - - //remove the check - w.unbind('scroll', check); - var i = $.inArray(check, $.fn.appear.checks); - if (i >= 0) $.fn.appear.checks.splice(i, 1); - } - - //trigger the original fn - fn.apply(this, arguments); - }; - - //bind the modified fn to the element - if (settings.one) t.one('appear', settings.data, modifiedFn); - else t.bind('appear', settings.data, modifiedFn); - - //check whenever the window scrolls - w.scroll(check); - - //check whenever the dom changes - $.fn.appear.checks.push(check); - - //check now - (check)(); - }); - }; - - //keep a queue of appearance checks - $.extend($.fn.appear, { - - checks: [], - timeout: null, - - //process the queue - checkAll: function() { - var length = $.fn.appear.checks.length; - if (length > 0) while (length--) ($.fn.appear.checks[length])(); - }, - - //check the queue asynchronously - run: function() { - if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout); - $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20); - } - }); - - //run checks when these methods are called - $.each(['append', 'prepend', 'after', 'before', 'attr', - 'removeAttr', 'addClass', 'removeClass', 'toggleClass', - 'remove', 'css', 'show', 'hide'], function(i, n) { - var old = $.fn[n]; - if (old) { - $.fn[n] = function() { - var r = old.apply(this, arguments); - $.fn.appear.run(); - return r; - } - } - }); - -})(jQuery); \ No newline at end of file -- 2.20.1