Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/erikdubbelboer/phpRedisAdmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Dubbelboer <erik@dubbelboer.com>2016-04-24 13:26:22 +0300
committerErik Dubbelboer <erik@dubbelboer.com>2016-04-24 13:26:22 +0300
commit1e2b8e17b5ebda9711e78a39cf9e85bd6b375345 (patch)
tree623c33d97f6ec23a6bbc57333d553b511a147092
parentd2207d359527a053bedba27c3878cdabaea072b1 (diff)
parent8cf5e8e4aa544d86f6fc21466503849ef2e0fe48 (diff)
Merge pull request #94 from GregOriol/master
Fixed "click" binding on redis databases with a lot of keys (#93)
-rw-r--r--js/index.js99
1 files changed, 46 insertions, 53 deletions
diff --git a/js/index.js b/js/index.js
index 0b4d924..b440a77 100644
--- a/js/index.js
+++ b/js/index.js
@@ -1,43 +1,60 @@
$(function() {
- $('#sidebar a').click(function(e) {
- if (e.currentTarget.href.indexOf('/?') == -1) {
- return;
- }
-
- e.preventDefault();
-
- var href;
-
- if ((e.currentTarget.href.indexOf('?') == -1) ||
- (e.currentTarget.href.indexOf('?') == (e.currentTarget.href.length - 1))) {
- href = 'overview.php';
- } else {
- href = e.currentTarget.href.substr(e.currentTarget.href.indexOf('?') + 1);
-
- if (href.indexOf('&') != -1) {
- href = href.replace('&', '.php?');
- } else {
- href += '.php';
- }
- }
+ $('#sidebar').on('click', 'a', function(e) {
+ if (e.currentTarget.className.indexOf('deltree') !== -1) {
+ e.preventDefault();
- if (href.indexOf('flush.php') == 0) {
- if (confirm('Are you sure you want to delete this key and all it\'s values?')) {
+ if (confirm('Are you sure you want to delete this whole tree and all it\'s keys?')) {
$.ajax({
type: "POST",
- url: href,
+ url: this.href,
data: 'post=1',
- success: function() {
- window.location.reload();
+ success: function(url) {
+ top.location.href = top.location.pathname+url;
}
});
}
} else {
- $('#iframe').attr('src', href);
+ if (e.currentTarget.href.indexOf('/?') == -1) {
+ return;
+ }
+
+ e.preventDefault();
+
+ var href;
+
+ if ((e.currentTarget.href.indexOf('?') == -1) ||
+ (e.currentTarget.href.indexOf('?') == (e.currentTarget.href.length - 1))) {
+ href = 'overview.php';
+ } else {
+ href = e.currentTarget.href.substr(e.currentTarget.href.indexOf('?') + 1);
+
+ if (href.indexOf('&') != -1) {
+ href = href.replace('&', '.php?');
+ } else {
+ href += '.php';
+ }
+ }
+
+ if (href.indexOf('flush.php') == 0) {
+ if (confirm('Are you sure you want to delete this key and all it\'s values?')) {
+ $.ajax({
+ type: "POST",
+ url: href,
+ data: 'post=1',
+ success: function() {
+ window.location.reload();
+ }
+ });
+ }
+ } else {
+ $('#iframe').attr('src', href);
+ }
+
+ $('li.current').removeClass('current');
+ $(this).parent().addClass('current');
}
});
-
$('#server').change(function(e) {
if (location.href.indexOf('?') == -1) {
location.href = location.href+'?s='+e.target.value;
@@ -62,7 +79,7 @@ $(function() {
$('li.current').parents('li.folder').removeClass('collapsed');
- $('li.folder').click(function(e) {
+ $('#sidebar').on('click', 'li.folder', function(e) {
var t = $(this);
if ((e.pageY >= t.offset().top) &&
@@ -72,14 +89,6 @@ $(function() {
}
});
- $('a').click(function() {
- $('li.current').removeClass('current');
- });
-
- $('li a').click(function() {
- $(this).parent().addClass('current');
- });
-
$('#btn_server_filter').click(function() {
var filter = $('#server_filter').val();
location.href = top.location.pathname + '?overview&s=' + $('#server').val() + '&d=' + ($('#database').val() || '') + '&filter=' + filter;
@@ -118,22 +127,6 @@ $(function() {
});
});
- $('.deltree').click(function(e) {
- e.preventDefault();
-
- if (confirm('Are you sure you want to delete this whole tree and all it\'s keys?')) {
- $.ajax({
- type: "POST",
- url: this.href,
- data: 'post=1',
- success: function(url) {
- top.location.href = top.location.pathname+url;
- }
- });
- }
- });
-
-
var isResizing = false;
var lastDownX = 0;
var lastWidth = 0;