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

Function initControls

js/plupload.dev.js:3889–4018  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

3887
3888
3889 function initControls(cb) {
3890 var self = this;
3891 var initialized = 0;
3892 var queue = [];
3893
3894 // common settings
3895 var options = {
3896 runtime_order: self.getOption('runtimes'),
3897 required_caps: self.getOption('required_features'),
3898 preferred_caps: self.getOption('preferred_caps'),
3899 swf_url: self.getOption('flash_swf_url'),
3900 xap_url: self.getOption('silverlight_xap_url')
3901 };
3902
3903 // add runtime specific options if any
3904 plupload.each(self.getOption('runtimes').split(/\s*,\s*/), function(runtime) {
3905 if (self.getOption(runtime)) {
3906 options[runtime] = self.getOption(runtime);
3907 }
3908 });
3909
3910 // initialize file pickers - there can be many
3911 if (self.getOption('browse_button')) {
3912 plupload.each(self.getOption('browse_button'), function(el) {
3913 queue.push(function(cb) {
3914 var fileInput = new moxie.file.FileInput(plupload.extend({}, options, {
3915 accept: self.getOption('filters').mime_types,
3916 name: self.getOption('file_data_name'),
3917 multiple: self.getOption('multi_selection'),
3918 container: self.getOption('container'),
3919 browse_button: el
3920 }));
3921
3922 fileInput.onready = function() {
3923 var info = plupload.Runtime.getInfo(this.ruid);
3924
3925 // for backward compatibility
3926 plupload.extend(self.features, {
3927 chunks: info.can('slice_blob'),
3928 multipart: info.can('send_multipart'),
3929 multi_selection: info.can('select_multiple')
3930 });
3931
3932 initialized++;
3933 _fileInputs.push(this);
3934 cb();
3935 };
3936
3937 fileInput.onchange = function() {
3938 self.addFile(this.files);
3939 };
3940
3941 fileInput.bind('mouseenter mouseleave mousedown mouseup', function(e) {
3942 if (!_disabled) {
3943 if (self.getOption('browse_button_hover')) {
3944 if ('mouseenter' === e.type) {
3945 plupload.addClass(el, self.getOption('browse_button_hover'));
3946 } else if ('mouseleave' === e.type) {

Callers

nothing calls this directly

Calls 1

cbFunction · 0.85

Tested by

no test coverage detected