<commit_before>declare var Silverlight: any;

var transitionOption = ' 1.25s';

// .player(.silverlight/.flash)
//   object(silverlight/flash)
export var silverlight = () => ({
    restrict: 'E',
    replace: true,
    template: '<div><div class="dummy" style="' + dummyStyle + '"></div></div>',
    link: (scope: any, element: JQuery, attrs: any) => {
        var chrome = window.navigator.userAgent.indexOf('Chrome') !== -1;

        var fullscreen = false;

        var dummy = element.children('.dummy');
        dummy.css('height', dummy.width() * 3 / 4);

        var sl = getSilverlight(
            chrome,
            attrs.localip,
            attrs.streamid,
            attrs.remoteip,
            () => element.click(),
            (width, height) => {
                dummy.css('height', dummy.width() * height / width);
                if (!fullscreen) {
                    sl.css('height', dummy.width() * height / width);
                }
            });
        element.append(sl);
        sl.css(getWindowSilverlightStyle(dummy));

        element.click(function (eventObject) {
        });
        // todo: t@N^O
    }
});

function getSilverlight(chrome: boolean, localIp: string, streamId: string, remoteIp: string, onClick: Function, onMediaOpen: (width: number, height: number) => void) {
    return $(Silverlight.createObject(
        '/plugins/wmvplayer.xap',
        null,
        Date.now().toString(),// ӂȕ
        {
            width: '100%',
            height: '100%',
            background: '#000',
            version: '5.0',
            windowless: chrome ? 'true' : 'false'// chrometrueȂiframeƂ̏dȂ肪肭`悳Ȃ
        },
        {
            onError: () => console.error('Error on Silverlight'),
            onLoad: (sl: any, args: any) => {
                var ctrler = sl.Content.Controller;
                ctrler.addEventListener('click', onClick);
                ctrler.addEventListener('mediaOpened', () => onMediaOpen(ctrler.width, ctrler.height));
                ctrler.LocalIp = localIp;
                ctrler.Play(streamId, remoteIp);
            }
        },
        null, //p[^
        null //onLoad Cxgɓnl
        ))
        .css(defaultSilverlightStyle);
}

var dummyStyle = 'width: 100%; background-color: #333;';
var defaultSilverlightStyle = {
    position: 'absolute',
    display: 'block',
    transition: 'top 0.125s, width 0.125s, height 0.125s',

    top: 0,
    width: '100%',
    height: '100%',
    zIndex: 2000
};
// transitionoverflowύXtransition~܂

function getWindowSilverlightStyle(dummy: JQuery) {
    return {
        top: dummy.position().top + 1, // 1pxĂ
        width: '61.8%',
        height: dummy.height(),
        zIndex: '',// todo: 0.125sKx点
        transitionTimingFunction: 'ease-in'
    };
}

var fullscreenSilverlightStyle = {
    top: 0,
    width: '100%',
    height: '100%',
    zIndex: 2000,
    transitionTimingFunction: 'ease'
};

export var channelList = () => ({
    restrict: 'E',
    replace: true,
    templateUrl: '/html/list.html'
});<commit_msg>fix: resize<commit_after>declare var Silverlight: any;

var transitionOption = ' 1.25s';

// .player(.silverlight/.flash)
//   object(silverlight/flash)
export var silverlight = () => ({
    restrict: 'E',
    replace: true,
    template: '<div><div class="dummy" style="' + dummyStyle + '"></div></div>',
    link: (scope: any, element: JQuery, attrs: any) => {
        var chrome = window.navigator.userAgent.indexOf('Chrome') !== -1;

        var fullscreen = false;

        var dummy = element.children('.dummy');
        dummy.css('height', dummy.width() * 3 / 4);

        var sl = getSilverlight(
            chrome,
            attrs.localip,
            attrs.streamid,
            attrs.remoteip,
            () => element.click(),
            (width, height) => {
                dummy.css('height', dummy.width() * height / width);
                sl.css('height', dummy.width() * height / width);
                // EBhETCYύXɃvC[EBhẼTCYς
                resize(() => {
                    dummy.css('height', dummy.width() * height / width);
                    sl.css({
                        transition: '',
                        height: dummy.width() * height / width
                    });
                });
            });
        element.append(sl);
        sl.css(getWindowSilverlightStyle(dummy));

        element.click(function (eventObject) {
        });
        // todo: t@N^O
    }
});

function getSilverlight(chrome: boolean, localIp: string, streamId: string, remoteIp: string, onClick: Function, onMediaOpen: (width: number, height: number) => void) {
    return $(Silverlight.createObject(
        '/plugins/wmvplayer.xap',
        null,
        Date.now().toString(),// ӂȕ
        {
            width: '100%',
            height: '100%',
            background: '#000',
            version: '5.0',
            windowless: chrome ? 'true' : 'false'// chrometrueȂiframeƂ̏dȂ肪肭`悳Ȃ
        },
        {
            onError: () => console.error('Error on Silverlight'),
            onLoad: (sl: any, args: any) => {
                var ctrler = sl.Content.Controller;
                ctrler.addEventListener('click', onClick);
                ctrler.addEventListener('mediaOpened', () => onMediaOpen(ctrler.width, ctrler.height));
                ctrler.LocalIp = localIp;
                ctrler.Play(streamId, remoteIp);
            }
        },
        null, //p[^
        null //onLoad Cxgɓnl
        ))
        .css(defaultSilverlightStyle);
}

var dummyStyle = 'width: 100%; background-color: #333;';
var defaultSilverlightStyle = {
    position: 'absolute',
    display: 'block',
    transition: 'top 0.125s, width 0.125s, height 0.125s',

    top: 0,
    width: '100%',
    height: '100%',
    zIndex: 2000
};
// transitionoverflowύXtransition~܂

function getWindowSilverlightStyle(dummy: JQuery) {
    return {
        top: dummy.position().top + 1, // 1pxĂ
        width: '61.8%',
        height: dummy.height(),
        zIndex: '',// todo: 0.125sKx点
        transitionTimingFunction: 'ease-in'
    };
}

var fullscreenSilverlightStyle = {
    top: 0,
    width: '100%',
    height: '100%',
    zIndex: 2000,
    transitionTimingFunction: 'ease'
};

export var channelList = () => ({
    restrict: 'E',
    replace: true,
    templateUrl: '/html/list.html'
});

function resize(onResize: Function) {
    var timer: number = null;
    $(window).resize(function () {
        if (timer != null) {
            clearTimeout(timer);
        }
        timer = setTimeout(() => onResize(), 10);
    });
}
{'fraction_non_alphanumeric': 0.15382276941784465, 'fraction_numerical': 0.02036783705730354, 'mean_word_length': 1.9760289461782, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '928550', 'n_tokens_mistral': 2149, 'n_tokens_neox': 1987, 'n_words': 423}