From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Fri, 6 Jul 2012 11:52:06 -0700
Subject: Expand tabs
---
js/components/hintable.reel/hintable.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'js/components/hintable.reel/hintable.js')
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js
index 1e7cc069..bd7a803a 100644
--- a/js/components/hintable.reel/hintable.js
+++ b/js/components/hintable.reel/hintable.js
@@ -172,13 +172,13 @@ exports.Hintable = Montage.create(Editable, {
this._super(arguments);
- /// Remove the phantom "
" element that is generated when
- /// content editable element is empty
- this._children(this._element, function(item) {
- return item.nodeName === 'BR';
- }).forEach(function(item) {
- this._element.removeChild(item);
- }, this);
+ /// Remove the phantom "
" element that is generated when
+ /// content editable element is empty
+ this._children(this._element, function(item) {
+ return item.nodeName === 'BR';
+ }).forEach(function(item) {
+ this._element.removeChild(item);
+ }, this);
if(k === 39) {
selection = window.getSelection();
--
cgit v1.2.3
From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Fri, 6 Jul 2012 11:53:10 -0700
Subject: Remove trailing spaces
---
js/components/hintable.reel/hintable.js | 62 ++++++++++++++++-----------------
1 file changed, 31 insertions(+), 31 deletions(-)
(limited to 'js/components/hintable.reel/hintable.js')
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js
index bd7a803a..563206e4 100644
--- a/js/components/hintable.reel/hintable.js
+++ b/js/components/hintable.reel/hintable.js
@@ -40,7 +40,7 @@ EDITABLE - Methods
- startEdit
- stopEdit
- value
--
+-
- _suggest
- _suggestNext
- _suggestPrev
@@ -56,7 +56,7 @@ exports.Hintable = Montage.create(Editable, {
inheritsFrom : { value : Editable },
_matchIndex : { value : 0 },
matches : { value : [] },
-
+
_hint : { value : null },
hint : {
get : function() {
@@ -64,7 +64,7 @@ exports.Hintable = Montage.create(Editable, {
},
set : function(hint) {
hint = hint || '';
-
+
///// Set the hint element's text
this._getFirstTextNode(this.hintElement).textContent = hint;
///// if hintElement was removed from the DOM, the object still
@@ -76,14 +76,14 @@ exports.Hintable = Montage.create(Editable, {
this._hint = hint;
}
},
-
+
_hintElement : { value : null },
hintElement : {
get : function() {
if(!this._hintElement) {
- /// Remove the phantom "
" element that is generated when
+ /// Remove the phantom "
" element that is generated when
/// content editable element is empty
- this._children(this._element, function(item) {
+ this._children(this._element, function(item) {
return item.nodeName === 'BR';
}).forEach(function(item) {
this._element.removeChild(item);
@@ -91,17 +91,17 @@ exports.Hintable = Montage.create(Editable, {
this._hintElement = document.createElement('span');
this._hintElement.classList.add(this.hintClass);
-
+
this._element.appendChild(this._hintElement);
}
-
+
return this._hintElement;
},
set : function(el) {
this._hintElement = el;
}
},
-
+
_getHintDifference : {
value : function() {
if(!this.matches[this._matchIndex]) {
@@ -110,12 +110,12 @@ exports.Hintable = Montage.create(Editable, {
return this.matches[this._matchIndex].substr(this.value.length);
}
},
-
+
hintNext : {
value : function(e) {
if(e) { e.preventDefault(); }
//console.log('next1');
-
+
if(this._matchIndex < this.matches.length - 1) {
//console.log('next');
++this._matchIndex;
@@ -143,7 +143,7 @@ exports.Hintable = Montage.create(Editable, {
var fullText = this._hint;
this.hint = null;
this.value += fullText;
-
+
if(!preserveCaretPosition) {
this.setCursor('end');
}
@@ -154,13 +154,13 @@ exports.Hintable = Montage.create(Editable, {
revert : {
value : function(e, forceRevert) {
this.hint = null;
-
+
if(this.isEditable || forceRevert) {
/// revert to old value
this.value = (this._preEditValue);
this._sendEvent('revert');
//console.log('reverting');
-
+
}
}
},
@@ -169,30 +169,30 @@ exports.Hintable = Montage.create(Editable, {
value : function handleKeydown(e) {
var k = e.keyCode,
isCaretAtEnd, selection, text;
-
+
this._super(arguments);
-
- /// Remove the phantom "
" element that is generated when
+
+ /// Remove the phantom "
" element that is generated when
/// content editable element is empty
- this._children(this._element, function(item) {
+ this._children(this._element, function(item) {
return item.nodeName === 'BR';
}).forEach(function(item) {
this._element.removeChild(item);
}, this);
-
+
if(k === 39) {
selection = window.getSelection();
text = selection.baseNode.textContent;
isCaretAtEnd = (selection.anchorOffset === text.length);
}
-
+
if(this.hint && isCaretAtEnd) {
///// Advance the cursor
this.hint = this.hint.substr(0, 1);
this.accept(e);
this.handleInput();
}
-
+
this._execKeyAction(e);
}
},
@@ -208,25 +208,25 @@ exports.Hintable = Montage.create(Editable, {
if(this.hints && this.hints.length) {
if(val.length > 0) { // content is not empty
-
- this._matchIndex = 0;
+
+ this._matchIndex = 0;
this.matches = this.hints.filter(function(h) {
if(!h) { return false; }
return h.indexOf(val) === 0;
}).sort();
-
+
///// If there are no matches, or the new value doesn't match all the
///// previous matches, then get new list of matches
if(!this.matches.length || !this._matchesAll(val)) {
}
-
+
if(this.matches.length) { // match(es) found
if(this.matches[this._matchIndex] !== val) {
// Suggest the matched hint, subtracting the typed-in string
// Only if the hint is not was the user has typed already
this.hint = this._getHintDifference();
} else {
- this.hint = null;
+ this.hint = null;
}
} else { // no matches found
this.hint = null;
@@ -254,7 +254,7 @@ exports.Hintable = Montage.create(Editable, {
value : function(e) {
var key = e.keyCode,
keys = this.keyActions;
-
+
if(this.hint) {
if( keys.hint.revert.indexOf(key) !== -1 ) { this.revert(e); }
if( keys.hint.accept.indexOf(key) !== -1 ) { this.accept(e); }
@@ -271,9 +271,9 @@ exports.Hintable = Montage.create(Editable, {
}
}
},
-
+
/* --------------- Utils --------------- */
-
+
_children : {
value : function(el, filter) {
var f = filter || function(item) {
@@ -301,7 +301,7 @@ exports.Hintable = Montage.create(Editable, {
hintClass : {
value : "hintable-hint"
},
- keyActions : {
+ keyActions : {
value : {
hint : {
accept : [9,13,186], // accept hint
@@ -321,5 +321,5 @@ exports.Hintable = Montage.create(Editable, {
},
distinct: true
}
-
+
});
--
cgit v1.2.3
From fdbec324dad4ab33d97282ab021d2c1661bc097c Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Mon, 9 Jul 2012 16:27:52 -0700
Subject: BSD License
---
js/components/hintable.reel/hintable.js | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
(limited to 'js/components/hintable.reel/hintable.js')
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js
index 563206e4..69631838 100644
--- a/js/components/hintable.reel/hintable.js
+++ b/js/components/hintable.reel/hintable.js
@@ -1,24 +1,25 @@
/*
-Copyright (c) 2012, Motorola Mobility, Inc
+Copyright (c) 2012, Motorola Mobility LLC.
All Rights Reserved.
-BSD License.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- - Neither the name of Motorola Mobility nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of Motorola Mobility LLC nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
--
cgit v1.2.3