summaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/vaadinBootstrap.js
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-06-03 12:58:56 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-06-03 15:09:11 +0300
commitad452a36795b764aeea2b00e3ceed2bae75d7949 (patch)
tree9b522f8b93464520430d839ab1608fa372efe23a /WebContent/VAADIN/vaadinBootstrap.js
parente65231e6028892bd6847777c5bad982b73278b14 (diff)
parent44eadeaa160152616152cd33f8181d7ab1fa3359 (diff)
downloadvaadin-framework-ad452a36795b764aeea2b00e3ceed2bae75d7949.tar.gz
vaadin-framework-ad452a36795b764aeea2b00e3ceed2bae75d7949.zip
Merge branch 'master' into valo
Conflicts: WebContent/release-notes.html build.properties client/src/com/vaadin/client/ApplicationConfiguration.java Change-Id: I36f075a03350e45c8666832142d7368891af3e59
Diffstat (limited to 'WebContent/VAADIN/vaadinBootstrap.js')
-rw-r--r--WebContent/VAADIN/vaadinBootstrap.js67
1 files changed, 36 insertions, 31 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js
index bab759b812..df46d8bc72 100644
--- a/WebContent/VAADIN/vaadinBootstrap.js
+++ b/WebContent/VAADIN/vaadinBootstrap.js
@@ -67,7 +67,7 @@
// "v-app-loading" we have only received the HTML
// but not yet started the widget set
// (UIConnector removes the v-app-loading div).
- if (className && className.contains("v-app-loading")) {
+ if (className && className.indexOf("v-app-loading") != -1) {
return false;
}
}
@@ -108,29 +108,29 @@
// No special url defined, use the same URL that loaded this page (without the fragment)
url = window.location.href.replace(/#.*/,'');
}
- url += ((/\?/).test(url) ? "&" : "?") + "v-browserDetails=1";
+ // Timestamp to avoid caching
+ url += ((/\?/).test(url) ? "&" : "?") + "v-" + (new Date()).getTime();
+
+ var params = "v-browserDetails=1";
var rootId = getConfig("v-rootId");
if (rootId !== undefined) {
- url += "&v-rootId=" + rootId;
+ params += "&v-rootId=" + rootId;
}
// Tell the UI what theme it is configured to use
var theme = getConfig('theme');
if (theme !== undefined) {
- url += '&theme=' + encodeURIComponent(theme);
+ params += '&theme=' + encodeURIComponent(theme);
}
- url += "&v-appId=" + appId;
+ params += "&v-appId=" + appId;
var extraParams = getConfig('extraParams')
if (extraParams !== undefined) {
- url += extraParams;
+ params += extraParams;
}
- url += '&' + vaadin.getBrowserDetailsParameters(appId);
-
- // Timestamp to avoid caching
- url += '&v-' + (new Date()).getTime();
+ params += '&' + vaadin.getBrowserDetailsParameters(appId);
var r;
try {
@@ -168,7 +168,9 @@
}
}
};
- r.send(null);
+ // send parameters as POST data
+ r.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ r.send(params);
log('sending request to ', url);
};
@@ -229,18 +231,21 @@
loadTheme: loadTheme,
registerWidgetset: function(widgetset, callback) {
log("Widgetset registered", widgetset);
- widgetsets[widgetset].callback = callback;
- for(var i = 0; i < widgetsets[widgetset].pendingApps.length; i++) {
- var appId = widgetsets[widgetset].pendingApps[i];
- log("Starting from register widgetset", appId);
- callback(appId);
+ var ws = widgetsets[widgetset];
+ if (ws && ws.pendingApps) {
+ ws.callback = callback;
+ for(var i = 0; i < ws.pendingApps.length; i++) {
+ var appId = ws.pendingApps[i];
+ log("Starting from register widgetset", appId);
+ callback(appId);
+ }
+ ws.pendingApps = null;
}
- widgetsets[widgetset].pendingApps = null;
},
getBrowserDetailsParameters: function(parentElementId) {
// Screen height and width
- var url = 'v-sh=' + window.screen.height;
- url += '&v-sw=' + window.screen.width;
+ var params = 'v-sh=' + window.screen.height;
+ params += '&v-sw=' + window.screen.width;
// Window height and width
var cw = 0;
@@ -254,12 +259,12 @@
cw = document.documentElement.clientWidth;
ch = document.documentElement.clientHeight;
}
- url += '&v-cw=' + cw + '&v-ch=' + ch;
+ params += '&v-cw=' + cw + '&v-ch=' + ch;
var d = new Date();
- url += '&v-curdate=' + d.getTime();
+ params += '&v-curdate=' + d.getTime();
var tzo1 = d.getTimezoneOffset(); // current offset
var dstDiff = 0;
@@ -276,29 +281,29 @@
}
// Time zone offset
- url += '&v-tzo=' + tzo1;
+ params += '&v-tzo=' + tzo1;
// DST difference
- url += '&v-dstd=' + dstDiff;
+ params += '&v-dstd=' + dstDiff;
// Raw time zone offset
- url += '&v-rtzo=' + rtzo;
+ params += '&v-rtzo=' + rtzo;
// DST in effect?
- url += '&v-dston=' + (tzo1 != rtzo);
+ params += '&v-dston=' + (tzo1 != rtzo);
var pe = document.getElementById(parentElementId);
if (pe) {
- url += '&v-vw=' + pe.offsetWidth;
- url += '&v-vh=' + pe.offsetHeight;
+ params += '&v-vw=' + pe.offsetWidth;
+ params += '&v-vh=' + pe.offsetHeight;
}
// Location
- url += '&v-loc=' + encodeURIComponent(location.href);
+ params += '&v-loc=' + encodeURIComponent(location.href);
// Window name
if (window.name) {
- url += '&v-wn=' + encodeURIComponent(window.name);
+ params += '&v-wn=' + encodeURIComponent(window.name);
}
// Detect touch device support
@@ -313,10 +318,10 @@
}
if (supportsTouch) {
- url += "&v-td=1";
+ params += "&v-td=1";
}
- return url;
+ return params;
}
};