<commit_before>YUI.add('moodle-qtype_ddwtos-dd', function(Y) {
    var DDWTOSDDNAME = 'ddwtos_dd';
    var DDWTOS_DD = function() {
        DDWTOS_DD.superclass.constructor.apply(this, arguments);
    }
    /**
     * This is the class for ddwtos question rendering.
     * A DDWTOS_DD class is created for each question.
     */
    Y.extend(DDWTOS_DD, Y.Base, {
        selectors : null,
        initializer : function(params) {
            this.selectors = this.css_selectors(this.get('topnode'));
            this.set_padding_sizes_all();
            this.clone_drag_items();
            this.place_drag_items();
            this.make_drop_zones();
            Y.later(500, this, this.position_drag_items, [], true);
        },
        /**
         * put all our selectors in the same place so we can quickly find and change them later
         * if the structure of the document changes.
         */
        css_selectors : function(topnode){
            return {
                top_node : function() {
                    return topnode;
                },
                drag_container : function() {
                    return topnode+' div.drags';
                },
                drags : function() {
                    return this.drag_container()+' span.drag';
                },
                drag : function(no) {
                    return this.drags()+'.no'+no;
                },
                unplaced_drags_for_choice_in_group : function(choiceno, groupno) {
                    return this.drags()+'.group'+groupno+'.choice'+choiceno+':not(.placed)';
                },
                drops : function() {
                    return topnode+' span.drop';
                },
                drop_for_place : function(placeno) {
                    return this.drops()+'.place'+placeno;
                },
                drops_in_group : function(groupno) {
                    return this.drops()+'.group'+groupno;
                },
                drag_homes : function() {
                    return topnode+' span.draghome';
                },
                drag_homes_group : function(groupno) {
                    return topnode+' .draggrouphomes'+groupno+' span.draghome';
                },
                drag_home : function(groupno, choiceno) {
                    return topnode+' .draggrouphomes'+groupno+' span.draghome.choice'+choiceno;
                },
                drops_group : function(groupno) {
                    return topnode+' span.drop.group'+groupno;
                },
            }
        },
        set_padding_sizes_all : function () {
            for (var groupno = 1; groupno <= 8; groupno++) {
                this.set_padding_size_for_group(groupno);
            }
        },
        set_padding_size_for_group : function (groupno) {
            var groupitems = Y.all(this.selectors.drag_homes_group(groupno));
            if (groupitems.size() !== 0) {
                var maxwidth = 0;
                var maxheight = 0;
                //find max height and width
                groupitems.each(function(item){
                    maxwidth = Math.max(maxwidth, item.get('offsetWidth'));
                    maxheight = Math.max(maxheight, item.get('offsetHeight'));
                }, this);
                groupitems.each(function(item) {
                    var margintopbottom = Math.ceil((maxheight - item.get('offsetHeight'))/2);
                    var marginleftright = Math.ceil((maxwidth - item.get('offsetWidth'))/2);
                    item.setStyle('padding', margintopbottom+'px '+marginleftright+'px ');
                }, this);
                Y.all(this.selectors.drops_group(groupno)).setStyles({'width': maxwidth - 2,
                                                                'height': maxheight - 2});
            }
        },
        /**
         * Invisible 'drag homes' are output by the renderer. These have the same properties 
         * as the drag items but are invisible. We clone these invisible elements to make the 
         * actual drag items.
         */
        clone_drag_items : function () {
            Y.all(this.selectors.drag_homes()).each(this.clone_drag_items_for_one_choice, this);<commit_msg>MDL-47494 ddwtos: NOBUG combination fix for size of drag objects and ie issues<commit_after>YUI.add('moodle-qtype_ddwtos-dd', function(Y) {
    var DDWTOSDDNAME = 'ddwtos_dd';
    var DDWTOS_DD = function() {
        DDWTOS_DD.superclass.constructor.apply(this, arguments);
    }
    /**
     * This is the class for ddwtos question rendering.
     * A DDWTOS_DD class is created for each question.
     */
    Y.extend(DDWTOS_DD, Y.Base, {
        selectors : null,
        initializer : function(params) {
            this.selectors = this.css_selectors(this.get('topnode'));
            this.set_padding_sizes_all();
            this.clone_drag_items();
            this.place_drag_items();
            this.make_drop_zones();
            Y.later(500, this, this.position_drag_items, [], true);
        },
        /**
         * put all our selectors in the same place so we can quickly find and change them later
         * if the structure of the document changes.
         */
        css_selectors : function(topnode){
            return {
                top_node : function() {
                    return topnode;
                },
                drag_container : function() {
                    return topnode+' div.drags';
                },
                drags : function() {
                    return this.drag_container()+' span.drag';
                },
                drag : function(no) {
                    return this.drags()+'.no'+no;
                },
                unplaced_drags_for_choice_in_group : function(choiceno, groupno) {
                    return this.drags()+'.group'+groupno+'.choice'+choiceno+':not(.placed)';
                },
                drops : function() {
                    return topnode+' span.drop';
                },
                drop_for_place : function(placeno) {
                    return this.drops()+'.place'+placeno;
                },
                drops_in_group : function(groupno) {
                    return this.drops()+'.group'+groupno;
                },
                drag_homes : function() {
                    return topnode+' span.draghome';
                },
                drag_homes_group : function(groupno) {
                    return topnode+' .draggrouphomes'+groupno+' span.draghome';
                },
                drag_home : function(groupno, choiceno) {
                    return topnode+' .draggrouphomes'+groupno+' span.draghome.choice'+choiceno;
                },
                drops_group : function(groupno) {
                    return topnode+' span.drop.group'+groupno;
                }
            }
        },
        set_padding_sizes_all : function () {
            for (var groupno = 1; groupno <= 8; groupno++) {
                this.set_padding_size_for_group(groupno);
            }
        },
        set_padding_size_for_group : function (groupno) {
            var groupitems = Y.all(this.selectors.drag_homes_group(groupno));
            if (groupitems.size() !== 0) {
                var maxwidth = 0;
                var maxheight = 0;
                //find max height and width
                groupitems.each(function(item){
                    maxwidth = Math.max(maxwidth, item.get('offsetWidth'));
                    maxheight = Math.max(maxheight, item.get('offsetHeight'));
                }, this);
                groupitems.each(function(item) {
                    var margintop = Math.round((maxheight - item.get('offsetHeight'))/2);
                    var marginleft = Math.round((maxwidth - item.get('offsetWidth'))/2);
                    var marginbottom = (maxheight - item.get('offsetHeight')) - margintop;
                    var marginright = (maxwidth - item.get('offsetWidth')) - marginleft;
                    item.setStyle('padding', margintop+'px '+marginleft+'px '
                                            +marginbottom+'px '+marginright+'px');
                }, this);
                Y.all(this.selectors.drops_group(groupno)).setStyles({'width': maxwidth - 2,
                                                                'height': maxheight - 2});
            }
        },
        /**
         * Invisible 'drag homes' are output by the renderer. These have the same properties 
         * as the drag items but are invisible. We clone these invisible elements to make the 
         * actual drag items.
         */
        clone_drag_items : function () {
            Y.all(this.selectors.drag_homes()).each(this.clone_drag_items_for_one_choice, this);
{'fraction_non_alphanumeric': 0.11014724346535784, 'fraction_numerical': 0.0033101244150211162, 'mean_word_length': 1.4821529745042492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1344501', 'n_tokens_mistral': 2409, 'n_tokens_neox': 2298, 'n_words': 463}