]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - js/infos.js
Add plain API format
[Github/YOURLS.git] / js / infos.js
1
2 $(document).ready(function(){
3         $('ul.toggle_display').css('display', 'block');
4         $('.tab h2').css('display','none');
5         
6         // Toggle tabs
7         $('ul.toggle_display li a').click(function(){
8                 var target = $(this).attr('href').replace('#', ''); // 'stat_tab_location'
9                 var divs = target.split('_')[1]; // 'tab'
10                 $('div.'+divs).css('display', 'none');
11                 $('div#'+target).css('display', 'block');
12                 $('ul.stat_'+divs+' li a').removeClass('selected');
13                 $('ul.stat_'+divs+' li a[href="#'+target+'"]').addClass('selected').css('outline', 'none').blur();
14                 return false;
15         });
16         
17         // Activate main tab
18         if (location.hash) {
19                 $('#tabs ul#headers li a[href="'+location.hash+'"]').click();
20         } else {
21                 $('#tabs ul#headers li a:first').click();
22         }
23         
24         // Activate first line graph
25         $('#stats_lines li a:first').click();
26         
27         // Prettify list
28         $('#historical_clicks li:odd').css('background', '#E3F3FF');
29         
30         // Toggle detail lists
31         $('a.details').click(function(){
32                 var target = $(this).attr('id').replace('more_', 'details_');
33                 $('#'+target).toggle();
34                 return false;   
35         });
36         
37         // If an image src is erroneous (404 or anything) replace it with a transparent gif
38         $('.fix_images').each(function(i,img) {
39                 $(img).error(function(){
40                         $(img).attr('src', 'images/blank.gif');
41                 });
42         });
43         
44         // If we have the zeroclipboard thing, init it when Share Tab is displayed
45         $('#tabs ul#headers li a[href="#stat_tab_share"]').click(function(){
46                 init_clipboard();
47         });
48 });