123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- (function(){
- "use strict";
- var
- jqver = '3.3.1',
- uiver = '1.12.1',
-
-
- lang = (function() {
- var locq = window.location.search,
- fullLang, locm, lang;
- if (locq && (locm = locq.match(/lang=([a-zA-Z_-]+)/))) {
-
- fullLang = locm[1];
- } else {
-
- fullLang = (navigator.browserLanguage || navigator.language || navigator.userLanguage);
- }
- lang = fullLang.substr(0,2);
- if (lang === 'pt') lang = 'pt_BR';
- else if (lang === 'ug') lang = 'ug_CN';
- else if (lang === 'zh') lang = (fullLang.substr(0,5).toLowerCase() === 'zh-tw')? 'zh_TW' : 'zh_CN';
- return lang;
- })(),
-
-
- start = function(elFinder, editors, config) {
-
- elFinder.prototype.loadCss('//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/themes/smoothness/jquery-ui.css');
-
- $(function() {
- var optEditors = {
- commandsOptions: {
- edit: {
- editors: Array.isArray(editors)? editors : []
- }
- }
- },
- opts = {};
-
-
- if (config && config.managers) {
- $.each(config.managers, function(id, mOpts) {
- opts = Object.assign(opts, config.defaultOpts || {});
-
- try {
- mOpts.commandsOptions.edit.editors = mOpts.commandsOptions.edit.editors.concat(editors || []);
- } catch(e) {
- Object.assign(mOpts, optEditors);
- }
-
- $('#' + id).elfinder(
-
- $.extend(true, { lang: lang }, opts, mOpts || {}),
-
- function(fm, extraObj) {
-
- fm.bind('init', function() {
-
- if (fm.lang === 'ja') {
- require(
- [ 'encoding-japanese' ],
- function(Encoding) {
- if (Encoding && Encoding.convert) {
- fm.registRawStringDecoder(function(s) {
- return Encoding.convert(s, {to:'UNICODE',type:'string'});
- });
- }
- }
- );
- }
- });
- }
- );
- });
- } else {
- alert('"elFinderConfig" object is wrong.');
- }
- });
- },
-
-
- load = function() {
- require(
- [
- 'elfinder'
- , 'extras/editors.default.min'
- , 'elFinderConfig'
-
- ],
- start,
- function(error) {
- alert(error.message);
- }
- );
- },
-
-
- old = (typeof window.addEventListener === 'undefined' && typeof document.getElementsByClassName === 'undefined')
- ||
- (!window.chrome && !document.unqueID && !window.opera && !window.sidebar && 'WebkitAppearance' in document.documentElement.style && document.body.style && typeof document.body.style.webkitFilter === 'undefined');
-
- require.config({
- baseUrl : 'js',
- paths : {
- 'jquery' : '//cdnjs.cloudflare.com/ajax/libs/jquery/'+(old? '1.12.4' : jqver)+'/jquery.min',
- 'jquery-ui': '//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/jquery-ui.min',
- 'elfinder' : 'elfinder.min',
- 'encoding-japanese': '//cdn.rawgit.com/polygonplanet/encoding.js/1.0.26/encoding.min'
- },
- waitSeconds : 10
- });
-
-
- if (! require.defined('elFinderConfig')) {
- define('elFinderConfig', {
-
-
-
- defaultOpts : {
- url : 'php/connector.minimal.php'
- ,commandsOptions : {
- edit : {
- extraOptions : {
-
-
- creativeCloudApiKey : '',
-
-
- managerUrl : ''
- }
- }
- ,quicklook : {
-
- sharecadMimes : ['image/vnd.dwg', 'image/vnd.dxf', 'model/vnd.dwf', 'application/vnd.hp-hpgl', 'application/plt', 'application/step', 'model/iges', 'application/vnd.ms-pki.stl', 'application/sat', 'image/cgm', 'application/x-msmetafile'],
-
- googleDocsMimes : ['application/pdf', 'image/tiff', 'application/vnd.ms-office', 'application/msword', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/postscript', 'application/rtf'],
-
-
- officeOnlineMimes : ['application/vnd.ms-office', 'application/msword', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.presentation']
- }
- }
- },
- managers : {
- 'elfinder': {},
- }
- });
- }
-
- load();
- })();
|