aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-03-28 14:20:34 +0000
committeranekos2010-03-28 14:20:34 +0000
commit2161a5d0bf42b4d6ade6da7fb5611c66e514b7e9 (patch)
treec68dad47716e78e63553a3e0c9525bf1ef211728
parentd4bd9fc378680ca2b70f633606e2537552e5eac5 (diff)
downloadvimperator-plugins-2161a5d0bf42b4d6ade6da7fb5611c66e514b7e9.tar.bz2
オレオレ化
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37114 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-xspatial-navigation.js29
1 files changed, 11 insertions, 18 deletions
diff --git a/spatial-navigation.js b/spatial-navigation.js
index 6e47bf0..5f3f30b 100755
--- a/spatial-navigation.js
+++ b/spatial-navigation.js
@@ -122,26 +122,19 @@ let g:spatial_navigation_mappings="<A-h> <A-j> <A-k> <A-l>"
return false;
}
- function inflateRect (rect, value) {
- var newRect = new Object();
-
- newRect.left = rect.left - value;
- newRect.top = rect.top - value;
- newRect.right = rect.right + value;
- newRect.bottom = rect.bottom + value;
- return newRect;
- }
+ function inflateRect (rect, value) ({
+ left: rect.left - value,
+ top: rect.top - value,
+ right: rect.right + value,
+ bottom: rect.bottom + value
+ });
- function containsRect (a, b) {
- return ( (b.left <= a.right) &&
- (b.right >= a.left) &&
- (b.top <= a.bottom) &&
- (b.bottom >= a.top) );
- }
+ function containsRect (a, b)
+ ((b.left <= a.right) && (b.right >= a.left) && (b.top <= a.bottom) && (b.bottom >= a.top));
function spatialDistance (dir, a, b) {
- var inlineNavigation = false;
- var mx, my, nx, ny;
+ let inlineNavigation = false;
+ let mx, my, nx, ny;
if (dir === DIR.L) {
@@ -279,7 +272,7 @@ let g:spatial_navigation_mappings="&lt;A-h> &lt;A-j> &lt;A-k> &lt;A-l>"
inlineNavigation = containsRect(scopedRect, b);
}
- var d = Math.pow((mx-nx), 2) + Math.pow((my-ny), 2);
+ let d = Math.pow((mx-nx), 2) + Math.pow((my-ny), 2);
// prefer elements directly aligned with the focused element
if (inlineNavigation)