Raw Source
matejos / Mass 'Replace Existing Object' button on Bundle Installation

// ==UserScript==
// @name         Mass 'Replace Existing Object' button on Bundle Installation
// @description  Button to change every dropdown from 'Add and Rename' to 'Replace Existing Object'
// @version      0.4
// @namespace    https://confluence.corp.netsuite.com/x/soI7DQ
// @downloadURL  https://powertools.eng.netsuite.com/solution/user-script/bundle-installation-mass-replace-button.user.js
// @updateURL    https://powertools.eng.netsuite.com/solution/user-script/bundle-installation-mass-replace-button.user.js
// @match        https://*.app.netsuite.com/app/bundler/previewbundleupdate.nl?id=*&fromcompid=*
// @require      http://code.jquery.com/jquery-latest.js
// @license      MIT
// @author       Matej Poklemba
// ==/UserScript==

(function () {
    'use strict';
    if ($('span[style*="color: red"]').get(0)) {
        $('#header :nth-child(5) :nth-child(1)').append('<button type="button" id="replaceAllButton" style="font-size: 11px; margin: 0px 0px 0px 10px">Replace All</button>');
        $("#replaceAllButton").on("click", function () {
            $('select').each(function () {
                if ($('option:selected', this).val() === "ADD") {
                    $(this).val("REPLACE");
                }
            });
        });
    }
})();