From caaae4e6db3b63985049a172060d5f9cbbe9afae Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Mon, 23 Oct 2017 10:52:33 -0700 Subject: [PATCH] resources: Remove the deprecated 'jquery.badge' module Bug: T178450 Change-Id: I4540e5959ea15323b1f54be51fbeea6ca3f35169 Depends-On: I78543abe412d04d61a05e76702cb7681d5fad61d --- RELEASE-NOTES-1.31 | 1 + jsduck.json | 1 - resources/Resources.php | 6 -- resources/src/jquery/jquery.badge.css | 35 ----------- resources/src/jquery/jquery.badge.js | 88 --------------------------- 5 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 resources/src/jquery/jquery.badge.css delete mode 100644 resources/src/jquery/jquery.badge.js diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 042af6e094..86d887bece 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -28,6 +28,7 @@ production. * … ==== Removed and replaced external libraries ==== +* (T17845) The deprecated 'jquery.badge' module was removed. * … === Bug fixes in 1.31 === diff --git a/jsduck.json b/jsduck.json index 7e59432c0e..0f8daf8bd2 100644 --- a/jsduck.json +++ b/jsduck.json @@ -22,7 +22,6 @@ "resources/src/mediawiki.widgets", "resources/src/jquery/jquery.accessKeyLabel.js", "resources/src/jquery/jquery.autoEllipsis.js", - "resources/src/jquery/jquery.badge.js", "resources/src/jquery/jquery.byteLength.js", "resources/src/jquery/jquery.byteLimit.js", "resources/src/jquery/jquery.checkboxShiftClick.js", diff --git a/resources/Resources.php b/resources/Resources.php index b9986fec57..ca24922b33 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -164,12 +164,6 @@ return [ 'dependencies' => 'jquery.highlightText', 'targets' => [ 'desktop', 'mobile' ], ], - 'jquery.badge' => [ - 'deprecated' => 'Please use Notifications instead.', - 'scripts' => 'resources/src/jquery/jquery.badge.js', - 'styles' => 'resources/src/jquery/jquery.badge.css', - 'dependencies' => 'mediawiki.language', - ], 'jquery.byteLength' => [ 'scripts' => 'resources/src/jquery/jquery.byteLength.js', 'targets' => [ 'desktop', 'mobile' ], diff --git a/resources/src/jquery/jquery.badge.css b/resources/src/jquery/jquery.badge.css deleted file mode 100644 index 1157c27d96..0000000000 --- a/resources/src/jquery/jquery.badge.css +++ /dev/null @@ -1,35 +0,0 @@ -.mw-badge { - background-color: #72777d; - min-width: 7px; - border-radius: 2px; - padding: 1px 4px; - text-align: center; - font-size: 12px; - line-height: 12px; - cursor: pointer; -} - -.mw-badge-content { - font-weight: bold; - color: #fff; - vertical-align: baseline; -} - -.mw-badge-inline { - margin-left: 3px; - display: inline-block; - /* Hack for IE6 and IE7 (T49926) */ - zoom: 1; - *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */ - -} -.mw-badge-overlay { - position: absolute; - bottom: -1px; - right: -3px; - z-index: 50; -} - -.mw-badge-important { - background-color: #d33; -} diff --git a/resources/src/jquery/jquery.badge.js b/resources/src/jquery/jquery.badge.js deleted file mode 100644 index 40b3baf0e9..0000000000 --- a/resources/src/jquery/jquery.badge.js +++ /dev/null @@ -1,88 +0,0 @@ -/*! - * jQuery Badge plugin - * - * @license MIT - * - * @author Ryan Kaldari , 2012 - * @author Andrew Garrett , 2012 - * @author Marius Hoch , 2012 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * This program is distributed WITHOUT ANY WARRANTY. - */ - -/** - * @class jQuery.plugin.badge - */ -( function ( $, mw ) { - /** - * Put a badge on an item on the page. The badge container will be appended to the selected element(s). - * - * $element.badge( text ); - * $element.badge( 5 ); - * $element.badge( '100+' ); - * $element.badge( text, inline ); - * $element.badge( 'New', true ); - * - * @param {number|string} text The value to display in the badge. If the value is falsey (0, - * null, false, '', etc.), any existing badge will be removed. - * @param {boolean} [inline=true] True if the badge should be displayed inline, false - * if the badge should overlay the parent element. - * @param {boolean} [displayZero=false] True if the number zero should be displayed, - * false if the number zero should result in the badge being hidden - * @return {jQuery} - * @chainable - */ - $.fn.badge = function ( text, inline, displayZero ) { - var $badge = this.find( '.mw-badge' ), - badgeStyleClass = 'mw-badge-' + ( inline ? 'inline' : 'overlay' ), - isImportant = true, - displayBadge = true; - - // If we're displaying zero, ensure style to be non-important - if ( mw.language.convertNumber( text, true ) === 0 ) { - isImportant = false; - if ( !displayZero ) { - displayBadge = false; - } - // If text is falsey (besides 0), hide the badge - } else if ( !text ) { - displayBadge = false; - } - - if ( displayBadge ) { - // If a badge already exists, reuse it - if ( $badge.length ) { - $badge - .toggleClass( 'mw-badge-important', isImportant ) - .find( '.mw-badge-content' ).text( text ); - } else { - // Otherwise, create a new badge with the specified text and style - $badge = $( '
' ) - .addClass( badgeStyleClass ) - .toggleClass( 'mw-badge-important', isImportant ) - .append( - $( '' ).text( text ) - ) - .appendTo( this ); - } - } else { - $badge.remove(); - } - return this; - }; - - /** - * @class jQuery - * @mixins jQuery.plugin.badge - */ -}( jQuery, mediaWiki ) ); -- 2.20.1