From 7987a459eb941e5b664859e4210565b72b3ff011 Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Feb 2015 13:13:03 +0100 Subject: [PATCH 1/2] [regions] instead of trying all cells, calculate x/y from distance according to the Hilbert curve also, refactoring to reduce duplicate code for level 4/6 cells --- plugins/regions.user.js | 96 ++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/plugins/regions.user.js b/plugins/regions.user.js index 4c2ec44b..cd897abb 100644 --- a/plugins/regions.user.js +++ b/plugins/regions.user.js @@ -120,6 +120,31 @@ window.plugin.regions.search = function(query) { }); } +// rot and d2xy from Wikipedia +window.plugin.regions.rot = function(n, x, y, rx, ry) { + if(ry == 0) { + if(rx == 1) { + x = n-1 - x; + y = n-1 - y; + } + + return [y, x]; + } + return [x, y]; +} +window.plugin.regions.d2xy = function(n, d) { + var rx, ry, s, t = d, xy = [0, 0]; + for(s=1; s Date: Mon, 23 Feb 2015 13:18:22 +0100 Subject: [PATCH 2/2] better tooltip handling - search: remove tooltip from DOM immediately instead of setting up a new instance (which would have other options) - sidebar toggle: remove tooltip upon click, tooltip might persist otherwise - close other tooltips before opening a new one --- code/boot.js | 2 ++ code/search.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/boot.js b/code/boot.js index 1f75b734..98797f09 100644 --- a/code/boot.js +++ b/code/boot.js @@ -453,6 +453,7 @@ window.setupSidebarToggle = function() { toggle.html(''); toggle.css('right', SIDEBAR_WIDTH+1+'px'); } + $('.ui-tooltip').remove(); }); } @@ -463,6 +464,7 @@ window.setupTooltips = function(element) { show: { effect: "hide", duration: 0 } , hide: false, open: function(event, ui) { + $(".ui-tooltip").not(ui.tooltip).remove(); ui.tooltip.delay(300).fadeIn(0); }, content: function() { diff --git a/code/search.js b/code/search.js index 1b4e9aed..e48ec4dd 100644 --- a/code/search.js +++ b/code/search.js @@ -190,7 +190,7 @@ window.search.doSearch = function(term, confirmed) { if(useAndroidPanes()) show('info'); - $('#search').tooltip().tooltip('close'); + $('.ui-tooltip').remove(); window.search.lastSearch = new window.search.Query(term, confirmed); window.search.lastSearch.show();