This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

238
include/javascript/yui/build/swfstore/swf.js vendored Executable file
View File

@@ -0,0 +1,238 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
YAHOO.namespace("widget");
(function () {
var version = 0;
var UA = YAHOO.env.ua;
var sF = "ShockwaveFlash";
if (UA.gecko || UA.webkit || UA.opera) {
if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) {
if ((eP = mF.enabledPlugin)) {
var vS = [];
vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.');
version = vS[0] + '.';
switch((vS[2].toString()).length)
{
case 1:
version += "00";
break;
case 2:
version += "0";
break;
}
version += vS[2];
version = parseFloat(version);
}
}
}
else if(UA.ie) {
try
{
var ax6 = new ActiveXObject(sF + "." + sF + ".6");
ax6.AllowScriptAccess = "always";
}
catch(e)
{
if(ax6 != null)
{
version = 6.0;
}
}
if (version == 0) {
try
{
var ax = new ActiveXObject(sF + "." + sF);
var vS = [];
vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(',');
version = vS[0] + '.';
switch((vS[2].toString()).length)
{
case 1:
version += "00";
break;
case 2:
version += "0";
break;
}
version += vS[2];
version = parseFloat(version);
} catch (e) {}
}
}
UA.flash = version;
YAHOO.util.SWFDetect = {
getFlashVersion : function () {
return version;
},
isFlashVersionAtLeast : function (ver) {
return version >= ver;
}
};
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
SWFDetect = YAHOO.util.SWFDetect,
Lang = YAHOO.lang,
// private
FLASH_CID = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
FLASH_TYPE = "application/x-shockwave-flash",
FLASH_VER = "10.22",
EXPRESS_INSTALL_URL = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + Math.random(),
EVENT_HANDLER = "YAHOO.widget.SWF.eventHandler",
possibleAttributes = {align:"", allowNetworking:"", allowScriptAccess:"", base:"", bgcolor:"", menu:"", name:"", quality:"", salign:"", scale:"", tabindex:"", wmode:""};
/**
* The SWF utility is a tool for embedding Flash applications in HTMl pages.
* @module swf
* @title SWF Utility
* @requires yahoo, dom, event
* @namespace YAHOO.widget
*/
/**
* Creates the SWF instance and keeps the configuration data
*
* @class SWF
* @extends YAHOO.util.Element
* @constructor
* @param {String|HTMLElement} id The id of the element, or the element itself that the SWF will be inserted into.
* The width and height of the SWF will be set to the width and height of this container element.
* @param {String} swfURL The URL of the SWF to be embedded into the page.
* @param {Object} p_oAttributes (optional) Configuration parameters for the Flash application and values for Flashvars
* to be passed to the SWF.
*/
YAHOO.widget.SWF = function (p_oElement /*:String*/, swfURL /*:String*/, p_oAttributes /*:Object*/ ) {
this._queue = this._queue || [];
this._events = this._events || {};
this._configs = this._configs || {};
/**
* The DOM id of this instance of the element. Automatically generated.
* @property _id
* @type String
*/
this._id = Dom.generateId(null, "yuiswf");
var _id = this._id;
var oElement = Dom.get(p_oElement);
var flashVersion = (p_oAttributes["version"] || FLASH_VER);
var isFlashVersionRight = SWFDetect.isFlashVersionAtLeast(flashVersion);
var canExpressInstall = (UA.flash >= 8.0);
var shouldExpressInstall = canExpressInstall && !isFlashVersionRight && p_oAttributes["useExpressInstall"];
var flashURL = (shouldExpressInstall)?EXPRESS_INSTALL_URL:swfURL;
var objstring = '<object ';
var w, h;
var flashvarstring = "YUISwfId=" + _id + "&YUIBridgeCallback=" + EVENT_HANDLER + "&";
YAHOO.widget.SWF._instances[_id] = this;
if (oElement && (isFlashVersionRight || shouldExpressInstall) && flashURL) {
objstring += 'id="' + _id + '" ';
if (UA.ie) {
objstring += 'classid="' + FLASH_CID + '" '
}
else {
objstring += 'type="' + FLASH_TYPE + '" data="' + flashURL + '" ';
}
w = "100%";
h = "100%";
objstring += 'width="' + w + '" height="' + h + '">';
if (UA.ie) {
objstring += '<param name="movie" value="' + flashURL + '"/>';
}
for (var attribute in p_oAttributes.fixedAttributes) {
if (possibleAttributes.hasOwnProperty(attribute)) {
objstring += '<param name="' + attribute + '" value="' + p_oAttributes.fixedAttributes[attribute] + '"/>';
}
}
for (var flashvar in p_oAttributes.flashVars) {
var fvar = p_oAttributes.flashVars[flashvar];
if (Lang.isString(fvar)) {
flashvarstring += "&" + flashvar + "=" + encodeURIComponent(fvar);
}
}
if (flashvarstring) {
objstring += '<param name="flashVars" value="' + flashvarstring + '"/>';
}
objstring += "</object>";
oElement.innerHTML = objstring;
}
YAHOO.widget.SWF.superclass.constructor.call(this, Dom.get(_id));
this._swf = Dom.get(_id);
};
/**
* The static collection of all instances of the SWFs on the page.
* @property _instances
* @private
* @type Object
*/
YAHOO.widget.SWF._instances = YAHOO.widget.SWF._instances || {};
/**
* Handles an event coming from within the SWF and delegate it
* to a specific instance of SWF.
* @method eventHandler
* @param swfid {String} the id of the SWF dispatching the event
* @param event {Object} the event being transmitted.
* @private
*/
YAHOO.widget.SWF.eventHandler = function (swfid, event) {
YAHOO.widget.SWF._instances[swfid]._eventHandler(event);
};
YAHOO.extend(YAHOO.widget.SWF, YAHOO.util.Element, {
_eventHandler: function(event)
{
if (event.type == "swfReady") {
this.createEvent("swfReady");
this.fireEvent("swfReady", event);
}
else {
this.fireEvent(event.type, event);
}
},
/**
* Calls a specific function exposed by the SWF's
* ExternalInterface.
* @method callSWF
* @param func {String} the name of the function to call
* @param args {Object} the set of arguments to pass to the function.
*/
callSWF: function (func, args)
{
if (this._swf[func]) {
return(this._swf[func].apply(this._swf, args));
} else {
return null;
}
}
});
})();
YAHOO.register("swf", YAHOO.widget.SWF, {version: "2.8.0r4", build: "2449"});

