|
@@ -7,33 +7,37 @@ function checkMobile(){
|
|
|
|
|
|
// var edlp_mobile is provided by edlp_mobile.module file
|
|
|
if(typeof edlp_mobile != "undefined"){
|
|
|
- console.log(edlp_mobile);
|
|
|
- console.log('window.location', window.location);
|
|
|
+ // console.log(edlp_mobile);
|
|
|
+ // console.log('window.location', window.location);
|
|
|
var device_redirect = false;
|
|
|
var device_is_mobile = checkMobile();
|
|
|
- console.log('is_mobile_domain', edlp_mobile.is_mobile_domain);
|
|
|
- console.log('device_is_mobile', device_is_mobile);
|
|
|
+ // console.log('is_mobile_domain', edlp_mobile.is_mobile_domain);
|
|
|
+ // console.log('device_is_mobile', device_is_mobile);
|
|
|
+ edlp_mobile.device_is_mobile = device_is_mobile;
|
|
|
switch(true){
|
|
|
case (device_is_mobile && !edlp_mobile.is_mobile_domain):
|
|
|
- console.log('redirect to mobile domain', window.location.protocol +'//'+ edlp_mobile.mobile_url);
|
|
|
+ // console.log('redirect to mobile domain', window.location.protocol +'//'+ edlp_mobile.mobile_url);
|
|
|
device_redirect = true;
|
|
|
// TODO: redirect to mobile domain
|
|
|
window.location.replace(window.location.protocol +'//'+ edlp_mobile.mobile_url);
|
|
|
break;
|
|
|
case (edlp_mobile.is_mobile_domain && !device_is_mobile):
|
|
|
- console.log('redirect to desktop domain', window.location.protocol +'//'+ edlp_mobile.desktop_url);
|
|
|
+ // console.log('redirect to desktop domain', window.location.protocol +'//'+ edlp_mobile.desktop_url);
|
|
|
device_redirect = true;
|
|
|
// TODO: redirect to desktop domain
|
|
|
window.location.replace(window.location.protocol +'//'+ edlp_mobile.desktop_url);
|
|
|
break;
|
|
|
default:
|
|
|
- console.log('do not redirect');
|
|
|
+ // console.log('do not redirect');
|
|
|
break;
|
|
|
}
|
|
|
+ if(device_is_mobile){
|
|
|
+ document.documentElement.className += "is-mobile";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// var edlp is provided by edlp_ajax.module file
|
|
|
-if(edlp.redirect && !device_redirect){
|
|
|
+if(edlp.redirect && !device_redirect && !device_is_mobile){
|
|
|
console.log('redirect', edlp);
|
|
|
console.log('window.location', window.location);
|
|
|
// window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
|