browser_wev8.js
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
Copyright (c) 2004-2005, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.storage.browser");
dojo.require("dojo.storage");
dojo.require("dojo.uri.*");
dojo.storage.browser.StorageProvider = function(){
this.initialized = false;
this.flash = null;
this.backlog = [];
}
dojo.inherits( dojo.storage.browser.StorageProvider,
dojo.storage.StorageProvider);
dojo.lang.extend(dojo.storage.browser.StorageProvider, {
storageOnLoad: function(){
this.initialized = true;
this.hideStore();
while(this.backlog.length){
this.set.apply(this, this.backlog.shift());
}
},
unHideStore: function(){
var container = dojo.byId("dojo-storeContainer");
with(container.style){
position = "absolute";
overflow = "visible";
width = "215px";
height = "138px";
// FIXME: make these positions dependent on screen size/scrolling!
left = "30px";
top = "30px";
visiblity = "visible";
zIndex = "20";
border = "1px solid black";
}
},
hideStore: function(status){
var container = dojo.byId("dojo-storeContainer");
with(container.style){
left = "-300px";
top = "-300px";
}
},
set: function(key, value, ns){
if(!this.initialized){
this.backlog.push([key, value, ns]);
return "pending";
}
return this.flash.set(key, value, ns||this.namespace);
},
get: function(key, ns){
return this.flash.get(key, ns||this.namespace);
},
writeStorage: function(){
var swfloc = dojo.uri.dojoUri("src/storage/Storage.swf").toString();
// alert(swfloc);
var storeParts = [
'<div id="dojo-storeContainer"',
'style="position: absolute; left: -300px; top: -300px;">'];
if(dojo.render.html.ie){
storeParts.push('<object');
storeParts.push(' style="border: 1px solid black;"');
storeParts.push(' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
storeParts.push(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
storeParts.push(' width="215" height="138" id="dojoStorage">');
storeParts.push(' <param name="movie" value="'+swfloc+'">');
storeParts.push(' <param name="quality" value="high">');
storeParts.push('</object>');
}else{
storeParts.push('<embed src="'+swfloc+'" width="215" height="138" ');
storeParts.push(' quality="high" ');
storeParts.push(' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
storeParts.push(' type="application/x-shockwave-flash" ');
storeParts.push(' name="dojoStorage">');
storeParts.push('</embed>');
}
storeParts.push('</div>');
document.write(storeParts.join(""));
}
});
dojo.storage.setProvider(new dojo.storage.browser.StorageProvider());
dojo.storage.provider.writeStorage();
dojo.addOnLoad(function(){
dojo.storage.provider.flash = (dojo.render.html.ie) ? window["dojoStorage"] : document["dojoStorage"];
});