Created
March 1, 2017 09:48
-
-
Save kesarion/d1d9f153035e828a0f26edf23e347cc9 to your computer and use it in GitHub Desktop.
Common file extensions mapped out to FontAwesome file classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function faFileType (name) { | |
var extensions = { | |
"txt" : "fa-file-text-o", | |
"ai" : "fa-file-code-o", | |
"bat" : "fa-file-code-o", | |
"bin" : "fa-file-code-o", | |
"css" : "fa-file-code-o", | |
"dll" : "fa-file-code-o", | |
"exe" : "fa-file-code-o", | |
"h" : "fa-file-code-o", | |
"htm" : "fa-file-code-o", | |
"html" : "fa-file-code-o", | |
"js" : "fa-file-code-o", | |
"mht" : "fa-file-code-o", | |
"mhtml" : "fa-file-code-o", | |
"json" : "fa-file-code-o", | |
"xml" : "fa-file-code-o", | |
"ttf" : "fa-file-code-o", | |
"mp3" : "fa-file-audio-o", | |
"m4a" : "fa-file-audio-o", | |
"mpa" : "fa-file-audio-o", | |
"mkv" : "fa-file-video-o", | |
"mp4" : "fa-file-video-o", | |
"avi" : "fa-file-video-o", | |
"mov" : "fa-file-video-o", | |
"movie" : "fa-file-video-o", | |
"mpe" : "fa-file-video-o", | |
"mpeg" : "fa-file-video-o", | |
"mpg" : "fa-file-video-o", | |
"dvi" : "fa-file-video-o", | |
"pdf" : "fa-file-pdf-o", | |
"swf" : "fa-file-pdf-o", | |
"jpe" : "fa-file-image-o", | |
"jpeg" : "fa-file-image-o", | |
"jpg" : "fa-file-image-o", | |
"png" : "fa-file-image-o", | |
"gif" : "fa-file-image-o", | |
"bmp" : "fa-file-image-o", | |
"tif" : "fa-file-image-o", | |
"tiff" : "fa-file-image-o", | |
"svg" : "fa-file-image-o", | |
"eps" : "fa-file-image-o", | |
"doc" : "fa-file-word-o", | |
"docx" : "fa-file-word-o", | |
"dot" : "fa-file-word-o", | |
"xlb" : "fa-file-word-o", | |
"xls" : "fa-file-word-o", | |
"xlsx" : "fa-file-word-o", | |
"pot" : "fa-file-powerpoint-o", | |
"ppa" : "fa-file-powerpoint-o", | |
"ppm" : "fa-file-powerpoint-o", | |
"pps" : "fa-file-powerpoint-o", | |
"ppt" : "fa-file-powerpoint-o", | |
"pptx" : "fa-file-powerpoint-o", | |
"zip" : "fa-file-archive-o", | |
"tar" : "fa-file-archive-o", | |
"rar" : "fa-file-archive-o", | |
"gz" : "fa-file-archive-o", | |
"xz" : "fa-file-archive-o" | |
}; | |
var splitName = name.split('.'); | |
return extensions[splitName[splitName.length - 1]] || 'fa-file-o'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment