{"size": 1600, "ext": "js", "max_stars_repo_path": "dist/dialogs/lookimage/lookimage.js", "max_stars_repo_name": "zhaojintian/ufinder", "max_stars_repo_stars_event_min_datetime": "2015-01-03T13:12:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T17:28:32.000Z", "max_issues_repo_path": "dist/dialogs/lookimage/lookimage.js", "max_issues_repo_name": "baiyanghese/ufinder", "max_issues_repo_issues_event_min_datetime": "2015-01-17T05:34:23.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-20T11:34:43.000Z", "max_forks_repo_path": "dist/dialogs/lookimage/lookimage.js", "max_forks_repo_name": "baiyanghese/ufinder", "max_forks_repo_forks_event_min_datetime": "2015-01-03T10:47:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-08T09:15:20.000Z"}
{"max_stars_count": 259, "max_issues_count": 8, "max_forks_count": 123, "avg_line_length": 37.2093023256, "max_line_length": 140, "alphanum_fraction": 0.475}
(function () {
    var widgetName = 'lookimage';
    UF.registerWidget(widgetName, {
        tpl: '<style type="text/css">.ufui-dialog-lookimage-body img{margin:0;padding:0;border:0;min-width:auto;min-height:auto;}</style>' +
            '<div class="ufui-dialog-lookimage-body"></div>',
        initContent: function (finder, $widget) {

            var me = this,
                lang = finder.getLang(widgetName);

            me.finder = finder;
            me.$widget = $widget;

            me.root().html($.parseTmpl(me.tpl, $.extend({}, lang['static'])));

            var src, $img, path = me.finder.getSelection().getSelectedFile();
            if(path && UF.Utils.isImagePath(path)) {
                src = me.finder.serverOption.realRootUrl + path;
                $img = $('<img src="' + src + '" width="100%" />').on('load', function(){
                    var $target = $(this),
                        width = $target.width(),
                        height = $target.height();
                    me.root().height(me.width * height / width);
                    me.$widget.ufui().autoCenter();
                }).on('click', function(){
                    me.finder.getWidgetData(widgetName).reset();
                    return false;
                });
                me.root().html('').css('over-flow', 'hidden').height(me.height).append($img);
            }
        },
        reset: function(){
            this.$widget.ufui().hide();
        },
        initEvent: function (editor, $w) {
        },
        buttons: {},
        width: 700,
        height: 300
    });
})();

