=h?p=0:(-1===p||h component higher in the tree to provide a loading indicator or placeholder to display."+ut(c))}Di=!0,s=po(s,c),l=u;do{switch(l.tag){case 3:c=s,l.effectTag|=2048,l.expirationTime=i,ao(l,i=Ci(l,c,i));break e;case 1:if(c=s,u=l.type,f=l.stateNode,0==(64&l.effectTag)&&("function"==typeof u.getDerivedStateFromError||null!==f&&"function"==typeof f.componentDidCatch&&(null===Bi||!Bi.has(f)))){l.effectTag|=2048,l.expirationTime=i,ao(l,i=Ti(l,c,i));break e}}l=l.return}while(null!==l)}Ui=$i(o);continue}r=!0,Ua(t)}}break}if(Ai=!1,yo=vo=mo=Oi.currentDispatcher=null,r)Li=null,e.finishedWork=null;else if(null!==Ui)e.finishedWork=null;else{if(null===(r=e.current.alternate)&&a("281"),Li=null,Di){if(o=e.latestPendingTime,i=e.latestSuspendedTime,l=e.latestPingedTime,0!==o&&ot?0:t)):(e.pendingCommitExpirationTime=n,e.finishedWork=r)}}function Qi(e,t){for(var n=e.return;null!==n;){switch(n.tag){case 1:var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Bi||!Bi.has(r)))return io(n,e=Ti(n,e=po(t,e),1073741823)),void Zi(n,1073741823);break;case 3:return io(n,e=Ci(n,e=po(t,e),1073741823)),void Zi(n,1073741823)}n=n.return}3===e.tag&&(io(e,n=Ci(e,n=po(t,e),1073741823)),Zi(e,1073741823))}function Yi(e,t){return 0!==Fi?e=Fi:Ai?e=Wi?1073741823:Ii:1&t.mode?(e=da?1073741822-10*(1+((1073741822-e+15)/10|0)):1073741822-25*(1+((1073741822-e+500)/25|0)),null!==Li&&e===Ii&&--e):e=1073741823,da&&(0===ua||e=i){i=o=r,e.didError=!1;var a=e.latestPingedTime;(0===a||a>i)&&(e.latestPingedTime=i),Zr(i,e)}else Yr(e,o=Yi(o=_a(),t));0!=(1&t.mode)&&e===Li&&Ii===r&&(Li=null),Ji(t,o),0==(1&t.mode)&&(Ji(n,o),1===n.tag&&null!==n.stateNode&&((t=ro(o)).tag=2,io(n,t))),0!==(n=e.expirationTime)&&Sa(e,n)}function Ji(e,t){e.expirationTimeIi&&Hi(),Yr(e,t),Ai&&!Wi&&Li===e||Sa(e,e.expirationTime),ba>ga&&(ba=0,a("185")))}function ea(e,t,n,r,o){var i=Fi;Fi=1073741823;try{return e(t,n,r,o)}finally{Fi=i}}var ta=null,na=null,ra=0,oa=void 0,ia=!1,aa=null,la=0,ua=0,ca=!1,sa=null,fa=!1,pa=!1,da=!1,ha=null,ma=i.unstable_now(),va=1073741822-(ma/10|0),ya=va,ga=50,ba=0,wa=null;function Ea(){va=1073741822-((i.unstable_now()-ma)/10|0)}function ka(e,t){if(0!==ra){if(te.expirationTime&&(e.expirationTime=t),ia||(fa?pa&&(aa=e,la=1073741823,Fa(e,1073741823,!1)):1073741823===t?Oa(1073741823,!1):ka(e,t))}function Ca(){var e=0,t=null;if(null!==na)for(var n=na,r=ta;null!==r;){var o=r.expirationTime;if(0===o){if((null===n||null===na)&&a("244"),r===r.nextScheduledRoot){ta=na=r.nextScheduledRoot=null;break}if(r===ta)ta=o=r.nextScheduledRoot,na.nextScheduledRoot=o,r.nextScheduledRoot=null;else{if(r===na){(na=n).nextScheduledRoot=ta,r.nextScheduledRoot=null;break}n.nextScheduledRoot=r.nextScheduledRoot,r.nextScheduledRoot=null}r=n.nextScheduledRoot}else{if(o>e&&(e=o,t=r),r===na)break;if(1073741823===e)break;n=r,r=r.nextScheduledRoot}}aa=t,la=e}var Ta=!1;function Na(){return!!Ta||!!i.unstable_shouldYield()&&(Ta=!0)}function Pa(){try{if(!Na()&&null!==ta){Ea();var e=ta;do{var t=e.expirationTime;0!==t&&va<=t&&(e.nextExpirationTimeToWorkOn=va),e=e.nextScheduledRoot}while(e!==ta)}Oa(0,!0)}finally{Ta=!1}}function Oa(e,t){if(Ca(),t)for(Ea(),ya=va;null!==aa&&0!==la&&e<=la&&!(Ta&&va>la);)Fa(aa,la,va>la),Ca(),Ea(),ya=va;else for(;null!==aa&&0!==la&&e<=la;)Fa(aa,la,!1),Ca();if(t&&(ra=0,oa=null),0!==la&&ka(aa,la),ba=0,wa=null,null!==ha)for(e=ha,ha=null,t=0;t=n&&(null===ha?ha=[r]:ha.push(r),r._defer))return e.finishedWork=t,void(e.expirationTime=0);e.finishedWork=null,e===wa?ba++:(wa=e,ba=0),Wi=Ai=!0,e.current===t&&a("177"),0===(n=e.pendingCommitExpirationTime)&&a("261"),e.pendingCommitExpirationTime=0,r=t.expirationTime;var o=t.childExpirationTime;if(r=o>r?o:r,e.didError=!1,0===r?(e.earliestPendingTime=0,e.latestPendingTime=0,e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0):(0!==(o=e.latestPendingTime)&&(o>r?e.earliestPendingTime=e.latestPendingTime=0:e.earliestPendingTime>r&&(e.earliestPendingTime=e.latestPendingTime)),0===(o=e.earliestSuspendedTime)?Yr(e,r):ro&&Yr(e,r)),Zr(0,e),Oi.current=null,1b&&(w=b,b=g,g=w),w=Ln(x,g),E=Ln(x,b),w&&E&&(1!==S.rangeCount||S.anchorNode!==w.node||S.anchorOffset!==w.offset||S.focusNode!==E.node||S.focusOffset!==E.offset)&&((_=_.createRange()).setStart(w.node,w.offset),S.removeAllRanges(),g>b?(S.addRange(_),S.extend(E.node,E.offset)):(_.setEnd(E.node,E.offset),S.addRange(_))))),_=[];for(S=x;S=S.parentNode;)1===S.nodeType&&_.push({element:S,left:S.scrollLeft,top:S.scrollTop});for("function"==typeof x.focus&&x.focus(),x=0;x<_.length;x++)(S=_[x]).element.scrollLeft=S.left,S.element.scrollTop=S.top}for(mr=null,_n=!!hr,hr=null,e.current=t,Ri=r;null!==Ri;){r=!1,x=void 0;try{for(_=n;null!==Ri;){var C=Ri.effectTag;if(36&C){var T=Ri.alternate;switch(g=_,(S=Ri).tag){case 0:case 11:case 15:break;case 1:var N=S.stateNode;if(4&S.effectTag)if(null===T)N.componentDidMount();else{var P=S.elementType===S.type?T.memoizedProps:Mo(S.type,T.memoizedProps);N.componentDidUpdate(P,T.memoizedState,N.__reactInternalSnapshotBeforeUpdate)}var O=S.updateQueue;null!==O&&so(0,O,N);break;case 3:var M=S.updateQueue;if(null!==M){if(b=null,null!==S.child)switch(S.child.tag){case 5:b=S.child.stateNode;break;case 1:b=S.child.stateNode}so(0,M,b)}break;case 5:var F=S.stateNode;null===T&&4&S.effectTag&&vr(S.type,S.memoizedProps)&&F.focus();break;case 6:case 4:case 12:case 13:case 17:break;default:a("163")}}if(128&C){var A=Ri.ref;if(null!==A){var U=Ri.stateNode;switch(Ri.tag){case 5:var L=U;break;default:L=U}"function"==typeof A?A(L):A.current=L}}Ri=Ri.nextEffect}}catch(e){r=!0,x=e}r&&(null===Ri&&a("178"),Qi(Ri,x),null!==Ri&&(Ri=Ri.nextEffect))}Ai=Wi=!1,"function"==typeof Dr&&Dr(t.stateNode),C=t.expirationTime,0===(t=(t=t.childExpirationTime)>C?t:C)&&(Bi=null),e.expirationTime=t,e.finishedWork=null}function Ua(e){null===aa&&a("246"),aa.expirationTime=0,ca||(ca=!0,sa=e)}function La(e,t){var n=fa;fa=!0;try{return e(t)}finally{(fa=n)||ia||Oa(1073741823,!1)}}function Ia(e,t){if(fa&&!pa){pa=!0;try{return e(t)}finally{pa=!1}}return e(t)}function ja(e,t,n){if(da)return e(t,n);fa||ia||0===ua||(Oa(ua,!1),ua=0);var r=da,o=fa;fa=da=!0;try{return e(t,n)}finally{da=r,(fa=o)||ia||Oa(1073741823,!1)}}function Da(e,t,n,r,o){var i=t.current;e:if(n){t:{2===tn(n=n._reactInternalFiber)&&1===n.tag||a("170");var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(Mr(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);a("171"),l=void 0}if(1===n.tag){var u=n.type;if(Mr(u)){n=Lr(n,u,l);break e}}n=l}else n=Cr;return null===t.context?t.context=n:t.pendingContext=n,t=o,(o=ro(r)).payload={element:e},null!==(t=void 0===t?null:t)&&(o.callback=t),Gi(),io(i,o),Zi(i,r),r}function Ra(e,t,n,r){var o=t.current;return Da(e,t,n,o=Yi(_a(),o),r)}function Wa(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function za(e){var t=1073741822-25*(1+((1073741822-_a()+500)/25|0));t>=Mi&&(t=Mi-1),this._expirationTime=Mi=t,this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function Va(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function Ba(e,t,n){e={current:t=Vr(3,null,null,t?3:0),containerInfo:e,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:n,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=t.stateNode=e}function Ha(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ga(e,t,n,r,o){Ha(n)||a("200");var i=n._reactRootContainer;if(i){if("function"==typeof o){var l=o;o=function(){var e=Wa(i._internalRoot);l.call(e)}}null!=e?i.legacy_renderSubtreeIntoContainer(e,t,o):i.render(t,o)}else{if(i=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new Ba(e,!1,t)}(n,r),"function"==typeof o){var u=o;o=function(){var e=Wa(i._internalRoot);u.call(e)}}Ia(function(){null!=e?i.legacy_renderSubtreeIntoContainer(e,t,o):i.render(t,o)})}return Wa(i._internalRoot)}function $a(e,t){var n=2=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},Fe=La,Ae=ja,Ue=function(){ia||0===ua||(Oa(ua,!1),ua=0)};var qa={createPortal:$a,findDOMNode:function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;return void 0===t&&("function"==typeof e.render?a("188"):a("268",Object.keys(e))),e=null===(e=rn(t))?null:e.stateNode},hydrate:function(e,t,n){return Ga(null,e,t,!0,n)},render:function(e,t,n){return Ga(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,r){return(null==e||void 0===e._reactInternalFiber)&&a("38"),Ga(e,t,n,!1,r)},unmountComponentAtNode:function(e){return Ha(e)||a("40"),!!e._reactRootContainer&&(Ia(function(){Ga(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return $a.apply(void 0,arguments)},unstable_batchedUpdates:La,unstable_interactiveUpdates:ja,flushSync:function(e,t){ia&&a("187");var n=fa;fa=!0;try{return ea(e,t)}finally{fa=n,Oa(1073741823,!1)}},unstable_flushControlled:function(e){var t=fa;fa=!0;try{ea(e)}finally{(fa=t)||ia||Oa(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[I,j,D,P.injectEventPluginsByName,g,H,function(e){C(e,B)},Oe,Me,Nn,M]},unstable_createRoot:function(e,t){return Ha(e)||a("299","unstable_createRoot"),new Ba(e,!0,null!=t&&!0===t.hydrate)}};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);Dr=Wr(function(e){return t.onCommitFiberRoot(n,e)}),Rr=Wr(function(e){return t.onCommitFiberUnmount(n,e)})}catch(e){}})(o({},e,{findHostInstanceByFiber:function(e){return null===(e=rn(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null}}))}({findFiberByHostInstance:L,bundleType:0,version:"16.6.3",rendererPackageName:"react-dom"});var Ka={default:qa},Qa=Ka&&qa||Ka;e.exports=Qa.default||Qa},function(e,t,n){"use strict";e.exports=n(285)},function(e,t,n){"use strict";
/** @license React v16.6.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/Object.defineProperty(t,"__esModule",{value:!0});var r=null,o=!1,i=3,a=-1,l=-1,u=!1,c=!1;function s(){if(!u){var e=r.expirationTime;c?y():c=!0,v(d,e)}}function f(){var e=r,t=r.next;if(r===t)r=null;else{var n=r.previous;r=n.next=t,t.previous=n}e.next=e.previous=null,n=e.callback,t=e.expirationTime,e=e.priorityLevel;var o=i,a=l;i=e,l=t;try{var u=n()}finally{i=o,l=a}if("function"==typeof u)if(u={callback:u,priorityLevel:e,expirationTime:t,next:null,previous:null},null===r)r=u.next=u.previous=u;else{n=null,e=r;do{if(e.expirationTime>=t){n=e;break}e=e.next}while(e!==r);null===n?n=r:n===r&&(r=u,s()),(t=n.previous).next=n.previous=u,u.next=n,u.previous=t}}function p(){if(-1===a&&null!==r&&1===r.priorityLevel){u=!0;try{do{f()}while(null!==r&&1===r.priorityLevel)}finally{u=!1,null!==r?s():c=!1}}}function d(e){u=!0;var n=o;o=e;try{if(e)for(;null!==r;){var i=t.unstable_now();if(!(r.expirationTime<=i))break;do{f()}while(null!==r&&r.expirationTime<=i)}else if(null!==r)do{f()}while(null!==r&&!g())}finally{u=!1,o=n,null!==r?s():c=!1,p()}}var h,m,v,y,g,b=Date,w="function"==typeof setTimeout?setTimeout:void 0,E="function"==typeof clearTimeout?clearTimeout:void 0,k="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,x="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function _(e){h=k(function(t){E(m),e(t)}),m=w(function(){x(h),e(t.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var S=performance;t.unstable_now=function(){return S.now()}}else t.unstable_now=function(){return b.now()};if("undefined"!=typeof window&&window._schedMock){var C=window._schedMock;v=C[0],y=C[1],g=C[2]}else if("undefined"==typeof window||"function"!=typeof window.addEventListener){var T=null,N=-1,P=function(e,t){if(null!==T){var n=T;T=null;try{N=t,n(e)}finally{N=-1}}};v=function(e,t){-1!==N?setTimeout(v,0,e,t):(T=e,setTimeout(P,t,!0,t),setTimeout(P,1073741823,!1,1073741823))},y=function(){T=null},g=function(){return!1},t.unstable_now=function(){return-1===N?0:N}}else{"undefined"!=typeof console&&("function"!=typeof k&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof x&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var O=null,M=!1,F=-1,A=!1,U=!1,L=0,I=33,j=33;g=function(){return L<=t.unstable_now()};var D="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(e){if(e.source===window&&e.data===D){M=!1,e=O;var n=F;O=null,F=-1;var r=t.unstable_now(),o=!1;if(0>=L-r){if(!(-1!==n&&n<=r))return A||(A=!0,_(R)),O=e,void(F=n);o=!0}if(null!==e){U=!0;try{e(o)}finally{U=!1}}}},!1);var R=function(e){if(null!==O){_(R);var t=e-L+j;tt&&(t=8),j=tt?window.postMessage(D,"*"):A||(A=!0,_(R))},y=function(){O=null,M=!1,F=-1}}t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,n){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=i,o=a;i=e,a=t.unstable_now();try{return n()}finally{i=r,a=o,p()}},t.unstable_scheduleCallback=function(e,n){var o=-1!==a?a:t.unstable_now();if("object"==typeof n&&null!==n&&"number"==typeof n.timeout)n=o+n.timeout;else switch(i){case 1:n=o+-1;break;case 2:n=o+250;break;case 5:n=o+1073741823;break;case 4:n=o+1e4;break;default:n=o+5e3}if(e={callback:e,priorityLevel:i,expirationTime:n,next:null,previous:null},null===r)r=e.next=e.previous=e,s();else{o=null;var l=r;do{if(l.expirationTime>n){o=l;break}l=l.next}while(l!==r);null===o?o=r:o===r&&(r=e,s()),(n=o.previous).next=o.previous=e,e.next=o,e.previous=n}return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)r=null;else{e===r&&(r=t);var n=e.previous;n.next=t,t.previous=n}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=i;return function(){var r=i,o=a;i=n,a=t.unstable_now();try{return e.apply(this,arguments)}finally{i=r,a=o,p()}}},t.unstable_getCurrentPriorityLevel=function(){return i},t.unstable_shouldYield=function(){return!o&&(null!==r&&r.expirationTime= 910) {
device = "large";
} else if (width < 910 && width >= 610) {
device = "mid";
} else if (width < 610) {
device = "tablet";
}
return device;
}
function generatePopupLinks() {
let pLink = {};
pLink.plingListUrl = "/#plingList", pLink.ocsapiContentUrl = "/#ocsapiContent", pLink.aboutContentUrl = "/#aboutContent", pLink.linkTarget = "_blank";
if (window.location.hostname.indexOf('opendesktop') === -1 || window.location.hostname === "git.opendesktop.org" || window.location.hostname === "git.opendesktop.cc" || window.location.hostname === "forum.opendesktop.org" || window.location.hostname === "forum.opendesktop.cc" || window.location.hostname === "my.opendesktop.org" || window.location.hostname === "my.opendesktop.cc") {
pLink.plingListUrl = "/plings";
pLink.ocsapiContentUrl = "/partials/ocsapicontent.phtml";
pLink.aboutContentUrl = "/partials/about.phtml";
pLink.linkTarget = "";
}
return pLink;
}
function getPopupUrl(key, isExternal, baseUrl) {
let url = baseUrl;
return url;
}
return {
generateMenuGroupsArray,
getDeviceFromWidth,
generatePopupLinks,
getPopupUrl
};
}();
class MetaHeader extends React.Component {
constructor(props){
super(props);
this.state = {
domains:config.domains,
baseUrl:config.baseUrl,
blogUrl:config.blogUrl,
forumUrl:config.forumUrl,
loginUrl:config.loginUrl,
logoutUrl:config.logoutUrl,
gitlabUrl:config.gitlabUrl,
sName:config.sName,
isExternal:config.isExternal,
user:config.user,
showModal:false,
modalUrl:'',
isAdmin:config.json_isAdmin
};
this.initMetaHeader = this.initMetaHeader.bind(this);
this.updateDimensions = this.updateDimensions.bind(this);
//this.getUser = this.getUser.bind(this);
}
componentWillMount() {
this.updateDimensions();
}
componentDidMount() {
this.initMetaHeader();
}
componentWillUnmount(){
window.removeEventListener("resize", this.updateDimensions);
window.removeEventListener("orientationchange",this.updateDimensions);
}
initMetaHeader(){
window.addEventListener("resize", this.updateDimensions);
window.addEventListener("orientationchange",this.updateDimensions);
//this.getUser();
}
getUser(){
const decodedCookie = decodeURIComponent(document.cookie);
let ocs_data = decodedCookie.split('ocs_data=')[1];
if (ocs_data){
if (ocs_data.indexOf(';') > -1){ ocs_data = ocs_data.split(';')[0]; }
const user = JSON.parse(ocs_data);
this.setState({user:user});
}
}
updateDimensions(){
const width = window.innerWidth;
let device;
if (width >= 910){
device = "large";
} else if (width < 910 && width >= 610){
device = "mid";
} else if (width < 610){
device = "tablet";
}
this.setState({device:device});
}
render(){
let domainsMenuDisplay;
if (this.state.device === "tablet"){
domainsMenuDisplay = (
)
} else {
domainsMenuDisplay = (
)
}
return (
)
}
}
class DomainsMenu extends React.Component {
constructor(props){
super(props);
this.state = {
};
}
render(){
let moreMenuItemDisplay;
if (this.props.device !== "large"){
moreMenuItemDisplay = (
)
}
let adminsDropDownMenuDisplay, myOpendesktopMenuDisplay;
if (this.props.isAdmin === true){
adminsDropDownMenuDisplay = (
);
myOpendesktopMenuDisplay = (
);
}
return (
-
openDesktop.org :
{adminsDropDownMenuDisplay}
{myOpendesktopMenuDisplay}
{moreMenuItemDisplay}
)
}
}
class DomainsDropDownMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
this.handleClick = this.handleClick.bind(this);
}
componentDidMount() {
let menuGroups = [];
this.props.domains.forEach(function(domain,index){
if (menuGroups.indexOf(domain.menugroup) === -1){
menuGroups.push(domain.menugroup);
}
});
this.setState({menuGroups:menuGroups});
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "domains-menu-link-item"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
let menuGroupsDisplayLeft, menuGroupsDisplayRight;
if (this.state.menuGroups){
menuGroupsDisplayLeft = this.state.menuGroups.slice(0,2).map((mg,i) => (
));
menuGroupsDisplayRight = this.state.menuGroups.slice(2).map((mg,i) => (
));
}
return (
this.node = node} id="domains-dropdown-menu" className={this.state.dropdownClass}>
Themes & Apps
);
}
}
class DiscussionBoardsDropDownMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "discussion-menu-link-item"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
return (
this.node = node} id="discussion-boards" className={this.state.dropdownClass}>
Discussion Boards
);
}
}
class AdminsDropDownMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
this.state = {
gitlabLink:config.gitlabUrl+"/dashboard/issues?assignee_id="
};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
componentDidMount() {
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
const gitlabLink = self.state.gitlabLink + res[0].id;
self.setState({gitlabLink:gitlabLink,loading:false});
}
};
xhttp.open("GET", config.gitlabUrl+"/api/v4/users?username="+this.props.user.username, true);
xhttp.send();
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "admins-menu-link-item"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
return (
this.node = node} id="admins-dropdown-menu" className={this.state.dropdownClass}>
Development
)
}
}
class CloudsServicesDropDownMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "cd-menu-link-item"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
const urlEnding = config.baseUrl.split('opendesktop.')[1];
return (
this.node = node} id="cd-dropdown-menu" className={this.state.dropdownClass}>
Clouds & Services
)
}
}
class MoreDropDownMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "more-menu-link-item"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
let faqLinkItem, apiLinkItem, aboutLinkItem;
if (config.isExternal === false){
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
} else {
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
}
return(
this.node = node} id="more-dropdown-menu" className={this.state.dropdownClass}>
More
)
}
}
class DomainsMenuGroup extends React.Component {
constructor(props){
super(props);
this.state = {};
this.filterDomainsByMenuGroup = this.filterDomainsByMenuGroup.bind(this);
}
filterDomainsByMenuGroup(domain){
if (domain.menugroup === this.props.menuGroup){
return domain;
}
}
render(){
const domainsDisplay = this.props.domains.filter(this.filterDomainsByMenuGroup).map((domain,index) => {
let domainPrefix = "";
if (domain.menuhref.indexOf('https://') === -1 && domain.menuhref.indexOf('http://') === -1){
domainPrefix += "http://";
}
return (
{domain.name}
);
});
return (
{this.props.menuGroup}
)
}
}
class UserMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
}
render(){
let userDropdownDisplay, userAppsContextDisplay;
if (this.props.user && this.props.user.member_id){
userDropdownDisplay = (
);
userAppsContextDisplay = (
)
} else {
userDropdownDisplay = (
Login
)
}
let userMenuContainerDisplay;
if (this.props.device === "large"){
let faqLinkItem, apiLinkItem, aboutLinkItem;
if (config.isExternal === false){
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
} else {
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
}
userMenuContainerDisplay = (
);
} else {
userMenuContainerDisplay = (
);
}
return (
)
}
}
class UserContextMenuContainer extends React.Component {
constructor(props){
super(props);
this.state = {
gitlabLink:config.gitlabUrl+"/dashboard/issues?assignee_id="
};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
componentDidMount() {
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
const gitlabLink = self.state.gitlabLink + res[0].id;
self.setState({gitlabLink:gitlabLink,loading:false});
}
};
xhttp.open("GET", config.gitlabUrl+"/api/v4/users?username="+this.props.user.username, true);
xhttp.send();
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "th-icon" || e.target.className === "btn btn-default dropdown-toggle"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass});
}
render(){
return (
this.node = node} id="user-context-menu-container">
)
}
}
class UserLoginMenuContainer extends React.Component {
constructor(props){
super(props);
this.state = {};
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
document.addEventListener('mousedown',this.handleClick, false);
}
componentWillUnmount() {
document.removeEventListener('mousedown',this.handleClick, false);
}
handleClick(e){
let dropdownClass = "";
if (this.node.contains(e.target)){
if (this.state.dropdownClass === "open"){
if (e.target.className === "th-icon" || e.target.className === "btn btn-default dropdown-toggle"){
dropdownClass = "";
} else {
dropdownClass = "open";
}
} else {
dropdownClass = "open";
}
}
this.setState({dropdownClass:dropdownClass})
}
render(){
return (
)
}
}
/** MOBILE SPECIFIC **/
class MobileLeftMenu extends React.Component {
constructor(props){
super(props);
this.state = {
overlayClass:""
};
this.toggleLeftSideOverlay = this.toggleLeftSideOverlay.bind(this);
this.handleClick = this.handleClick.bind(this);
}
componentWillMount() {
window.addEventListener('mousedown',this.handleClick, false);
window.addEventListener('touchend', this.handleClick, false);
}
componentWillUnmount() {
window.removeEventListener('mousedown',this.handleClick, false);
window.addEventListener('touchend', this.handleClick, false);
}
toggleLeftSideOverlay(){
let overlayClass = "open";
if (this.state.overlayClass === "open") {
overlayClass = "";
}
this.setState({overlayClass:overlayClass});
}
handleClick(e){
let overlayClass = "";
if (this.node.contains(e.target)){
if (this.state.overlayClass === "open"){
if (e.target.id === "left-side-overlay" || e.target.id === "menu-toggle-item"){
overlayClass = "";
} else {
overlayClass = "open";
}
} else {
overlayClass = "open";
}
}
this.setState({overlayClass:overlayClass});
}
render(){
return (
this.node = node} id="metaheader-left-mobile" className={this.state.overlayClass}>
);
}
}
class MobileLeftSidePanel extends React.Component {
constructor(props){
super(props);
this.state = {};
}
componentDidMount() {
let menuGroups = [];
this.props.domains.forEach(function(domain,index){
if (menuGroups.indexOf(domain.menugroup) === -1){
menuGroups.push(domain.menugroup);
}
});
this.setState({menuGroups:menuGroups});
}
render(){
let panelMenuGroupsDisplay;
if (this.state.menuGroups){
panelMenuGroupsDisplay = this.state.menuGroups.map((mg,i) => (
));
}
let faqLinkItem, apiLinkItem, aboutLinkItem;
if (config.isExternal === false){
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
} else {
faqLinkItem = (FAQ);
apiLinkItem = (API);
aboutLinkItem = (About);
}
return (
)
}
}
customElements.define('opendesktop-metaheader', class extends HTMLElement {
constructor() {
super();
this.buildComponent();
}
async buildComponent() {
- await initConfig(this.getAttribute('config-target'));
+ await initConfig(this.getAttribute('config-target'),this.getAttribute('config-url'));
const metaheaderElement = document.createElement('div');
metaheaderElement.id = 'metaheader';
ReactDOM.render(React.createElement(MetaHeader, null), metaheaderElement);
const stylesheetElement = document.createElement('link');
stylesheetElement.rel = 'stylesheet';
stylesheetElement.href = 'https://www.opendesktop.org/theme/react/assets/css/metaheader.css';
- else if (location.hostname.endsWith('cc')) {
+ if (location.hostname.endsWith('cc')) {
stylesheetElement.href = 'https://www.opendesktop.cc/theme/react/assets/css/metaheader.css';
}
else if (location.hostname.endsWith('localhost')) {
stylesheetElement.href = 'https://www.opendesktop.cc/theme/react/assets/css/metaheader.css';
}else{
stylesheetElement.href = 'https://www.opendesktop.org/theme/react/assets/css/metaheader.css';
}
// Component must be capsule within Shadow DOM, and don't hack
// context/scope of external sites.
/*
this.attachShadow({mode: 'open'});
this.shadowRoot.appendChild(stylesheetElement);
this.shadowRoot.appendChild(metaheaderElement);
*/
// However, make this as Light DOM for now, because current
// implementation is not real component design yet.
// Need solve event handling, scoped CSS.
this.appendChild(stylesheetElement);
this.appendChild(metaheaderElement);
}
});