]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/public/js/mobile.js
Added UI for working with tags
[bluechips.git] / bluechips / public / js / mobile.js
1 try {
2     console.log("init");
3 } catch(e) {
4     console = { log: function() {} };
5 }
6
7 $(function() {
8     console.log("ready()");
9
10     $('#tabs a').click(function() {
11         $('#tabs a').removeClass('selected');
12         $(this).addClass('selected');
13         $('div.tab').hide();
14
15         /* See if that tab has been rendered to the page. */
16         tabname = '#tab-' + $(this).attr('id');
17         tab = $(tabname);
18         if(tab.children().length < 1) {
19             /* If not, return true so that we actually reload. */
20             tab.load($(this).attr('href') + ' ' + tabname + '> *');
21         }
22         tab.show();
23         return false;
24     });
25     $('#tabs a.selected').click();
26
27     $('body').bind('orientationchange', function() {
28         switch(window.orientation) {
29             case 0:
30             case 180:
31                 $('body').attr('id', 'portrait');
32                 break;
33             case -90:
34             case 90:
35                 $('body').attr('id', 'landscape');
36                 break;
37         }
38     });
39     $('body').trigger('orientationchange');
40
41     console.log("ready() done");
42 });
43