Skip to content

Commit

Permalink
update plugin with custom style
Browse files Browse the repository at this point in the history
  • Loading branch information
fraserxu committed Oct 11, 2013
1 parent eeea6ab commit 80fd617
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
.DS_Store
bower_components
bower_components
*/node_modules
41 changes: 41 additions & 0 deletions lib/Gruntfile.js
@@ -0,0 +1,41 @@
/*jshint node: true */

module.exports = function (grunt) {

'use strict';

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

uglify: {
options: {
banner:
'/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */',
sourceMap: 'jquery.textcomplete.min.map'
},
all: {
files: {
'jquery.textcomplete.min.js': [
'jquery.textcomplete.js'
]
}
}
},

connect: {
server: {
options: {
port: 8000,
base: '../',
keepalive: true
}
}
}
});

grunt.registerTask('default', ['connect']);
};
12 changes: 8 additions & 4 deletions lib/jquery.textcomplete.js
Expand Up @@ -121,7 +121,7 @@
},
list: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
zIndex: '100',
display: 'none'
Expand Down Expand Up @@ -256,15 +256,19 @@
position: 'absolute',
overflow: 'auto',
'white-space': 'pre-wrap',
top: 0,
bottom: 0,
left: -9999
}, getStyles(this.$el, properties));

$div = $('<div></div>').css(css).text(this.getTextFromHeadToCaret());
$span = $('<span></span>').text('&nbsp;').appendTo($div);
this.$el.before($div);
position = $span.position();
position.top += $span.height() - this.$el.scrollTop();

delete position.top;
position.bottom = 0;

position.bottom += 2*$span.height() + this.$el.scrollTop();
$div.remove();
return position;
},
Expand Down Expand Up @@ -461,4 +465,4 @@
return this;
};

})(window.jQuery || window.Zepto);
})(window.jQuery || window.Zepto);
6 changes: 2 additions & 4 deletions lib/jquery.textcomplete.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 80fd617

Please sign in to comment.