/*! * VisualEditor UserInterface MediaWiki EducationPopup class. * * @copyright See AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * UserInterface education popup. * * Shows a pulsating blue dot which, when you click, * reveals a popup with useful information. * * @class * * @constructor * @extends OO.ui.Widget * @param {jQuery} $target Element to attach to * @param {Object} config Configuration options * @param {string} config.popupTitle * @param {string|jQuery} config.popupText * @param {string} [config.popupImage] Popup image class * @param {string} [config.trackingName] */ ve.ui.MWEducationPopupWidget = function VeUiMwEducationPopup( $target, config ) { config = config || {}; // HACK: Do not display on platforms other than desktop if ( !( ve.init.mw.DesktopArticleTarget && ve.init.target instanceof ve.init.mw.DesktopArticleTarget ) ) { return; } // Do not display if the user already acknowledged the popups if ( !mw.libs.ve.shouldShowEducationPopups() ) { return; } // Parent method ve.ui.MWEducationPopupWidget.super.call( this, config ); // Properties this.$target = $target; this.popupCloseButton = new OO.ui.ButtonWidget( { label: ve.msg( 'visualeditor-educationpopup-dismiss' ), flags: [ 'progressive', 'primary' ], classes: [ 've-ui-educationPopup-dismiss' ] } ); this.trackingName = config.trackingName; this.$pulsatingDot = $( '
' ).append( config.popupText instanceof $ ? config.popupText : document.createTextNode( config.popupText ) ), this.popupCloseButton.$element ); ve.targetLinksToNewWindow( $popupContent[ 0 ] ); if ( config.popupImage ) { $popupContent.prepend( // The following classes can be generated here: // * ve-ui-educationPopup-image-link // * others generated by extensions $( '