Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 1x 1x 1x 1x 2x 1x 2x 2x 1x | var util = require( './../mobile.startup/util' ), mfExtend = require( './../mobile.startup/mfExtend' ), icons = require( './../mobile.startup/icons' ), View = require( './../mobile.startup/View' ); /** * Shows the user a load failure message * * @class LoadErrorMessage * @extends View * @fires LoadErrorMessage#retry * * @param {Object} options Configuration options * @param {string} options.retryPath path of URL to try again */ function LoadErrorMessage( options ) { View.call( this, { events: { 'click .load-fail-msg-link a': 'onRetry' } }, options ); } mfExtend( LoadErrorMessage, View, { template: util.template( ` <div class="load-fail-msg"> <div class="load-fail-msg-text">{{msgToUser}}</div> <div class="load-fail-msg-link"> <a href="#">{{retryTxt}}</a> </div> </div> ` ), isTemplateMode: true, /** * @inheritdoc * @cfg {Object} defaults Default options hash. * @cfg {string} defaults.icon HTML of the alert icon * @cfg {string} defaults.msgToUser Message shown when media load fails * @cfg {string} defaults.retryTxt Text of retry link * @memberof LoadErrorMessage * @instance */ defaults: util.extend( {}, LoadErrorMessage.prototype.defaults, { msgToUser: mw.msg( 'mobile-frontend-media-load-fail-message' ), retryTxt: mw.msg( 'mobile-frontend-media-load-fail-retry' ) } ), /** * @inheritdoc * @memberof LoadErrorMessage * @instance */ postRender: function () { this.$el.prepend( icons.error().$el ); this.$el.find( '.load-fail-msg-link a' ).attr( 'href', '#' + this.options.retryPath ); }, /** * Event handler for retry event * * @param {jQuery.Event} ev * @return {boolean} Returns false to prevent default behavior for links and * stop the event from propagating * @memberof LoadErrorMessage * @instance */ onRetry: function () { /** * Triggered when retry button is clicked. * * @event LoadErrorMessage#retry */ this.emit( 'retry' ); return false; } } ); module.exports = LoadErrorMessage; |