From: Matthias Schmidt Date: Sat, 20 May 2017 06:25:19 +0000 (+0200) Subject: Add file-specific icons for media in JavaScript code X-Git-Tag: 3.1.0_Alpha_1~450 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=141dda57e429d0edaceb595bd709927aed23e6e7;p=GitHub%2FWoltLab%2FWCF.git Add file-specific icons for media in JavaScript code Close #2276 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Select.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Select.js index 1f44ff037d..c606df8160 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Select.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Select.js @@ -6,8 +6,8 @@ * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Media/Manager/Select */ -define(['Core', 'Dom/Traverse', 'Dom/Util', 'Language', 'ObjectMap', 'Ui/Dialog', 'WoltLabSuite/Core/Media/Manager/Base'], - function(Core, DomTraverse, DomUtil, Language, ObjectMap, UiDialog, MediaManagerBase) { +define(['Core', 'Dom/Traverse', 'Dom/Util', 'Language', 'ObjectMap', 'Ui/Dialog', 'WoltLabSuite/Core/FileUtil', 'WoltLabSuite/Core/Media/Manager/Base'], + function(Core, DomTraverse, DomUtil, Language, ObjectMap, UiDialog, FileUtil, MediaManagerBase) { "use strict"; if (!COMPILER_TARGET_DEFAULT) { @@ -121,8 +121,13 @@ define(['Core', 'Dom/Traverse', 'Dom/Util', 'Language', 'ObjectMap', 'Ui/Dialog' displayElement.innerHTML = '' + (media.altText && media.altText[LANGUAGE_ID] ? media.altText[LANGUAGE_ID] : '') + ''; } else { + var fileIcon = FileUtil.getIconNameByFilename(media.filename); + if (fileIcon) { + fileIcon = '-' + fileIcon; + } + displayElement.innerHTML = '
' - + '' + + '' + '
' + '

' + media.filename + '

' + '

' + media.formattedFilesize + '

' diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Upload.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Upload.js index e739358690..7781ad0ab6 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Upload.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Upload.js @@ -227,7 +227,12 @@ define( } else { fileIcon.classList.remove('fa-spinner'); - fileIcon.classList.add('fa-file-o'); + + var fileIconName = FileUtil.getIconNameByFilename(media.filename); + if (fileIconName) { + fileIconName = '-' + fileIconName; + } + fileIcon.classList.add('fa-file' + fileIconName + '-o'); } },