]> iEval git - gruntmaster-page.git/blob - js/90-divine-format.js
5369b748abe2c966245448376e7e81c11fd5af21
[gruntmaster-page.git] / js / 90-divine-format.js
1 function divine_format() {
2 var filename = $('#prog')[0].value;
3 var ext = /\.([^.]*)$/.exec(filename)[1];
4 var format;
5
6 switch(ext) {
7 case 'c':
8 format = 'C';
9 break;
10 case 'cc':
11 case 'cpp':
12 case 'cxx':
13 case 'C':
14 format = 'CPP';
15 break;
16 case 'go':
17 format = 'GOLANG';
18 break;
19 case 'hs':
20 case 'lhs':
21 format = 'HASKELL';
22 break;
23 case 'lisp':
24 case 'lsp':
25 case 'cl':
26 case 'l':
27 format = 'SBCL';
28 break;
29 case 'java':
30 format = 'JAVA';
31 break;
32 case 'pas':
33 format = 'PASCAL';
34 break;
35 case 'pl':
36 format = 'PERL';
37 break;
38 case 'py':
39 format = 'PYTHON';
40 break;
41 case 'rb':
42 format = 'RUBY';
43 break;
44 }
45
46 if(format)
47 $('#prog_format')[0].value = format;
48 }
49
50 $(function() {
51 $('#prog').on('change', divine_format);
52 });
This page took 0.047665 seconds and 3 git commands to generate.