comparison app/assets/javascripts/init.tabs.js @ 123:5b58b0d6841c

Use hashbang instead of plain hash.
author Edho Arief <edho@myconan.net>
date Mon, 12 Nov 2012 15:27:10 +0700
parents a836cfe4092f
children 4a8cefa814f1
comparison
equal deleted inserted replaced
122:a836cfe4092f 123:5b58b0d6841c
12 12
13 update_state = function() { 13 update_state = function() {
14 var paste = $('#paste'), 14 var paste = $('#paste'),
15 mode = paste.data('mode'), 15 mode = paste.data('mode'),
16 width = paste.data('width'), 16 width = paste.data('width'),
17 qstring = '#' + mode + '.' + width; 17 qstring = '#!' + mode + '.' + width;
18 if (width == 'auto') { 18 if (width == 'auto') {
19 qstring = '#'; 19 qstring = '#!';
20 if (mode != 'plain') { 20 if (mode != 'plain') {
21 qstring += mode; 21 qstring += mode;
22 } 22 }
23 } 23 }
24 window.location = qstring; 24 window.location = qstring;
46 paste_resize($(this).data('size')); 46 paste_resize($(this).data('size'));
47 $('.open').removeClass('open'); 47 $('.open').removeClass('open');
48 return false; 48 return false;
49 }); 49 });
50 50
51 mode = window.location.hash.substr(1).split('.'); 51 mode = window.location.hash.substr(2).split('.');
52 if (mode[0] == 'highlight') { $('#paste-tabs li:eq(1) a').click(); } 52 if (mode[0] == 'highlight') { $('#paste-tabs li:eq(1) a').click(); }
53 else if (mode[0] == 'markdown') { $('#paste-tabs li:eq(2) a').click(); } 53 else if (mode[0] == 'markdown') { $('#paste-tabs li:eq(2) a').click(); }
54 if (mode[1] && mode[1].match(/^\d+px$/)) { paste_resize(mode[1]); } 54 if (mode[1] && mode[1].match(/^\d+px$/)) { paste_resize(mode[1]); }
55 55
56 } 56 }