<commit_before>/**
 * Copyright (c) UNA, Inc - https://una.io
 * MIT License - https://opensource.org/licenses/MIT
 *
 * @defgroup    UnaCore UNA Core
 *
 * @{
 */

function BxDolCategories(oOptions) {
    this._sActionsUrl = oOptions.sActionUrl;
    this._sObjName = oOptions.sObjName == undefined ? 'oBxDolCategories' : oOptions.sObjName;

    this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
    this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;

    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
}

BxDolCategories.prototype.categoryAdd = function (oButton, sName) {
    var oButton = $(oButton);

    var oCategory = oButton.parents('#bx-form-element-' + sName).find('.bx-form-input-category:first').clone();
    oCategory.find("input[type = 'text']").val('');
    oCategory.find("input[type = 'hidden']").remove();

    oButton.parents('.bx-form-input-category-add:first').before(oCategory);
};

BxDolCategories.prototype.categoryAddNew = function (oButton, sName) {
    var oButton = $(oButton);

    var oCategory = oButton.parents('#bx-form-element-' + sName).find('.bx-form-input-category-new:first').clone();
    oCategory.find("input[type = 'text']").val('');
    oCategory.find("input[type = 'hidden']").remove();

    $('.bx-form-input-categories .bx-form-input-category-add:first').before(oCategory);
};

BxDolCategories.prototype.categoryDelete = function (oButton) {
    $(oButton).parents('.bx-form-input-category:first').remove();
};

BxDolCategories.prototype.categoryDeleteNew = function (oButton) {
    $(oButton).parents('.bx-form-input-category-new:first').remove();
};
<commit_msg>#3489 Multi-categories: "Create own category" isn't working correctly when more than one form of the same page with multi-categories fiels<commit_after>/**
 * Copyright (c) UNA, Inc - https://una.io
 * MIT License - https://opensource.org/licenses/MIT
 *
 * @defgroup    UnaCore UNA Core
 *
 * @{
 */

function BxDolCategories(oOptions) {
    this._sActionsUrl = oOptions.sActionUrl;
    this._sObjName = oOptions.sObjName == undefined ? 'oBxDolCategories' : oOptions.sObjName;

    this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
    this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;

    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
}

BxDolCategories.prototype.categoryAdd = function (oButton, sName) {
    var oButton = $(oButton);

    var oCategory = oButton.parents('#bx-form-element-' + sName).find('.bx-form-input-category:first').clone();
    oCategory.find("input[type = 'text']").val('');
    oCategory.find("input[type = 'hidden']").remove();

    oButton.parents('.bx-form-input-category-add:first').before(oCategory);
};

BxDolCategories.prototype.categoryAddNew = function (oButton, sName) {
    var oButton = $(oButton);

    var oCategory = oButton.parents('#bx-form-element-' + sName).find('.bx-form-input-category-new:first').clone();
    oCategory.find("input[type = 'text']").val('');
    oCategory.find("input[type = 'hidden']").remove();

    oButton.parents('#bx-form-element-' + sName).find('.bx-form-input-categories .bx-form-input-category-add:first').before(oCategory);
};

BxDolCategories.prototype.categoryDelete = function (oButton) {
    $(oButton).parents('.bx-form-input-category:first').remove();
};

BxDolCategories.prototype.categoryDeleteNew = function (oButton) {
    $(oButton).parents('.bx-form-input-category-new:first').remove();
};

{'fraction_non_alphanumeric': 0.17061734826777808, 'fraction_numerical': 0.001041938004688721, 'mean_word_length': 4.622254758418741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '4131160', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1199, 'n_words': 182}