lede/package/lean/luci-app-amule/luasrc/view/amule/webshell.htm
2017-09-06 20:18:34 +08:00

91 lines
2.6 KiB
HTML

<script type="text/javascript">//<![CDATA[
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
var iwxhr = new XHR();
function update_status(e) {
if(e!=null && e.keyCode!=13) return false;
/*var cmd = document.getElementById("cmd").value;
if(cmd.startsWith("cd"))
{
newpath = cmd.replace("cd","").replace(" ","");
if(newpath.startsWith("/")){
document.getElementById("currentpath").value = newpath;
}else{
document.getElementById("currentpath").value += newpath;
}
cmd="";
}*/
obj = document.getElementById("screen");
cmdstr=(document.getElementById("cmd").value).replace(/\s+/g,"")
if (cmdstr == "cls" || cmdstr == "clear")
{
obj = document.getElementById("screen");
obj.value = "";
document.getElementById("cmd").value = "";
return false;
}
iwxhr.get('<%=luci.dispatcher.build_url("admin", "nas", "amule", "amulecmd")%>', {cmd: document.getElementById("cmd").value },
function(x, ifc)
{
obj = document.getElementById("screen");
obj.value+=ifc[0];
document.getElementById("cmd").focus();
}
)
if ((document.getElementById("cmd").value).replace(/\s+/g,"") != "")
{
obj.value+="\r\n--------------------------------------------\r\n"+document.getElementById("cmd").value+"\r\n--------------------------------------------\r\n";
document.getElementById("cmd").value = "";
return false;
}
};
function clear_textfield() {
obj = document.getElementById("screen");
obj.value=""
}
//]]></script>
<style>
.cmd_line{
background-color:yellow;
}
#list ul li
{
margin-right:5px;
height:16px;
display:block;
float:left;
word-break: keep-all;
}
#list ul li:hover
{
background:blue;
cursor:pointer;
}
</style>
<div class="cbi-map" id="cbi-system">
<h4><a id="content" name="content"><%:You can call amulecmd commands here to control your amule.%></a></h4>
<h4><a id="content" name="content"><%:Execute 'Help' to get more infomation.%></a></h4>
<textarea id="screen" style="width:100%;height:400px;overflow:auto;font-size:12px;" readonly="readonly" ></textarea>
<br/>
<%=translate("Command: ")%>
<input type="text" id="cmd"/>
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="update_status(null)"
<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", translate("Execute")) %> />
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="clear_textfield()"
<%= attr("name", section) .. attr("id", cbid .. ".btn3") .. attr("value", translate("Clear")) %> />
<br/>
</div>