/*! * VisualEditor UserInterface MediaWiki EducationPopupTool class. * * @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * UserInterface education popup tool. Used as a mixin to show a pulsating blue dot * which, when you click, reveals a popup with useful information. * * @class * * @constructor * @param {Object} [config] Configuration options */ ve.ui.MWEducationPopupTool = function VeUiMwEducationPopupTool( config ) { var popupCloseButton, $popupContent, $shield, usePrefs = !mw.user.isAnon(), prefSaysShow = usePrefs && !mw.user.options.get( 'visualeditor-hideusered' ), tool = this, localStorageHidePref = null; try { localStorageHidePref = localStorage.getItem( 've-hideusered' ); } catch ( e ) {} config = config || {}; if ( !( ve.init.mw.DesktopArticleTarget && ve.init.target instanceof ve.init.mw.DesktopArticleTarget ) || ve.init.target.dummyToolbar || ( !prefSaysShow && !( !usePrefs && localStorageHidePref === null && $.cookie( 've-hideusered' ) === null ) ) ) { return; } popupCloseButton = new OO.ui.ButtonWidget( { label: ve.msg( 'visualeditor-educationpopup-dismiss' ), flags: [ 'progressive', 'primary' ], classes: [ 've-ui-educationPopup-dismiss' ] } ); popupCloseButton.connect( this, { click: 'onPopupCloseButtonClick' } ); $popupContent = $( '
' ).text( config.text ), popupCloseButton.$element ); this.popup = new OO.ui.PopupWidget( { $content: $popupContent, padded: true, width: 300 } ); this.shownEducationPopup = false; this.$pulsatingDot = $( '