This commit is contained in:
blackorbird
2019-04-18 11:19:12 +08:00
parent f6c2839353
commit b3c7e3e449
495 changed files with 73786 additions and 0 deletions

View File

@@ -0,0 +1,784 @@
body, html {
margin: 0;
padding: 0;
direction: ltr;
/*background: linear-gradient(-135deg, #c850c0, #4158d0);*/
background: #4c4c4c;
color: #000 !important;
}
form {
margin: 0;
}
/** {
font: 14px arial;
}*/
* {
font-size: 14px;
}
/*.ui.input input {
padding:0.608em 1em !important
}*/
t {
width: 180px;
display: inline-block;
text-align: right;
padding-right: 5px;
}
g {
margin-left: 30px;
}
input[type="text"], input[type="file"], textarea {
width: 60%;
background: #cbcbcb;
color: #000;
border: 1px solid #999;
margin-bottom: 3px;
}
input[type="text"] {
padding: 2px;
}
input[type="button"], input[type="submit"] {
height: 23px;
}
input[type="checkbox"] {
width: 23px;
height: 24px;
position: absolute;
margin: 0;
}
hr {
margin: 0;
border: 0;
border-top: 1px solid #fff;
}
.h {
width: 90px;
text-align: center;
/*background: #6435c9;*/
color: #000;
vertical-align: middle;
}
table {
margin: 0;
border-collapse: collapse;
}
td {
padding:0
}
.b {
padding:5px;
}
body {
/*flex-direction: column;
display: flex;
padding: 10px;*/
/*font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif*/
}
div.tbbt {
overflow: hidden;
border: 1px solid #ccc;
background-color: #aaa
}
div.tbbt button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
/*font-size: 17px;*/
}
div.tbbt button:hover {
background-color: #ddd
}
div.tbbt button.active {
background-color: #ccc
}
.tb {
display: none;
border: 1px solid #ccc;
border-top: none;
background-color: #aaa
}
.loader {
border: 3px solid #f3f3f3;
border-radius: 50%;
border-top: 3px solid #3498db;
width: 16px;
height: 16px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
position: absolute;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#objFrame {
padding: 0 5px 5px 5px
}
.objRight {
display: table;
padding: 0 5px;
cursor: pointer;
float: left;
line-height: 24px;
border-radius: 0 5px 5px 0;
}
.objD {
background-color: #23a4ff
}
.objD:hover {
background-color: #63beff
}
.objN {
background-color: #23d7ff
}
.objN:hover {
background-color: #72e5ff
}
.objF {
margin-top: 5px;
min-height: 24px;
}
.objLeft {
position: relative;
padding: 0 5px;
float: left;
width: 90px;
background-color: #c3c3c3;
border-radius: 5px 0 0 5px;
line-height: 24px;
}
.objS {
text-align: right;
cursor: default;
overflow: hidden;
max-height: 24px;
min-height: 24px;
}
.objS:hover {
background-color: #d3d3d3;
}
.objB {
padding: 0 5px;
float: left;
line-height: 24px;
}
.objL {
display: inline-block;
margin-left: 3px;
}
.objLocHolder {
padding: 0 5px 0 5px;
min-height: 24px;
margin-top: 5px;
}
.objError {
background-color: #ff2e2e;
color: white;
}
.objError:hover {
background-color: #8a1b1b;
}
.driveSizeProgress {
width: 200px;
border: 1px solid white;
background-color: #d8d6d6;
height: 24px;
float: left;
margin-left: 5px;
border-radius: 5px;
}
.driveSizeProgress div {
background-color: #26a0da;
height: 22px;
border-radius: 5px;
}
.driveSizeText {
float: left;
margin-left: 5px;
}
.driveSizeText .t {
padding: 0 5px;
display: inline-block;
color: #444444;
border: 1px solid #e0e0e0;
border-radius: 5px 0 0 5px;
line-height: 22px;
}
.driveSizeText .v {
background-color: #e0e0e0;
padding: 0 5px;
display: inline-block;
border-radius: 0 5px 5px 0;
line-height: 24px;
}
.cat {
float: left;
/*padding-top: 5px;*/
}
#log {
/*flex: 1 0;
overflow-y: scroll;
min-height: 500px;*/
margin: 0;
padding-top: 5px;
color: #fff;
font-family: "Lucida Console";
}
.iCmd {
float: left;
margin-left: 5px;
border-radius: 5px;
cursor: pointer;
background-color: #d6d6d6;
display: inline-block;
padding: 0 5px;
line-height: 20px;
user-select: none;
border: 2px solid;
}
.iInput {
float: left;
margin-left: 5px;
border: 2px solid;
border-radius: 5px;
}
.iInput .t {
display: inline-block;
color: #444444;
border-radius: 5px 0 0 5px;
cursor: default;
background-color: #cbcbcb;
}
.iInput .t input {
border: none;
margin: 0;
padding: 0 5;
line-height: 22px;
background: none;
width: 100px;
height: 20px;
}
.iInput .v {
background-color: #d6d6d6;
padding: 0 5px;
display: inline-block;
border-radius: 0 5px 5px 0;
cursor: pointer;
border-left: 2px solid;
line-height: 20px;
}
.iInput.iRename {
color: #a291fb;
border-color: #a291fb;
}
.iInput.iRename .v {
border-color: #a291fb;
}
.iInput.iRename .v:hover {
color: #fff;
background-color: #8a73ff;
border-color: #8a73ff;
}
.iInput.iRename .v:active {
background-color: #7860f9;
}
.iInput.iCopy {
color: #a96216;
border-color: #a96216;
}
.iInput.iCopy .v {
border-color: #a96216;
}
.iInput.iCopy .v.copy {
border-radius: 0;
}
.iInput.iCopy .v:hover {
color: #fff;
background-color: #c86f11;
}
.iInput.iCopy .v:active {
background-color: #a96216;
}
.iDownload {
color: #ff5bd1;
border-color: #ff5bd1;
}
.iDownload:hover {
color: #fff;
border-color: #ff74d8;
background-color: #ff74d8;
}
.iDownload:active {
background-color: #ff5bd1;
}
.iDelete {
color: #dc73ff;
border-color: #dc73ff;
}
.iDelete:hover {
color: #fff;
border-color: #d65aff;
background-color: #d65aff;
}
.iDelete:active {
background-color: #cf40ff;
}
:after, :before {
box-sizing: inherit;
}
.loadingM:before {
position: absolute;
content: '';
top: 50%;
left: 50%;
margin: -0.65em 0em 0em -0.65em;
width: 1.3em;
height: 1.3em;
border-radius: 10px;
border: 0.2em solid rgba(0, 0, 0, 0.15);
}
.loadingM:after {
position: absolute;
content: '';
top: 50%;
left: 50%;
margin: -0.65em 0em 0em -0.65em;
width: 1.3em;
height: 1.3em;
-webkit-animation: button-spin 0.6s linear;
animation: button-spin 0.6s linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
border-radius: 500rem;
border-color: #FFFFFF transparent transparent;
border-style: solid;
border-width: 0.2em;
box-shadow: 0px 0px 0px 1px transparent;
}
.loadingM {
position: relative;
cursor: default;
text-shadow: none !important;
color: transparent !important;
opacity: 1;
pointer-events: auto;
-webkit-transition: all 0s linear,opacity .1s ease;
transition: all 0s linear,opacity .1s ease;
box-shadow: 0 0 0 0 rgba(34,36,38,.15) inset;
}
@-webkit-keyframes button-spin {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes button-spin {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.ml10 {
margin-left:10px !important;
}
.ml5 {
margin-left: 5px !important;
}
/*.button {
cursor: pointer;
display: inline-block;
min-height: 1em;
outline: 0;
border: none;
vertical-align: baseline;
background: #767676 none;
color: #fff;
padding: 10px 15px;
text-transform: none;
text-shadow: none;
font-weight: 700;
line-height: 1em;
font-style: normal;
text-align: center;
text-decoration: none;
border-radius: .28571429rem;
box-shadow: 0 0 0 1px transparent inset, 0 0 0 0 rgba(34,36,38,.15) inset;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;
transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;
will-change: '';
-webkit-tap-highlight-color: transparent;
}
.button:hover {
background-color: #838383;
}*/
/*.active.button {
background-color: #21ba45 !important;
background-image: none !important;
box-shadow: 0 0 0 1px transparent inset !important;
}
.active.button:hover {
background-color: #16ab39 !important;
}*/
/*.error.button {
background-color: #ff695e !important;
background-image: none !important;
box-shadow: 0 0 0 1px transparent inset !important;
}
.error.button:hover {
background-color: #ff5144 !important;
}*/
.button {
margin-right:0 !important
}
.micon {
display: inline-block;
opacity: 1;
width: 16px;
height: 16px;
float: left;
margin-right: 3px;
}
.micon.compress {
background: url('img/box-zipper.png')
}
.micon.heart-empty {
background: url('img/heart-empty.png')
}
.micon.download-cloud {
background: url('img/download-cloud.png')
}
.micon.minus-button {
background: url('img/minus-button.png')
}
.active .micon.heart-empty {
background: url('img/heart.png');
}
.error .micon.heart-empty {
background: url('img/exclamation-diamond.png');
}
input.login:-webkit-autofill, input.login:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0px 1000px #21ba45 inset;
}
input.logout:-webkit-autofill, input.logout:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0px 1000px #db2828 inset;
}
.login {
background-color: #21ba45 !important;
}
.logout {
background-color: #db2828 !important;
}
.button.loading.active i,
.button.loading.error i,
.button.loading i {
background: none !important;
}
/*.button.loading:before {
border: 0.2em solid rgba(0, 0, 0, 0.3);
width: 16px;
height: 16px;
margin:-8px 0 0 -8px;
}
.button.loading:after {
width: 16px;
height: 16px;
margin: -8px 0 0 -8px;
}*/
.objF .checkbox {
float: left;
margin: 3px 5px 0 0;
}
.objDate {
background: none;
border: 1px solid #23a4ff;
border-radius: 0;
line-height: 22px;
cursor: auto;
}
#loc {
}
.formLabel {
width: 150px;
display: inline-block;
text-align: right;
}
.contentPlace {
padding: 10px;
/*background-color: #424242 !important*/
}
.rightButton {
position: fixed;
top: 17px;
padding: 0px;
margin: 0px;
width: 35px;
height: 90px;
background: #000;
z-index: 15;
border-radius: 5px 0px 0px 5px;
cursor: pointer;
border: 1px solid #fff;
border-right: none;
right: 259px;
backface-visibility: visible !important;
visibility: visible;
}
.ui.right.sidebar {
overflow-y:visible !important;
}
.rightButton span {
color: #fff;
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
display: block;
}
/*.icon.big {
right: 23px;
bottom: 30px;
position: fixed;
background: #fff;
width: 32px;
height: 32px;
border-radius:3px;
cursor:pointer
}
.icon.big:before {
font-size: 24px !important;
line-height: 32px;
}*/
.ui.card.download {
margin: 5px 0 0 5px;
width: 242px
}
body ::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.54);
}
.ui.form .fields {
margin: 0 -.5em 5px !important;
}
.ui.form .field {
margin: 0 0 5px;
}
.ui.compact.labeled.icon.button {
height:36px;
}
.ui.compact.labeled.icon.button i {
width: 44px;
}
.ui.segment {
background:#ffffff61;
border-color: #fff;
padding: 0;
}
.ui.attached.segment {
border-color: #fff;
}
.ui.tabular.menu {
border-color: #fff;
}
.ui.tabular.menu .active.item {
background: #ffffff61;
border: 1px solid #fff;
border-bottom: none;
margin-bottom: 0;
}
.ui.tabular.menu .item {
border-left: none;
border-right: none;
border-bottom: 1px solid #fff;
}
.ui.attached.tabular.menu {
border:none
}
.ui.tabular.menu .active.item:hover {
cursor: default;
color: #000
}
.ui.tabular.menu .item {
color:rgba(255,255,255,0.8);
}
.ui.tabular.menu .item:hover {
color: #fff;
}
.dropdown-table-item, .item .hidden-label {
display: none;
}
.item .dropdown-table-item, .hidden-label {
display:inline-table;
}
.dropdown-table-header {
width: 100%;
border-bottom: 1px solid #ccc
}
.dropdown-table-item {
width: 100%;
}
.dropdown-table-header td {
padding: 5px 0;
}
.dropdown-table-header .clmn1, .dropdown-table-item .clmn1 {width:180px}
.dropdown-table-header .clmn2, .dropdown-table-item .clmn2 {width:180px}
.dropdown-table-header .clmn3, .dropdown-table-item .clmn3 {width:180px}
.dropdown-table-header .clmn4, .dropdown-table-item .clmn4 {width:200px}
.dropdown-table-header .clmn5, .dropdown-table-item .clmn5 {}
.dropdown-table-header .clmn6, .dropdown-table-item .clmn6 {width:120px}
.sqlTable {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
.sqlTable td, #sqlTable th {
border: 1px solid #ddd;
padding: 8px;
}
.sqlTable tr {
background-color: #FFF;
}
.sqlTable tr:nth-child(even) {
background-color: #f2f2f2;
}
.sqlTable tr:hover {
background-color: #ddd;
}
.sqlTable th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}

