dennisshen7 / Selected Site

// ==UserScript==
// @name        Selected Site
// @namespace   --
// @include       http*://*aspsoft/*AddTransUpload*
// @grant none
// @version     1.0
// ==/UserScript==
//this.$ = this.jQuery = jQuery.noConflict(true);
var $ = unsafeWindow.jQuery;


var rb_addRow2 = function(obj) {
    var last = $('table[objectname=addTransUploadDetail] tr[repeat=true]:last');
    var last_2 = $('table[objectname=addTransUploadDetail] tr[repeat=true]:nth-last-child(2)');

    last.find('input[objectname=database_name]:checkbox').each(function() {
        var db_id = $(this).val();

        $(this).prop('checked', last_2.find('input[objectname=database_name][value=' + db_id + ']:checkbox').prop('checked'))
    });
    last.find('select[objectname=upload_type] option[value='+last_2.find('select[objectname=upload_type] option:selected').val()+']').prop('selected',true);
};


$(function(){
   $('table[objectname=addTransUploadDetail]').on('click','tr[repeat=true] input[value="+"]:button',function(){
       rb_addRow2(this);
   });

});