3c99f4ac50e57032ef9c2dea434f1a512c8c50b2
[portal.git] / portal-FE-os / src / app / shared / utils / utils.js
1 function getCookies() {
2     var cookies = { };
3     if (document.cookie && document.cookie != '') {
4         var split = document.cookie.split(';');
5         for (var i = 0; i < split.length; i++) {
6             var name_value = split[i].split("=");
7             name_value[0] = name_value[0].replace(/^ /, '');
8             cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
9         }
10     }
11     return cookies;
12 }
13
14 function getContextRoot(){
15         var pathName = window.location.pathname;
16         var pathArray = pathName.split( '/' );
17         var contextRoot='';
18         if(pathArray.length!=0 && pathArray.length>=1)
19                 contextRoot = pathArray[1];
20         return contextRoot;
21 }