module.exports = function getInjectTpl (biliPath) {
  return `

  var sc = typeof script === 'function'
    ? script.options
    : script;

  if (sc && typeof sc === 'object') {
    sc._bili_path = '${biliPath}'

    if (typeof sc.methods === 'object') {
      var lifeCyclesAndEventCallbacks = [
        'onLoad', 'onShow', 'onReady', 'onHide', 'onUnload',
        'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'
      ];

      for (var methodName in sc.methods) {
        if (sc.methods.hasOwnProperty(methodName)) {
          if (lifeCyclesAndEventCallbacks.indexOf(methodName) !== -1) {
            sc[methodName] = sc.methods[methodName]

            delete sc.methods[methodName]
          }
        }
      }
    }
  }
  `
}