[webpack.common] added gstore field 'HOST' that contains 'https://ptut.xdrm.io' or 'http://ptut.com:8080'

This commit is contained in:
xdrm-brackets 2018-03-20 12:08:53 +01:00
parent e32ce89837
commit c8c1bf2ede
1 changed files with 8 additions and 5 deletions

View File

@ -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);