Commit 9a283c7f authored by Jyrki's avatar Jyrki 🐾
Browse files

added ability to remove words

parent e97c011e
......@@ -2112,6 +2112,17 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
})
}(jQuery);
function a(b){
function a(b) {
document.getElementById("recent-count").disabled = b;
}
function b(x) {
x.preventDefault();
$.get("ucp.php?page=ajax&action=delete-word&id=" + x.dataset.wordId,
function (d) {
d = JSON.parse(d);
if (d.success) {
document.getElementById("words-" + x.dataset.wordId).outerHTML="";
}
}
);
}
This diff is collapsed.
......@@ -23,7 +23,6 @@ include_once 'config.php';
function check_privileges($ajax = false) {
if (!$_SESSION['logged_in']) {
if ($ajax) {
header('Content-Type: application/javascript');
echo json_encode(array("success" => false));
} else {
$_SESSION['flash'] = "Log in to continue.";
......@@ -36,7 +35,6 @@ function check_privileges($ajax = false) {
switch ($_GET['page']) {
case "ajax": {
check_privileges(true);
header('Content-Type: application/javascript');
$response = array("success" => false);
switch ($_GET['action']) {
case "delete-word": {
......@@ -52,6 +50,7 @@ switch ($_GET['page']) {
}
}
echo json_encode($response);
exit();
break;
}
case "login": {
......
......@@ -17,7 +17,7 @@
<tbody>
{loop="$words"}
<tr>
<td><b>{$value.author}</b> thinks that you are <span class="label label-default">{$value.word1}</span>, <span class="label label-default">{$value.word2}</span> and <span class="label label-default">{$value.word3}</span><a class="float-right" href="#"><i class="glyphicon glyphicon-remove"></i></a></td>
<td id="words-{$value.id}"><b>{$value.author}</b> thinks that you are <span class="label label-default">{$value.word1}</span>, <span class="label label-default">{$value.word2}</span> and <span class="label label-default">{$value.word3}</span><a class="float-right" href="#" class="text-danger" onclick="b(this)" data-word-id="{$value.id}"><i class="glyphicon glyphicon-remove"></i></a></td>
</tr>
{/loop}
</tbody>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment