embed stuff into admin html

This commit is contained in:
Bruno Rybársky 2023-06-10 09:14:37 +02:00
parent 92cdabb7ae
commit 0882db10b2
No known key found for this signature in database
GPG Key ID: DFE2C061EF985CD4
3 changed files with 156 additions and 156 deletions

@ -3,9 +3,163 @@
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="pico.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<style>
#indexmanagement{
display: none;
}
</style>
<script>
let password = "";
let datatable = {};
let content = "";
function justadd(){
let id = $("#addid").val();
let contentid = $("#addcontentid").val();
let nickname = $("#addnickname").val();
$.post("api.php",
{
action: "set",
password: password,
id: id,
contentid: contentid,
nickname: nickname,
}, function( data ) {
getlinks();
});
}
function justaddc(){
let id = $("#addidc").val();
let content = $("#addcontentc").val();
$.post("api.php",
{
action: "setcontent",
password: password,
id: id,
content: content,
}, function( data ) {
getcontents();
});
}
function delcthis(name){
$.post("api.php",
{
action: "deletecontent",
password: password,
id: name
}, function( data ) {
getcontents();
});
}
function getcontents(){
$.post("api.php",
{
action: "getcontent",
password: password
}, function( data ) {
$("#contentlist").html(data);
$("#addcontentc").keyup(function(event) {
if (event.keyCode === 13) {
$("#contentadder").click();
}
});
$("#addidc").keyup(function(event) {
if (event.keyCode === 13) {
$("#addcontentc").focus();
}
});
});
}
function delthis(name){
$.post("api.php",
{
action: "delete",
password: password,
id: name
}, function( data ) {
getlinks();
});
}
function verifyPassword(){
password = $("#pwdbox").val();
$.post("api.php",
{
action: "verify",
password: password
}, function( data ) {
if (data == "OK"){
getlinks();
getcontents();
$("#pwdentry").fadeOut("slow", function(){
$("#indexmanagement").fadeIn("slow", function(){
});
});
}
});
}
function getlinks(){
$.post("api.php",
{
action: "get",
password: password
}, function( data ) {
$("#linkslist").html(data);
$("#addnickname").keyup(function(event) {
if (event.keyCode === 13) {
$("#linkadder").click();
}
});
$("#addid").keyup(function(event) {
if (event.keyCode === 13) {
$("#addcontentid").focus();
}
});
$("#addcontentid").keyup(function(event) {
if (event.keyCode === 13) {
$("#addnickname").focus();
}
});
});
}
function getlog(){
let id = $("#logid").val();
$.post("api.php",
{
action: "getlog",
password: password,
id: id
}, function( data ) {
$("#loglist").html(data);
});
}
$(function() {
$("#submitpwd").click(verifyPassword);
$("#logget").click(getlog);
$("#logid").keyup(function(event) {
if (event.keyCode === 13) {
$("#logget").click();
}
});
});
</script>
<title>Content dispenser admin</title>
</head>
<body>

@ -1,151 +0,0 @@
let password = "";
let datatable = {};
let content = "";
function justadd(){
let id = $("#addid").val();
let contentid = $("#addcontentid").val();
let nickname = $("#addnickname").val();
$.post("api.php",
{
action: "set",
password: password,
id: id,
contentid: contentid,
nickname: nickname,
}, function( data ) {
getlinks();
});
}
function justaddc(){
let id = $("#addidc").val();
let content = $("#addcontentc").val();
$.post("api.php",
{
action: "setcontent",
password: password,
id: id,
content: content,
}, function( data ) {
getcontents();
});
}
function delcthis(name){
$.post("api.php",
{
action: "deletecontent",
password: password,
id: name
}, function( data ) {
getcontents();
});
}
function getcontents(){
$.post("api.php",
{
action: "getcontent",
password: password
}, function( data ) {
$("#contentlist").html(data);
$("#addcontentc").keyup(function(event) {
if (event.keyCode === 13) {
$("#contentadder").click();
$("#addidc").focus();
}
});
$("#addidc").keyup(function(event) {
if (event.keyCode === 13) {
$("#addcontentc").focus();
}
});
});
}
function delthis(name){
$.post("api.php",
{
action: "delete",
password: password,
id: name
}, function( data ) {
getlinks();
});
}
function verifyPassword(){
password = $("#pwdbox").val();
$.post("api.php",
{
action: "verify",
password: password
}, function( data ) {
if (data == "OK"){
getlinks();
getcontents();
$("#pwdentry").fadeOut("slow", function(){
$("#indexmanagement").fadeIn("slow", function(){
});
});
}
});
}
function getlinks(){
$.post("api.php",
{
action: "get",
password: password
}, function( data ) {
$("#linkslist").html(data);
$("#addnickname").keyup(function(event) {
if (event.keyCode === 13) {
$("#linkadder").click();
$("#addid").focus();
}
});
$("#addid").keyup(function(event) {
if (event.keyCode === 13) {
$("#addcontentid").focus();
}
});
$("#addcontentid").keyup(function(event) {
if (event.keyCode === 13) {
$("#addnickname").focus();
}
});
});
}
function getlog(){
let id = $("#logid").val();
$.post("api.php",
{
action: "getlog",
password: password,
id: id
}, function( data ) {
$("#loglist").html(data);
});
}
$(function() {
$("#submitpwd").click(verifyPassword);
$("#logget").click(getlog);
$("#logid").keyup(function(event) {
if (event.keyCode === 13) {
$("#logget").click();
}
});
});

@ -1,3 +0,0 @@
#indexmanagement{
display: none;
}