lib/assets/badge.js
function replace (script){
    var parent = script.parentNode
    if (!parent) return

    LARGE = /\?large/.test(script.src)
    var iframe = document.createElement('iframe')
    var iframePath = '/iframe' + (LARGE ? '?large' : '')
    iframe.src = script.src.replace(/\/slackin\.js.*/, iframePath)
    iframe.style.borderWidth = 0
    iframe.className = '__slackin'

    // a decent aproximation that we adjust later
    // once we have the knowledge of the actual
    // numbers of users, based on a user count
    // of 3 digits by 3 digits
    iframe.style.width = (LARGE ? 190 : 140) + 'px'

    // height depends on target size
    iframe.style.height = (LARGE ? 30 : 20) + 'px'

    // hidden by default to avoid flicker
    iframe.style.visibility = 'hidden'

    parent.insertBefore(iframe, script)
    parent.removeChild(script)

    // setup iframe RPC
    iframe.onload = function (){
      setup(iframe)
    }
  }
function replace (script){
    var parent = script.parentNode
    if (!parent) return

    LARGE = /\?large/.test(script.src)
    var iframe = document.createElement('iframe')
    var iframePath = '/iframe' + (LARGE ? '?large' : '')
    iframe.src = script.src.replace(/\/slackin\.js.*/, iframePath)
    iframe.style.borderWidth = 0
    iframe.className = '__slackin'

    // a decent aproximation that we adjust later
    // once we have the knowledge of the actual
    // numbers of users, based on a user count
    // of 3 digits by 3 digits
    iframe.style.width = (LARGE ? 190 : 140) + 'px'

    // height depends on target size
    iframe.style.height = (LARGE ? 30 : 20) + 'px'

    // hidden by default to avoid flicker
    iframe.style.visibility = 'hidden'

    parent.insertBefore(iframe, script)
    parent.removeChild(script)

    // setup iframe RPC
    iframe.onload = function (){
      setup(iframe)
    }
  }
function replace ( script ) { var parent = script . parentNode if ( ! parent ) return LARGE = / \?large / . test ( script . src ) var iframe = document . createElement ( 'iframe' ) var iframePath = '/iframe' + ( LARGE ? '?large' : '' ) iframe . src = script . src . replace ( / \/slackin\.js.* / , iframePath ) iframe . style . borderWidth = 0 iframe . className = '__slackin' // a decent aproximation that we adjust later // once we have the knowledge of the actual // numbers of users, based on a user count // of 3 digits by 3 digits iframe . style . width = ( LARGE ? 190 : 140 ) + 'px' // height depends on target size iframe . style . height = ( LARGE ? 30 : 20 ) + 'px' // hidden by default to avoid flicker iframe . style . visibility = 'hidden' parent . insertBefore ( iframe , script ) parent . removeChild ( script ) // setup iframe RPC iframe . onload = function ( ) { setup ( iframe ) } }
replace the script tag with an iframe
replace the script tag with an iframe