View File

@@ -0,0 +1,617 @@
$(document).ready(function () {
$('#btnLogin').click();
//getLocation(function () { $("#mdlspy").click(); });
//document.getElementById("chkModules").click();
//spyCheckTimer();
//$('#stickyDirCommand')
// .sticky({
// context: '#stickyDirContext'
// });
//$('#tbMain')
// .sticky({
// context: '#log'
// });
$('.ui.dropdown').dropdown();
$('#cmbIP').dropdown({
fullTextSearch: 'exact',
match: 'text',
onLabelSelect: function (selectedLabels) {
var selectedValue = $(selectedLabels).attr('data-value');
if (selectedValue) {
$('#cmdSelectedLocation').text(selectedValue);
setAddress(selectedLabels, selectedValue);
}
},
action: function (text, value) {
console.log(text);
console.log(value);
$(this).dropdown("set selected", value);
$(this).dropdown("refresh");
}
});
$('.menu .item').tab();
$('#inpCmd').focus();
$(".ui.toggle.button").state({
});
$('#TargetComputerTable').DataTable({
"order": [[1, 'asc']],
"paging": false,
"autoWidth": false,
"columnDefs": [
{ "orderable": false, "targets": 0 }
]
});
$(".ui.checkbox").checkbox();
$('#TargetComputersCheckAll').checkbox({
onChecked: function () { TargetComputerSelectAllItem(); },
onUnchecked: function () { TargetComputerDeSelectAllItem(); }
});
$('.ui.button').popup();
LoadStorageSettings();
});
var varNames = {
password:"p",
url: "url",
method: "m",
command: "cmd",
btnLogin: "btnLogin",
lblLocation: "loc",
explorer: "exadd",
getSize: "gsize",
download: "don",
changeTimeHidden:"timeh",
changeTimeFile:"tfil",
changeTimeTarget:"ttar",
changeTimeTime: "ttim",
installModuleName: "mname",
cookieNameUsername:"cookieUsername",
cookieNamePassword:"cookiePassword"
};
var methodID = {
auth : 0,
command : 1,
upload : 2,
uploadbase64 : 3,
delete : 4,
download : 5,
changeTime : 6,
sqlQuery : 7,
explorer: 8,
getsize: 9,
getlocation: 10,
rename: 11,
copy: 12,
view: 13,
commandAjax:14,
downloadTest: 15,
checkModules: 16,
installModule: 17,
uninstallModule: 18,
cmd7z: 19,
authAjax: 20,
getlocationAjax: 21,
spycheck: 22,
localExplore: 23,
multiDelete: 24,
checkDownloadProgress: 25,
getIPFromNbt: 26,
GetLogicDrives: 27,
NetworkDownloaderCheck: 28,
NetworkDownloaderLog: 29,
NetworkDownloaderError: 30,
NetworkDownloaderDone: 31,
NetworkDownloaderDir: 32,
SaveLog: 33,
downloadDemo: 34,
downloadPause: 35,
downloadInfo: 36,
downloadLoad: 37,
downloadClose: 38,
downloadChangeStatusToRequested: 39
};
function copyLoc() {
copyToClipboard(document.getElementById("loc"));
}
function subm() {
//var url = getElementValue(varNames.url);
//var frm = document.getElementsByClassName('form');
//for (var i = 0; i < frm.length; i++) {
// frm.action = url;
//}
//var mmm = document.getElementsByClassName('mmm');
//for (var i = 0; i < mmm.length; i++) {
// mmm[i].value = btoa(mmm[i].value);
//}
}
function reset() {
document.cookie = "data=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/";
location.href = location.pathname;
}
//function openTab(ev, nm) {
// var i, tb, tblnk;
// tb = document.getElementsByClassName("tb");
// for (i = 0; i < tb.length; i++) {
// tb[i].style.display = "none";
// }
// tblnk = document.getElementsByClassName("tblnk");
// for (i = 0; i < tblnk.length; i++) {
// tblnk[i].className = "tblnk";
// }
// document.getElementById(nm).style.display = "block";
// ev.className += " active";
// $('#tbMain').sticky('refresh');
//}
//function fixLogSize()
//{
// document.getElementById('log').style.height = "calc(100% - " + document.getElementById('header').offsetHeight + ")";
//}
function loader(sender)
{
//<span id="loader" class="loader" style="display:none"></span>
var ldr = document.createElement("span");
ldr.className = "loader";
ldr.style.top = sender.getBoundingClientRect().top;
ldr.style.left = sender.getBoundingClientRect().left + sender.offsetWidth + 5;
document.body.appendChild(ldr);
return ldr;
}
function print(str, isAppendPrint) {
if (isAppendPrint || typeof isAppendPrint == 'undefined')
{
var log = document.getElementById("log");
log.innerHTML = document.getElementById("log").innerHTML + str + "<br>";
}
else
document.getElementById("log").innerHTML = str;
}
function logout(sender)
{
var urlBox = document.getElementById(varNames.url);
urlBox.value = "";
eraseCookie(varNames.password);
eraseCookie(varNames.url);
urlBox.className = "";
if (spyCheckTimerHandler)
clearTimeout(spyCheckTimerHandler);
$("#mdlspy").removeClass("green");
$("#mdlspy").removeClass("red");
$("#mdlspy").removeClass("blue");
$("#mdlspy").children('.icon').eq(0).attr("class", "large Empty Heart icon");
$('.mdlItem').each(function () {
$(this).removeClass("active");
$(this).removeClass("loading");
});
document.getElementById(varNames.lblLocation).innerText = "";
login(sender);
}
var afterUpload;
function login(sender)
{
var urlBox = document.getElementById(varNames.url);
if (urlBox.value.isEmpty())
{
urlBox.value = readCookie(varNames.url);
}
var UrlP = urlBox.value.split(";");
var url = UrlP[0];
var p = UrlP[1];
urlBox.value = url;
if (p)
{
eraseCookie(varNames.password);
createCookie(varNames.password, p, 144);
}
else
p = readCookie(varNames.password);
eraseCookie(varNames.url);
createCookie(varNames.url, url, 144);
var data = [
{ name: varNames.method, value: methodID.authAjax },
{ name: varNames.url, value: url }
];
if (spyCheckTimerHandler)
clearTimeout(spyCheckTimerHandler);
requestTextResult(data, sender, false, function (res) {
if (res.startsWith("Error"))
print(res);
else {
var data = JSON.parse(res);
if (data.auth.toLowerCase() == "true") {
readCookie(varNames.url);
document.getElementsByName("adminU")[0].value = readCookie(varNames.cookieNameUsername);
document.getElementsByName("adminP")[0].value = readCookie(varNames.cookieNamePassword);
urlBox.className = "login";
//print("Login successful\r\n");
document.getElementById(varNames.lblLocation).innerText = b64DecodeUnicode(data.loc);
$("#mdlspy").click();
spyCheckTimer();
//checkModulesFN(b64DecodeUnicode(data.module));
checkModules(document.getElementById('chkModules'));
DownloadLoad();
TardigradeOnLoad();
if (afterUpload)
afterUpload();
else
setAddress(document.getElementById('btnExpror'), "\\\\localhost");
breadcrumber(url);
} else {
urlBox.className = "logout";
//print("Login failed\r\n");
}
}
});
}
function requestTextResult(data, sender, isPrint, callback, dataIsBinary, isAppendPrint)
{
var loadingClassName = "loadingM";
var loadingElement = null;
if (sender != null) {
loadingElement = $(sender);
if ($(sender).prop("tagName") == "INPUT") {
loadingClassName = "loading";
loadingElement = loadingElement.parent();
}
}
if (sender == null || !loadingElement.hasClass(loadingClassName)) {
//for (var i = 0; i < data.length; i++) {
// createCookie(data[i].name, data[i].value, 144);
//}
var ldr = null;
//if (sender)
// ldr = loader(sender);
//sender.className = sender.className + " loadingM";
if (sender != null)
loadingElement.addClass(loadingClassName);
var info = {
data: data,
onSuccess: function (res, xhr) {
//if(ldr)
// ldr.remove();
var data = res;
if (isPrint)
print(data, isAppendPrint);
if (callback)
callback(res, xhr);
//sender.className = sender.className.replace(" loadingM", "");
if (sender != null)
loadingElement.removeClass(loadingClassName);
},
dataIsBinary: dataIsBinary
};
sendData(info);
}
else
console.log("sender are in loading state");
}
function cmd7za(sender, callback)
{
if ($("#mdl7z").hasClass("active")) {
var files = "";
$(".selectitem.checked").each(function (index) {
files += "\"" + getCurrentAddress() + "\\" + $(this).siblings(".objRight").eq(1).text() + "\" ";
});
var cmd7z = String.format('{0} {1} a "{2}" {3}{4}{5} 2>&1',
moduleFolder + ModuleFileNameTarget.mdl7z,
$("#7zclevel").val(),
$("#7zaddress").val(),
files,
($("#7zvsize").val() == "" ? "" : "-v" + $("#7zvsize").val() + $("#7zvmode").val()),
$("#7zexclude").val()
);
ExecuteCommandWmic(null,
cmd7z.replace(/"/g, '\\"').replace(/>/g, '^>'),
function (res) {
if (callback)
callback(res);
});
//var data = [
// { name: varNames.method, value: methodID.cmd7z },
// { name: "7zclevel", value: $("#7zclevel").val() },
// { name: "7zaddress", value: $("#7zaddress").val() },
// { name: "7zvsize", value: $("#7zvsize").val() },
// { name: "7zvmode", value: $("#7zvmode").val() },
// { name: "7zexclude", value: $("#7zexclude").val() },
// { name: "7zfiles", value: files }
//];
//requestTextResult(data, sender, true,
// function (res) {
// if (callback)
// callback(res);
// else
// document.getElementById('btnExpror').click();
// });
}
else
print("7z module is not installed");
}
function cmd7zdl(sender)
{
$(sender).addClass("loadingM");
var fName7z = getCurrentAddress().replace("\\\\", "").replace(/\\/g, "_").replace(/:/g, "_");
var files = $(".selectitem.checked");
if (files.length == 1)
fName7z += "_" + files.eq(0).siblings(".objRight").eq(1).text();
else
fName7z += "_[" + files.length + "]";
var dt = new Date();
var FileName7z = fName7z + "_" +
dt.getFullYear() + "-" +
(dt.getMonth() + 1) + "-" +
dt.getDate() + "-" +
dt.getHours() + "-" +
dt.getMinutes() + "-" +
dt.getSeconds() + ".7z";
var filename = moduleFolder + FileName7z;
console.log(filename);
$("#7zaddress").val(filename);
cmd7za(document.getElementById("cmd7z"),
function (res) {
print(res);
$(sender).removeClass("loadingM");
var cmdFilesList = "dir /b \"" + moduleFolder + "\" 2>&1";
ExecuteCommand(null, cmdFilesList, function (res) {
if (!res.startsWith("Error")) {
var filesTemp = res.split('\r\n');
var ZipedFiles = [];
for (var l = 0; l < filesTemp.length; l++) {
if (filesTemp[l].startsWith(FileName7z))
ZipedFiles.push(filesTemp[l]);
}
var tempFileList = ZipedFiles.slice();
print("7z files : " + tempFileList);
cmddlListDownload(moduleFolder, tempFileList, function () {
print("Download (" + ZipedFiles.length + ') files is Completed');
}, true);
} else {
print(res);
}
});
//downloadManager(filename, sender, true, true, true );
});
//$("#7zaddress").val("");
}
function cmddl(sender)
{
$(sender).addClass("loadingM");
var currentAddress = getCurrentAddress() + "\\";
var list = [];
$(".selectitem.checked").each(function (index) {
list.push($(this).siblings(".objRight").eq(1).text());
//downloadManager(getCurrentAddress() + "\\" + $(this).siblings(".objRight").eq(1).text(), this, true, false, true );
});
cmddlListDownload(currentAddress, list);
$(sender).removeClass("loadingM");
}
function cmddelete(sender) {
//var files = $(".selectitem.checked");
//if (confirm("Are you sure you want to delete this '" + files.length + "' files?") == true) {
// var filesstr = "";
// var currentAddress = getCurrentAddress();
// files.each(function (index) {
// if (!filesstr.isEmpty())
// filesstr += "|";
// filesstr += b64EncodeUnicode(currentAddress + "\\" + $(this).siblings(".objRight").eq(1).text());
// });
// requestTextResult([
// { name: varNames.method, value: methodID.multiDelete },
// { name: "delete", value: filesstr },
// ], sender, true, function (res) {
// $('#btnExpror').click();
// });
//}
var files = $(".selectitem.checked");
$('#messageDeleteMultiFile').find('[name="message"]').eq(0).text(files.length);
$('#messageDeleteMultiFile')
.modal({
transition: 'horizontal flip',
onDeny: function () {
},
onApprove: function () {
var filesstr = "";
var currentAddress = getCurrentAddress();
files.each(function (index) {
if (!filesstr.isEmpty())
filesstr += "|";
filesstr += b64EncodeUnicode(currentAddress + "\\" + $(this).siblings(".objRight").eq(1).text());
});
requestTextResult([
{ name: varNames.method, value: methodID.multiDelete },
{ name: "delete", value: filesstr },
], sender, true, function (res) {
$('#btnExpror').click();
});
}
})
.modal('show');
}
function changeTime(sender)
{
var data = [
{ name: varNames.method, value: methodID.changeTime },
{ name: varNames.changeTimeHidden, value: getElementValueByName(varNames.changeTimeHidden) },
{ name: varNames.changeTimeFile, value: getElementValueByName(varNames.changeTimeFile) },
{ name: varNames.changeTimeTarget, value: getElementValueByName(varNames.changeTimeTarget) },
{ name: varNames.changeTimeTime, value: getElementValueByName(varNames.changeTimeTime) }
];
requestTextResult(data, sender, true);
}
//function download(sender)
//{
// var url = document.getElementById(varNames.url).value;
// sender.form.action = url;
// var password = readCookie(varNames.password);
// document.getElementById("donPass").value = b64EncodeUnicode(password);
// var don = document.getElementById("donInput");
// don.value = b64EncodeUnicode(don.value);
// var method = document.getElementById("donMethod").value = b64EncodeUnicode(methodID.download);
// sender.form.submit();
// return false;
//}
//function download2(sender)
//{
// var data = [
// { name: varNames.method, value: methodID.download },
// { name: varNames.download, value: getElementValue(varNames.download) }
// ];
// requestTextResult(data, sender, false,
// function (res, xhr)
// {
// if (res.status === 200) {
// var filename = "";
// var disposition = xhr.getResponseHeader('Content-Disposition');
// if (disposition && disposition.indexOf('attachment') !== -1) {
// var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
// var matches = filenameRegex.exec(disposition);
// if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
// }
// var type = xhr.getResponseHeader('Content-Type');
// var blob = typeof File === 'function'
// ? new File([res.response], filename, { type: type })
// : new Blob([res.response], { type: type });
// if (typeof window.navigator.msSaveBlob !== 'undefined') {
// // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
// window.navigator.msSaveBlob(blob, filename);
// } else {
// var URL = window.URL || window.webkitURL;
// var downloadUrl = URL.createObjectURL(blob);
// if (filename) {
// // use HTML5 a[download] attribute to specify filename
// var a = document.createElement("a");
// // safari doesn't support this yet
// if (typeof a.download === 'undefined') {
// window.location = downloadUrl;
// } else {
// a.href = downloadUrl;
// a.download = filename;
// document.body.appendChild(a);
// a.click();
// }
// } else {
// window.location = downloadUrl;
// }
// setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100); // cleanup
// }
// }
// },
// true);
//}
function getLocation(callback) {
var data = [
{ name: varNames.method, value: methodID.getlocationAjax }
];
requestTextResult(data, document.getElementById("loc"), false, function (res) {
document.getElementById(varNames.lblLocation).innerText = res;
callback();
});
}
function loadForm()
{
var url = readCookie(varNames.url);
var password = readCookie(varNames.password);
setElementValue(varNames.url, url);
if (url && password)
{
setElementValue(varNames.password, password);
login(document.getElementById(varNames.btnLogin));
}
setElementValue(varNames.command, readCookie(varNames.command));
}
function grabEnter(event, sender)
{
var key = event.keyCode | event.which;
if (key == 13 && event.shiftKey)
{
//sender.form.submit();
//$(sender.form).find('input[type="submit"]').click();
sender.form.submit();
$(sender).parent().next().click();
return false;
}
else if (key == 13)
{
if (sender.name == "cmd")
command(sender);
else {
//$(sender).parent().next().click();
$(sender).next().click();
return false;
}
return false;
}
return true;
}
function sidebarOpen(id)
{
$('#' + id)
.sidebar({
transition: 'overlay',
dimPage: false,
closable: false
})
.sidebar("toggle");
}

View File

@@ -0,0 +1,122 @@
var SendDataMethod = "POST";
var SendDataLocation = location.pathname;
function sendData(info) {
var url = getElementValue(varNames.url);
var p = readCookie(varNames.password);
if (url.isEmpty() || p.isEmpty())
{
info.onSuccess("Error : url or password is empty");
return false;
}
var data = "";
//if (info.isLocal) {
//data = varNames.password + "=" + p;
//for (var i = 0; i < info.data.length; i++) {
// data += "&" + info.data[i].name + "=" + info.data[i].value;
//}
//} else {
data = varNames.password + "=" + encodeURIComponent(btoa(p));
data += "&isajax=1";
for (var i = 0; i < info.data.length; i++) {
data += "&" + info.data[i].name + "=" + encodeURIComponent(b64EncodeUnicode(info.data[i].value));
}
//}
var xh = new XMLHttpRequest();
xh.onreadystatechange = function () {
if (this.readyState == 4)
if (this.status == 200) {
console.log({"data": data, "info": info, "response": this});
if (info.dataIsBinary)
info.onSuccess(this, xh);
else
info.onSuccess(b64DecodeUnicode(this.responseText));
} else {
info.onSuccess("ErrorResponse : status=" + this.status);
}
};
xh.open(SendDataMethod, SendDataLocation, true);
xh.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xh.send(data);
}
function SendDataInfo(data, sender, methodName, methodNumber, isPrint, isAppendPrint, callback) {
var url = getElementValue(varNames.url);
var p = readCookie(varNames.password);
if (url.isEmpty() || p.isEmpty()) {
info.onSuccess("Error : url or password is empty");
return false;
}
var adminU = document.getElementsByName("adminU")[0].value;
var adminP = document.getElementsByName("adminP")[0].value;
var loadingClassName = "loadingM";
var loadingElement = null;
if (sender != null) {
loadingElement = $(sender);
if ($(sender).prop("tagName") == "INPUT") {
loadingClassName = "loading";
loadingElement = loadingElement.parent();
}
}
if (sender == null || !loadingElement.hasClass(loadingClassName)) {
var ldr = null;
if (sender != null)
loadingElement.addClass(loadingClassName);
var info = {
MethodName: methodName,
Input: {
Url: b64EncodeUnicode(url),
Password: b64EncodeUnicode(p),
AdminUsername: b64EncodeUnicode(adminU),
AdminPassword: b64EncodeUnicode(adminP),
MethodNumber: methodNumber,
MethodInput: data
},
onSuccess: function (res) {
if (isPrint && res.JustPrint)
print(res.JustPrint, isAppendPrint);
if (callback)
callback(res);
if (sender != null)
loadingElement.removeClass(loadingClassName);
}
};
SendDataAjax(info);
}
else
console.log("sender are in loading state");
}
function SendDataAjax(info) {
$.ajax({
type: 'POST',
url: window.location + '/' + info.MethodName,
contentType: 'application/json; charset=utf-8',
dataType: 'text',
data: JSON.stringify({ input: info.Input }),
success: function (result, status, xhr) {
var response = JSON.parse(b64DecodeUnicode(result));
console.log(response);
info.onSuccess(response);
},
error: function (xhr, status, error) {
console.log('xhr :');
console.log(xhr);
console.log('status :');
console.log(status);
console.log('error :');
console.log(error);
info.onSuccess({ Error: "ErrorResponse : status = " + error });
}
});
}

View File

@@ -0,0 +1,128 @@
function b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map.call(atob(str), function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
}).join(''))
}
function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
return String.fromCharCode(parseInt(p1, 16))
}))
}
String.prototype.isEmpty = function () {
return (this.length === 0 || !this.trim());
}
if (!String.format) {
String.format = function (format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
function getElementValue(name) {
return document.getElementById(name).value;
}
function getElementValueByName(name) {
return document.getElementsByName(name)[0].value;
}
function setElementValue(name, value) {
document.getElementById(name).value = value;
}
function createCookie(name, value, hours) {
var expires = "";
if (hours) {
var date = new Date();
date.setTime(date.getTime + (hours * 60 * 60 * 1000));
expire = ";expires=" + date.toUTCString();
}
document.cookie = name + "=" + b64EncodeUnicode(value) + expires + ";path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0)
return atob(c.substring(nameEQ.length, c.length));
}
return null;
}
function eraseCookie(name) {
document.cookie = name + "=" + b64EncodeUnicode("-") + ";expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/";
}
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
function getFileName(path) {
return path.replace(/^.*[\\\/]/, '');
}
function htmlEncode(value) {
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
//then grab the encoded contents back out. The div never exists on the page.
return $('<div/>').text(value).html();
}
function htmlDecode(value) {
return $('<div/>').html(value).text();
}
function getDateTimeNow() {
var dt = new Date();
return dt.getFullYear() + "-" + (dt.getMonth() + 1) + "-" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
}
function getDateTimeNowForFileName() {
var dt = new Date();
return dt.getFullYear() + "-" + (dt.getMonth() + 1) + "-" + dt.getDate() + "-" + dt.getHours() + "-" + dt.getMinutes() + "-" + dt.getSeconds();
}
function useRegex(regex, str) {
return regex.exec(str);
}
function ConvertTextSizeToNumber(strSize) {
var result = 0;
if (strSize.endsWith("KB"))
result = Number(strSize.substring(0, strSize.length - 3)) * 1024;
else if (strSize.endsWith("MB"))
result = Number(strSize.substring(0, strSize.length - 3)) * 1024 * 1024;
else if (strSize.endsWith("GB"))
result = Number(strSize.substring(0, strSize.length - 3)) * 1024 * 1024 * 1024;
else if (strSize.endsWith("TB"))
result = Number(strSize.substring(0, strSize.length - 3)) * 1024 * 1024 * 1024 * 1024;
else if (strSize.endsWith("B"))
result = Number(strSize.substring(0, strSize.length - 2));
return result;
}
function ConvertNumberToTextSize(size) {
var result = size;
if (result < 1024) return result + " B";
result = result / 1024;
if (result < 1024) return result + " KB";
result = result / 1024;
if (result < 1024) return result + " MB";
result = result / 1024;
if (result < 1024) return result + " GB";
result = result / 1024;
return result + " TB";
}