Mercurial > zeropaste
changeset 97:e8a0e82213cd
Updated autosize from vendor, separated box size hack to its own function.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Mon, 12 Nov 2012 09:35:55 +0700 |
parents | a2d87bcd39fb |
children | 58aa32120b54 |
files | app/assets/javascripts/autosize-box-fix.js app/assets/javascripts/pastes.js lib/assets/javascripts/jquery.autosize.js |
diffstat | 3 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/assets/javascripts/autosize-box-fix.js Mon Nov 12 09:35:55 2012 +0700 @@ -0,0 +1,7 @@ +(function($) { + $.autosize_box_fix = function(elem) { + elem.css('box-sizing', ''); + elem.css('-webkit-box-sizing', ''); + elem.css('-moz-box-sizing', ''); + }; +}) (jQuery);
--- a/app/assets/javascripts/pastes.js Mon Nov 12 09:12:33 2012 +0700 +++ b/app/assets/javascripts/pastes.js Mon Nov 12 09:35:55 2012 +0700 @@ -8,5 +8,6 @@ }); $(document).ready(function() { $('#paste_paste').autosize({ className: 'mirrored_text row-fluid', append: "\n"}); + $.autosize_box_fix($('.mirrored_text')); $('#paste_paste').focus(); })
--- a/lib/assets/javascripts/jquery.autosize.js Mon Nov 12 09:12:33 2012 +0700 +++ b/lib/assets/javascripts/jquery.autosize.js Mon Nov 12 09:35:55 2012 +0700 @@ -12,7 +12,7 @@ hidden = 'hidden', borderBox = 'border-box', lineHeight = 'lineHeight', - copy = '<textarea tabindex="-1" style="position:absolute; top:-9999px; left:-9999px; right:auto; bottom:auto; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>', + copy = '<textarea tabindex="-1" style="position:absolute; top:-9999px; left:-9999px; right:auto; bottom:auto; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>', // line-height is omitted because IE7/IE8 doesn't return the correct value. copyStyle = [ 'fontFamily', @@ -177,4 +177,4 @@ }; } -}(jQuery)); +}(window.jQuery || window.Zepto)); \ No newline at end of file