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