nl_tokens: Create a <button >
pl_tokens: function createButton ( buttonType , attr ) { var _this = this ; var attributes = extend ( { } , attr ) ; var type = toCamelCase ( buttonType ) ; var props = { element : 'button' , toggle : false , label : null , icon : null , labelPressed : null , iconPressed : null } ; [ 'element' , 'icon' , 'label' ] . forEach ( function ( key ) { if ( Object . keys ( attributes ) . includes ( key ) ) { props [ key ] = attributes [ key ] ; delete attributes [ <mask> ] ; } } ) ; // Default to 'button' type to prevent form submission if ( props . element === 'button' && ! Object . keys ( attributes ) . includes ( 'type' ) ) { attributes . type = 'button' ; } // Set class name if ( Object . keys ( attributes ) . includes ( 'class' ) ) { if ( ! attributes . class . split ( ' ' ) . some ( function ( c ) { return c === _this . config . classNames . control ; } ) ) { extend ( attributes , { class : "" . concat ( attributes . class , " " ) . concat ( this . config . classNames . control ) } ) ; } } else { attributes . class = this . config . classNames . control ; } // Large play button switch ( buttonType ) { case 'play' : props . toggle = true ; props . label = 'play' ; props . labelPressed = 'pause' ; props . icon = 'play' ; props . iconPressed = 'pause' ; break ; case 'mute' : props . toggle = true ; props . label = 'mute' ; props . labelPressed = 'unmute' ; props . icon = 'volume' ; props . iconPressed = 'muted' ; break ; case 'captions' : props . toggle = true ; props . label = 'enableCaptions' ; props . labelPressed = 'disableCaptions' ; props . icon = 'captions-off' ; props . iconPressed = 'captions-on' ; break ; case 'fullscreen' : props . toggle = true ; props . label = 'enterFullscreen' ; props . labelPressed = 'exitFullscreen' ; props . icon = 'enter-fullscreen' ; props . iconPressed = 'exit-fullscreen' ; break ; case 'play-large' : attributes . class += " " . concat ( this . config . classNames . control , "--overlaid" ) ; type = 'play' ; props . label = 'play' ; props . icon = 'play' ; break ; default : if ( is$1 . empty ( props . label ) ) { props . label = type ; } if ( is$1 . empty ( props . icon ) ) { props . icon = buttonType ; } } var button = createElement ( props . element ) ; // Setup toggle icon and labels if ( props . toggle ) { // Icon button . appendChild ( controls . createIcon . call ( this , props . iconPressed , { class : 'icon--pressed' } ) ) ; button . appendChild ( controls . createIcon . call ( this , props . icon , { class : 'icon--not-pressed' } ) ) ; // Label/Tooltip button . appendChild ( controls . createLabel . call ( this , props . labelPressed , { class : 'label--pressed' } ) ) ; button . appendChild ( controls . createLabel . call ( this , props . label , { class : 'label--not-pressed' } ) ) ; } else { button . appendChild ( controls . createIcon . call ( this , props . icon ) ) ; button . appendChild ( controls . createLabel . call ( this , props . label ) ) ; } // Merge and set attributes extend ( attributes , getAttributesFromSelector ( this . config . selectors . buttons [ type ] , attributes ) ) ; setAttributes ( button , attributes ) ; // We have multiple play buttons if ( type === 'play' ) { if ( ! is$1 . array ( this . elements . buttons [ type ] ) ) { this . elements . buttons [ type ] = [ ] ; } this . elements . buttons [ type ] . push ( button ) ; } else { this . elements . buttons [ type ] = button ; } return button ; }