From c8c1bf2ede56426dd8307ab0411504fca878e8e3 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 20 Mar 2018 12:08:53 +0100 Subject: [PATCH] [webpack.common] added gstore field 'HOST' that contains 'https://ptut.xdrm.io' or 'http://ptut.com:8080' --- webpack/data/common.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/webpack/data/common.js b/webpack/data/common.js index 70e9b69..f83fb68 100644 --- a/webpack/data/common.js +++ b/webpack/data/common.js @@ -9,19 +9,22 @@ window.gstore = new GlobalStore(); /* (1) Global data ---------------------------------------------------------*/ -/* (1) Get Full URI */ +/* (1) Get URL host */ +gstore.add('HOST', document.URL.replace(/^((?:https?:\/\/)?[^\/]+)*(?:.+)$/, '$1')); + +/* (2) Get list of URI arguments */ gstore.add('URI', document.URL.replace(/^(?:\/\/|[^\/]+)*/, '').split('/').filter(function(i){ return i.length; })); -/* (2) Get if local version or prod */ +/* (3) Get if local version or prod */ gstore.add('is_local', document.URL.replace(/^https?:\/\/([^\/:]+).*$/, '$1') == 'ptut.com'); -/* (3) API instance */ +/* (4) API instance */ window.api = new APIClient(gstore.get.is_local ? 'http://ptut.com:8080/api/v/1.0/' : 'https://ptut.xdrm.io/api/v/1.0/'); -/* (4) PopUp instance */ +/* (5) PopUp instance */ window.popup = new PopUp(); -/* (5) Create class in window */ +/* (6) Create class in window */ window.onblur = new OnBlurManager(document.body);