ep_adminpads2
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "ep_adminpads2", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Etherpad plugin to list and delete pads in /admin.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,1 +1,8 @@ | ||
let query = { | ||
pattern: '', | ||
offset: 0, | ||
limit: 12, | ||
}; | ||
let total; | ||
exports.documentReady = async (hookName, context) => { | ||
@@ -14,8 +21,2 @@ if (context !== 'admin/pads') return; | ||
$('#search-results').data('query', { | ||
pattern: '', | ||
offset: 0, | ||
limit: 12, | ||
}); | ||
let doUpdate = false; | ||
@@ -26,7 +27,6 @@ const doAutoUpdate = () => $('#results-autoupdate').prop('checked'); | ||
clearTimeout(changeTimer); | ||
socket.emit('search', $('#search-results').data('query')); | ||
socket.emit('search', query); | ||
}; | ||
const submitSearch = () => { | ||
const query = $('#search-results').data('query'); | ||
query.pattern = $('#search-query')[0].value; | ||
@@ -77,3 +77,2 @@ query.offset = 0; | ||
$('#do-prev-page').off('click').click((e) => { | ||
const query = $('#search-results').data('query'); | ||
query.offset -= query.limit; | ||
@@ -84,4 +83,2 @@ if (query.offset < 0) query.offset = 0; | ||
$('#do-next-page').off('click').click((e) => { | ||
const query = $('#search-results').data('query'); | ||
const total = $('#search-results').data('total'); | ||
if (query.offset + query.limit < total) { | ||
@@ -132,11 +129,11 @@ query.offset += query.limit; | ||
widget.data('query', data.query); | ||
widget.data('total', data.total); | ||
query = data.query; | ||
total = data.total; | ||
widget.find('.offset').html(data.query.offset); | ||
widget.find('.limit').html(limit); | ||
widget.find('.total').html(data.total); | ||
$('#offset').text(query.offset); | ||
$('#limit').text(limit); | ||
$('#total').text(total); | ||
widget.find('#results *').remove(); | ||
const resultList = widget.find('#results'); | ||
const resultList = $('#results'); | ||
resultList.empty(); | ||
@@ -146,3 +143,3 @@ if (data.results.length > 0) { | ||
const {padName, lastEdited, userCount} = resultset; | ||
const row = widget.find('#template').clone().removeAttr('id'); | ||
const row = $('#template').clone().removeAttr('id'); | ||
row.find('.padname').empty().append( | ||
@@ -149,0 +146,0 @@ $('<a>').attr('href', `../p/${encodeURIComponent(padName)}`).text(padName)); |
Sorry, the diff of this file is not supported yet
38259
288