4
This plug in automatically gets all the cookies for this site and adds them to the post_params.
5
Cookies are loaded only on initialization. The refreshCookies function can be called to update the post_params.
6
The cookies will override any other post params with the same name.
10
if (typeof(SWFUpload) === "function") {
11
SWFUpload.prototype.initSettings = function (oldInitSettings) {
12
return function (userSettings) {
13
if (typeof(oldInitSettings) === "function") {
14
oldInitSettings.call(this, userSettings);
17
this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
19
}(SWFUpload.prototype.initSettings);
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) {
26
sendToFlash = !!sendToFlash;
28
// Get the post_params object
29
var postParams = this.settings.post_params;
32
var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
33
for (i = 0; i < caLength; i++) {
37
while (c.charAt(0) === " ") {
38
c = c.substring(1, c.length);
40
eqIndex = c.indexOf("=");
42
name = c.substring(0, eqIndex);
43
value = c.substring(eqIndex + 1);
44
postParams[name] = value;
49
this.setPostParams(postParams);