Mercurial > zeropaste
annotate app/assets/javascripts/zp.new.js @ 291:d701cf49fa3b
Add rails scripts. To bin.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 13:47:48 +0900 |
parents | 45bd94c70896 |
children | 3ce44f960d3a |
rev | line source |
---|---|
215 | 1 //= require jquery.autosize |
214
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
2 //= require autosize-box-fix |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
3 (function($) { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
4 window.zp.new = { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
5 input: function() { return $("#paste_paste") }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
6 clear: function(e) { |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
7 this.input().val("").focus() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
8 e.preventDefault() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
9 }, |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
10 init: function() { |
217
cbd5819d7468
Completely wtf init for zp.new
Edho Arief <edho@myconan.net>
parents:
215
diff
changeset
|
11 if (this.input().length === 0) { return } |
214
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
12 $(document).on('click', "#reset_paste", $.proxy(this.clear, this)) |
262
45bd94c70896
Fix class name for form autoresizer.
edogawaconan <me@myconan.net>
parents:
217
diff
changeset
|
13 this.input().autosize({ className: 'mirrored_text form-control', append: "\n"}); |
214
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
14 $.autosize_box_fix($(".mirrored_text")) |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
15 this.input().focus() |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
16 } |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
17 } |
22c4b5f90e24
Massive javascript and html refactor. Also, ie9
Edho Arief <edho@myconan.net>
parents:
diff
changeset
|
18 })(jQuery) |