1mw.getExtradataFormData = function (data, call) { 2 3 if (data.form_data_required) { 4 if (!data.form_data_module_params) { 5 data.form_data_module_params = {}; 6 } 7 data.form_data_module_params._confirm = 1 8 } 9 10 11 if (data.form_data_required_params) { 12 data.form_data_module_params = $.extend({}, data.form_data_required_params,data.form_data_module_params); 13 } 14 15 if (data.form_data_module) { 16 mw.loadModuleData(data.form_data_module, function (moduledata) { 17 call.call(undefined, moduledata); 18 }, null, data.form_data_module_params); 19 } 20 else { 21 call.call(undefined, data.form_data_required); 22 } 23} 24 25mw.extradataForm = function (options, data, func) { 26 if (options._success) { 27 options.success = options._success; 28 delete options._success; 29 } 30 mw.getExtradataFormData(data, function (extra_html) { 31 var form = document.createElement('form'); 32 mw.$(form).append(extra_html); 33 34 if(data.form_data_required){ 35 mw.$(form).append('<hr><button type="submit" class="mw-ui-btn pull-right mw-ui-btn-invert">' + mw.lang('Submit') + '</button>'); 36 } 37 38 39 40 form.action = options.url; 41 form.method = options.type; 42 form.__modal = mw.dialog({ 43 content: form, 44 title: data.error, 45 closeButton: false, 46 closeOnEscape: false 47 }); 48 mw.$('script', form).each(function() { 49 eval($(this).text()); 50 }); 51 52 $(form.__modal).on('closedByUser', function () { 53 if(options.onExternalDataDialogClose) { 54 options.onExternalDataDialogClose.call(); 55 } 56 }); 57 58 59 60 if(data.form_data_required) { 61 mw.$(form).on('submit', function (e) { 62 e.preventDefault(); 63 var when = form.$beforepost ? form.$beforepost : function () {}; 64 $.when(when()).then(function() { 65 var exdata = mw.serializeFields(form); 66 if(typeof options.data === 'string'){ 67 var params = {}; 68 options.data.split('&').forEach(function(a){ 69 var c = a.split('='); 70 params[c[0]] = decodeURIComponent(c[1]); 71 }); 72 options.data = params; 73 } 74 var isFormData = options.data.constructor.name === 'FormData'; 75 if(isFormData) { 76 for (var i in exdata) { 77 options.data.set(i, exdata[i]); 78 } 79 80 } else { 81 for (var i in exdata) { 82 options.data[i] = exdata[i]; 83 } 84 } 85 if(func) { 86 func(options); 87 88 } else { 89 mw.ajax(options); 90 91 } 92 form.__modal.remove(); 93 }) 94 95 96 97 }); 98 } 99 }); 100};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.