236 lines
6.3 KiB
HTML
236 lines
6.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<link rel="stylesheet" href="pico.css" type="text/css">
|
|
<script type="text/javascript" src="jquery.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: "addlink",
|
|
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: "addcontent",
|
|
password: password,
|
|
id: id,
|
|
content: content,
|
|
}, function( data ) {
|
|
getcontents();
|
|
});
|
|
}
|
|
|
|
function delcthis(name){
|
|
$.post("api.php",
|
|
{
|
|
action: "deletecontent",
|
|
id: name
|
|
}, function( data ) {
|
|
getcontents();
|
|
});
|
|
}
|
|
|
|
function upcthis(name){
|
|
let id = $("#addidc_" + name).val();
|
|
let contentin = $("#addcontentc_" + name).val();
|
|
$.post("api.php",
|
|
{
|
|
action: "setcontent",
|
|
idwhere: name,
|
|
id: id,
|
|
content: contentin,
|
|
}, function( data ) {
|
|
getcontents();
|
|
});
|
|
}
|
|
|
|
function uplinkthis(name){
|
|
let id = $("#addid_" + name).val();
|
|
let contentid = $("#addcontentid_" + name).val();
|
|
let nickname = $("#addnickname_" + name).val();
|
|
$.post("api.php",
|
|
{
|
|
action: "setlink",
|
|
idwhere: name,
|
|
id: id,
|
|
contentid: contentid,
|
|
nickname: nickname,
|
|
}, function( data ) {
|
|
getcontents();
|
|
});
|
|
}
|
|
|
|
function getcontents(){
|
|
$.post("api.php",
|
|
{
|
|
action: "getcontent"
|
|
}, 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: "deletelink",
|
|
id: name
|
|
}, function( data ) {
|
|
getlinks();
|
|
});
|
|
}
|
|
|
|
function dellog(name){
|
|
$.post("api.php",
|
|
{
|
|
action: "deletelog",
|
|
id: name
|
|
}, function( data ) {
|
|
getlog();
|
|
});
|
|
}
|
|
|
|
function loadmgmt() {
|
|
getlinks();
|
|
getcontents();
|
|
getlog();
|
|
$("#pwdentry").fadeOut("fast", function(){
|
|
$("#indexmanagement").fadeIn("fast", function(){
|
|
});
|
|
});
|
|
}
|
|
|
|
function verifyPassword(){
|
|
password = $("#pwdbox").val();
|
|
$.post("api.php",
|
|
{
|
|
action: "verify",
|
|
password: password
|
|
}, function( data ) {
|
|
if (data == "OK"){
|
|
loadmgmt();
|
|
}
|
|
});
|
|
}
|
|
|
|
function getlinks(){
|
|
$.post("api.php",
|
|
{
|
|
action: "getlinks"
|
|
}, 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",
|
|
id: id
|
|
}, function( data ) {
|
|
$("#loglist").html(data);
|
|
});
|
|
}
|
|
|
|
$(function() {
|
|
|
|
$("#submitpwd").click(verifyPassword);
|
|
$("#logget").click(getlog);
|
|
|
|
$.post("api.php",
|
|
{
|
|
action: "hassession"
|
|
}, function( data ) {
|
|
if (data == "YES"){
|
|
loadmgmt();
|
|
}
|
|
});
|
|
|
|
$("#logid").keyup(function(event) {
|
|
if (event.keyCode === 13) {
|
|
$("#logget").click();
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<title>Content dispenser admin</title>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="pwdentry">
|
|
<input type="password" id="pwdbox">
|
|
<button id="submitpwd">Login</button>
|
|
</div>
|
|
|
|
<div id="indexmanagement">
|
|
<h1>Link manager:</h1>
|
|
<div id="linkslist">
|
|
|
|
</div>
|
|
<h1>Content manager:</h1>
|
|
<div id="contentlist">
|
|
|
|
</div>
|
|
<h1>Log manager:</h1>
|
|
<input type="text" id="logid" value="*" placeholder="Link ID"><button id="logget">Get log</button><br>
|
|
<div id="loglist">
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |