Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
86 ashish 1
<html>
2
<head><script>
3
var $wnd = parent;
4
var $doc = $wnd.document;
5
var $moduleName, $moduleBase, $entry
6
,$stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null
7
,$sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;
8
// Lightweight metrics
9
if ($stats) {
10
  var moduleFuncName = location.search.substr(1);
11
  var moduleFunc = $wnd[moduleFuncName];
12
  var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
13
  $stats({moduleName:moduleName,sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalStart'});
14
}
15
var $hostedHtmlVersion="2.0";
16
 
17
var gwtOnLoad;
18
var $hosted = "localhost:9997";
19
 
20
function loadIframe(url) {
21
  var topDoc = window.top.document;
22
 
23
  // create an iframe
24
  var iframeDiv = topDoc.createElement("div");
25
  iframeDiv.innerHTML = "<iframe scrolling=no frameborder=0 src='" + url + "'>";
26
  var iframe = iframeDiv.firstChild;
27
 
28
  // mess with the iframe style a little
29
  var iframeStyle = iframe.style;
30
  iframeStyle.position = "absolute";
31
  iframeStyle.borderWidth = "0";
32
  iframeStyle.left = "0";
33
  iframeStyle.top = "0";
34
  iframeStyle.width = "100%";
35
  iframeStyle.backgroundColor = "#ffffff";
36
  iframeStyle.zIndex = "1";
37
  iframeStyle.height = "100%";
38
 
39
  // update the top window's document's body's style
40
  var hostBodyStyle = window.top.document.body.style; 
41
  hostBodyStyle.margin = "0";
42
  hostBodyStyle.height = iframeStyle.height;
43
  hostBodyStyle.overflow = "hidden";
44
 
45
  // insert the iframe
46
  topDoc.body.insertBefore(iframe, topDoc.body.firstChild);
47
}
48
 
49
var ua = navigator.userAgent.toLowerCase();
50
if (ua.indexOf("gecko") != -1) {
51
  // install eval wrapper on FF to avoid EvalError problem
52
  var __eval = window.eval;
53
  window.eval = function(s) {
54
    return __eval(s);
55
  }
56
}
57
if (ua.indexOf("chrome") != -1) {
58
  // work around __gwt_ObjectId appearing in JS objects
59
  var hop = Object.prototype.hasOwnProperty;
60
  Object.prototype.hasOwnProperty = function(prop) {
61
    return prop != "__gwt_ObjectId" && hop.call(this, prop);
62
  };
63
}
64
 
65
// wrapper to call JS methods, which we need both to be able to supply a
66
// different this for method lookup and to get the exception back
67
function __gwt_jsInvoke(thisObj, methodName) {
68
  try {
69
    var args = Array.prototype.slice.call(arguments, 2);
70
    return [0, window[methodName].apply(thisObj, args)];
71
  } catch (e) {
72
    return [1, e];
73
  }
74
}
75
 
76
var __gwt_javaInvokes = [];
77
function __gwt_makeJavaInvoke(argCount) {
78
  return __gwt_javaInvokes[argCount] || __gwt_doMakeJavaInvoke(argCount);
79
}
80
 
81
function __gwt_doMakeJavaInvoke(argCount) {
82
  // IE6 won't eval() anonymous functions except as r-values
83
  var argList = "";
84
  for (var i = 0; i < argCount; i++) {
85
    argList += ",p" + i;
86
  }
87
  var argListNoComma = argList.substring(1);
88
 
89
  return eval(
90
    "__gwt_javaInvokes[" + argCount + "] =\n" +
91
    "  function(thisObj, dispId" + argList + ") {\n" +
92
    "    var result = __static(dispId, thisObj" + argList + ");\n" +
93
    "    if (result[0]) {\n" +
94
    "      throw result[1];\n" +
95
    "    } else {\n" +
96
    "      return result[1];\n" +
97
    "    }\n" +
98
    "  }\n"
99
  ); 
100
}
101
 
102
/*
103
 * This is used to create tear-offs of Java methods.  Each function corresponds
104
 * to exactly one dispId, and also embeds the argument count.  We get the "this"
105
 * value from the context in which the function is being executed.
106
 * Function-object identity is preserved by caching in a sparse array.
107
 */
108
var __gwt_tearOffs = [];
109
var __gwt_tearOffGenerators = [];
110
function __gwt_makeTearOff(proxy, dispId, argCount) {
111
  return __gwt_tearOffs[dispId] || __gwt_doMakeTearOff(dispId, argCount);
112
}
113
 
114
function __gwt_doMakeTearOff(dispId, argCount) {
115
  return __gwt_tearOffs[dispId] = 
116
      (__gwt_tearOffGenerators[argCount] || __gwt_doMakeTearOffGenerator(argCount))(dispId);
117
}
118
 
119
function __gwt_doMakeTearOffGenerator(argCount) {
120
  // IE6 won't eval() anonymous functions except as r-values
121
  var argList = "";
122
  for (var i = 0; i < argCount; i++) {
123
    argList += ",p" + i;
124
  }
125
  var argListNoComma = argList.substring(1);
126
 
127
  return eval(
128
    "__gwt_tearOffGenerators[" + argCount + "] =\n" +
129
    "  function(dispId) {\n" +
130
    "    return function(" + argListNoComma + ") {\n" +
131
    "      var result = __static(dispId, this" + argList + ");\n" +
132
    "      if (result[0]) {\n" +
133
    "        throw result[1];\n" +
134
    "      } else {\n" +
135
    "        return result[1];\n" +
136
    "      }\n" +
137
    "    }\n" +
138
    "  }\n"
139
  ); 
140
}
141
 
142
function __gwt_makeResult(isException, result) {
143
  return [isException, result];
144
}
145
 
146
function __gwt_disconnected() {
147
  // Prevent double-invocation.
148
  window.__gwt_disconnected = new Function();
149
  // Do it in a timeout so we can be sure we have a clean stack.
150
  window.setTimeout(__gwt_disconnected_impl, 1);
151
}
152
 
153
function __gwt_disconnected_impl() {
154
  var topWin = window.top;
155
  var topDoc = topWin.document;
156
  var outer = topDoc.createElement("div");
157
  // Do not insert whitespace or outer.firstChild will get a text node.
158
  outer.innerHTML = 
159
    '<div style="position:absolute;z-index:2147483646;left:0px;top:0px;right:0px;bottom:0px;filter:alpha(opacity=75);opacity:0.75;background-color:#000000;"></div>' +
160
    '<div style="position:absolute;z-index:2147483647;left:50px;top:50px;width:600px;color:#FFFFFF;font-family:verdana;">' +
161
      '<div style="font-size:30px;font-weight:bold;">GWT Code Server Disconnected</div>' +
162
      '<p style="font-size:15px;"> Most likely, you closed GWT development mode. Or you might have lost network connectivity. To fix this, try restarting GWT Development Mode and <a style="color: #FFFFFF; font-weight: bold;" href="javascript:location.reload()">REFRESH</a> this page.</p>' +
163
    '</div>'
164
  ;
165
  topDoc.body.appendChild(outer);
166
  var glass = outer.firstChild;
167
  var glassStyle = glass.style;
168
 
169
  // Scroll to the top and remove scrollbars.
170
  topWin.scrollTo(0, 0);
171
  if (topDoc.compatMode == "BackCompat") {
172
    topDoc.body.style["overflow"] = "hidden";
173
  } else {
174
    topDoc.documentElement.style["overflow"] = "hidden";
175
  }
176
 
177
  // Steal focus.
178
  glass.focus();
179
 
180
  if ((navigator.userAgent.indexOf("MSIE") >= 0) && (topDoc.compatMode == "BackCompat")) {
181
    // IE quirks mode doesn't support right/bottom, but does support this.
182
    glassStyle.width = "125%";
183
    glassStyle.height = "100%";
184
  } else if (navigator.userAgent.indexOf("MSIE 6") >= 0) {
185
    // IE6 doesn't have a real standards mode, so we have to use hacks.
186
    glassStyle.width = "125%"; // Get past scroll bar area.
187
    // Nasty CSS; onresize would be better but the outer window won't let us add a listener IE.
188
    glassStyle.setExpression("height", "document.documentElement.clientHeight");
189
  }
190
}
191
 
192
function findPluginObject() {
193
  try {
194
    return document.getElementById('pluginObject');
195
  } catch (e) {
196
    return null;
197
  }
198
}
199
 
200
function findPluginEmbed() {
201
  try {
202
    return document.getElementById('pluginEmbed')
203
  } catch (e) {
204
    return null;
205
  }
206
}
207
 
208
function findPluginXPCOM() {
209
  try {
210
    return __gwt_HostedModePlugin;
211
  } catch (e) {
212
    return null;
213
  }
214
}
215
 
216
gwtOnLoad = function(errFn, modName, modBase){
217
  $moduleName = modName;
218
  $moduleBase = modBase;
219
 
220
  // Note that the order is important
221
  var pluginFinders = [
222
    findPluginXPCOM,
223
    findPluginObject,
224
    findPluginEmbed,
225
  ];
226
  var topWin = window.top;
227
  var url = topWin.location.href;
228
  if (!topWin.__gwt_SessionID) {
229
    var ASCII_EXCLAMATION = 33;
230
    var ASCII_TILDE = 126;
231
    var chars = [];
232
    for (var i = 0; i < 16; ++i) {
233
      chars.push(Math.floor(ASCII_EXCLAMATION
234
          + Math.random() * (ASCII_TILDE - ASCII_EXCLAMATION + 1)));
235
    }
236
    topWin.__gwt_SessionID = String.fromCharCode.apply(null, chars);
237
  }
238
  var plugin = null;
239
  for (var i = 0; i < pluginFinders.length; ++i) {
240
    try {
241
      var maybePlugin = pluginFinders[i]();
242
      if (maybePlugin != null && maybePlugin.init(window)) {
243
        plugin = maybePlugin;
244
        break;
245
      }
246
    } catch (e) {
247
    }
248
  }
249
  if (!plugin) {
250
    // try searching for a v1 plugin for backwards compatibility
251
    var found = false;
252
    for (var i = 0; i < pluginFinders.length; ++i) {
253
      try {
254
        plugin = pluginFinders[i]();
255
        if (plugin != null && plugin.connect($hosted, $moduleName, window)) {
256
          return;
257
        }
258
      } catch (e) {
259
      }
260
    }
261
    loadIframe("http://gwt.google.com/missing-plugin");
262
  } else {
263
    if (plugin.connect(url, topWin.__gwt_SessionID, $hosted, $moduleName,
264
        $hostedHtmlVersion)) {
265
      window.onUnload = function() {
266
        try {
267
          // wrap in try/catch since plugins are not required to supply this
268
          plugin.disconnect();
269
        } catch (e) {
270
        }
271
      };
272
    } else {
273
      if (errFn) {
274
        errFn(modName);
275
      } else {
276
        alert("Plugin failed to connect to hosted mode server at " + $hosted);
277
        loadIframe("http://code.google.com/p/google-web-toolkit/wiki/TroubleshootingOOPHM");
278
      }
279
    }
280
  }
281
}
282
 
283
window.onunload = function() {
284
};
285
 
286
// Lightweight metrics
287
window.fireOnModuleLoadStart = function(className) {
288
  $stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'onModuleLoadStart', className:className});
289
};
290
 
291
window.__gwt_module_id = 0;
292
</script></head>
293
<body>
294
<font face='arial' size='-1'>This html file is for hosted mode support.</font>
295
<script><!--
296
// Lightweight metrics
297
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'moduleEvalEnd'});
298
 
299
// OOPHM currently only supports IFrameLinker
300
var query = parent.location.search;
301
if (!findPluginXPCOM()) {
302
  document.write('<embed id="pluginEmbed" type="application/x-gwt-hosted-mode" width="10" height="10">');
303
  document.write('</embed>');
304
  document.write('<object id="pluginObject" CLASSID="CLSID:1D6156B6-002B-49E7-B5CA-C138FB843B4E">');
305
  document.write('</object>');
306
}
307
 
308
// look for the old query parameter if we don't find the new one
309
var idx = query.indexOf("gwt.codesvr=");
310
if (idx >= 0) {
311
  idx += 12;  // "gwt.codesvr=".length() == 12
312
} else {
313
  idx = query.indexOf("gwt.hosted=");
314
  if (idx >= 0) {
315
    idx += 11;  // "gwt.hosted=".length() == 11
316
  }
317
}
318
if (idx >= 0) {
319
  var amp = query.indexOf("&", idx);
320
  if (amp >= 0) {
321
    $hosted = query.substring(idx, amp);
322
  } else {
323
    $hosted = query.substring(idx);
324
  }
325
 
326
  // According to RFC 3986, some of this component's characters (e.g., ':')
327
  // are reserved and *may* be escaped.
328
  $hosted = decodeURIComponent($hosted);
329
}
330
 
331
query = window.location.search.substring(1);
332
if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
333
--></script></body></html>