File indexing completed on 2024-12-22 05:34:45

0001 window.appHelpers = (function(){
0002 
0003   function generateMenuGroupsArray(domains){
0004     let menuGroups = [];
0005     domains.forEach(function(domain,index){
0006       if (menuGroups.indexOf(domain.menugroup) === -1){
0007         menuGroups.push(domain.menugroup);
0008       }
0009     });
0010     return menuGroups;
0011   }
0012 
0013   function getDeviceFromWidth(width){
0014     let device;
0015     if (width >= 910){
0016       device = "large";
0017     } else if (width < 910 && width >= 610){
0018       device = "mid";
0019     } else if (width < 610){
0020       device = "tablet";
0021     }
0022     return device;
0023   }
0024 
0025   function generatePopupLinks(){
0026 
0027     let pLink = {};
0028       pLink.plingListUrl = "/#plingList",
0029       pLink.ocsapiContentUrl = "/#ocsapiContent",
0030       pLink.aboutContentUrl = "/#aboutContent",
0031       pLink.linkTarget = "_blank";
0032 
0033     if (window.location.hostname.indexOf('opendesktop') === -1 ||
0034         window.location.hostname === "git.opendesktop.org" || window.location.hostname === "git.opendesktop.cc" ||
0035         window.location.hostname === "forum.opendesktop.org" || window.location.hostname === "forum.opendesktop.cc" ||
0036         window.location.hostname === "my.opendesktop.org" || window.location.hostname === "my.opendesktop.cc" ){
0037         pLink.plingListUrl = "/plings";
0038         pLink.ocsapiContentUrl = "/partials/ocsapicontent.phtml";
0039         pLink.aboutContentUrl = "/partials/about.phtml";
0040         pLink.linkTarget = "";
0041     }
0042     return pLink;
0043   }
0044 
0045   function getPopupUrl(key,isExternal,baseUrl){
0046     let url = baseUrl;
0047     return url;
0048   }
0049 
0050   return {
0051     generateMenuGroupsArray,
0052     getDeviceFromWidth,
0053     generatePopupLinks,
0054     getPopupUrl
0055   }
0056 
0057 }());