# HG changeset patch # User Edho Arief # Date 1349679636 -25200 # Node ID 50b8738d6428a4ea8c51740257be27fff7de38df # Parent 6ae3333a0251fff62275920e3f074e605f093c09 Use (modified) autosize to automatically resize textarea. diff -r 6ae3333a0251 -r 50b8738d6428 app/assets/javascripts/application.js --- a/app/assets/javascripts/application.js Sun Oct 07 16:05:30 2012 +0700 +++ b/app/assets/javascripts/application.js Mon Oct 08 14:00:36 2012 +0700 @@ -13,4 +13,5 @@ //= require jquery //= require jquery_ujs //= require prettify +//= require jquery.autosize //= require_tree . diff -r 6ae3333a0251 -r 50b8738d6428 app/assets/javascripts/pastes.js --- a/app/assets/javascripts/pastes.js Sun Oct 07 16:05:30 2012 +0700 +++ b/app/assets/javascripts/pastes.js Mon Oct 08 14:00:36 2012 +0700 @@ -7,5 +7,6 @@ return false; }); $(document).ready(function() { + $('#paste_paste').autosize({ className: 'mirrored_text row-fluid', append: "\n"}); $('#paste_paste').focus(); }) diff -r 6ae3333a0251 -r 50b8738d6428 app/assets/stylesheets/box.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/assets/stylesheets/box.css Mon Oct 08 14:00:36 2012 +0700 @@ -0,0 +1,5 @@ +* { + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ +} diff -r 6ae3333a0251 -r 50b8738d6428 app/assets/stylesheets/pastes.css --- a/app/assets/stylesheets/pastes.css Sun Oct 07 16:05:30 2012 +0700 +++ b/app/assets/stylesheets/pastes.css Mon Oct 08 14:00:36 2012 +0700 @@ -1,4 +1,4 @@ -textarea#paste_paste { +textarea#paste_paste, .mirrored_text { font-family: Monaco, Menlo, Consolas, "Courier New", monospace; - resize: vertical; + resize: none; } diff -r 6ae3333a0251 -r 50b8738d6428 lib/assets/javascripts/jquery.autosize.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/assets/javascripts/jquery.autosize.js Mon Oct 08 14:00:36 2012 +0700 @@ -0,0 +1,180 @@ +// Autosize 1.13 - jQuery plugin for textareas +// (c) 2012 Jack Moore - jacklmoore.com +// license: www.opensource.org/licenses/mit-license.php + +(function ($) { + var + defaults = { + className: 'autosizejs', + append: "", + callback: false + }, + hidden = 'hidden', + borderBox = 'border-box', + lineHeight = 'lineHeight', + copy = '