vendor: 2,684 bytes, lines 1-104
1(function($, FilePond){ 2 'use strict'; 3 4 // No jQuery No Go 5 if (!$ || !FilePond) { 6 return; 7 } 8 9 // Test if FilePond is supported 10 if (!FilePond.supported()) { 11 // add stub 12 $.fn.filepond = function() {}; 13 return; 14 } 15 16 // Helpers 17 function argsToArray(args) { 18 return Array.prototype.slice.call(args); 19 } 20 21 function isFactory(args) { 22 return !args.length || typeof args[0] === 'object'; 23 } 24 25 function isGetter(obj, key) { 26 var descriptor = Object.getOwnPropertyDescriptor(obj, key); 27 return descriptor ? typeof descriptor.get !== 'undefined' : false; 28 } 29 30 function isSetter(obj, key) { 31 var descriptor = Object.getOwnPropertyDescriptor(obj, key); 32 return descriptor ? typeof descriptor.set !== 'undefined' : false; 33 } 34 35 function isMethod(obj, key) { 36 return typeof obj[key] === 'function'; 37 } 38 39 // Setup plugin 40 $.fn.filepond = function() { 41 42 // get arguments as array 43 var args = argsToArray(arguments); 44 45 // method results array 46 var results = []; 47 48 // Execute for every item in the list 49 var items = this.each(function() { 50 51 // test if is create call 52 if (isFactory(args)) { 53 FilePond.create(this, args[0]) 54 return; 55 } 56 57 // get a reference to the pond instance based on the element 58 var pond = FilePond.find(this); 59 60 // if no pond found, exit here 61 if (!pond) { 62 return; 63 } 64 65 // get property name or method name 66 var key = args[0]; 67 68 // get params to pass 69 var params = args.concat().slice(1); 70 71 // run method 72 if (isMethod(pond, key)) { 73 results.push(pond[key].apply(pond, params)); 74 return; 75 } 76 77 // set setter 78 if (isSetter(pond, key) && params.length) { 79 pond[key] = params[0]; 80 return; 81 } 82 83 // get getter 84 if (isGetter(pond, key)) { 85 results.push(pond[key]); 86 return; 87 } 88 89 console.warn('$().filepond("' + key + '") is an unknown property or method.'); 90 }); 91 92 // returns a jQuery object if no results returned 93 return results.length ? this.length === 1 ? results[0] : results : items; 94 }; 95 96 // Static API 97 Object.keys(FilePond).forEach(function(key) { 98 $.fn.filepond[key] = FilePond[key]; 99 }); 100 101 // Redirect setDefaults to setOptions 102 $.fn.filepond.setDefaults = FilePond.setOptions; 103 104}(jQuery, FilePond));
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.