<commit_before>
Vps.onContentReady(function() {

    var lightbox = new Vpc.Basic.ImageEnlarge();
    var els = document.getElementsByTagName('a');
    for (var i=0; i<els.length; i++) {
        if (els[i].rel.match(/enlarge_[0-9]+_[0-9]+/)) {
            Ext.EventManager.addListener(els[i], 'click', function(e) {
                lightbox.show(Ext.get(this), e);
                e.stopEvent();
            }, els[i], { stopEvent: true });
        }
    }
});


Ext.namespace("Vpc.Basic");
Vpc.Basic.ImageEnlarge = function()
{
    this.lightbox = Ext.get(
        Ext.DomHelper.append(Ext.getBody(),
            { tag: 'div', cls: 'lightbox' }
        )
    );
};

Vpc.Basic.ImageEnlarge.prototype =
{

    hide: function(e)
    {
        if (e) e.stopEvent();
        this.lightbox.applyStyles('display: none;');
        this.unmask();
    },

    show: function(linkEl)
    {
        this.mask();

        this.lightbox.applyStyles('display: block;');
        this.lightbox.center();

        var m = linkEl.dom.rel.match(/enlarge_([0-9]+)_([0-9]+)_?(.*)/);

        var imgWidth = parseInt(m[1]);
        var imgHeight = parseInt(m[2]);
        var fullSizePath = false;
        if (m[3]) {
            fullSizePath = m[3];
        }

        // head
        var hdHtml = '';
        if (fullSizePath) hdHtml += '<a href="'+fullSizePath+'" class="fullSizeLink" target="_blank"></a> ';
        hdHtml += linkEl.dom.title ? linkEl.dom.title : '&nbsp;';
        var hd = Ext.DomHelper.overwrite(this.lightbox,
            { tag: 'div', cls:'lightboxHd', html: hdHtml }
        );

        // head - close
        var closeLink = Ext.get(Ext.DomHelper.insertFirst(hd,
            { tag: 'a', cls: 'lightboxClose', href: '#', children: [
                { tag: 'img', src: '/assets/vps/images/spacer.gif', alt: 'close' }
            ]}
        ));

        // body
        var bd = Ext.get(Ext.DomHelper.append(this.lightbox,
            { tag: 'div', cls: 'lightboxBd' }
        ));

        // body - image
        var imageTopMargin = (parseInt(bd.getStyle('height')) - imgHeight) / 2;
        if (imageTopMargin < 0) imageTopMargin = 0;

        var img = Ext.get(Ext.DomHelper.append(bd, {
            tag    : 'img',
            src    : linkEl.dom.href,
            alt    : '',
            width  : imgWidth,<commit_msg>Title bei Download Icon in Photobox<commit_after>
Vps.onContentReady(function() {

    var lightbox = new Vpc.Basic.ImageEnlarge();
    var els = document.getElementsByTagName('a');
    for (var i=0; i<els.length; i++) {
        if (els[i].rel.match(/enlarge_[0-9]+_[0-9]+/)) {
            Ext.EventManager.addListener(els[i], 'click', function(e) {
                lightbox.show(Ext.get(this), e);
                e.stopEvent();
            }, els[i], { stopEvent: true });
        }
    }
});


Ext.namespace("Vpc.Basic");
Vpc.Basic.ImageEnlarge = function()
{
    this.lightbox = Ext.get(
        Ext.DomHelper.append(Ext.getBody(),
            { tag: 'div', cls: 'lightbox' }
        )
    );
};

Vpc.Basic.ImageEnlarge.prototype =
{

    hide: function(e)
    {
        if (e) e.stopEvent();
        this.lightbox.applyStyles('display: none;');
        this.unmask();
    },

    show: function(linkEl)
    {
        this.mask();

        this.lightbox.applyStyles('display: block;');
        this.lightbox.center();

        var m = linkEl.dom.rel.match(/enlarge_([0-9]+)_([0-9]+)_?(.*)/);

        var imgWidth = parseInt(m[1]);
        var imgHeight = parseInt(m[2]);
        var fullSizePath = false;
        if (m[3]) {
            fullSizePath = m[3];
        }

        // head
        var hdHtml = '';
        if (fullSizePath) hdHtml += '<a href="'+fullSizePath+'" class="fullSizeLink" title="Bild in Originalgröße" target="_blank"></a> ';
        hdHtml += linkEl.dom.title ? linkEl.dom.title : '&nbsp;';
        var hd = Ext.DomHelper.overwrite(this.lightbox,
            { tag: 'div', cls:'lightboxHd', html: hdHtml }
        );

        // head - close
        var closeLink = Ext.get(Ext.DomHelper.insertFirst(hd,
            { tag: 'a', cls: 'lightboxClose', href: '#', children: [
                { tag: 'img', src: '/assets/vps/images/spacer.gif', alt: 'close' }
            ]}
        ));

        // body
        var bd = Ext.get(Ext.DomHelper.append(this.lightbox,
            { tag: 'div', cls: 'lightboxBd' }
        ));

        // body - image
        var imageTopMargin = (parseInt(bd.getStyle('height')) - imgHeight) / 2;
        if (imageTopMargin < 0) imageTopMargin = 0;

        var img = Ext.get(Ext.DomHelper.append(bd, {
            tag    : 'img',
            src    : linkEl.dom.href,
            alt    : '',
            width  : imgWidth,
{'fraction_non_alphanumeric': 0.17310960067969414, 'fraction_numerical': 0.006796941376380629, 'mean_word_length': 1.904996915484269, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2347157', 'n_tokens_mistral': 1596, 'n_tokens_neox': 1582, 'n_words': 277}