View File

@@ -0,0 +1,470 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
/**
* Provides a swf based storage implementation
*
* @module swfstore
*/
/**
* Class for the YUI SWFStore util.
*
* @namespace YAHOO.util
* @class SWFStore
* @uses YAHOO.util.AttributeProvider
* @constructor
* @param containerId {HTMLElement} Container element for the Flash Player instance.
* @param shareData {Boolean} Whether or not data should be shared across browsers
* @param useCompression {Boolean} Container element for the Flash Player instance.
*/
YAHOO.util.SWFStore = function(containerID, shareData, useCompression)
{
//browser detection
var browser;
var newValue;
//convert Booleans to strings for flashvars compatibility
shareData = shareData.toString();
useCompression = useCompression.toString();
if (YAHOO.env.ua.ie) browser = "ie";
else if (YAHOO.env.ua.gecko) browser = "gecko"; //Firefox
else if (YAHOO.env.ua.webkit) browser = "webkit"; // Safari, Webkit
else if (YAHOO.env.ua.caja) browser = "caja";
else if (YAHOO.env.ua.opera) browser = "opera";
else browser = "other";
if(YAHOO.util.Cookie.get("swfstore") == null || YAHOO.util.Cookie.get("swfstore") == "null" || YAHOO.util.Cookie.get("swfstore") == "")
{
newValue = Math.round(Math.random() * Math.PI * 100000);
YAHOO.util.Cookie.set("swfstore", newValue);
}
else
{
newValue = YAHOO.util.Cookie.get("swfstore");
}
var params =
{
version: 9.115,
useExpressInstall: false,
fixedAttributes:
{allowScriptAccess:"always", allowNetworking:"all", scale:"noScale"},
flashVars:
{shareData: shareData, browser: newValue, useCompression: useCompression}
};
this.embeddedSWF = new YAHOO.widget.SWF(containerID, YAHOO.util.SWFStore.SWFURL, params);
/**
* Fires when an error occurs
*
* @event error
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("error");
/**
* Fires when there is not enough space available to store the data
*
* @event quotaExceededError
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("quotaExceededError");
/**
* Fires when the url matching for the security whitelist is invalid.
* If no whitelist is used, fires when page's url does not match the embedded swf's url
*
* @event securityError
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("securityError");
/**
* Fires when a store is saved successfully
*
* @event save
* @param event.type {String} The event type
*
*/
this.createEvent("save");
/**
* Fires when a store is successfully cleared
*
* @event clear
* @param event.type {String} The event type
*
*/
this.createEvent("clear");
/**
* Fires when the save is pending, due to a request for additional storage
*
* @event error
* @param event.type {String} The event type
*
*/
this.createEvent("pending");
/**
* Fires as the settings dialog displays
*
* @event openingDialog
* @param event.type {String} The event type
*
*/
this.createEvent("openingDialog");
/**
* Fires when a settings dialog is not able to be displayed due to
* the SWF not being large enough to show it. In this case, the developer
* needs to resize the SWF to width of 215px and height of 138px or above,
* or display an external settings page.
*
* @event inadequateDimensions
* @param event.type {String} The event type
*
*/
this.createEvent("inadequateDimensions");
};
YAHOO.extend(YAHOO.util.SWFStore, YAHOO.util.AttributeProvider,
{
/**
* Method to attach listeners to events
* @param type {String} The tyep of event to listen for
* @param listener {String} The function to call
*/
on: function(type, listener)
{
this.embeddedSWF.addListener(type, listener);
},
/**
* Method to attach listeners to events
* @param type {String} The tyep of event to listen for
* @param listener {String} The function to call
*/
addListener: function(type, listener)
{
YAHOO.log("adding '" + type + "' listener");
this.embeddedSWF.addListener(type, listener);
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method toString
* @return {String} Unique name of the SWFStore instance.
*/
toString: function()
{
return "SWFStore " + this._id;
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method getShareData
* @return {Boolean} Whether or not data is being shared among browsers
*/
getShareData: function()
{
return this.embeddedSWF.callSWF("getShareData");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method setShareData
* @param {Boolean} Whether or not to share among browsers
*/
setShareData: function(value)
{
YAHOO.log("Setting share data to " + value);
this.embeddedSWF.callSWF("setShareData", [value]);
},
/**
* Determines if SWF's visible area is large enough to fit the settings panel
*
* @method hasAdequateDimensions
* @return {Boolean} Whether or not to share among browsers
*/
hasAdequateDimensions: function()
{
YAHOO.log("dimensions adequate? " + this.embeddedSWF.callSWF("hasAdequateDimensions"));
return this.embeddedSWF.callSWF("hasAdequateDimensions");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method getUseCompression
* @return {Boolean} Whether or compression is being used
*/
getUseCompression: function()
{
return this.embeddedSWF.callSWF("getUseCompression");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method setUseCompression
* @param {Boolean} Whether or to compress stored data
*/
setUseCompression: function(value)
{
YAHOO.log("Setting compression to " + value);
this.embeddedSWF.callSWF("setUseCompression", [value]);
},
/**
* Saves data to local storage. It returns a String that can
* be one of three values: "true" if the storage succeeded; "false" if the user
* has denied storage on their machine or storage space allotted is not sufficient.
* <p>The size limit for the passed parameters is ~40Kb.</p>
* @method setItem
* @param data {Object} The data to store
* @param location {String} The name of the "cookie" or store
* @return {Boolean} Whether or not the save was successful
*
*/
setItem: function(location,data)
{
YAHOO.log("setting " + location + " to " + data);
return this.embeddedSWF.callSWF("setItem", [location, data]);
} ,
/**
* Returns the value of the store at the specified index, if any.
* @method getValueAt
* @param index {Number} The index of the stored item
* @return {Object} The value of the store at that index
*
*/
getValueAt: function(index)
{
YAHOO.log("value at " + index + " is " + this.embeddedSWF.callSWF("getValueAt", [index]) );
return this.embeddedSWF.callSWF("getValueAt", [index]);
},
/**
* Returns the key name in storage, if any, at the specified index.
*
* @param index {Number} The index of the "cookie" or store
* @return {Object}The data
* @method setItem
*
*/
getNameAt: function(index)
{
YAHOO.log("name at " + index + " is " + this.embeddedSWF.callSWF("getNameAt", [index]) );
return this.embeddedSWF.callSWF("getNameAt", [index]);
},
/**
* Returns the value of the item in storage, if any.
* @method getValueOf
* @param location {String} The name of the "cookie" or store
* @return {Object} The data
*
*/
getValueOf: function(location)
{
YAHOO.log("value of " + location + " is " + this.embeddedSWF.callSWF("getValueOf", [location]) );
return this.embeddedSWF.callSWF("getValueOf", [location]);
} ,
/**
* Returns the data type of of the storage.
* <p>May be one of the following types:
* <ul>
* <li>boolean</li>
* <li>function</li>
* <li>number</li>
* <li>object</li>
* <li>string</li>
* <li>number</li>
* <li>xml</li>
* </ul>
* </p>
* @method getTypeOf
* @param location {String} The name of the "cookie" or store
* @return {String} The type
*
*/
getTypeOf: function(location)
{
YAHOO.log("type of " + location + " is " + this.embeddedSWF.callSWF("getTypeOf", [location]) );
return this.embeddedSWF.callSWF("getTypeOf", [location]);
} ,
/**
* Returns the data type of of the storage.
* <p>May be one of the following types:
* <ul>
* <li>boolean</li>
* <li>function</li>
* <li>number</li>
* <li>object</li>
* <li>string</li>
* <li>number</li>
* <li>xml</li>
* </ul>
* </p>
* @method getTypeAt
* @param location {Number} The index of the "cookie" or store
* @return {String} The type
*
*/
getTypeAt: function(index)
{
YAHOO.log("type at " + index + " is " + this.embeddedSWF.callSWF("getTypeAt", [index]) );
return this.embeddedSWF.callSWF("getTypeAt", [index]);
} ,
/**
* Returns the items in storage as an array.
* @method getItems
* @return {Object} The data.
* @public
*/
getItems: function()
{
return this.embeddedSWF.callSWF("getItems", []);
},
/**
* Removes the item in storage, if any.
* @method removeItem
* @param location {String} The name of the "cookie" or store
*
*/
removeItem: function(location)
{
YAHOO.log("removing " + location);
return this.embeddedSWF.callSWF("removeItem", [location]);
} ,
/**
* Removes the item in storage at the specified index, if any.
* @method removeItem
* @param index {Number} The index of the "cookie" or store
*
*/
removeItemAt: function(index)
{
YAHOO.log("removing item at " + index);
return this.embeddedSWF.callSWF("removeItemAt", [index]);
} ,
/**
* Returns the number of items in storage, if any.
* @method getLength
* @return {Number} The number of items
*
*/
getLength: function()
{
return this.embeddedSWF.callSWF("getLength", []);
} ,
/**
* Removes all data in local storage for this domain.
* <p>Be careful when using this method, as it may
* remove stored information that is used by other applications
* in this domain </p>
* @method clear
*/
clear: function()
{
YAHOO.log("clearing all items");
return this.embeddedSWF.callSWF("clear", []);
} ,
/**
* Gets the current size, in KB, of the amount of space taken by the current store.
* Note that this is calculated, and may take time depending on the number of items stored
* @method calculateCurrentSize
* @return {Number} The size of the store in KB
*/
calculateCurrentSize: function()
{
YAHOO.log("calculating size");
return this.embeddedSWF.callSWF("calculateCurrentSize", []);
} ,
/**
* Gets the timestamp of the last store. This value is automatically set when
* data is stored.
* @method getModificationDate
* @return {Date} A Date object
*/
getModificationDate: function()
{
YAHOO.log("getting date");
return this.embeddedSWF.callSWF("getModificationDate", []);
} ,
/**
* This method requests more storage (if the amount is above 100KB or the current setting).
*
* The request dialog has to be displayed within the Flash player itself
* so the SWF it is called from must be visible and at least 215px x 138px (w x h) in size.
*
* @method setSize
* @param value {Number} The size, in KB
* @return {String}
*/
setSize: function(value)
{
var result = this.embeddedSWF.callSWF("setSize", [value]);
YAHOO.log("attempt to set size to " + value*1024 + " bytes resulted in " + result);
return result;
} ,
/**
* Displays the settings dialog to allow the user to configure
* storage settings manually. If the SWF height and width are smaller than
* what is allowable to display the local settings panel,
* an openExternalDialog message will be sent to JavaScript.
* @method displaySettings
*/
displaySettings: function()
{
YAHOO.log("attempting to show settings. are dimensions adequate? " + this.embeddedSWF.callSWF("hasAdequateDimensions"));
this.embeddedSWF.callSWF("displaySettings", []);
}
});
YAHOO.util.SWFStore.SWFURL = "swfstore.swf";
YAHOO.register("swfstore", YAHOO.util.SWFStore, {version: "2.8.0r4", build: "2449"});
YAHOO.register("swfstore", YAHOO.util.SWFStore, {version: "2.8.0r4", build: "2449"});

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
YAHOO.util.SWFStore=function(A,C,D){var B;var E;C=C.toString();D=D.toString();if(YAHOO.env.ua.ie){B="ie";}else{if(YAHOO.env.ua.gecko){B="gecko";}else{if(YAHOO.env.ua.webkit){B="webkit";}else{if(YAHOO.env.ua.caja){B="caja";}else{if(YAHOO.env.ua.opera){B="opera";}else{B="other";}}}}}if(YAHOO.util.Cookie.get("swfstore")==null||YAHOO.util.Cookie.get("swfstore")=="null"||YAHOO.util.Cookie.get("swfstore")==""){E=Math.round(Math.random()*Math.PI*100000);YAHOO.util.Cookie.set("swfstore",E);}else{E=YAHOO.util.Cookie.get("swfstore");}var F={version:9.115,useExpressInstall:false,fixedAttributes:{allowScriptAccess:"always",allowNetworking:"all",scale:"noScale"},flashVars:{shareData:C,browser:E,useCompression:D}};this.embeddedSWF=new YAHOO.widget.SWF(A,YAHOO.util.SWFStore.SWFURL,F);this.createEvent("error");this.createEvent("quotaExceededError");this.createEvent("securityError");this.createEvent("save");this.createEvent("clear");this.createEvent("pending");this.createEvent("openingDialog");this.createEvent("inadequateDimensions");};YAHOO.extend(YAHOO.util.SWFStore,YAHOO.util.AttributeProvider,{on:function(A,B){this.embeddedSWF.addListener(A,B);},addListener:function(A,B){this.embeddedSWF.addListener(A,B);},toString:function(){return"SWFStore "+this._id;},getShareData:function(){return this.embeddedSWF.callSWF("getShareData");},setShareData:function(A){this.embeddedSWF.callSWF("setShareData",[A]);},hasAdequateDimensions:function(){return this.embeddedSWF.callSWF("hasAdequateDimensions");},getUseCompression:function(){return this.embeddedSWF.callSWF("getUseCompression");},setUseCompression:function(A){this.embeddedSWF.callSWF("setUseCompression",[A]);},setItem:function(A,B){return this.embeddedSWF.callSWF("setItem",[A,B]);},getValueAt:function(A){return this.embeddedSWF.callSWF("getValueAt",[A]);},getNameAt:function(A){return this.embeddedSWF.callSWF("getNameAt",[A]);},getValueOf:function(A){return this.embeddedSWF.callSWF("getValueOf",[A]);},getTypeOf:function(A){return this.embeddedSWF.callSWF("getTypeOf",[A]);},getTypeAt:function(A){return this.embeddedSWF.callSWF("getTypeAt",[A]);},getItems:function(){return this.embeddedSWF.callSWF("getItems",[]);},removeItem:function(A){return this.embeddedSWF.callSWF("removeItem",[A]);},removeItemAt:function(A){return this.embeddedSWF.callSWF("removeItemAt",[A]);},getLength:function(){return this.embeddedSWF.callSWF("getLength",[]);},clear:function(){return this.embeddedSWF.callSWF("clear",[]);},calculateCurrentSize:function(){return this.embeddedSWF.callSWF("calculateCurrentSize",[]);},getModificationDate:function(){return this.embeddedSWF.callSWF("getModificationDate",[]);},setSize:function(B){var A=this.embeddedSWF.callSWF("setSize",[B]);return A;},displaySettings:function(){this.embeddedSWF.callSWF("displaySettings",[]);}});YAHOO.util.SWFStore.SWFURL="swfstore.swf";YAHOO.register("swfstore",YAHOO.util.SWFStore,{version:"2.8.0r4",build:"2449"});YAHOO.register("swfstore",YAHOO.util.SWFStore,{version:"2.8.0r4",build:"2449"});

View File

@@ -0,0 +1,453 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
/**
* Provides a swf based storage implementation
*
* @module swfstore
*/
/**
* Class for the YUI SWFStore util.
*
* @namespace YAHOO.util
* @class SWFStore
* @uses YAHOO.util.AttributeProvider
* @constructor
* @param containerId {HTMLElement} Container element for the Flash Player instance.
* @param shareData {Boolean} Whether or not data should be shared across browsers
* @param useCompression {Boolean} Container element for the Flash Player instance.
*/
YAHOO.util.SWFStore = function(containerID, shareData, useCompression)
{
//browser detection
var browser;
var newValue;
//convert Booleans to strings for flashvars compatibility
shareData = shareData.toString();
useCompression = useCompression.toString();
if (YAHOO.env.ua.ie) browser = "ie";
else if (YAHOO.env.ua.gecko) browser = "gecko"; //Firefox
else if (YAHOO.env.ua.webkit) browser = "webkit"; // Safari, Webkit
else if (YAHOO.env.ua.caja) browser = "caja";
else if (YAHOO.env.ua.opera) browser = "opera";
else browser = "other";
if(YAHOO.util.Cookie.get("swfstore") == null || YAHOO.util.Cookie.get("swfstore") == "null" || YAHOO.util.Cookie.get("swfstore") == "")
{
newValue = Math.round(Math.random() * Math.PI * 100000);
YAHOO.util.Cookie.set("swfstore", newValue);
}
else
{
newValue = YAHOO.util.Cookie.get("swfstore");
}
var params =
{
version: 9.115,
useExpressInstall: false,
fixedAttributes:
{allowScriptAccess:"always", allowNetworking:"all", scale:"noScale"},
flashVars:
{shareData: shareData, browser: newValue, useCompression: useCompression}
};
this.embeddedSWF = new YAHOO.widget.SWF(containerID, YAHOO.util.SWFStore.SWFURL, params);
/**
* Fires when an error occurs
*
* @event error
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("error");
/**
* Fires when there is not enough space available to store the data
*
* @event quotaExceededError
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("quotaExceededError");
/**
* Fires when the url matching for the security whitelist is invalid.
* If no whitelist is used, fires when page's url does not match the embedded swf's url
*
* @event securityError
* @param event.type {String} The event type
* @param event.message {String} The data
*
*/
this.createEvent("securityError");
/**
* Fires when a store is saved successfully
*
* @event save
* @param event.type {String} The event type
*
*/
this.createEvent("save");
/**
* Fires when a store is successfully cleared
*
* @event clear
* @param event.type {String} The event type
*
*/
this.createEvent("clear");
/**
* Fires when the save is pending, due to a request for additional storage
*
* @event error
* @param event.type {String} The event type
*
*/
this.createEvent("pending");
/**
* Fires as the settings dialog displays
*
* @event openingDialog
* @param event.type {String} The event type
*
*/
this.createEvent("openingDialog");
/**
* Fires when a settings dialog is not able to be displayed due to
* the SWF not being large enough to show it. In this case, the developer
* needs to resize the SWF to width of 215px and height of 138px or above,
* or display an external settings page.
*
* @event inadequateDimensions
* @param event.type {String} The event type
*
*/
this.createEvent("inadequateDimensions");
};
YAHOO.extend(YAHOO.util.SWFStore, YAHOO.util.AttributeProvider,
{
/**
* Method to attach listeners to events
* @param type {String} The tyep of event to listen for
* @param listener {String} The function to call
*/
on: function(type, listener)
{
this.embeddedSWF.addListener(type, listener);
},
/**
* Method to attach listeners to events
* @param type {String} The tyep of event to listen for
* @param listener {String} The function to call
*/
addListener: function(type, listener)
{
this.embeddedSWF.addListener(type, listener);
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method toString
* @return {String} Unique name of the SWFStore instance.
*/
toString: function()
{
return "SWFStore " + this._id;
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method getShareData
* @return {Boolean} Whether or not data is being shared among browsers
*/
getShareData: function()
{
return this.embeddedSWF.callSWF("getShareData");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method setShareData
* @param {Boolean} Whether or not to share among browsers
*/
setShareData: function(value)
{
this.embeddedSWF.callSWF("setShareData", [value]);
},
/**
* Determines if SWF's visible area is large enough to fit the settings panel
*
* @method hasAdequateDimensions
* @return {Boolean} Whether or not to share among browsers
*/
hasAdequateDimensions: function()
{
return this.embeddedSWF.callSWF("hasAdequateDimensions");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method getUseCompression
* @return {Boolean} Whether or compression is being used
*/
getUseCompression: function()
{
return this.embeddedSWF.callSWF("getUseCompression");
},
/**
* Public accessor to the unique name of the SWFStore instance.
*
* @method setUseCompression
* @param {Boolean} Whether or to compress stored data
*/
setUseCompression: function(value)
{
this.embeddedSWF.callSWF("setUseCompression", [value]);
},
/**
* Saves data to local storage. It returns a String that can
* be one of three values: "true" if the storage succeeded; "false" if the user
* has denied storage on their machine or storage space allotted is not sufficient.
* <p>The size limit for the passed parameters is ~40Kb.</p>
* @method setItem
* @param data {Object} The data to store
* @param location {String} The name of the "cookie" or store
* @return {Boolean} Whether or not the save was successful
*
*/
setItem: function(location,data)
{
return this.embeddedSWF.callSWF("setItem", [location, data]);
} ,
/**
* Returns the value of the store at the specified index, if any.
* @method getValueAt
* @param index {Number} The index of the stored item
* @return {Object} The value of the store at that index
*
*/
getValueAt: function(index)
{
return this.embeddedSWF.callSWF("getValueAt", [index]);
},
/**
* Returns the key name in storage, if any, at the specified index.
*
* @param index {Number} The index of the "cookie" or store
* @return {Object}The data
* @method setItem
*
*/
getNameAt: function(index)
{
return this.embeddedSWF.callSWF("getNameAt", [index]);
},
/**
* Returns the value of the item in storage, if any.
* @method getValueOf
* @param location {String} The name of the "cookie" or store
* @return {Object} The data
*
*/
getValueOf: function(location)
{
return this.embeddedSWF.callSWF("getValueOf", [location]);
} ,
/**
* Returns the data type of of the storage.
* <p>May be one of the following types:
* <ul>
* <li>boolean</li>
* <li>function</li>
* <li>number</li>
* <li>object</li>
* <li>string</li>
* <li>number</li>
* <li>xml</li>
* </ul>
* </p>
* @method getTypeOf
* @param location {String} The name of the "cookie" or store
* @return {String} The type
*
*/
getTypeOf: function(location)
{
return this.embeddedSWF.callSWF("getTypeOf", [location]);
} ,
/**
* Returns the data type of of the storage.
* <p>May be one of the following types:
* <ul>
* <li>boolean</li>
* <li>function</li>
* <li>number</li>
* <li>object</li>
* <li>string</li>
* <li>number</li>
* <li>xml</li>
* </ul>
* </p>
* @method getTypeAt
* @param location {Number} The index of the "cookie" or store
* @return {String} The type
*
*/
getTypeAt: function(index)
{
return this.embeddedSWF.callSWF("getTypeAt", [index]);
} ,
/**
* Returns the items in storage as an array.
* @method getItems
* @return {Object} The data.
* @public
*/
getItems: function()
{
return this.embeddedSWF.callSWF("getItems", []);
},
/**
* Removes the item in storage, if any.
* @method removeItem
* @param location {String} The name of the "cookie" or store
*
*/
removeItem: function(location)
{
return this.embeddedSWF.callSWF("removeItem", [location]);
} ,
/**
* Removes the item in storage at the specified index, if any.
* @method removeItem
* @param index {Number} The index of the "cookie" or store
*
*/
removeItemAt: function(index)
{
return this.embeddedSWF.callSWF("removeItemAt", [index]);
} ,
/**
* Returns the number of items in storage, if any.
* @method getLength
* @return {Number} The number of items
*
*/
getLength: function()
{
return this.embeddedSWF.callSWF("getLength", []);
} ,
/**
* Removes all data in local storage for this domain.
* <p>Be careful when using this method, as it may
* remove stored information that is used by other applications
* in this domain </p>
* @method clear
*/
clear: function()
{
return this.embeddedSWF.callSWF("clear", []);
} ,
/**
* Gets the current size, in KB, of the amount of space taken by the current store.
* Note that this is calculated, and may take time depending on the number of items stored
* @method calculateCurrentSize
* @return {Number} The size of the store in KB
*/
calculateCurrentSize: function()
{
return this.embeddedSWF.callSWF("calculateCurrentSize", []);
} ,
/**
* Gets the timestamp of the last store. This value is automatically set when
* data is stored.
* @method getModificationDate
* @return {Date} A Date object
*/
getModificationDate: function()
{
return this.embeddedSWF.callSWF("getModificationDate", []);
} ,
/**
* This method requests more storage (if the amount is above 100KB or the current setting).
*
* The request dialog has to be displayed within the Flash player itself
* so the SWF it is called from must be visible and at least 215px x 138px (w x h) in size.
*
* @method setSize
* @param value {Number} The size, in KB
* @return {String}
*/
setSize: function(value)
{
var result = this.embeddedSWF.callSWF("setSize", [value]);
return result;
} ,
/**
* Displays the settings dialog to allow the user to configure
* storage settings manually. If the SWF height and width are smaller than
* what is allowable to display the local settings panel,
* an openExternalDialog message will be sent to JavaScript.
* @method displaySettings
*/
displaySettings: function()
{
this.embeddedSWF.callSWF("displaySettings", []);
}
});
YAHOO.util.SWFStore.SWFURL = "swfstore.swf";
YAHOO.register("swfstore", YAHOO.util.SWFStore, {version: "2.8.0r4", build: "2449"});
YAHOO.register("swfstore", YAHOO.util.SWFStore, {version: "2.8.0r4", build: "2449"});