DETAILS - Script Extension
499529
def show
      @script_extensions = Script::Extension.friendly.find(params[:id])
      @versions = Phcscriptcdn::ExtensionVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Extension')
    end
324218
function validateScript(script) {
  var valid = this._validate(script);
  validateScript.errors = this._validate.errors;
  return valid;
}
577006
private Object getScriptResult(String script, ScriptEngine engine) throws ScriptException {
        String scriptToExecute = script.substring(script.indexOf(":") + 1);
        return engine.eval(scriptToExecute);
    }
1127909
protected function runExtensionScript($script, array $arguments = [])
    {
        $this->log('d', 'Running custom extension script ' . $script . ' for extension ' . $this->getExtension()->getId());
        if (file_exists($script)) {
            require_once $script;
        } elseif (class_exists($script) && is_subclass_of($script, \oat\oatbox\action\Action::class)) {
            $action = new $script();

            if ($action instanceof ServiceLocatorAwareInterface) {
                $action->setServiceLocator($this->getServiceManager());
            }

            call_user_func($action, $arguments);
        } else {
            $error = new common_ext_InstallationException('Unable to run install script ' . $script);
            $error->setExtensionId($this->getExtension()->getId());

            throw $error;
        }
    }
759101
function script(path, type) {
  if (path) {
	var html = '<script src="'+path+'"'+(type ? 'type="'+type+'"' : '')+'></script>';
	if (this.html.indexOf(html) == -1) this.append(html);
  }
  return this;
}
421018
function appendScript( script ) {
        currentlyAddingScript = script;

        // If BASE tag is in play, using appendChild is a problem for IE6.
        // See: http://dev.jquery.com/ticket/2709
        baseElement
            ? headElement.insertBefore( script, baseElement )
            : headElement.appendChild( script );

        currentlyAddingScript = null;
    }
718923
@RequestMapping(value = "/api/scripts", method = RequestMethod.POST)
    public
    @ResponseBody
    Script addScript(Model model,
                     @RequestParam(required = true) String name,
                     @RequestParam(required = true) String script) throws Exception {

        return ScriptService.getInstance().addScript(name, script);
    }
1125053
public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        _doScript(req, rsp, "_scriptText.jelly");
    }
1261342
function get(scriptModule, agent, msg, cb) {
    const filename = msg.filename;
    if (!filename) {
        cb('empty filename');
        return;
    }

    fs.readFile(path.join(scriptModule.root, filename), 'utf-8', (err, data) => {
        if (err) {
            logger.error(`fail to read script file:${filename}, ${err.stack}`);
            cb(`fail to read script with name:${filename}`);
        }

        cb(null, data);
    });
}
391654
private function _script() {
        // we need to compress?
        if($this->compress && $this->_config['compress']['js']) {
            // get cache
            $cache = $this->filename('js');
            if(!$cache)
                return false;

            // get paths
            $web_path = $this->_config['paths']['js'] . '/' . $cache;
            $system_path = $this->js['full'] . DS . $cache;

            // no cache file? write it
            if(!file_exists($system_path)) {
                // process compression
                $output = $this->process('js');

                // write to file
                file_put_contents($system_path, $output);
            }

            // output the cached file with the HTML helper
            return $this->Html->script($web_path);

        // no need to compress? output separately with the HTML helper
        } else return $this->Html->script($this->js['extern']);
    }
108942
async function scriptsFromDirectory(dirpath) {
  const dir = (await readdir(dirpath))
    .map(name => toFullPath(name, dirpath))
    .filter(await filters.onlyFiles)
    .filter(filters.onlyWithExtension('.js'));
  const result = {};
  for (const filepath of dir) {
    const name = path.basename(filepath, '.js');
    const script = await readFile(filepath, 'utf8');
    result[name] = script;
  }
  return result;
}
1097064
function(script) {
			if (gui.Type.isString(script)) {
				var func = gui.Object.lookup(script);
				if (func) {
					script = func;
				} else {
					throw new Error(this + ' could not locate "' + script + '"');
				}
			}
			if (gui.Type.isFunction(script)) {
				this.script.load(script);
			} else {
				throw new TypeError(this + " could not load script");
			}
		}
1090223
function (definition) {
        if (!definition) {
            return;
        }

        var result,
            script = definition.script;

        if (Script.isScript(script)) {
            result = script;
        }
        else if (_.isArray(script) || _.isString(script)) {
            result = new Script({ exec: script });
        }
        else if (_.isObject(script)) {
            result = new Script(script);
        }

        _.mergeDefined(this, /** @lends Event.prototype */ {
            /**
             * Name of the event that this instance is intended to listen to.
             * @type {String}
             */
            listen: _.isString(definition.listen) ? definition.listen.toLowerCase() : undefined,

            /**
             * The script that is to be executed when this event is triggered.
             * @type {Script}
             */
            script: result
        });
    }
323628
def script(self):
        """"""
        # The script object is cached, since constructing it may involve
        # a number of string-manipulation operations.
        if getattr(self, '_script', None) is None:
            self._script = self._script__getter()
        return self._script
269276
def scripts( self, mydict ):
        """"""

        if isinstance( mydict, dict ):
            for src, type in list( mydict.items( ) ):
                self.script( '', src=src, type='text/%s' % type )
        else:
            try:
                for src in mydict:
                    self.script( '', src=src, type='text/javascript' )
            except:
                raise TypeError( "Script should be given a dictionary of src:type pairs or a list of javascript src's." )
1369782
function runScriptViaModuleLoader(script, context) {
    if(!fs.existsSync(script.fullPath)) {
        events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
        return Q();
    }
    var scriptFn = require(script.fullPath);
    context.scriptLocation = script.fullPath;
    context.opts.plugin = script.plugin;

    // We can't run script if it is a plain Node script - it will run its commands when we require it.
    // This is not a desired case as we want to pass context, but added for compatibility.
    if (scriptFn instanceof Function) {
        // If hook is async it can return promise instance and we will handle it.
        return Q(scriptFn(context));
    } else {
        return Q();
    }
}
504672
function script($script, $scriptId = null) {
        if (!isset($scriptId) || !isset($this->_scriptIds[$scriptId])) {
            $this->_scripts[] = $script;
            if (isset($scriptId)) $this->_scriptIds[$scriptId] = true;
        }
    }