ScriptClip
Displays a small line of text on the page with a button to transfer it to the clipboard.
Parameters
- script - The text to display
- fileName - Alternative to script. The file to display as a clip
[{/OpenForum/Extensions/ScriptClip script="ls -la /open-forum/content"}]
[{/OpenForum/Extensions/ScriptClip fileName="renderer.sjs"}]
Source
/OpenForum/Extensions/ScriptClip/renderer.sjs/*
* Author:
* Description:
*/
try{
var script = extension.getAttribute("script");
var fileName = extension.getAttribute("fileName");
var scriptPageName = extension.getAttribute("scriptPageName");
if( fileName!=null ) {
if( scriptPageName==null ) scriptPageName = pageName;
if(file.attachmentExists( scriptPageName, fileName )) {
script = file.getAttachment( scriptPageName, fileName );
} else {
script = "";
}
}
script = ""+script;
var id = extension.getAttribute("id");
var ofId = "";
if(id==null) {
id = ""+js.generateMD5(script).substring(0,8);
} else {
id = "" + id;
ofId = "of-id='" + id + "'";
}
var rows = script.split("\n").length+1;
script = script.replace(//g,">");
var html = ""+
"
"+
"
"+
"
";
return html;
} catch(e) {
return ""+e;
}