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