nl_tokens: Insert controls
pl_tokens: function inject ( ) { var _this11 = this ; // Sprite if ( this . config . loadSprite ) { var icon = controls . getIconUrl . call ( this ) ; // Only load external sprite using AJAX if ( icon . cors ) { loadSprite ( icon . url , 'sprite-plyr' ) ; } } // Create a unique ID this . id = Math . floor ( Math . random ( ) * 10000 ) ; // Null by default var container = null ; this . elements . controls = null ; // Set template properties var props = { id : this . id , seektime : this . config . seekTime , title : this . config . title } ; var update = true ; // If function, run it and use output if ( is$1 . function ( this . config . controls ) ) { this . config . controls = this . config . controls . call ( this , props ) ; } // Convert falsy controls to empty array (primarily for empty strings) if ( ! this . config . controls ) { this . config . controls = [ ] ; } if ( is$1 . element ( this . config . controls ) || is$1 . string ( this . config . controls ) ) { // HTMLElement or Non-empty string passed as the option container = this . config . controls ; } else { // Create controls container = controls . create . call ( this , { id : this . id , seektime : this . config . seekTime , speed : this . speed , quality : this . quality , captions : captions . getLabel . call ( this ) // TODO: Looping // loop: 'None', } ) ; update = false ; } // Replace props with their value var replace = function replace ( input ) { var result = input ; Object . entries ( props ) . forEach ( function ( _ref2 ) { var _ref3 = _slicedToArray ( _ref2 , 2 ) , key = _ref3 [ 0 ] , <mask> = _ref3 [ 1 ] ; result = replaceAll ( result , "{" . concat ( key , "}" ) , value ) ; } ) ; return result ; } ; // Update markup if ( update ) { if ( is$1 . string ( this . config . controls ) ) { container = replace ( container ) ; } else if ( is$1 . element ( container ) ) { container . innerHTML = replace ( container . innerHTML ) ; } } // Controls container var target ; // Inject to custom location if ( is$1 . string ( this . config . selectors . controls . container ) ) { target = document . querySelector ( this . config . selectors . controls . container ) ; } // Inject into the container by default if ( ! is$1 . element ( target ) ) { target = this . elements . container ; } // Inject controls HTML (needs to be before captions, hence "afterbegin") var insertMethod = is$1 . element ( container ) ? 'insertAdjacentElement' : 'insertAdjacentHTML' ; target [ insertMethod ] ( 'afterbegin' , container ) ; // Find the elements if need be if ( ! is$1 . element ( this . elements . controls ) ) { controls . findElements . call ( this ) ; } // Add pressed property to buttons if ( ! is$1 . empty ( this . elements . buttons ) ) { var addProperty = function addProperty ( button ) { var className = _this11 . config . classNames . controlPressed ; Object . defineProperty ( button , 'pressed' , { enumerable : true , get : function get ( ) { return hasClass ( button , className ) ; } , set : function set ( ) { var pressed = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ; toggleClass ( button , className , pressed ) ; } } ) ; } ; // Toggle classname when pressed property is set Object . values ( this . elements . buttons ) . filter ( Boolean ) . forEach ( function ( button ) { if ( is$1 . array ( button ) || is$1 . nodeList ( button ) ) { Array . from ( button ) . filter ( Boolean ) . forEach ( addProperty ) ; } else { addProperty ( button ) ; } } ) ; } // Edge sometimes doesn't finish the paint so force a repaint if ( browser . isEdge ) { repaint ( target ) ; } // Setup tooltips if ( this . config . tooltips . controls ) { var _this$config = this . config , classNames = _this$config . classNames , selectors = _this$config . selectors ; var selector = "" . concat ( selectors . controls . wrapper , " " ) . concat ( selectors . labels , " ." ) . concat ( classNames . hidden ) ; var labels = getElements . call ( this , selector ) ; Array . from ( labels ) . forEach ( function ( label ) { toggleClass ( label , _this11 . config . classNames . hidden , false ) ; toggleClass ( label , _this11 . config . classNames . tooltip , true ) ; } ) ; } }