--- /dev/null
+(function(){
+ 'use strict';
+
+ function divine_format() {
+ var filename = $('#prog').val();
+ var ext = /\.([^.]*)$/.exec(filename)[1];
+ var format;
+
+ switch(ext) {
+ case 'c':
+ format = 'C';
+ break;
+ case 'cc':
+ case 'cpp':
+ case 'cxx':
+ case 'C':
+ format = 'CPP';
+ break;
+ case 'go':
+ format = 'GOLANG';
+ break;
+ case 'hs':
+ case 'lhs':
+ format = 'HASKELL';
+ break;
+ case 'java':
+ format = 'JAVA';
+ break;
+ case 'pas':
+ format = 'PASCAL';
+ break;
+ case 'pl':
+ format = 'PERL';
+ break;
+ case 'py':
+ format = 'PYTHON';
+ break;
+ }
+
+ if(format)
+ $('#prog_format').val(format);
+ }
+
+ $( document ).ready(function() {
+ $('#prog').on('change', divine_format);
+ });
+})();