<commit_before>/*
 * Copyright 2005-2012 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 *
 * 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.
 */

/**
 * Hide the message tooltip associated with the field by id
 * @param fieldId the id of the field
 */
function hideMessageTooltip(fieldId) {
    var elementInfo = getHoverElement(fieldId);
    var element = elementInfo.element;
    if (elementInfo.type == "fieldset") {
        //for checkbox/radio fieldsets we put the tooltip on the label of the first input
        element = jQuery(element).filter(".uif-tooltip");
    }

    var data = jQuery("#" + fieldId).data(kradVariables.VALIDATION_MESSAGES);
    if (data && data.showTimer) {
        clearTimeout(data.showTimer);
    }

    var tooltipId = jQuery(element).GetBubblePopupID();

    //browser specific hover check, note content in tooltip when input is also focused will not
    //be selectable in ie <= 8 (this is a hack to allow users to click links in tooltips in supported browsers)
    var isHovered = false;
    if(!jQuery.browser.msie || (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) > 8)){
        isHovered = jQuery("#" + tooltipId).is(":hover");
    }

    if(tooltipId && !isHovered){
        //this causes the tooltip to be IMMEDIATELY hidden, rather than wait for animation
        jQuery("#" + tooltipId).css("opacity", 0);
        jQuery("#" + tooltipId).hide();
        jQuery(element).HideBubblePopup();
    }
    else{
        jQuery(element).HideBubblePopup();
    }
}

/**
 * Gets the hover elements for a field by id.  The hover elements are the elements which will cause the tooltip to
 * be shown, the element the tooltip is actually placed on is an item its hover elements.
 * @param fieldId the id of the field
 */
function getHoverElement(fieldId) {
    var fieldset = jQuery("#" + fieldId).find("fieldset");
    var hasFieldset = fieldset.length;
    var elementInfo = {};

    if (!hasFieldset || (hasFieldset && fieldset.data("type") == "InputSet")) {<commit_msg>additional small tweak to tootltip hiding interaction<commit_after>/*
 * Copyright 2005-2012 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 *
 * 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.
 */

/**
 * Hide the message tooltip associated with the field by id
 * @param fieldId the id of the field
 */
function hideMessageTooltip(fieldId) {
    var elementInfo = getHoverElement(fieldId);
    var element = elementInfo.element;
    if (elementInfo.type == "fieldset") {
        //for checkbox/radio fieldsets we put the tooltip on the label of the first input
        element = jQuery(element).filter(".uif-tooltip");
    }

    var data = jQuery("#" + fieldId).data(kradVariables.VALIDATION_MESSAGES);
    if (data && data.showTimer) {
        clearTimeout(data.showTimer);
    }

    var tooltipId = jQuery(element).GetBubblePopupID();

    //browser specific hover check, note content in tooltip when input is also focused will not
    //be selectable in ie <= 8 (this is a hack to allow users to click links in tooltips in supported browsers)
    var isHovered = true;
    if(!jQuery.browser.msie || (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) > 8)){
        isHovered = jQuery("#" + tooltipId).is(":hover");
    }

    if(tooltipId && !isHovered){
        //this causes the tooltip to be IMMEDIATELY hidden, rather than wait for animation
        jQuery("#" + tooltipId).css("opacity", 0);
        jQuery("#" + tooltipId).hide();
        jQuery(element).HideBubblePopup();
    }
    else{
        jQuery(element).HideBubblePopup();
    }
}

/**
 * Gets the hover elements for a field by id.  The hover elements are the elements which will cause the tooltip to
 * be shown, the element the tooltip is actually placed on is an item its hover elements.
 * @param fieldId the id of the field
 */
function getHoverElement(fieldId) {
    var fieldset = jQuery("#" + fieldId).find("fieldset");
    var hasFieldset = fieldset.length;
    var elementInfo = {};

    if (!hasFieldset || (hasFieldset && fieldset.data("type") == "InputSet")) {
{'fraction_non_alphanumeric': 0.10405539070227497, 'fraction_numerical': 0.006330365974282888, 'mean_word_length': 3.4389815627743636, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '2973958', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1381, 'n_words': 544}