Delicious, finally, a good fucking commit
modified: README.md modified: apps/Cinema/index.php modified: apps/Cinema/meta modified: apps/FileManager/index.html modified: apps/FileManager/meta modified: apps/Notepad/index.php modified: apps/Notepad/meta modified: apps/terminal/terminal/scripts/swapTheme.php
This commit is contained in:
parent
ba0428c46e
commit
89e990207e
|
@ -27,4 +27,4 @@ And that's it! Now you have the latest version of DremJS installed on your web s
|
|||
A system to update with a single click of a button and to install applications from DremJS itself is coming soon.
|
||||
<br />
|
||||
<br />
|
||||
© Innovation Inc. 2022
|
||||
© Innovation Inc. 2020
|
||||
|
|
|
@ -1,238 +1,238 @@
|
|||
<?php
|
||||
$file = "/home/user/Pictures/Default.png";
|
||||
|
||||
function GenerateTagForMedia($path) {
|
||||
global $file;
|
||||
// What even is this massive statement? The answer may shock you.
|
||||
// (it's laziness)
|
||||
if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "shuffle") {
|
||||
return ShuffleMusic();
|
||||
}
|
||||
if(isset($_REQUEST["openfile"])) {
|
||||
if(file_exists($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]) && !is_dir($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"])) {
|
||||
$mime = mime_content_type($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
if(strstr($mime, "video/")){
|
||||
return "<video class='media' controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</video>";
|
||||
// This basically depends on the video tag to support the video and is dumb.
|
||||
}else if(strstr($mime, "image/")){
|
||||
return "<img class='media' src='".$_REQUEST['openfile']."'>";
|
||||
}else if(strstr($mime, "audio/")){
|
||||
return "<audio controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</audio>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
// Build array of all music in the user's Music directory
|
||||
$files = scandir("/home/user/Music/");
|
||||
$music = array();
|
||||
$temp = "";
|
||||
|
||||
// Find all files that have .mp3, .wav, or .ogg (not case sensitive) and put them into the $music array
|
||||
for ($i = 0; $i < count($files); $i++) {
|
||||
if (count($temp) >= 5) {
|
||||
$temp = substr($files[$i], count($files[$i]-4));
|
||||
} else {
|
||||
$temp = "StringTooSmallSkipping";
|
||||
}
|
||||
if($temp == ".mp3" || $temp == ".wav" || $temp == ".ogg") {
|
||||
$music[] = $files[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if($_REQUEST["action"] == "shuffle") {
|
||||
ShufleMusic();
|
||||
}*/
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
background-color: white;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
.actionbar {
|
||||
height: 42px;
|
||||
width: 100%;
|
||||
background-color: black;
|
||||
}
|
||||
.actionbarbutton {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 10px;
|
||||
}
|
||||
.media {
|
||||
height: 95%;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["<hr />", ""],
|
||||
["Shuffle", "ShuffleMusic();"],
|
||||
["<hr />", ""],
|
||||
["Toggle Light", "ToggleLight();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
}
|
||||
|
||||
CurrentFile = "/home/user/";
|
||||
var MediaTag = "";
|
||||
|
||||
function Init() {
|
||||
//document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
MediaTag = "<?php echo GenerateTagForMedia("/home/user/Pictures/Default.png"); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
|
||||
document.getElementById('MediaBox').innerHTML=MediaTag;
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function ToggleLight() {
|
||||
if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "white";
|
||||
} else {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "black";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url:'index.php',
|
||||
data:'action=shuffle',
|
||||
success:function(data) {
|
||||
if(data=="Something") {
|
||||
// Do Something
|
||||
} else {
|
||||
// Do Something
|
||||
}
|
||||
}
|
||||
});
|
||||
window.location.href = "index.php?action=shuffle";
|
||||
}
|
||||
</script>
|
||||
<!--<div id="actionBar" class="actionbar">
|
||||
<div id="light" class="actionbarbutton left">
|
||||
<img style="width:42px;height:42px;" src="assets/images/lightbulb-on-white.png" />
|
||||
</div>
|
||||
</div>-->
|
||||
<center>
|
||||
<div id="MediaBox">
|
||||
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the media file you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="cinema.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Cinema</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens a media file.<br />
|
||||
Toggle Light: Toggles the background to be white or black (easier on the eyes)<br />
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
<?php
|
||||
$file = "/home/user/Pictures/Default.png";
|
||||
|
||||
function GenerateTagForMedia($path) {
|
||||
global $file;
|
||||
// What even is this massive statement? The answer may shock you.
|
||||
// (it's laziness)
|
||||
if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "shuffle") {
|
||||
return ShuffleMusic();
|
||||
}
|
||||
if(isset($_REQUEST["openfile"])) {
|
||||
if(file_exists($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]) && !is_dir($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"])) {
|
||||
$mime = mime_content_type($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
if(strstr($mime, "video/")){
|
||||
return "<video class='media' controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</video>";
|
||||
// This basically depends on the video tag to support the video and is dumb.
|
||||
}else if(strstr($mime, "image/")){
|
||||
return "<img class='media' src='".$_REQUEST['openfile']."'>";
|
||||
}else if(strstr($mime, "audio/")){
|
||||
return "<audio controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</audio>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
// Build array of all music in the user's Music directory
|
||||
$files = scandir("/home/user/Music/");
|
||||
$music = array();
|
||||
$temp = "";
|
||||
|
||||
// Find all files that have .mp3, .wav, or .ogg (not case sensitive) and put them into the $music array
|
||||
for ($i = 0; $i < count($files); $i++) {
|
||||
if (count($temp) >= 5) {
|
||||
$temp = substr($files[$i], count($files[$i]-4));
|
||||
} else {
|
||||
$temp = "StringTooSmallSkipping";
|
||||
}
|
||||
if($temp == ".mp3" || $temp == ".wav" || $temp == ".ogg") {
|
||||
$music[] = $files[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if($_REQUEST["action"] == "shuffle") {
|
||||
ShufleMusic();
|
||||
}*/
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
background-color: white;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
.actionbar {
|
||||
height: 42px;
|
||||
width: 100%;
|
||||
background-color: black;
|
||||
}
|
||||
.actionbarbutton {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 10px;
|
||||
}
|
||||
.media {
|
||||
height: 95%;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["<hr />", ""],
|
||||
["Shuffle", "ShuffleMusic();"],
|
||||
["<hr />", ""],
|
||||
["Toggle Light", "ToggleLight();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
}
|
||||
|
||||
CurrentFile = "/home/user/";
|
||||
var MediaTag = "";
|
||||
|
||||
function Init() {
|
||||
//document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
MediaTag = "<?php echo GenerateTagForMedia("/home/user/Pictures/Default.png"); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
|
||||
document.getElementById('MediaBox').innerHTML=MediaTag;
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function ToggleLight() {
|
||||
if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "white";
|
||||
} else {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "black";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url:'index.php',
|
||||
data:'action=shuffle',
|
||||
success:function(data) {
|
||||
if(data=="Something") {
|
||||
// Do Something
|
||||
} else {
|
||||
// Do Something
|
||||
}
|
||||
}
|
||||
});
|
||||
window.location.href = "index.php?action=shuffle";
|
||||
}
|
||||
</script>
|
||||
<!--<div id="actionBar" class="actionbar">
|
||||
<div id="light" class="actionbarbutton left">
|
||||
<img style="width:42px;height:42px;" src="assets/images/lightbulb-on-white.png" />
|
||||
</div>
|
||||
</div>-->
|
||||
<center>
|
||||
<div id="MediaBox">
|
||||
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the media file you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="cinema.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Cinema</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens a media file.<br />
|
||||
Toggle Light: Toggles the background to be white or black (easier on the eyes)<br />
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,6 @@
|
|||
Name: Cinema
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: cinema.png
|
||||
Name: Cinema
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: cinema.png
|
||||
Category: /Media
|
|
@ -1,9 +1,9 @@
|
|||
<!-- File Manager Forwarder -->
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="0;url=../../home/user/index.php" />
|
||||
</head>
|
||||
<!-- File Manager Forwarder -->
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="0;url=../../home/user/index.php" />
|
||||
</head>
|
||||
</html>
|
|
@ -1,6 +1,6 @@
|
|||
Name: File Manager
|
||||
Author: Innovation Science
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: filemanager.png
|
||||
Name: File Manager
|
||||
Author: Innovation Science
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: filemanager.png
|
||||
Category: /
|
|
@ -1,211 +1,211 @@
|
|||
<?php
|
||||
//if(!isset($_POST["open"])) {
|
||||
$file = "/home/user/Documents/NewFile.txt";
|
||||
//} else {
|
||||
//$file = $_POST["open"];
|
||||
//}
|
||||
function GetFileContents() {
|
||||
global $file;
|
||||
if(isset($_REQUEST["openfile"]))
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$file);
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//$currentUser = $_SERVER["DOCUMENT_ROOT"]."/home/user";
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$_REQUEST["file"], "w");
|
||||
fwrite($writeto, $_REQUEST["text"]);
|
||||
fclose($writeto);
|
||||
}
|
||||
if (isset($_REQUEST["action"])) {
|
||||
if($_REQUEST["action"] == "save") {
|
||||
SaveDocument();
|
||||
} elseif ($_REQUEST["action"] == "open") {
|
||||
global $file;
|
||||
$file = $_REQUEST["openfile"];
|
||||
if(!is_file($_SERVER["DOCUMENT_ROOT"].$file)) {
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$file, "w");
|
||||
fclose($writeto);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script>
|
||||
CurrentFile = "<?php echo $file; ?>";
|
||||
|
||||
function Init() {
|
||||
document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
document.getElementById("inputbox").value = "<?php echo GetFileContents(); //echo file_get_contents($_SERVER["DOCUMENT_ROOT"].$file); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
}
|
||||
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["Save", "SaveDocument();"],
|
||||
["<hr />", ""],
|
||||
["Copy", "CopyText();"],
|
||||
["Paste", "PasteText();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
// Scrapped
|
||||
// ["New", "NewDocument();"],
|
||||
// ["Save As...", "SaveDocumentAs();"],
|
||||
// ["Delete", "DeleteSelected();"],
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//document.getElementById("form").submit();
|
||||
//console.log(document.getElementById("inputbox").value);
|
||||
$.ajax({
|
||||
url : window.location.href,
|
||||
type: "POST",
|
||||
data : {action : "save", text : document.getElementById("inputbox").value, file : CurrentFile},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Saved");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});
|
||||
//Init();
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
//console.log(document.getElementById("open").value);
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function CopyText() {
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
function PasteText() {
|
||||
box = document.getElementById("inputbox");
|
||||
box.focus();
|
||||
navigator.clipboard.readText()
|
||||
.then(text => {
|
||||
loc = box.value.slice(0, box.selectionStart).length;
|
||||
value = document.getElementById("inputbox").value;
|
||||
document.getElementById("inputbox").value = value.substring(0, loc) + text + value.substring(loc, value.length);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to read clipboard contents: ', err);
|
||||
});
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
</script>
|
||||
<!--<form>
|
||||
<label>DremJS Notepad</label>
|
||||
<br />
|
||||
<textarea id="inputbox" name="inputbox" rows="50" columns="500"></textarea>
|
||||
</form>-->
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the document you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="notepad.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Notepad</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens or creates a new document.<br />
|
||||
Save: Saves the current document.<br />
|
||||
Copy: Copies selected text to the clipboard.<br />
|
||||
Paste: Pastes the text in the clipboard to where the cursor is (requires clipboard access).
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
|
||||
</div>
|
||||
<textarea id="inputbox" name="text" rows="23" cols="90"></textarea>
|
||||
<p id="writingto"></p>
|
||||
</body>
|
||||
<?php
|
||||
//if(!isset($_POST["open"])) {
|
||||
$file = "/home/user/Documents/NewFile.txt";
|
||||
//} else {
|
||||
//$file = $_POST["open"];
|
||||
//}
|
||||
function GetFileContents() {
|
||||
global $file;
|
||||
if(isset($_REQUEST["openfile"]))
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$file);
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//$currentUser = $_SERVER["DOCUMENT_ROOT"]."/home/user";
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$_REQUEST["file"], "w");
|
||||
fwrite($writeto, $_REQUEST["text"]);
|
||||
fclose($writeto);
|
||||
}
|
||||
if (isset($_REQUEST["action"])) {
|
||||
if($_REQUEST["action"] == "save") {
|
||||
SaveDocument();
|
||||
} elseif ($_REQUEST["action"] == "open") {
|
||||
global $file;
|
||||
$file = $_REQUEST["openfile"];
|
||||
if(!is_file($_SERVER["DOCUMENT_ROOT"].$file)) {
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$file, "w");
|
||||
fclose($writeto);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script>
|
||||
CurrentFile = "<?php echo $file; ?>";
|
||||
|
||||
function Init() {
|
||||
document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
document.getElementById("inputbox").value = "<?php echo GetFileContents(); //echo file_get_contents($_SERVER["DOCUMENT_ROOT"].$file); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
}
|
||||
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["Save", "SaveDocument();"],
|
||||
["<hr />", ""],
|
||||
["Copy", "CopyText();"],
|
||||
["Paste", "PasteText();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
// Scrapped
|
||||
// ["New", "NewDocument();"],
|
||||
// ["Save As...", "SaveDocumentAs();"],
|
||||
// ["Delete", "DeleteSelected();"],
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//document.getElementById("form").submit();
|
||||
//console.log(document.getElementById("inputbox").value);
|
||||
$.ajax({
|
||||
url : window.location.href,
|
||||
type: "POST",
|
||||
data : {action : "save", text : document.getElementById("inputbox").value, file : CurrentFile},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Saved");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});
|
||||
//Init();
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
//console.log(document.getElementById("open").value);
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function CopyText() {
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
function PasteText() {
|
||||
box = document.getElementById("inputbox");
|
||||
box.focus();
|
||||
navigator.clipboard.readText()
|
||||
.then(text => {
|
||||
loc = box.value.slice(0, box.selectionStart).length;
|
||||
value = document.getElementById("inputbox").value;
|
||||
document.getElementById("inputbox").value = value.substring(0, loc) + text + value.substring(loc, value.length);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to read clipboard contents: ', err);
|
||||
});
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
</script>
|
||||
<!--<form>
|
||||
<label>DremJS Notepad</label>
|
||||
<br />
|
||||
<textarea id="inputbox" name="inputbox" rows="50" columns="500"></textarea>
|
||||
</form>-->
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the document you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="notepad.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Notepad</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens or creates a new document.<br />
|
||||
Save: Saves the current document.<br />
|
||||
Copy: Copies selected text to the clipboard.<br />
|
||||
Paste: Pastes the text in the clipboard to where the cursor is (requires clipboard access).
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
|
||||
</div>
|
||||
<textarea id="inputbox" name="text" rows="23" cols="90"></textarea>
|
||||
<p id="writingto"></p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,6 @@
|
|||
Name: Notepad
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: notepad.png
|
||||
Name: Notepad
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: notepad.png
|
||||
Categpry: /Tools
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
$theme = file_get_contents('../configs/theme.conf');
|
||||
|
||||
if($theme == "1") {
|
||||
file_put_contents('../configs/theme.conf', '0');
|
||||
} else {
|
||||
file_put_contents('../configs/theme.conf', '1');
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
$theme = file_get_contents('../configs/theme.conf');
|
||||
|
||||
if($theme == "1") {
|
||||
file_put_contents('../configs/theme.conf', '0');
|
||||
} else {
|
||||
file_put_contents('../configs/theme.conf', '1');
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue