MCPcopy
hub / github.com/moxiecode/plupload / normalizeCaps

Function normalizeCaps

js/plupload.dev.js:4082–4137  ·  view source on GitHub ↗
(settings)

Source from the content-addressed store, hash-verified

4080
4081 // convert plupload features to caps acceptable by mOxie
4082 function normalizeCaps(settings) {
4083 var features = settings.required_features,
4084 caps = {};
4085
4086 function resolve(feature, value, strict) {
4087 // Feature notation is deprecated, use caps (this thing here is required for backward compatibility)
4088 var map = {
4089 chunks: 'slice_blob',
4090 jpgresize: 'send_binary_string',
4091 pngresize: 'send_binary_string',
4092 progress: 'report_upload_progress',
4093 multi_selection: 'select_multiple',
4094 dragdrop: 'drag_and_drop',
4095 drop_element: 'drag_and_drop',
4096 headers: 'send_custom_headers',
4097 urlstream_upload: 'send_binary_string',
4098 canSendBinary: 'send_binary',
4099 triggerDialog: 'summon_file_dialog'
4100 };
4101
4102 if (map[feature]) {
4103 caps[map[feature]] = value;
4104 } else if (!strict) {
4105 caps[feature] = value;
4106 }
4107 }
4108
4109 if (typeof(features) === 'string') {
4110 plupload.each(features.split(/\s*,\s*/), function(feature) {
4111 resolve(feature, true);
4112 });
4113 } else if (typeof(features) === 'object') {
4114 plupload.each(features, function(value, feature) {
4115 resolve(feature, value);
4116 });
4117 } else if (features === true) {
4118 // check settings for required features
4119 if (settings.chunk_size && settings.chunk_size > 0) {
4120 caps.slice_blob = true;
4121 }
4122
4123 if (!plupload.isEmptyObj(settings.resize) || settings.multipart === false) {
4124 caps.send_binary_string = true;
4125 }
4126
4127 if (settings.http_method) {
4128 caps.use_http_method = settings.http_method;
4129 }
4130
4131 plupload.each(settings, function(value, feature) {
4132 resolve(feature, !!value, true); // strict check
4133 });
4134 }
4135
4136 return caps;
4137 }
4138
4139 function normalizeOptions(options) {

Callers 1

normalizeOptionFunction · 0.70

Calls 1

resolveFunction · 0.70

Tested by

no test coverage detected