module.exports = function getInjectTpl (biliPath, isWebviewOnly) {
    return `
  var scriptIsFunc = typeof script === 'function';
  var sc = scriptIsFunc
    ? script.options
    : script;

  if (sc && typeof sc === 'object') {
    sc._bili_path = '${biliPath}';
    sc._not_webview_only = ${!isWebviewOnly}

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

      for (var m in sc.methods) {
        if (sc.methods.hasOwnProperty(m)) {
          if (lifeCyclesAndEventCallbacks.indexOf(m) !== -1) {
            delete sc.methods[m]
          }
        }
      }
    }
  }
  `;
};