'use strict'; import React from 'react'; import InjectInHeadMixin from '../../mixins/inject_in_head_mixin'; import Panel from 'react-bootstrap/lib/Panel'; import AppConstants from '../../constants/application_constants.js'; /** * This is the component that implements display-specific functionality. * * ResourceViewer handles the following mimetypes: * - image * - video * - audio * - pdf * - other */ let Other = React.createClass({ propTypes: { url: React.PropTypes.string.isRequired }, render() { let ext = this.props.url.split('.').pop(); return (

.{ext}

); } }); let Image = React.createClass({ propTypes: { url: React.PropTypes.string.isRequired, preview: React.PropTypes.string.isRequired }, mixins: [InjectInHeadMixin], componentDidMount() { this.inject('https://code.jquery.com/jquery-2.1.4.min.js') .then(() => Promise.all([ this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/shmui.css'), this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/jquery.shmui.js') ]).then(() => { window.jQuery('.shmui-ascribe').shmui(); })); }, render() { return ( ); } }); let Audio = React.createClass({ propTypes: { url: React.PropTypes.string.isRequired }, mixins: [InjectInHeadMixin], componentDidMount() { this.inject(AppConstants.baseUrl + 'static/thirdparty/audiojs/audiojs/audio.min.js').then(this.ready); }, ready() { window.audiojs.events.ready(function() { var as = audiojs.createAll(); }); }, render() { return (