Configuration.js

44 lines | 1.489 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: ['.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";
}