captproton-restfulx 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +50 -0
- data/Rakefile +79 -0
- data/VERSION.yml +4 -0
- data/app_generators/rx_app/USAGE +22 -0
- data/app_generators/rx_app/rx_app_generator.rb +110 -0
- data/app_generators/rx_app/templates/actionscript.properties +16 -0
- data/app_generators/rx_app/templates/actionscriptair.properties +16 -0
- data/app_generators/rx_app/templates/app.yaml.erb +12 -0
- data/app_generators/rx_app/templates/default_tasks.rake +38 -0
- data/app_generators/rx_app/templates/empty.txt +0 -0
- data/app_generators/rx_app/templates/expressInstall.swf +0 -0
- data/app_generators/rx_app/templates/flex.properties +2 -0
- data/app_generators/rx_app/templates/generate.rb +17 -0
- data/app_generators/rx_app/templates/html-template/AC_OETags.js +276 -0
- data/app_generators/rx_app/templates/html-template/history/history.css +6 -0
- data/app_generators/rx_app/templates/html-template/history/history.js +645 -0
- data/app_generators/rx_app/templates/html-template/history/historyFrame.html +29 -0
- data/app_generators/rx_app/templates/html-template/index.template.html +121 -0
- data/app_generators/rx_app/templates/html-template/playerProductInstall.swf +0 -0
- data/app_generators/rx_app/templates/index.html.erb +18 -0
- data/app_generators/rx_app/templates/index.yaml +11 -0
- data/app_generators/rx_app/templates/mainair-app.xml +134 -0
- data/app_generators/rx_app/templates/mainapp-config.xml +22 -0
- data/app_generators/rx_app/templates/mainapp.mxml +152 -0
- data/app_generators/rx_app/templates/project-textmate.erb +72 -0
- data/app_generators/rx_app/templates/project.properties +18 -0
- data/app_generators/rx_app/templates/projectair.properties +24 -0
- data/app_generators/rx_app/templates/restfulx.yml +46 -0
- data/app_generators/rx_app/templates/swfobject.js +5 -0
- data/bin/rx-gen +31 -0
- data/lib/restfulx.rb +90 -0
- data/lib/restfulx/active_foo.rb +181 -0
- data/lib/restfulx/active_record_tasks.rb +90 -0
- data/lib/restfulx/active_record_uuid_helper.rb +17 -0
- data/lib/restfulx/configuration.rb +75 -0
- data/lib/restfulx/datamapper_foo.rb +81 -0
- data/lib/restfulx/rails/recipes.rb +60 -0
- data/lib/restfulx/rails/schema_to_yaml.rb +112 -0
- data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +8 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +17 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +73 -0
- data/lib/restfulx/rails/swf_helper.rb +59 -0
- data/lib/restfulx/tasks.rb +110 -0
- data/rails_generators/rx_config/USAGE +19 -0
- data/rails_generators/rx_config/rx_config_generator.rb +151 -0
- data/rails_generators/rx_config/templates/actionscript.properties +16 -0
- data/rails_generators/rx_config/templates/actionscriptair.properties +16 -0
- data/rails_generators/rx_config/templates/expressInstall.swf +0 -0
- data/rails_generators/rx_config/templates/flex.properties +2 -0
- data/rails_generators/rx_config/templates/flex_controller.erb +4 -0
- data/rails_generators/rx_config/templates/html-template/AC_OETags.js +276 -0
- data/rails_generators/rx_config/templates/html-template/history/history.css +6 -0
- data/rails_generators/rx_config/templates/html-template/history/history.js +645 -0
- data/rails_generators/rx_config/templates/html-template/history/historyFrame.html +29 -0
- data/rails_generators/rx_config/templates/html-template/index.template.html +121 -0
- data/rails_generators/rx_config/templates/html-template/playerProductInstall.swf +0 -0
- data/rails_generators/rx_config/templates/index.erb +16 -0
- data/rails_generators/rx_config/templates/mainair-app.xml +134 -0
- data/rails_generators/rx_config/templates/mainapp-config.xml +22 -0
- data/rails_generators/rx_config/templates/mainapp.mxml +129 -0
- data/rails_generators/rx_config/templates/project-textmate.erb +72 -0
- data/rails_generators/rx_config/templates/project.properties +18 -0
- data/rails_generators/rx_config/templates/projectair.properties +24 -0
- data/rails_generators/rx_config/templates/restfulx.erb +75 -0
- data/rails_generators/rx_config/templates/restfulx.yml +65 -0
- data/rails_generators/rx_config/templates/restfulx_tasks.rake +9 -0
- data/rails_generators/rx_config/templates/routes.erb +47 -0
- data/rails_generators/rx_config/templates/session_store_flash.erb +1 -0
- data/rails_generators/rx_config/templates/swfobject.js +5 -0
- data/rails_generators/rx_controller/USAGE +10 -0
- data/rails_generators/rx_controller/rx_controller_generator.rb +31 -0
- data/rails_generators/rx_controller/templates/controller.as.erb +38 -0
- data/rails_generators/rx_main_app/USAGE +8 -0
- data/rails_generators/rx_main_app/rx_main_app_generator.rb +60 -0
- data/rails_generators/rx_main_app/templates/mainapp.mxml +129 -0
- data/rails_generators/rx_scaffold/USAGE +35 -0
- data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +242 -0
- data/rails_generators/rx_scaffold/templates/controllers/default.rb.erb +125 -0
- data/rails_generators/rx_scaffold/templates/controllers/resource_controller.rb.erb +23 -0
- data/rails_generators/rx_scaffold/templates/fixtures.yml.erb +39 -0
- data/rails_generators/rx_scaffold/templates/functional_test.rb +45 -0
- data/rails_generators/rx_scaffold/templates/helper_test.rb +4 -0
- data/rails_generators/rx_scaffold/templates/layouts/default.erb +167 -0
- data/rails_generators/rx_scaffold/templates/migration.rb.erb +46 -0
- data/rails_generators/rx_scaffold/templates/model.as.erb +73 -0
- data/rails_generators/rx_scaffold/templates/model.rb.erb +46 -0
- data/rails_generators/rx_yaml_scaffold/USAGE +51 -0
- data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +68 -0
- data/rxgen_generators/rx_config/USAGE +5 -0
- data/rxgen_generators/rx_config/rx_config_generator.rb +21 -0
- data/rxgen_generators/rx_controller/USAGE +10 -0
- data/rxgen_generators/rx_controller/rx_controller_generator.rb +41 -0
- data/rxgen_generators/rx_controller/templates/assist.py +65 -0
- data/rxgen_generators/rx_controller/templates/controller.as.erb +38 -0
- data/rxgen_generators/rx_controller/templates/iso8601.py +92 -0
- data/rxgen_generators/rx_controller/templates/restful.py +136 -0
- data/rxgen_generators/rx_main_app/USAGE +8 -0
- data/rxgen_generators/rx_main_app/rx_main_app_generator.rb +65 -0
- data/rxgen_generators/rx_main_app/templates/main.py.erb +29 -0
- data/rxgen_generators/rx_main_app/templates/mainapp.mxml +152 -0
- data/rxgen_generators/rx_scaffold/USAGE +29 -0
- data/rxgen_generators/rx_scaffold/rx_scaffold_generator.rb +194 -0
- data/rxgen_generators/rx_scaffold/templates/controller.py.erb +27 -0
- data/rxgen_generators/rx_scaffold/templates/layouts/default.erb +167 -0
- data/rxgen_generators/rx_scaffold/templates/model.as.erb +73 -0
- data/rxgen_generators/rx_scaffold/templates/model.py.erb +14 -0
- data/rxgen_generators/rx_yaml_scaffold/USAGE +45 -0
- data/rxgen_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +47 -0
- data/spec/restfulx_spec.rb +4 -0
- data/spec/spec_helper.rb +13 -0
- data/tasks/restfulx.rake +2 -0
- data/test/rails/controllers/application_controller.rb +15 -0
- data/test/rails/controllers/locations_controller.rb +93 -0
- data/test/rails/controllers/notes_controller.rb +96 -0
- data/test/rails/controllers/projects_controller.rb +93 -0
- data/test/rails/controllers/tasks_controller.rb +93 -0
- data/test/rails/controllers/users_controller.rb +93 -0
- data/test/rails/database.yml +4 -0
- data/test/rails/fixtures/locations.yml +8 -0
- data/test/rails/fixtures/notes.yml +17 -0
- data/test/rails/fixtures/projects.yml +25 -0
- data/test/rails/fixtures/simple_properties.yml +19 -0
- data/test/rails/fixtures/tasks.yml +46 -0
- data/test/rails/fixtures/users.yml +13 -0
- data/test/rails/helpers/functional_test_helper.rb +21 -0
- data/test/rails/helpers/test_helper.rb +54 -0
- data/test/rails/helpers/unit_test_helper.rb +29 -0
- data/test/rails/model.yml +35 -0
- data/test/rails/models/location.rb +4 -0
- data/test/rails/models/note.rb +3 -0
- data/test/rails/models/project.rb +4 -0
- data/test/rails/models/simple_property.rb +2 -0
- data/test/rails/models/task.rb +18 -0
- data/test/rails/models/user.rb +20 -0
- data/test/rails/schema.rb +77 -0
- data/test/rails/test.swf +1 -0
- data/test/rails/test_active_foo.rb +36 -0
- data/test/rails/test_rails_integration_functional.rb +22 -0
- data/test/rails/test_to_fxml.rb +35 -0
- data/test/rails/test_to_json.rb +23 -0
- data/test/rails/views/notes/empty_params_action.html.erb +1 -0
- data/test/rails/views/notes/index.html.erb +1 -0
- metadata +234 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<actionScriptProperties mainApplicationPath="<%= flex_project_name %>.mxml" version="3">
|
3
|
+
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored,Nested" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="<%= flex_root %>" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
|
4
|
+
<compilerSourcePath/>
|
5
|
+
<libraryPath defaultLinkType="1">
|
6
|
+
<libraryPathEntry kind="4" path=""/>
|
7
|
+
<libraryPathEntry kind="1" linkType="1" path="lib"/>
|
8
|
+
</libraryPath>
|
9
|
+
<sourceAttachmentPath/>
|
10
|
+
</compiler>
|
11
|
+
<applications>
|
12
|
+
<application path="<%= flex_project_name %>.mxml"/>
|
13
|
+
</applications>
|
14
|
+
<modules/>
|
15
|
+
<buildCSSFiles/>
|
16
|
+
</actionScriptProperties>
|
Binary file
|
@@ -0,0 +1,276 @@
|
|
1
|
+
// Flash Player Version Detection - Rev 1.6
|
2
|
+
// Detect Client Browser type
|
3
|
+
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
|
4
|
+
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
|
5
|
+
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
|
6
|
+
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
|
7
|
+
|
8
|
+
function ControlVersion()
|
9
|
+
{
|
10
|
+
var version;
|
11
|
+
var axo;
|
12
|
+
var e;
|
13
|
+
|
14
|
+
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
|
15
|
+
|
16
|
+
try {
|
17
|
+
// version will be set for 7.X or greater players
|
18
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
19
|
+
version = axo.GetVariable("$version");
|
20
|
+
} catch (e) {
|
21
|
+
}
|
22
|
+
|
23
|
+
if (!version)
|
24
|
+
{
|
25
|
+
try {
|
26
|
+
// version will be set for 6.X players only
|
27
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
28
|
+
|
29
|
+
// installed player is some revision of 6.0
|
30
|
+
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
|
31
|
+
// so we have to be careful.
|
32
|
+
|
33
|
+
// default to the first public version
|
34
|
+
version = "WIN 6,0,21,0";
|
35
|
+
|
36
|
+
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
|
37
|
+
axo.AllowScriptAccess = "always";
|
38
|
+
|
39
|
+
// safe to call for 6.0r47 or greater
|
40
|
+
version = axo.GetVariable("$version");
|
41
|
+
|
42
|
+
} catch (e) {
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
if (!version)
|
47
|
+
{
|
48
|
+
try {
|
49
|
+
// version will be set for 4.X or 5.X player
|
50
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
|
51
|
+
version = axo.GetVariable("$version");
|
52
|
+
} catch (e) {
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
if (!version)
|
57
|
+
{
|
58
|
+
try {
|
59
|
+
// version will be set for 3.X player
|
60
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
|
61
|
+
version = "WIN 3,0,18,0";
|
62
|
+
} catch (e) {
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
if (!version)
|
67
|
+
{
|
68
|
+
try {
|
69
|
+
// version will be set for 2.X player
|
70
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
71
|
+
version = "WIN 2,0,0,11";
|
72
|
+
} catch (e) {
|
73
|
+
version = -1;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
return version;
|
78
|
+
}
|
79
|
+
|
80
|
+
// JavaScript helper required to detect Flash Player PlugIn version information
|
81
|
+
function GetSwfVer(){
|
82
|
+
// NS/Opera version >= 3 check for Flash plugin in plugin array
|
83
|
+
var flashVer = -1;
|
84
|
+
|
85
|
+
if (navigator.plugins != null && navigator.plugins.length > 0) {
|
86
|
+
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
|
87
|
+
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
|
88
|
+
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
|
89
|
+
var descArray = flashDescription.split(" ");
|
90
|
+
var tempArrayMajor = descArray[2].split(".");
|
91
|
+
var versionMajor = tempArrayMajor[0];
|
92
|
+
var versionMinor = tempArrayMajor[1];
|
93
|
+
var versionRevision = descArray[3];
|
94
|
+
if (versionRevision == "") {
|
95
|
+
versionRevision = descArray[4];
|
96
|
+
}
|
97
|
+
if (versionRevision[0] == "d") {
|
98
|
+
versionRevision = versionRevision.substring(1);
|
99
|
+
} else if (versionRevision[0] == "r") {
|
100
|
+
versionRevision = versionRevision.substring(1);
|
101
|
+
if (versionRevision.indexOf("d") > 0) {
|
102
|
+
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
|
103
|
+
}
|
104
|
+
}
|
105
|
+
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
// MSN/WebTV 2.6 supports Flash 4
|
109
|
+
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
|
110
|
+
// WebTV 2.5 supports Flash 3
|
111
|
+
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
|
112
|
+
// older WebTV supports Flash 2
|
113
|
+
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
|
114
|
+
else if ( isIE && isWin && !isOpera ) {
|
115
|
+
flashVer = ControlVersion();
|
116
|
+
}
|
117
|
+
return flashVer;
|
118
|
+
}
|
119
|
+
|
120
|
+
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
|
121
|
+
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
|
122
|
+
{
|
123
|
+
versionStr = GetSwfVer();
|
124
|
+
if (versionStr == -1 ) {
|
125
|
+
return false;
|
126
|
+
} else if (versionStr != 0) {
|
127
|
+
if(isIE && isWin && !isOpera) {
|
128
|
+
// Given "WIN 2,0,0,11"
|
129
|
+
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
|
130
|
+
tempString = tempArray[1]; // "2,0,0,11"
|
131
|
+
versionArray = tempString.split(","); // ['2', '0', '0', '11']
|
132
|
+
} else {
|
133
|
+
versionArray = versionStr.split(".");
|
134
|
+
}
|
135
|
+
var versionMajor = versionArray[0];
|
136
|
+
var versionMinor = versionArray[1];
|
137
|
+
var versionRevision = versionArray[2];
|
138
|
+
|
139
|
+
// is the major.revision >= requested major.revision AND the minor version >= requested minor
|
140
|
+
if (versionMajor > parseFloat(reqMajorVer)) {
|
141
|
+
return true;
|
142
|
+
} else if (versionMajor == parseFloat(reqMajorVer)) {
|
143
|
+
if (versionMinor > parseFloat(reqMinorVer))
|
144
|
+
return true;
|
145
|
+
else if (versionMinor == parseFloat(reqMinorVer)) {
|
146
|
+
if (versionRevision >= parseFloat(reqRevision))
|
147
|
+
return true;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
function AC_AddExtension(src, ext)
|
155
|
+
{
|
156
|
+
if (src.indexOf('?') != -1)
|
157
|
+
return src.replace(/\?/, ext+'?');
|
158
|
+
else
|
159
|
+
return src + ext;
|
160
|
+
}
|
161
|
+
|
162
|
+
function AC_Generateobj(objAttrs, params, embedAttrs)
|
163
|
+
{
|
164
|
+
var str = '';
|
165
|
+
if (isIE && isWin && !isOpera)
|
166
|
+
{
|
167
|
+
str += '<object ';
|
168
|
+
for (var i in objAttrs)
|
169
|
+
str += i + '="' + objAttrs[i] + '" ';
|
170
|
+
str += '>';
|
171
|
+
for (var i in params)
|
172
|
+
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
|
173
|
+
str += '</object>';
|
174
|
+
} else {
|
175
|
+
str += '<embed ';
|
176
|
+
for (var i in embedAttrs)
|
177
|
+
str += i + '="' + embedAttrs[i] + '" ';
|
178
|
+
str += '> </embed>';
|
179
|
+
}
|
180
|
+
|
181
|
+
document.write(str);
|
182
|
+
}
|
183
|
+
|
184
|
+
function AC_FL_RunContent(){
|
185
|
+
var ret =
|
186
|
+
AC_GetArgs
|
187
|
+
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
|
188
|
+
, "application/x-shockwave-flash"
|
189
|
+
);
|
190
|
+
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
|
191
|
+
}
|
192
|
+
|
193
|
+
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
|
194
|
+
var ret = new Object();
|
195
|
+
ret.embedAttrs = new Object();
|
196
|
+
ret.params = new Object();
|
197
|
+
ret.objAttrs = new Object();
|
198
|
+
for (var i=0; i < args.length; i=i+2){
|
199
|
+
var currArg = args[i].toLowerCase();
|
200
|
+
|
201
|
+
switch (currArg){
|
202
|
+
case "classid":
|
203
|
+
break;
|
204
|
+
case "pluginspage":
|
205
|
+
ret.embedAttrs[args[i]] = args[i+1];
|
206
|
+
break;
|
207
|
+
case "src":
|
208
|
+
case "movie":
|
209
|
+
args[i+1] = AC_AddExtension(args[i+1], ext);
|
210
|
+
ret.embedAttrs["src"] = args[i+1];
|
211
|
+
ret.params[srcParamName] = args[i+1];
|
212
|
+
break;
|
213
|
+
case "onafterupdate":
|
214
|
+
case "onbeforeupdate":
|
215
|
+
case "onblur":
|
216
|
+
case "oncellchange":
|
217
|
+
case "onclick":
|
218
|
+
case "ondblClick":
|
219
|
+
case "ondrag":
|
220
|
+
case "ondragend":
|
221
|
+
case "ondragenter":
|
222
|
+
case "ondragleave":
|
223
|
+
case "ondragover":
|
224
|
+
case "ondrop":
|
225
|
+
case "onfinish":
|
226
|
+
case "onfocus":
|
227
|
+
case "onhelp":
|
228
|
+
case "onmousedown":
|
229
|
+
case "onmouseup":
|
230
|
+
case "onmouseover":
|
231
|
+
case "onmousemove":
|
232
|
+
case "onmouseout":
|
233
|
+
case "onkeypress":
|
234
|
+
case "onkeydown":
|
235
|
+
case "onkeyup":
|
236
|
+
case "onload":
|
237
|
+
case "onlosecapture":
|
238
|
+
case "onpropertychange":
|
239
|
+
case "onreadystatechange":
|
240
|
+
case "onrowsdelete":
|
241
|
+
case "onrowenter":
|
242
|
+
case "onrowexit":
|
243
|
+
case "onrowsinserted":
|
244
|
+
case "onstart":
|
245
|
+
case "onscroll":
|
246
|
+
case "onbeforeeditfocus":
|
247
|
+
case "onactivate":
|
248
|
+
case "onbeforedeactivate":
|
249
|
+
case "ondeactivate":
|
250
|
+
case "type":
|
251
|
+
case "codebase":
|
252
|
+
ret.objAttrs[args[i]] = args[i+1];
|
253
|
+
break;
|
254
|
+
case "id":
|
255
|
+
case "width":
|
256
|
+
case "height":
|
257
|
+
case "align":
|
258
|
+
case "vspace":
|
259
|
+
case "hspace":
|
260
|
+
case "class":
|
261
|
+
case "title":
|
262
|
+
case "accesskey":
|
263
|
+
case "name":
|
264
|
+
case "tabindex":
|
265
|
+
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
|
266
|
+
break;
|
267
|
+
default:
|
268
|
+
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
|
269
|
+
}
|
270
|
+
}
|
271
|
+
ret.objAttrs["classid"] = classid;
|
272
|
+
if (mimeType) ret.embedAttrs["type"] = mimeType;
|
273
|
+
return ret;
|
274
|
+
}
|
275
|
+
|
276
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
|
2
|
+
|
3
|
+
#ie_historyFrame { width: 0px; height: 0px; display:none }
|
4
|
+
#firefox_anchorDiv { width: 0px; height: 0px; display:none }
|
5
|
+
#safari_formDiv { width: 0px; height: 0px; display:none }
|
6
|
+
#safari_rememberDiv { width: 0px; height: 0px; display:none }
|
@@ -0,0 +1,645 @@
|
|
1
|
+
BrowserHistoryUtils = {
|
2
|
+
addEvent: function(elm, evType, fn, useCapture) {
|
3
|
+
useCapture = useCapture || false;
|
4
|
+
if (elm.addEventListener) {
|
5
|
+
elm.addEventListener(evType, fn, useCapture);
|
6
|
+
return true;
|
7
|
+
}
|
8
|
+
else if (elm.attachEvent) {
|
9
|
+
var r = elm.attachEvent('on' + evType, fn);
|
10
|
+
return r;
|
11
|
+
}
|
12
|
+
else {
|
13
|
+
elm['on' + evType] = fn;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
BrowserHistory = (function() {
|
19
|
+
// type of browser
|
20
|
+
var browser = {
|
21
|
+
ie: false,
|
22
|
+
firefox: false,
|
23
|
+
safari: false,
|
24
|
+
opera: false,
|
25
|
+
version: -1
|
26
|
+
};
|
27
|
+
|
28
|
+
// if setDefaultURL has been called, our first clue
|
29
|
+
// that the SWF is ready and listening
|
30
|
+
//var swfReady = false;
|
31
|
+
|
32
|
+
// the URL we'll send to the SWF once it is ready
|
33
|
+
//var pendingURL = '';
|
34
|
+
|
35
|
+
// Default app state URL to use when no fragment ID present
|
36
|
+
var defaultHash = '';
|
37
|
+
|
38
|
+
// Last-known app state URL
|
39
|
+
var currentHref = document.location.href;
|
40
|
+
|
41
|
+
// Initial URL (used only by IE)
|
42
|
+
var initialHref = document.location.href;
|
43
|
+
|
44
|
+
// Initial URL (used only by IE)
|
45
|
+
var initialHash = document.location.hash;
|
46
|
+
|
47
|
+
// History frame source URL prefix (used only by IE)
|
48
|
+
var historyFrameSourcePrefix = 'history/historyFrame.html?';
|
49
|
+
|
50
|
+
// History maintenance (used only by Safari)
|
51
|
+
var currentHistoryLength = -1;
|
52
|
+
|
53
|
+
var historyHash = [];
|
54
|
+
|
55
|
+
var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
|
56
|
+
|
57
|
+
var backStack = [];
|
58
|
+
var forwardStack = [];
|
59
|
+
|
60
|
+
var currentObjectId = null;
|
61
|
+
|
62
|
+
//UserAgent detection
|
63
|
+
var useragent = navigator.userAgent.toLowerCase();
|
64
|
+
|
65
|
+
if (useragent.indexOf("opera") != -1) {
|
66
|
+
browser.opera = true;
|
67
|
+
} else if (useragent.indexOf("msie") != -1) {
|
68
|
+
browser.ie = true;
|
69
|
+
browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
|
70
|
+
} else if (useragent.indexOf("safari") != -1) {
|
71
|
+
browser.safari = true;
|
72
|
+
browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
|
73
|
+
} else if (useragent.indexOf("gecko") != -1) {
|
74
|
+
browser.firefox = true;
|
75
|
+
}
|
76
|
+
|
77
|
+
if (browser.ie == true && browser.version == 7) {
|
78
|
+
window["_ie_firstload"] = false;
|
79
|
+
}
|
80
|
+
|
81
|
+
// Accessor functions for obtaining specific elements of the page.
|
82
|
+
function getHistoryFrame()
|
83
|
+
{
|
84
|
+
return document.getElementById('ie_historyFrame');
|
85
|
+
}
|
86
|
+
|
87
|
+
function getAnchorElement()
|
88
|
+
{
|
89
|
+
return document.getElementById('firefox_anchorDiv');
|
90
|
+
}
|
91
|
+
|
92
|
+
function getFormElement()
|
93
|
+
{
|
94
|
+
return document.getElementById('safari_formDiv');
|
95
|
+
}
|
96
|
+
|
97
|
+
function getRememberElement()
|
98
|
+
{
|
99
|
+
return document.getElementById("safari_remember_field");
|
100
|
+
}
|
101
|
+
|
102
|
+
/* Get the Flash player object for performing ExternalInterface callbacks. */
|
103
|
+
function getPlayer(objectId) {
|
104
|
+
var objectId = objectId || null;
|
105
|
+
var player = null; /* AJH, needed? = document.getElementById(getPlayerId()); */
|
106
|
+
if (browser.ie && objectId != null) {
|
107
|
+
player = document.getElementById(objectId);
|
108
|
+
}
|
109
|
+
if (player == null) {
|
110
|
+
player = document.getElementsByTagName('object')[0];
|
111
|
+
}
|
112
|
+
|
113
|
+
if (player == null || player.object == null) {
|
114
|
+
player = document.getElementsByTagName('embed')[0];
|
115
|
+
}
|
116
|
+
|
117
|
+
return player;
|
118
|
+
}
|
119
|
+
|
120
|
+
function getPlayers() {
|
121
|
+
var players = [];
|
122
|
+
if (players.length == 0) {
|
123
|
+
var tmp = document.getElementsByTagName('object');
|
124
|
+
players = tmp;
|
125
|
+
}
|
126
|
+
|
127
|
+
if (players.length == 0 || players[0].object == null) {
|
128
|
+
var tmp = document.getElementsByTagName('embed');
|
129
|
+
players = tmp;
|
130
|
+
}
|
131
|
+
return players;
|
132
|
+
}
|
133
|
+
|
134
|
+
function getIframeHash() {
|
135
|
+
var doc = getHistoryFrame().contentWindow.document;
|
136
|
+
var hash = String(doc.location.search);
|
137
|
+
if (hash.length == 1 && hash.charAt(0) == "?") {
|
138
|
+
hash = "";
|
139
|
+
}
|
140
|
+
else if (hash.length >= 2 && hash.charAt(0) == "?") {
|
141
|
+
hash = hash.substring(1);
|
142
|
+
}
|
143
|
+
return hash;
|
144
|
+
}
|
145
|
+
|
146
|
+
/* Get the current location hash excluding the '#' symbol. */
|
147
|
+
function getHash() {
|
148
|
+
// It would be nice if we could use document.location.hash here,
|
149
|
+
// but it's faulty sometimes.
|
150
|
+
var idx = document.location.href.indexOf('#');
|
151
|
+
return (idx >= 0) ? document.location.href.substr(idx+1) : '';
|
152
|
+
}
|
153
|
+
|
154
|
+
/* Get the current location hash excluding the '#' symbol. */
|
155
|
+
function setHash(hash) {
|
156
|
+
// It would be nice if we could use document.location.hash here,
|
157
|
+
// but it's faulty sometimes.
|
158
|
+
if (hash == '') hash = '#'
|
159
|
+
document.location.hash = hash;
|
160
|
+
}
|
161
|
+
|
162
|
+
function createState(baseUrl, newUrl, flexAppUrl) {
|
163
|
+
return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
|
164
|
+
}
|
165
|
+
|
166
|
+
/* Add a history entry to the browser.
|
167
|
+
* baseUrl: the portion of the location prior to the '#'
|
168
|
+
* newUrl: the entire new URL, including '#' and following fragment
|
169
|
+
* flexAppUrl: the portion of the location following the '#' only
|
170
|
+
*/
|
171
|
+
function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
|
172
|
+
|
173
|
+
//delete all the history entries
|
174
|
+
forwardStack = [];
|
175
|
+
|
176
|
+
if (browser.ie) {
|
177
|
+
//Check to see if we are being asked to do a navigate for the first
|
178
|
+
//history entry, and if so ignore, because it's coming from the creation
|
179
|
+
//of the history iframe
|
180
|
+
if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
|
181
|
+
currentHref = initialHref;
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
|
185
|
+
newUrl = baseUrl + '#' + defaultHash;
|
186
|
+
flexAppUrl = defaultHash;
|
187
|
+
} else {
|
188
|
+
// for IE, tell the history frame to go somewhere without a '#'
|
189
|
+
// in order to get this entry into the browser history.
|
190
|
+
getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
|
191
|
+
}
|
192
|
+
setHash(flexAppUrl);
|
193
|
+
} else {
|
194
|
+
|
195
|
+
//ADR
|
196
|
+
if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
|
197
|
+
initialState = createState(baseUrl, newUrl, flexAppUrl);
|
198
|
+
} else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
|
199
|
+
backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
|
200
|
+
}
|
201
|
+
|
202
|
+
if (browser.safari) {
|
203
|
+
// for Safari, submit a form whose action points to the desired URL
|
204
|
+
if (browser.version <= 419.3) {
|
205
|
+
var file = window.location.pathname.toString();
|
206
|
+
file = file.substring(file.lastIndexOf("/")+1);
|
207
|
+
getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
|
208
|
+
//get the current elements and add them to the form
|
209
|
+
var qs = window.location.search.substring(1);
|
210
|
+
var qs_arr = qs.split("&");
|
211
|
+
for (var i = 0; i < qs_arr.length; i++) {
|
212
|
+
var tmp = qs_arr[i].split("=");
|
213
|
+
var elem = document.createElement("input");
|
214
|
+
elem.type = "hidden";
|
215
|
+
elem.name = tmp[0];
|
216
|
+
elem.value = tmp[1];
|
217
|
+
document.forms.historyForm.appendChild(elem);
|
218
|
+
}
|
219
|
+
document.forms.historyForm.submit();
|
220
|
+
} else {
|
221
|
+
top.location.hash = flexAppUrl;
|
222
|
+
}
|
223
|
+
// We also have to maintain the history by hand for Safari
|
224
|
+
historyHash[history.length] = flexAppUrl;
|
225
|
+
_storeStates();
|
226
|
+
} else {
|
227
|
+
// Otherwise, write an anchor into the page and tell the browser to go there
|
228
|
+
addAnchor(flexAppUrl);
|
229
|
+
setHash(flexAppUrl);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
backStack.push(createState(baseUrl, newUrl, flexAppUrl));
|
233
|
+
}
|
234
|
+
|
235
|
+
function _storeStates() {
|
236
|
+
if (browser.safari) {
|
237
|
+
getRememberElement().value = historyHash.join(",");
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
function handleBackButton() {
|
242
|
+
//The "current" page is always at the top of the history stack.
|
243
|
+
var current = backStack.pop();
|
244
|
+
if (!current) { return; }
|
245
|
+
var last = backStack[backStack.length - 1];
|
246
|
+
if (!last && backStack.length == 0){
|
247
|
+
last = initialState;
|
248
|
+
}
|
249
|
+
forwardStack.push(current);
|
250
|
+
}
|
251
|
+
|
252
|
+
function handleForwardButton() {
|
253
|
+
//summary: private method. Do not call this directly.
|
254
|
+
|
255
|
+
var last = forwardStack.pop();
|
256
|
+
if (!last) { return; }
|
257
|
+
backStack.push(last);
|
258
|
+
}
|
259
|
+
|
260
|
+
function handleArbitraryUrl() {
|
261
|
+
//delete all the history entries
|
262
|
+
forwardStack = [];
|
263
|
+
}
|
264
|
+
|
265
|
+
/* Called periodically to poll to see if we need to detect navigation that has occurred */
|
266
|
+
function checkForUrlChange() {
|
267
|
+
|
268
|
+
if (browser.ie) {
|
269
|
+
if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
|
270
|
+
//This occurs when the user has navigated to a specific URL
|
271
|
+
//within the app, and didn't use browser back/forward
|
272
|
+
//IE seems to have a bug where it stops updating the URL it
|
273
|
+
//shows the end-user at this point, but programatically it
|
274
|
+
//appears to be correct. Do a full app reload to get around
|
275
|
+
//this issue.
|
276
|
+
if (browser.version < 7) {
|
277
|
+
currentHref = document.location.href;
|
278
|
+
document.location.reload();
|
279
|
+
} else {
|
280
|
+
if (getHash() != getIframeHash()) {
|
281
|
+
// this.iframe.src = this.blankURL + hash;
|
282
|
+
var sourceToSet = historyFrameSourcePrefix + getHash();
|
283
|
+
getHistoryFrame().src = sourceToSet;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
if (browser.safari) {
|
290
|
+
// For Safari, we have to check to see if history.length changed.
|
291
|
+
if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
|
292
|
+
//alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
|
293
|
+
// If it did change, then we have to look the old state up
|
294
|
+
// in our hand-maintained array since document.location.hash
|
295
|
+
// won't have changed, then call back into BrowserManager.
|
296
|
+
currentHistoryLength = history.length;
|
297
|
+
var flexAppUrl = historyHash[currentHistoryLength];
|
298
|
+
if (flexAppUrl == '') {
|
299
|
+
//flexAppUrl = defaultHash;
|
300
|
+
}
|
301
|
+
//ADR: to fix multiple
|
302
|
+
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
|
303
|
+
var pl = getPlayers();
|
304
|
+
for (var i = 0; i < pl.length; i++) {
|
305
|
+
pl[i].browserURLChange(flexAppUrl);
|
306
|
+
}
|
307
|
+
} else {
|
308
|
+
getPlayer().browserURLChange(flexAppUrl);
|
309
|
+
}
|
310
|
+
_storeStates();
|
311
|
+
}
|
312
|
+
}
|
313
|
+
if (browser.firefox) {
|
314
|
+
if (currentHref != document.location.href) {
|
315
|
+
var bsl = backStack.length;
|
316
|
+
|
317
|
+
var urlActions = {
|
318
|
+
back: false,
|
319
|
+
forward: false,
|
320
|
+
set: false
|
321
|
+
}
|
322
|
+
|
323
|
+
if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
|
324
|
+
urlActions.back = true;
|
325
|
+
// FIXME: could this ever be a forward button?
|
326
|
+
// we can't clear it because we still need to check for forwards. Ugg.
|
327
|
+
// clearInterval(this.locationTimer);
|
328
|
+
handleBackButton();
|
329
|
+
}
|
330
|
+
|
331
|
+
// first check to see if we could have gone forward. We always halt on
|
332
|
+
// a no-hash item.
|
333
|
+
if (forwardStack.length > 0) {
|
334
|
+
if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
|
335
|
+
urlActions.forward = true;
|
336
|
+
handleForwardButton();
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
// ok, that didn't work, try someplace back in the history stack
|
341
|
+
if ((bsl >= 2) && (backStack[bsl - 2])) {
|
342
|
+
if (backStack[bsl - 2].flexAppUrl == getHash()) {
|
343
|
+
urlActions.back = true;
|
344
|
+
handleBackButton();
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
if (!urlActions.back && !urlActions.forward) {
|
349
|
+
var foundInStacks = {
|
350
|
+
back: -1,
|
351
|
+
forward: -1
|
352
|
+
}
|
353
|
+
|
354
|
+
for (var i = 0; i < backStack.length; i++) {
|
355
|
+
if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
|
356
|
+
arbitraryUrl = true;
|
357
|
+
foundInStacks.back = i;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
for (var i = 0; i < forwardStack.length; i++) {
|
361
|
+
if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
|
362
|
+
arbitraryUrl = true;
|
363
|
+
foundInStacks.forward = i;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
handleArbitraryUrl();
|
367
|
+
}
|
368
|
+
|
369
|
+
// Firefox changed; do a callback into BrowserManager to tell it.
|
370
|
+
currentHref = document.location.href;
|
371
|
+
var flexAppUrl = getHash();
|
372
|
+
if (flexAppUrl == '') {
|
373
|
+
//flexAppUrl = defaultHash;
|
374
|
+
}
|
375
|
+
//ADR: to fix multiple
|
376
|
+
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
|
377
|
+
var pl = getPlayers();
|
378
|
+
for (var i = 0; i < pl.length; i++) {
|
379
|
+
pl[i].browserURLChange(flexAppUrl);
|
380
|
+
}
|
381
|
+
} else {
|
382
|
+
getPlayer().browserURLChange(flexAppUrl);
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
//setTimeout(checkForUrlChange, 50);
|
387
|
+
}
|
388
|
+
|
389
|
+
/* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
|
390
|
+
function addAnchor(flexAppUrl)
|
391
|
+
{
|
392
|
+
if (document.getElementsByName(flexAppUrl).length == 0) {
|
393
|
+
getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
var _initialize = function () {
|
398
|
+
if (browser.ie)
|
399
|
+
{
|
400
|
+
var scripts = document.getElementsByTagName('script');
|
401
|
+
for (var i = 0, s; s = scripts[i]; i++) {
|
402
|
+
if (s.src.indexOf("history.js") > -1) {
|
403
|
+
var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
|
404
|
+
}
|
405
|
+
}
|
406
|
+
historyFrameSourcePrefix = iframe_location + "?";
|
407
|
+
var src = historyFrameSourcePrefix;
|
408
|
+
|
409
|
+
var iframe = document.createElement("iframe");
|
410
|
+
iframe.id = 'ie_historyFrame';
|
411
|
+
iframe.name = 'ie_historyFrame';
|
412
|
+
//iframe.src = historyFrameSourcePrefix;
|
413
|
+
try {
|
414
|
+
document.body.appendChild(iframe);
|
415
|
+
} catch(e) {
|
416
|
+
setTimeout(function() {
|
417
|
+
document.body.appendChild(iframe);
|
418
|
+
}, 0);
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
422
|
+
if (browser.safari)
|
423
|
+
{
|
424
|
+
var rememberDiv = document.createElement("div");
|
425
|
+
rememberDiv.id = 'safari_rememberDiv';
|
426
|
+
document.body.appendChild(rememberDiv);
|
427
|
+
rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
|
428
|
+
|
429
|
+
var formDiv = document.createElement("div");
|
430
|
+
formDiv.id = 'safari_formDiv';
|
431
|
+
document.body.appendChild(formDiv);
|
432
|
+
|
433
|
+
var reloader_content = document.createElement('div');
|
434
|
+
reloader_content.id = 'safarireloader';
|
435
|
+
var scripts = document.getElementsByTagName('script');
|
436
|
+
for (var i = 0, s; s = scripts[i]; i++) {
|
437
|
+
if (s.src.indexOf("history.js") > -1) {
|
438
|
+
html = (new String(s.src)).replace(".js", ".html");
|
439
|
+
}
|
440
|
+
}
|
441
|
+
reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
|
442
|
+
document.body.appendChild(reloader_content);
|
443
|
+
reloader_content.style.position = 'absolute';
|
444
|
+
reloader_content.style.left = reloader_content.style.top = '-9999px';
|
445
|
+
iframe = reloader_content.getElementsByTagName('iframe')[0];
|
446
|
+
|
447
|
+
if (document.getElementById("safari_remember_field").value != "" ) {
|
448
|
+
historyHash = document.getElementById("safari_remember_field").value.split(",");
|
449
|
+
}
|
450
|
+
|
451
|
+
}
|
452
|
+
|
453
|
+
if (browser.firefox)
|
454
|
+
{
|
455
|
+
var anchorDiv = document.createElement("div");
|
456
|
+
anchorDiv.id = 'firefox_anchorDiv';
|
457
|
+
document.body.appendChild(anchorDiv);
|
458
|
+
}
|
459
|
+
|
460
|
+
//setTimeout(checkForUrlChange, 50);
|
461
|
+
}
|
462
|
+
|
463
|
+
return {
|
464
|
+
historyHash: historyHash,
|
465
|
+
backStack: function() { return backStack; },
|
466
|
+
forwardStack: function() { return forwardStack },
|
467
|
+
getPlayer: getPlayer,
|
468
|
+
initialize: function(src) {
|
469
|
+
_initialize(src);
|
470
|
+
},
|
471
|
+
setURL: function(url) {
|
472
|
+
document.location.href = url;
|
473
|
+
},
|
474
|
+
getURL: function() {
|
475
|
+
return document.location.href;
|
476
|
+
},
|
477
|
+
getTitle: function() {
|
478
|
+
return document.title;
|
479
|
+
},
|
480
|
+
setTitle: function(title) {
|
481
|
+
try {
|
482
|
+
backStack[backStack.length - 1].title = title;
|
483
|
+
} catch(e) { }
|
484
|
+
//if on safari, set the title to be the empty string.
|
485
|
+
if (browser.safari) {
|
486
|
+
if (title == "") {
|
487
|
+
try {
|
488
|
+
var tmp = window.location.href.toString();
|
489
|
+
title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
|
490
|
+
} catch(e) {
|
491
|
+
title = "";
|
492
|
+
}
|
493
|
+
}
|
494
|
+
}
|
495
|
+
document.title = title;
|
496
|
+
},
|
497
|
+
setDefaultURL: function(def)
|
498
|
+
{
|
499
|
+
defaultHash = def;
|
500
|
+
def = getHash();
|
501
|
+
//trailing ? is important else an extra frame gets added to the history
|
502
|
+
//when navigating back to the first page. Alternatively could check
|
503
|
+
//in history frame navigation to compare # and ?.
|
504
|
+
if (browser.ie)
|
505
|
+
{
|
506
|
+
window['_ie_firstload'] = true;
|
507
|
+
var sourceToSet = historyFrameSourcePrefix + def;
|
508
|
+
var func = function() {
|
509
|
+
getHistoryFrame().src = sourceToSet;
|
510
|
+
window.location.replace("#" + def);
|
511
|
+
setInterval(checkForUrlChange, 50);
|
512
|
+
}
|
513
|
+
try {
|
514
|
+
func();
|
515
|
+
} catch(e) {
|
516
|
+
window.setTimeout(function() { func(); }, 0);
|
517
|
+
}
|
518
|
+
}
|
519
|
+
|
520
|
+
if (browser.safari)
|
521
|
+
{
|
522
|
+
currentHistoryLength = history.length;
|
523
|
+
if (historyHash.length == 0) {
|
524
|
+
historyHash[currentHistoryLength] = def;
|
525
|
+
var newloc = "#" + def;
|
526
|
+
window.location.replace(newloc);
|
527
|
+
} else {
|
528
|
+
//alert(historyHash[historyHash.length-1]);
|
529
|
+
}
|
530
|
+
//setHash(def);
|
531
|
+
setInterval(checkForUrlChange, 50);
|
532
|
+
}
|
533
|
+
|
534
|
+
|
535
|
+
if (browser.firefox || browser.opera)
|
536
|
+
{
|
537
|
+
var reg = new RegExp("#" + def + "$");
|
538
|
+
if (window.location.toString().match(reg)) {
|
539
|
+
} else {
|
540
|
+
var newloc ="#" + def;
|
541
|
+
window.location.replace(newloc);
|
542
|
+
}
|
543
|
+
setInterval(checkForUrlChange, 50);
|
544
|
+
//setHash(def);
|
545
|
+
}
|
546
|
+
|
547
|
+
},
|
548
|
+
|
549
|
+
/* Set the current browser URL; called from inside BrowserManager to propagate
|
550
|
+
* the application state out to the container.
|
551
|
+
*/
|
552
|
+
setBrowserURL: function(flexAppUrl, objectId) {
|
553
|
+
if (browser.ie && typeof objectId != "undefined") {
|
554
|
+
currentObjectId = objectId;
|
555
|
+
}
|
556
|
+
//fromIframe = fromIframe || false;
|
557
|
+
//fromFlex = fromFlex || false;
|
558
|
+
//alert("setBrowserURL: " + flexAppUrl);
|
559
|
+
//flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
|
560
|
+
|
561
|
+
var pos = document.location.href.indexOf('#');
|
562
|
+
var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
|
563
|
+
var newUrl = baseUrl + '#' + flexAppUrl;
|
564
|
+
|
565
|
+
if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
|
566
|
+
currentHref = newUrl;
|
567
|
+
addHistoryEntry(baseUrl, newUrl, flexAppUrl);
|
568
|
+
currentHistoryLength = history.length;
|
569
|
+
}
|
570
|
+
|
571
|
+
return false;
|
572
|
+
},
|
573
|
+
|
574
|
+
browserURLChange: function(flexAppUrl) {
|
575
|
+
var objectId = null;
|
576
|
+
if (browser.ie && currentObjectId != null) {
|
577
|
+
objectId = currentObjectId;
|
578
|
+
}
|
579
|
+
pendingURL = '';
|
580
|
+
|
581
|
+
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
|
582
|
+
var pl = getPlayers();
|
583
|
+
for (var i = 0; i < pl.length; i++) {
|
584
|
+
try {
|
585
|
+
pl[i].browserURLChange(flexAppUrl);
|
586
|
+
} catch(e) { }
|
587
|
+
}
|
588
|
+
} else {
|
589
|
+
try {
|
590
|
+
getPlayer(objectId).browserURLChange(flexAppUrl);
|
591
|
+
} catch(e) { }
|
592
|
+
}
|
593
|
+
|
594
|
+
currentObjectId = null;
|
595
|
+
}
|
596
|
+
|
597
|
+
}
|
598
|
+
|
599
|
+
})();
|
600
|
+
|
601
|
+
// Initialization
|
602
|
+
|
603
|
+
// Automated unit testing and other diagnostics
|
604
|
+
|
605
|
+
function setURL(url)
|
606
|
+
{
|
607
|
+
document.location.href = url;
|
608
|
+
}
|
609
|
+
|
610
|
+
function backButton()
|
611
|
+
{
|
612
|
+
history.back();
|
613
|
+
}
|
614
|
+
|
615
|
+
function forwardButton()
|
616
|
+
{
|
617
|
+
history.forward();
|
618
|
+
}
|
619
|
+
|
620
|
+
function goForwardOrBackInHistory(step)
|
621
|
+
{
|
622
|
+
history.go(step);
|
623
|
+
}
|
624
|
+
|
625
|
+
//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
|
626
|
+
(function(i) {
|
627
|
+
var u =navigator.userAgent;var e=/*@cc_on!@*/false;
|
628
|
+
var st = setTimeout;
|
629
|
+
if(/webkit/i.test(u)){
|
630
|
+
st(function(){
|
631
|
+
var dr=document.readyState;
|
632
|
+
if(dr=="loaded"||dr=="complete"){i()}
|
633
|
+
else{st(arguments.callee,10);}},10);
|
634
|
+
} else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
|
635
|
+
document.addEventListener("DOMContentLoaded",i,false);
|
636
|
+
} else if(e){
|
637
|
+
(function(){
|
638
|
+
var t=document.createElement('doc:rdy');
|
639
|
+
try{t.doScroll('left');
|
640
|
+
i();t=null;
|
641
|
+
}catch(e){st(arguments.callee,0);}})();
|
642
|
+
} else{
|
643
|
+
window.onload=i;
|
644
|
+
}
|
645
|
+
})( function() {BrowserHistory.initialize();} );
|