ep_adminpads2
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "ep_adminpads2", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Etherpad plugin to list and delete pads in /admin.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/rhansen/ep_adminpads2", |
@@ -1,7 +0,7 @@ | ||
exports.documentReady = async function(hooks, context) { | ||
exports.documentReady = function(hooks, context, cb) { | ||
if (context !== "admin/pads") { | ||
return; | ||
return cb; | ||
} | ||
let socket, | ||
var socket, | ||
loc = document.location, | ||
@@ -15,5 +15,5 @@ port = loc.port == "" ? (loc.protocol == "https:" ? 443 : 80) : loc.port, | ||
let room = url + "pluginfw/admin/pads"; | ||
var room = url + "pluginfw/admin/pads"; | ||
let changeTimer; | ||
var changeTimer; | ||
@@ -29,8 +29,8 @@ //connect | ||
let doUpdate = false; | ||
const doAutoUpdate = function () { | ||
var doUpdate = false; | ||
var doAutoUpdate = function () { | ||
return $("#results-autoupdate").prop("checked"); | ||
}; | ||
let search = function () { | ||
var search = function () { | ||
clearTimeout(changeTimer); | ||
@@ -40,8 +40,8 @@ socket.emit("search", $(".search-results").data("query")); | ||
let htmlEntities = function (padName) { | ||
var htmlEntities = function (padName) { | ||
return $("<div/>").text(padName).html(); | ||
}; | ||
let submitSearch = function () { | ||
let query = $(".search-results").data("query"); | ||
var submitSearch = function () { | ||
var query = $(".search-results").data("query"); | ||
query.pattern = $("#search-query")[0].value; | ||
@@ -52,11 +52,11 @@ query.offset = 0; | ||
let isInt = function (input) { | ||
var isInt = function (input) { | ||
return typeof input === "number" && input % 1 === 0; | ||
}; | ||
let formatDate = function (longtime) { | ||
let formattedDate = ""; | ||
var formatDate = function (longtime) { | ||
var formattedDate = ""; | ||
if (longtime != null && isInt(longtime)) { | ||
let date = new Date(longtime); | ||
let month = date.getMonth() + 1; | ||
var date = new Date(longtime); | ||
var month = date.getMonth() + 1; | ||
formattedDate = date.getFullYear() + "-" + fillZeros(month) + "-" + fillZeros(date.getDate()) + " " + fillZeros(date.getHours()) + ":" + fillZeros(date.getMinutes()) + ":" + fillZeros(date.getSeconds()); | ||
@@ -67,3 +67,3 @@ } | ||
let fillZeros = function (fillForm) { | ||
var fillZeros = function (fillForm) { | ||
return isInt(fillForm) ? (fillForm < 10 ? "0" + fillForm : fillForm) : ""; | ||
@@ -93,4 +93,4 @@ }; | ||
$(".do-delete").off("click").click(function (e) { | ||
let row = $(e.target).closest("tr"); | ||
let padID = row.find(".padname").text(); | ||
var row = $(e.target).closest("tr"); | ||
var padID = row.find(".padname").text(); | ||
if (confirm("Do you really want to delete the pad " + padID + "?")) { | ||
@@ -103,3 +103,3 @@ doUpdate = true; | ||
$(".do-prev-page").off("click").click(function (e) { | ||
let query = $(".search-results").data("query"); | ||
var query = $(".search-results").data("query"); | ||
query.offset -= query.limit; | ||
@@ -112,4 +112,4 @@ if (query.offset < 0) { | ||
$(".do-next-page").off("click").click(function (e) { | ||
let query = $(".search-results").data("query"); | ||
let total = $(".search-results").data("total"); | ||
var query = $(".search-results").data("query"); | ||
var total = $(".search-results").data("total"); | ||
if (query.offset + query.limit < total) { | ||
@@ -130,3 +130,3 @@ query.offset += query.limit; | ||
let message = "Unknown status"; | ||
var message = "Unknown status"; | ||
if (data.message) { | ||
@@ -154,3 +154,3 @@ message = "<span class=\"status\">" + data.message.toString() + "</span>"; | ||
socket.on("search-result", function (data) { | ||
let widget = $(".search-results") | ||
var widget = $(".search-results") | ||
, limit = data.query.offset + data.query.limit | ||
@@ -170,10 +170,10 @@ ; | ||
widget.find(".results *").remove(); | ||
let resultList = widget.find(".results"); | ||
var resultList = widget.find(".results"); | ||
if (data.results.length > 0) { | ||
data.results.forEach(function (resultset) { | ||
let padName = resultset.padName; | ||
let lastEdited = resultset.lastEdited; | ||
let userCount = resultset.userCount; | ||
let row = widget.find(".template tr").clone(); | ||
var padName = resultset.padName; | ||
var lastEdited = resultset.lastEdited; | ||
var userCount = resultset.userCount; | ||
var row = widget.find(".template tr").clone(); | ||
row.find(".padname").html("<a href=\"../p/" + encodeURIComponent(padName) + "\">" + htmlEntities(padName) + "</a>" | ||
@@ -195,2 +195,3 @@ ) | ||
search(); | ||
return cb; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38288
288