+ }(SWFUpload.prototype.displayDebugInfo);
+}
|
|
|
|
| 8 | 8 | |
| 9 | 9 | var SWFUpload; |
| 10 | 10 | if (typeof(SWFUpload) === "function") { |
| 11 | | SWFUpload.prototype.initSettings = function (old_initSettings) { |
| 12 | | return function (init_settings) { |
| 13 | | if (typeof(old_initSettings) === "function") { |
| 14 | | old_initSettings.call(this, init_settings); |
| | 11 | SWFUpload.prototype.initSettings = function (oldInitSettings) { |
| | 12 | return function () { |
| | 13 | if (typeof(oldInitSettings) === "function") { |
| | 14 | oldInitSettings.call(this); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point |
| 18 | 18 | }; |
| 19 | 19 | }(SWFUpload.prototype.initSettings); |
| 20 | 20 | |
| 21 | | // refreshes the post_params and updates SWFUpload. The send_to_flash parameters is optional and defaults to True |
| 22 | | SWFUpload.prototype.refreshCookies = function (send_to_flash) { |
| 23 | | if (send_to_flash !== false) send_to_flash = true; |
| | 21 | // refreshes the post_params and updates SWFUpload. The sendToFlash parameters is optional and defaults to True |
| | 22 | SWFUpload.prototype.refreshCookies = function (sendToFlash) { |
| | 23 | if (sendToFlash === undefined) { |
| | 24 | sendToFlash = true; |
| | 25 | } |
| | 26 | sendToFlash = !!sendToFlash; |
| 24 | 27 | |
| 25 | 28 | // Get the post_params object |
| 26 | | var post_params = this.getSetting("post_params"); |
| | 29 | var postParams = this.settings.post_params; |
| 27 | 30 | |
| 28 | 31 | // Get the cookies |
| 29 | | var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value; |
| 30 | | for(i = 0; i < ca_length; i++) { |
| 31 | | c = cookie_array[i]; |
| | 32 | var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value; |
| | 33 | for (i = 0; i < caLength; i++) { |
| | 34 | c = cookieArray[i]; |
| 32 | 35 | |
| 33 | 36 | // Left Trim spaces |
| 34 | | while (c.charAt(0) == " ") { |
| | 37 | while (c.charAt(0) === " ") { |
| 35 | 38 | c = c.substring(1, c.length); |
| 36 | 39 | } |
| 37 | | eq_index = c.indexOf("="); |
| 38 | | if (eq_index > 0) { |
| 39 | | name = c.substring(0, eq_index); |
| 40 | | value = c.substring(eq_index+1); |
| 41 | | post_params[name] = value; |
| | 40 | eqIndex = c.indexOf("="); |
| | 41 | if (eqIndex > 0) { |
| | 42 | name = c.substring(0, eqIndex); |
| | 43 | value = c.substring(eqIndex + 1); |
| | 44 | postParams[name] = value; |
| 42 | 45 | } |
| 43 | 46 | } |
| 44 | 47 | |
| 45 | | if (send_to_flash) { |
| 46 | | this.setPostParams(post_params); |
| | 48 | if (sendToFlash) { |
| | 49 | this.setPostParams(postParams); |
| 47 | 50 | } |
| 48 | 51 | }; |
| 49 | 52 | |