packages/embed-plugin-youtube/src/index.js
function onLoad({ input }, { clickClass, onVideoShow, height }) {
  if (!isDom(input)) {
    throw new Error("input should be a DOM Element.")
  }
  let classes = document.getElementsByClassName(clickClass)
  for (let i = 0; i < classes.length; i++) {
    classes[i].onclick = function() {
      let url = this.getAttribute("data-url")
      onVideoShow(url)
      url += "?autoplay=1"
      this.parentNode.innerHTML = withoutDetailsTemplate(url, height, id)
    }
  }
}
function onLoad({ input }, { clickClass, onVideoShow, height }) {
  if (!isDom(input)) {
    throw new Error("input should be a DOM Element.")
  }
  let classes = document.getElementsByClassName(clickClass)
  for (let i = 0; i < classes.length; i++) {
    classes[i].onclick = function() {
      let url = this.getAttribute("data-url")
      onVideoShow(url)
      url += "?autoplay=1"
      this.parentNode.innerHTML = withoutDetailsTemplate(url, height, id)
    }
  }
}
function onLoad ( { input } , { clickClass , onVideoShow , height } ) { if ( ! isDom ( input ) ) { throw new Error ( "input should be a DOM Element." ) } let classes = document . getElementsByClassName ( clickClass ) for ( let i = 0 ; i < classes . length ; i ++ ) { classes [ i ] . onclick = function ( ) { let url = this . getAttribute ( "data-url" ) onVideoShow ( url ) url += "?autoplay=1" this . parentNode . innerHTML = withoutDetailsTemplate ( url , height , id ) } } }
Function executed when a content is rendered on the client site.
@param input
@param clickClass
@param onVideoShow
@param height
Function executed when a content is rendered on the client site .