bs-autoscale-input
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "bs-autoscale-input", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/Beanstalkhq/bs-autoscale-input", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -6,11 +6,4 @@ /*! | ||
* license: MIT | ||
* version: 1.0.2 | ||
* version: 1.0.3 | ||
*/ | ||
!function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return t[r].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(){"use strict";/*! | ||
* bs-autoscale-input | ||
* author: Bret Little | ||
* copyright: 2015 | ||
* license: MIT | ||
* version: 1.0.0 | ||
*/ | ||
var t=angular.module("bs-autoscale-input",[]);t.directive("bsAutoscaleInput",[function(){var t=function(t,e,n){return'<div style="position: absolute;"><span style="font-family:'+n+";font-size:"+e+'; font-weight:400;">'+t+"</span></div>"};return{require:"ngModel",restrict:"A",link:function(e,n,r,a){var o=function(e){e=e.length<3?"hello":e,e=e.replace(/\s/g,"_"),r.maxLength&&(e=e.substring(0,r.maxLength));var a=$(t(e,n.css("font-size"),n.css("font-family")));n.after(a),n.width(a.width()||"50px"),a.remove()};n.keyup(function(){var t=n.val();o(t&&t.length?t:n.attr("placeholder")||"hello dawg")}),o(n.val()||n.attr("placeholder")||"hello dawg"),e.$watch(function(){return a.$modelValue},function(){o(n.val()||n.attr("placeholder")||"hello dawg")})}}}])}]); | ||
!function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return t[r].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(){"use strict";var t=angular.module("bs-autoscale-input",[]);t.directive("bsAutoscaleInput",[function(){var t=function(t,e,n){return'<div style="position: absolute;"><span style="font-family:'+n+";font-size:"+e+'; font-weight:400;">'+t+"</span></div>"};return{require:"ngModel",restrict:"A",link:function(e,n,r,a){var l=function(e){e=e.length<3?"hello":e,e=e.replace(/\s/g,"_"),r.maxLength&&(e=e.substring(0,r.maxLength));var a=$(t(e,n.css("font-size"),n.css("font-family").replace(/\"/g,"'")));n.after(a),n.width(a.width()||"50px"),a.remove()};n.keyup(function(){var t=n.val();l(t&&t.length?t:n.attr("placeholder")||"hello dawg")}),l(n.val()||n.attr("placeholder")||"hello dawg"),e.$watch(function(){return a.$modelValue},function(){l(n.val()||n.attr("placeholder")||"hello dawg")})}}}])}]); |
{ | ||
"name": "bs-autoscale-input", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "An angular directive time picker.", | ||
@@ -5,0 +5,0 @@ "main": "build/bs-time-pick.js", |
@@ -26,1 +26,8 @@ bs-autoscale-input [![Build Status](https://travis-ci.org/Beanstalkhq/bs-autoscale-input.png?branch=master)](https://travis-ci.org/Beanstalkhq/bs-autoscale-input) | ||
``` | ||
## Options | ||
### Max-length | ||
Limit the length the input auto-scales to | ||
```html | ||
<input type="text" ng-model="myDate" bs-autoscale-input max-length="20"/> | ||
``` |
@@ -1,8 +0,1 @@ | ||
/*! | ||
* bs-autoscale-input | ||
* author: Bret Little | ||
* copyright: 2015 | ||
* license: MIT | ||
* version: 1.0.0 | ||
*/ | ||
var batp = angular.module("bs-autoscale-input", []); | ||
@@ -25,3 +18,3 @@ | ||
if(attr.maxLength) text = text.substring(0,attr.maxLength); | ||
var measuredEl = $(html(text, el.css('font-size'), el.css('font-family'))); | ||
var measuredEl = $(html(text, el.css('font-size'), el.css('font-family').replace(/\"/g, "'"))); | ||
el.after(measuredEl); | ||
@@ -28,0 +21,0 @@ el.width(measuredEl.width() || "50px"); |
33
1286954
33680