diff 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
line wrap: on
line diff
--- a/app/assets/javascripts/init.tabs.js	Mon Nov 12 11:42:26 2012 +0700
+++ b/app/assets/javascripts/init.tabs.js	Mon Nov 12 12:27:39 2012 +0700
@@ -9,4 +9,16 @@
   mode = window.location.hash.substr(1);
   if (mode == 'highlight') { $('#paste-tabs li:eq(1) a').click(); }
   else if (mode == 'markdown') { $('#paste-tabs li:eq(2) a').click(); }
+
+  $('#tab-resize ul a').click(function() {
+    var size = $(this).data('size'),
+      paste = $('#paste'),
+      title = $('#tab-resize a.btn');
+    title.html(title.html().replace(/(Width: ).*\n/, '$1' + size + '\n'));
+    if (size == 'full') {
+      paste.css('width', '');
+    } else {
+      paste.css('width', size);
+    }
+  });
 });