<commit_before><script type="text/javascript">
    /**
     * Licensed to The Apereo Foundation under one or more contributor license
     * agreements. See the NOTICE file distributed with this work for
     * additional information regarding copyright ownership.

     * The Apereo Foundation licenses this file to you under the Apache License,
     * Version 2.0 (the "License"); you may not use this file except in
     * compliance with the License. You may obtain a copy of the License at:
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */

    // pageChanged & sizeChanged functions are needed in every model file
    // other functions for model should also be in here to avoid conflicts
    var dragDropLabel = new function() {
        var labelTxt1,
                labelTxt2,
                labelTxt3,
                targetTxt1,
                targetTxt2,
                submitBtnTxt,
                interactivity,
				tooltips = [];

        // function called every time the page is viewed after it has initially loaded
        this.pageChanged = function() {
            var resize = $("#labelHolder .label").length == $("#labelHolder .label.ui-draggable-disabled").length && x_currentPageXML.getAttribute("labelPos") != "text" ? true : false;
            this.createLabels();
            if (resize) {
                this.sizeChanged();
            }
            submitBtnTxt = x_currentPageXML.getAttribute("submitText") != undefined && x_currentPageXML.getAttribute("submitText") != "" ? x_currentPageXML.getAttribute("submitText") : "Submit";

        };

        // function called every time the size of the LO is changed
        this.sizeChanged = function(firstLoad) {
            $x_pageHolder.scrollTop(0);
            var $panel = $("#mainPanel");

            if (firstLoad == true) {
                firstLoad = false;
                this.createLabels();
            } else {
                // resize image to max that will fit space
                var $image = $("#image"),
                        prevW = $image.width(),
                        labelHolderH = x_currentPageXML.getAttribute("labelPos") != "text" ? $("#labelHolder").height() : 0,
                        imgSize = x_currentPageXML.getAttribute("imgWidth") == undefined || x_currentPageXML.getAttribute("imgWidth") == "Medium" ? 0.5 : x_currentPageXML.getAttribute("imgWidth") == "Small" ? 0.3 : 0.8;

                x_scaleImg($image, $x_pageHolder.width() * imgSize, $x_pageHolder.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - (parseInt($("#mainPanel").css("padding-top")) * 2) - labelHolderH - 10);
                $("#labelHolder").width($image.width());

                // adjust target sizes and positions
                var scale = $image.width() / prevW;
                $("#targetHolder .target").each(function() {
                    var $this = $(this);
                    $this.css({
                        "left"		:$this.position().left * scale,
                        "top"		:$this.position().top * scale,
                        "width"		:$this.width() * scale,
                        "height"	:$this.height() * scale
                    });
                });

                // also adjust labels
                $("#labelHolder .ui-draggable-disabled").each(function() {
                    var $this = $(this);
                    $this.css({
                        "left"		:$this.data("target").position().left + 2 + $panel.position().left,
                        "top"		:$this.data("target").position().top + 2 + $panel.position().top
                    });
                });
            }
        };

        this.leavePage = function() {
            if ($(x_currentPageXML).children().length > 0) {
                if (!this.checked) {
                    this.showFeedBackandTrackResults();
                }
            }
        };

        this.init = function() {
            // store strings used to give titles to labels and targets when keyboard is being used (for screen readers)
            labelTxt1 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "name", "Draggable Item");
            labelTxt2 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "selected", "Item Selected");
            labelTxt3 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "toSelect", "Press space to select");
            targetTxt1 = x_getLangInfo(x_languageData.find("interactions").find("targetArea")[0], "description", "Drop zone for");
            targetTxt2 = x_getLangInfo(x_languageData.find("interactions").find("targetArea")[0], "toSelect", "Press space to drop the selected item.");
            submitBtnTxt = x_currentPageXML.getAttribute("submitText") != undefined && x_currentPageXML.getAttribute("submitText") != "" ? x_currentPageXML.getAttribute("submitText") : "Submit";
            interactivity = x_currentPageXML.getAttribute("interactivity") != undefined && x_currentPageXML.getAttribute("interactivity") != "" ? x_currentPageXML.getAttribute("interactivity") : "Describe";


            $("#mainText").html(x_addLineBreaks(x_currentPageXML.getAttribute("text")));

            if (x_currentPageXML.getAttribute("labelPos") == "text") {
                $("#mainText")
                        .after($("#labelHolder"))
                        .after('<hr/>');
            }<commit_msg>Fix dropped labels floating off targets when resized - #915<commit_after><script type="text/javascript">
    /**
     * Licensed to The Apereo Foundation under one or more contributor license
     * agreements. See the NOTICE file distributed with this work for
     * additional information regarding copyright ownership.

     * The Apereo Foundation licenses this file to you under the Apache License,
     * Version 2.0 (the "License"); you may not use this file except in
     * compliance with the License. You may obtain a copy of the License at:
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */

    // pageChanged & sizeChanged functions are needed in every model file
    // other functions for model should also be in here to avoid conflicts
    var dragDropLabel = new function() {
        var labelTxt1,
                labelTxt2,
                labelTxt3,
                targetTxt1,
                targetTxt2,
                submitBtnTxt,
                interactivity,
				tooltips = [];

        // function called every time the page is viewed after it has initially loaded
        this.pageChanged = function() {
            var resize = $("#labelHolder .label").length == $("#labelHolder .label.ui-draggable-disabled").length && x_currentPageXML.getAttribute("labelPos") != "text" ? true : false;
            this.createLabels();
            if (resize) {
                this.sizeChanged();
            }
            submitBtnTxt = x_currentPageXML.getAttribute("submitText") != undefined && x_currentPageXML.getAttribute("submitText") != "" ? x_currentPageXML.getAttribute("submitText") : "Submit";

        };

        // function called every time the size of the LO is changed
        this.sizeChanged = function(firstLoad) {
            $x_pageHolder.scrollTop(0);
            var $panel = $("#mainPanel");

            if (firstLoad == true) {
                firstLoad = false;
                this.createLabels();
            } else {
                // resize image to max that will fit space
                var $image = $("#image"),
                        prevW = $image.width(),
                        labelHolderH = x_currentPageXML.getAttribute("labelPos") != "text" ? $("#labelHolder").height() : 0,
                        imgSize = x_currentPageXML.getAttribute("imgWidth") == undefined || x_currentPageXML.getAttribute("imgWidth") == "Medium" ? 0.5 : x_currentPageXML.getAttribute("imgWidth") == "Small" ? 0.3 : 0.8;

                x_scaleImg($image, $x_pageHolder.width() * imgSize, $x_pageHolder.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - (parseInt($("#mainPanel").css("padding-top")) * 2) - labelHolderH - 10);
                $("#labelHolder").width($image.width());

                // adjust target sizes and positions
                var scale = $image.width() / prevW;
                $("#targetHolder .target").each(function() {
                    var $this = $(this);
                    $this.css({
                        "left"		:$this.position().left * scale,
                        "top"		:$this.position().top * scale,
                        "width"		:$this.width() * scale,
                        "height"	:$this.height() * scale
                    });
                });

                // also adjust labels
                $("#labelHolder .ui-draggable").each(function(i) {
                    var $this = $(this);
                    var $target = $this.data("target");
                    if (!isNaN($target)) {
                      $target = $("#targetHolder .target").eq($target);
                      $this.css({
                          "left"		:$target.position().left + 2 + $panel.position().left,
                          "top"		:$target.position().top + 2 + $panel.position().top
                      });
                    }
                });
            }
        };

        this.leavePage = function() {
            if ($(x_currentPageXML).children().length > 0) {
                if (!this.checked) {
                    this.showFeedBackandTrackResults();
                }
            }
        };

        this.init = function() {
            // store strings used to give titles to labels and targets when keyboard is being used (for screen readers)
            labelTxt1 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "name", "Draggable Item");
            labelTxt2 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "selected", "Item Selected");
            labelTxt3 = x_getLangInfo(x_languageData.find("interactions").find("draggableItem")[0], "toSelect", "Press space to select");
            targetTxt1 = x_getLangInfo(x_languageData.find("interactions").find("targetArea")[0], "description", "Drop zone for");
            targetTxt2 = x_getLangInfo(x_languageData.find("interactions").find("targetArea")[0], "toSelect", "Press space to drop the selected item.");
            submitBtnTxt = x_currentPageXML.getAttribute("submitText") != undefined && x_currentPageXML.getAttribute("submitText") != "" ? x_currentPageXML.getAttribute("submitText") : "Submit";
            interactivity = x_currentPageXML.getAttribute("interactivity") != undefined && x_currentPageXML.getAttribute("interactivity") != "" ? x_currentPageXML.getAttribute("interactivity") : "Describe";


            $("#mainText").html(x_addLineBreaks(x_currentPageXML.getAttribute("text")));

            if (x_currentPageXML.getAttribute("labelPos") == "text") {
                $("#mainText")
                        .after($("#labelHolder"))
                        .after('<hr/>');
            }
{'fraction_non_alphanumeric': 0.1277208435673753, 'fraction_numerical': 0.006013381892097908, 'mean_word_length': 2.071001300390117, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4557352', 'n_tokens_mistral': 3077, 'n_tokens_neox': 2955, 'n_words': 754}