|
296 | 296 | }
|
297 | 297 | });
|
298 | 298 | };
|
299 |
| - |
300 |
| - /** |
| 299 | + |
| 300 | + /** |
301 | 301 | * Improved xhr call function, reduce some annoying configs and code required by
|
302 | 302 | * the original version (based on Promise)
|
303 | 303 | *
|
304 | 304 | * @param {object} para
|
305 | 305 | * @returns Promise the promise to fetch the result
|
306 |
| - */ |
307 |
| - _jB.prototype.promiseFetch = function (para) { |
| 306 | + */ |
| 307 | + _jB.prototype.promiseFetch = function (para) { |
308 | 308 | let defaultParams = {
|
309 | 309 | timeout: false,
|
310 | 310 | data: {},
|
|
317 | 317 | msg: ""
|
318 | 318 | };
|
319 | 319 | let params = jB.extend({}, defaultParams, para);
|
320 |
| - if (params.call === undefined || params.call === '') { |
| 320 | + if (params.call === undefined || params.call === '') { |
321 | 321 | console.error('jB.fetch: "call" parameter is not defined!');
|
322 | 322 | return;
|
323 | 323 | }
|
|
798 | 798 | //**************************************************************************
|
799 | 799 | // private methods - centralized functions
|
800 | 800 |
|
| 801 | + /** |
| 802 | + * Creates an input recoursivelly, if the value is atom just add one input, |
| 803 | + * if iterable creates recoursivelly one input for each child |
| 804 | + * |
| 805 | + * @param {string} key name of the key |
| 806 | + * @param {mixed} value the value(s) |
| 807 | + * @param {type} form the form node to insert the inputs |
| 808 | + * @returns {undefined} |
| 809 | + */ |
801 | 810 | var _recoursiveCallInput = function (key, value, form) {
|
802 | 811 | if (value instanceof Array || typeof value === 'object') {
|
803 |
| - for(let paramSubkey in value){ |
| 812 | + for (let paramSubkey in value) { |
804 | 813 | _recoursiveCallInput(key + "[" + paramSubkey + "]", value[paramSubkey], form);
|
805 | 814 | }
|
806 | 815 | } else {
|
|
825 | 834 | /**
|
826 | 835 | * Sanitize url, return url whithout any "undesired" stuff (particular chars ..)
|
827 | 836 | *
|
828 |
| - * @param {strinf} url the url to sanitize |
| 837 | + * @param {string} url the url to sanitize |
829 | 838 | * @returns {object} the response canatinig the following keys
|
830 | 839 | * - sanitized - what you're looking for, the sanitized url
|
831 | 840 | * - warning - true if the sanitize function found some "undesired" stuff
|
832 | 841 | */
|
833 | 842 | var _sanitizeUrl = function (url) {
|
834 | 843 | var sanitizedMatch = url.match(/^(.*?[a-zA-Z0-9_\/])(([$&+,:;=?@<>#%][^\/]*)?)$/);
|
835 |
| - if(sanitizedMatch === null){ |
836 |
| - if (!this.config.silentMode) { |
| 844 | + if (sanitizedMatch === null) { |
| 845 | + if (!this.config.silentMode) { |
837 | 846 | console.warn("jB: Current Url seems to be un-parsable");
|
838 | 847 | }
|
839 | 848 | }
|
|
0 commit comments