Configuration.js

60 lines | 2.006 kB Blame History Raw Download


//Общие конфигурации
export default class Configuration {
    static RooDirectoryID = -1;
    static upload_chunk_size = 1048576;
    static OpenRegisteredExtension =
        [
            {
                Ext: ['.txt', '.doc', '.docx', '.xls', '.xlsx', '.pdf'/*, '.ppt', '.pptx'*/],
                Service: function (url)
                {
                    let u = 'http://docs.google.com/viewer?url=' + url;

                    if (Configuration.EnviromentValue == 'Development') {
                        console.log(u);
                        //debugger;
                    }

                    window.open(
                        u,
                        '_blank'
                    );
                }
            },
            //{
            //    Ext: ['.ppt', '.pptx'],
            //    Service: function (url) {
            //        let u = 'https://ppt.online-reader.com//view?url=' + url;

            //        if (Configuration.EnviromentValue == 'Development') {
            //            console.log(u);
            //            //debugger;
            //        }

            //        window.open(
            //            u,
            //            '_blank'
            //        );
            //    }
            //},
            {
                Ext: ['.jpg', '.png', '.jpeg', '.bmp', '.gif'],
                Service: function (url) {

                    if (Configuration.EnviromentValue == 'Development') {
                        console.log(url);
                        //debugger;
                    }

                    const w = window.open('about:blank', 'new image'); // открываем окно
                    w.document.write("<img src='" + url + "' alt='from old image' />"); //  вставляем картинку
                }
            },
        ];
    static RegisteredExtension = this.OpenRegisteredExtension.flatMap(e => e.Ext);

    //Заполнятся при старте запросом из WebApi
    static EnviromentValue = "NoSet";
}