All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.sauceondemand.js Maven / Gradle / Ivy

The newest version!
if (typeof SAUCE == "undefined")
{
    var SAUCE = new Object();
    SAUCE.builderModePrefix = "";
    SAUCE.postModePrefix = "";
}

SAUCE.doExtensionSave = function()
{
    var versionTypeKey = jQuery("#brmp_versionTypeKey").val();
    var versionTypeDescription = jQuery("#brmp_versionTypeDescription").val();
    var versionTypeCaseSensitive = jQuery("#brmp_versionTypeCaseSensitive").is(':checked');

    if (versionTypeCaseSensitive)
    {
        var caseImage = '';
    } else
    {
        var caseImage = '';
    }

    var curJSON = jQuery("#" + SAUCE.builderModePrefix + "_custom_brmp_versiontypes_json").val();
    if (curJSON == "" || curJSON == null || curJSON == undefined || curJSON.substr(0, 1) != "[")
    {
        curJSON = "[]";
    }
    var jsonArray = jQuery.evalJSON(curJSON);

    var newEntry = new Object();
    newEntry.key = versionTypeKey;
    newEntry.description = versionTypeDescription;
    newEntry.caseSensitive = versionTypeCaseSensitive;
    newEntry.tagReleased = false;
    newEntry.tagUnreleased = false;

    jsonArray[jsonArray.length] = newEntry;

    var newJSON = jQuery.toJSON(jsonArray);
    jQuery("#" + SAUCE.builderModePrefix + "_custom_brmp_versiontypes_json").val(newJSON);

    jQuery("#brmpAddVersionTypeFormRow").before('' + versionTypeKey + ' ' + versionTypeDescription + '' + caseImage + '');
    jQuery(".brmpRemoveVersionTypeButton").unbind('click');
    jQuery(".brmpRemoveVersionTypeButton").click(SAUCE.doVersionTypeDelete);

    jQuery("#brmp_versionTypeKey").val("");
    jQuery("#brmp_versionTypeDescription").val("");
    jQuery("#brmp_versionTypeCaseSensitive").attr('checked', false);
    return false;
}

SAUCE.doExtensionDelete = function()
{
    var rowIndex = jQuery(this).parent().parent()[0].sectionRowIndex;
    var row = jQuery(this).parent().parent();
    var removeIndex = rowIndex - 2;

    var curJSON = jQuery("#" + SAUCE.builderModePrefix + "_custom_brmp_versiontypes_json").val();
    var jsonArray = jQuery.evalJSON(curJSON);
    jsonArray.splice(removeIndex, 1);

    var newJSON = jQuery.toJSON(jsonArray);
    jQuery("#" + SAUCE.builderModePrefix + "_custom_brmp_versiontypes_json").val(newJSON);

    row.remove();

    return false;
}

jQuery(document).ready(function()
{
    jQuery("#saveExtensionButton").click(SAUCE.doExtensionSave);

    jQuery(".sauceRemoveExtensionButton").click(SAUCE.doExtensionDelete);

    //setup tab switching
    var builderItems = jQuery('#sauceBuilderTabs>ul>li');
    builderItems.click(function()
    {
        builderItems.removeClass('selected');
        jQuery(this).addClass('selected');

        var index = builderItems.index(jQuery(this));
        jQuery('#sauceBuilderTabs>div').hide().eq(index).show();
    }).eq(0).click();

});






© 2015 - 2025 Weber Informatics LLC | Privacy Policy