comparison app/assets/javascripts/init.tabs.js @ 108:a949b71c9afb

Allows paste content width resize.
author Edho Arief <edho@myconan.net>
date Mon, 12 Nov 2012 12:27:39 +0700
parents 9825e51ba30f
children 90eee69e4ee9
comparison
equal deleted inserted replaced
107:c6af63fc16ab 108:a949b71c9afb
7 $('#markdown div').html(marked(raw)); 7 $('#markdown div').html(marked(raw));
8 8
9 mode = window.location.hash.substr(1); 9 mode = window.location.hash.substr(1);
10 if (mode == 'highlight') { $('#paste-tabs li:eq(1) a').click(); } 10 if (mode == 'highlight') { $('#paste-tabs li:eq(1) a').click(); }
11 else if (mode == 'markdown') { $('#paste-tabs li:eq(2) a').click(); } 11 else if (mode == 'markdown') { $('#paste-tabs li:eq(2) a').click(); }
12
13 $('#tab-resize ul a').click(function() {
14 var size = $(this).data('size'),
15 paste = $('#paste'),
16 title = $('#tab-resize a.btn');
17 title.html(title.html().replace(/(Width: ).*\n/, '$1' + size + '\n'));
18 if (size == 'full') {
19 paste.css('width', '');
20 } else {
21 paste.css('width', size);
22 }
23 });
12 }); 24 });