1-
21function getFileLang ( src ) {
3-
4- var EXTENSIONS = {
5- 'js' : 'javascript' ,
6- 'py' : 'python' ,
7- 'rb' : 'ruby' ,
8- 'ps1' : 'powershell' ,
9- 'psm1' : 'powershell' ,
10- 'sh' : 'bash' ,
11- 'bat' : 'batch' ,
12- 'h' : 'c' ,
13- 'tex' : 'latex'
14- } ;
2+
3+ var lang_aliases = /*aliases_placeholder[*/ {
4+ "html" : "markup" ,
5+ "xml" : "markup" ,
6+ "svg" : "markup" ,
7+ "mathml" : "markup" ,
8+ "ssml" : "markup" ,
9+ "atom" : "markup" ,
10+ "rss" : "markup" ,
11+ "js" : "javascript" ,
12+ "g4" : "antlr4" ,
13+ "ino" : "arduino" ,
14+ "adoc" : "asciidoc" ,
15+ "avs" : "avisynth" ,
16+ "avdl" : "avro-idl" ,
17+ "shell" : "bash" ,
18+ "shortcode" : "bbcode" ,
19+ "rbnf" : "bnf" ,
20+ "oscript" : "bsl" ,
21+ "cs" : "csharp" ,
22+ "dotnet" : "csharp" ,
23+ "cfc" : "cfscript" ,
24+ "coffee" : "coffeescript" ,
25+ "conc" : "concurnas" ,
26+ "jinja2" : "django" ,
27+ "dns-zone" : "dns-zone-file" ,
28+ "dockerfile" : "docker" ,
29+ "gv" : "dot" ,
30+ "eta" : "ejs" ,
31+ "xlsx" : "excel-formula" ,
32+ "xls" : "excel-formula" ,
33+ "gamemakerlanguage" : "gml" ,
34+ "gni" : "gn" ,
35+ "go-mod" : "go-module" ,
36+ "hbs" : "handlebars" ,
37+ "hs" : "haskell" ,
38+ "idr" : "idris" ,
39+ "gitignore" : "ignore" ,
40+ "hgignore" : "ignore" ,
41+ "npmignore" : "ignore" ,
42+ "webmanifest" : "json" ,
43+ "kt" : "kotlin" ,
44+ "kts" : "kotlin" ,
45+ "kum" : "kumir" ,
46+ "tex" : "latex" ,
47+ "context" : "latex" ,
48+ "ly" : "lilypond" ,
49+ "emacs" : "lisp" ,
50+ "elisp" : "lisp" ,
51+ "emacs-lisp" : "lisp" ,
52+ "md" : "markdown" ,
53+ "moon" : "moonscript" ,
54+ "n4jsd" : "n4js" ,
55+ "nani" : "naniscript" ,
56+ "objc" : "objectivec" ,
57+ "qasm" : "openqasm" ,
58+ "objectpascal" : "pascal" ,
59+ "px" : "pcaxis" ,
60+ "pcode" : "peoplecode" ,
61+ "pq" : "powerquery" ,
62+ "mscript" : "powerquery" ,
63+ "pbfasm" : "purebasic" ,
64+ "purs" : "purescript" ,
65+ "py" : "python" ,
66+ "qs" : "qsharp" ,
67+ "rkt" : "racket" ,
68+ "razor" : "cshtml" ,
69+ "rpy" : "renpy" ,
70+ "robot" : "robotframework" ,
71+ "rb" : "ruby" ,
72+ "sh-session" : "shell-session" ,
73+ "shellsession" : "shell-session" ,
74+ "smlnj" : "sml" ,
75+ "sol" : "solidity" ,
76+ "sln" : "solution-file" ,
77+ "rq" : "sparql" ,
78+ "t4" : "t4-cs" ,
79+ "trickle" : "tremor" ,
80+ "troy" : "tremor" ,
81+ "trig" : "turtle" ,
82+ "ts" : "typescript" ,
83+ "tsconfig" : "typoscript" ,
84+ "uscript" : "unrealscript" ,
85+ "uc" : "unrealscript" ,
86+ "url" : "uri" ,
87+ "vb" : "visual-basic" ,
88+ "vba" : "visual-basic" ,
89+ "webidl" : "web-idl" ,
90+ "mathematica" : "wolfram" ,
91+ "nb" : "wolfram" ,
92+ "wl" : "wolfram" ,
93+ "xeoracube" : "xeora" ,
94+ "yml" : "yaml"
95+ } /*]*/ ;
1596
1697 src = src . replaceAll ( '\n' , '' ) ;
17-
1898 const extension = ( / \. ( \w + ) $ / . exec ( src ) || [ , 'none' ] ) [ 1 ] ;
19- return EXTENSIONS [ extension ] || extension ;
99+ return lang_aliases [ extension ] || extension ;
20100
21101}
22102
@@ -30,6 +110,17 @@ function processFile(file) {
30110 cd . textContent = event . target . result ;
31111 cd . lang = getFileLang ( file . name ) ;
32112 cd . focus ( ) ;
113+
114+ // change tab character
115+ if ( cd . textContent . includes ( '\t' ) ) {
116+
117+ cd . options . tab = '\t' ;
118+
119+ } else {
120+
121+ cd . options . tab = ' ' ;
122+
123+ }
33124
34125 cd . history = [ ] ;
35126
@@ -52,7 +143,7 @@ cd.on('drop', (ev) => {
52143 ev . preventDefault ( ) ;
53144
54145 // if not logged into git
55- if ( gitToken == null ) {
146+ if ( gitToken == '' ) {
56147
57148 // remove drop indication
58149 document . body . classList . remove ( 'focus' ) ;
@@ -93,7 +184,7 @@ cd.on('dragover', (ev) => {
93184 ev . preventDefault ( ) ;
94185
95186 // if not logged into git
96- if ( gitToken == null ) {
187+ if ( gitToken == '' ) {
97188
98189 // show drop indication
99190 document . body . classList . add ( 'focus' ) ;
@@ -105,7 +196,7 @@ cd.on('dragover', (ev) => {
105196cd . on ( 'dragleave' , ( ev ) => {
106197
107198 // if not logged into git
108- if ( gitToken == null ) {
199+ if ( gitToken == '' ) {
109200
110201 // remove drop indication
111202 document . body . classList . remove ( 'focus' ) ;
@@ -119,7 +210,7 @@ if ('launchQueue' in window) {
119210 launchQueue . setConsumer ( async ( launchParams ) => {
120211
121212 // if not logged into git
122- if ( gitToken == null ) {
213+ if ( gitToken == '' ) {
123214
124215 // nothing to do when the queue is empty
125216 if ( ! launchParams . files . length ) {
0 commit comments