=h?p=0:(-1===p||h component higher in the tree to provide a loading indicator or placeholder to display."+ut(c))}Do=!0,s=pi(s,c),l=u;do{switch(l.tag){case 3:c=s,l.effectTag|=2048,l.expirationTime=o,ai(l,o=Co(l,c,o));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===Bo||!Bo.has(f)))){l.effectTag|=2048,l.expirationTime=o,ai(l,o=To(l,c,o));break e}}l=l.return}while(null!==l)}Fo=$o(i);continue}r=!0,Fa(t)}}break}if(Ao=!1,vi=mi=hi=Oo.currentDispatcher=null,r)Io=null,e.finishedWork=null;else if(null!==Fo)e.finishedWork=null;else{if(null===(r=e.current.alternate)&&a("281"),Io=null,Do){if(i=e.latestPendingTime,o=e.latestSuspendedTime,l=e.latestPingedTime,0!==i&&it?0:t)):(e.pendingCommitExpirationTime=n,e.finishedWork=r)}}function Qo(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===Bo||!Bo.has(r)))return oi(n,e=To(n,e=pi(t,e),1073741823)),void Zo(n,1073741823);break;case 3:return oi(n,e=Co(n,e=pi(t,e),1073741823)),void Zo(n,1073741823)}n=n.return}3===e.tag&&(oi(e,n=Co(e,n=pi(t,e),1073741823)),Zo(e,1073741823))}function Yo(e,t){return 0!==Uo?e=Uo:Ao?e=Wo?1073741823:Lo:1&t.mode?(e=da?1073741822-10*(1+((1073741822-e+15)/10|0)):1073741822-25*(1+((1073741822-e+500)/25|0)),null!==Io&&e===Lo&&--e):e=1073741823,da&&(0===ua||e=o){o=i=r,e.didError=!1;var a=e.latestPingedTime;(0===a||a>o)&&(e.latestPingedTime=o),Zr(o,e)}else Yr(e,i=Yo(i=_a(),t));0!=(1&t.mode)&&e===Io&&Lo===r&&(Io=null),Jo(t,i),0==(1&t.mode)&&(Jo(n,i),1===n.tag&&null!==n.stateNode&&((t=ri(i)).tag=2,oi(n,t))),0!==(n=e.expirationTime)&&Sa(e,n)}function Jo(e,t){e.expirationTimeLo&&Ho(),Yr(e,t),Ao&&!Wo&&Io===e||Sa(e,e.expirationTime),ba>ya&&(ba=0,a("185")))}function ea(e,t,n,r,i){var o=Uo;Uo=1073741823;try{return e(t,n,r,i)}finally{Uo=o}}var ta=null,na=null,ra=0,ia=void 0,oa=!1,aa=null,la=0,ua=0,ca=!1,sa=null,fa=!1,pa=!1,da=!1,ha=null,ma=o.unstable_now(),va=1073741822-(ma/10|0),ga=va,ya=50,ba=0,wa=null;function Ea(){va=1073741822-((o.unstable_now()-ma)/10|0)}function ka(e,t){if(0!==ra){if(te.expirationTime&&(e.expirationTime=t),oa||(fa?pa&&(aa=e,la=1073741823,Ua(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 i=r.expirationTime;if(0===i){if((null===n||null===na)&&a("244"),r===r.nextScheduledRoot){ta=na=r.nextScheduledRoot=null;break}if(r===ta)ta=i=r.nextScheduledRoot,na.nextScheduledRoot=i,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(i>e&&(e=i,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||!!o.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(),ga=va;null!==aa&&0!==la&&e<=la&&!(Ta&&va>la);)Ua(aa,la,va>la),Ca(),Ea(),ga=va;else for(;null!==aa&&0!==la&&e<=la;)Ua(aa,la,!1),Ca();if(t&&(ra=0,ia=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),Wo=Ao=!0,e.current===t&&a("177"),0===(n=e.pendingCommitExpirationTime)&&a("261"),e.pendingCommitExpirationTime=0,r=t.expirationTime;var i=t.childExpirationTime;if(r=i>r?i:r,e.didError=!1,0===r?(e.earliestPendingTime=0,e.latestPendingTime=0,e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0):(0!==(i=e.latestPendingTime)&&(i>r?e.earliestPendingTime=e.latestPendingTime=0:e.earliestPendingTime>r&&(e.earliestPendingTime=e.latestPendingTime)),0===(i=e.earliestSuspendedTime)?Yr(e,r):ri&&Yr(e,r)),Zr(0,e),Oo.current=null,1b&&(w=b,b=y,y=w),w=In(x,y),E=In(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(),y>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,Ro=r;null!==Ro;){r=!1,x=void 0;try{for(_=n;null!==Ro;){var C=Ro.effectTag;if(36&C){var T=Ro.alternate;switch(y=_,(S=Ro).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:Oi(S.type,T.memoizedProps);N.componentDidUpdate(P,T.memoizedState,N.__reactInternalSnapshotBeforeUpdate)}var O=S.updateQueue;null!==O&&si(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}si(0,M,b)}break;case 5:var U=S.stateNode;null===T&&4&S.effectTag&&vr(S.type,S.memoizedProps)&&U.focus();break;case 6:case 4:case 12:case 13:case 17:break;default:a("163")}}if(128&C){var A=Ro.ref;if(null!==A){var F=Ro.stateNode;switch(Ro.tag){case 5:var I=F;break;default:I=F}"function"==typeof A?A(I):A.current=I}}Ro=Ro.nextEffect}}catch(e){r=!0,x=e}r&&(null===Ro&&a("178"),Qo(Ro,x),null!==Ro&&(Ro=Ro.nextEffect))}Ao=Wo=!1,"function"==typeof Dr&&Dr(t.stateNode),C=t.expirationTime,0===(t=(t=t.childExpirationTime)>C?t:C)&&(Bo=null),e.expirationTime=t,e.finishedWork=null}function Fa(e){null===aa&&a("246"),aa.expirationTime=0,ca||(ca=!0,sa=e)}function Ia(e,t){var n=fa;fa=!0;try{return e(t)}finally{(fa=n)||oa||Oa(1073741823,!1)}}function La(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||oa||0===ua||(Oa(ua,!1),ua=0);var r=da,i=fa;fa=da=!0;try{return e(t,n)}finally{da=r,(fa=i)||oa||Oa(1073741823,!1)}}function Da(e,t,n,r,i){var o=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=Ir(n,u,l);break e}}n=l}else n=Cr;return null===t.context?t.context=n:t.pendingContext=n,t=i,(i=ri(r)).payload={element:e},null!==(t=void 0===t?null:t)&&(i.callback=t),Go(),oi(o,i),Zo(o,r),r}function Ra(e,t,n,r){var i=t.current;return Da(e,t,n,i=Yo(_a(),i),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>=Mo&&(t=Mo-1),this._expirationTime=Mo=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,i){Ha(n)||a("200");var o=n._reactRootContainer;if(o){if("function"==typeof i){var l=i;i=function(){var e=Wa(o._internalRoot);l.call(e)}}null!=e?o.legacy_renderSubtreeIntoContainer(e,t,i):o.render(t,i)}else{if(o=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 i){var u=i;i=function(){var e=Wa(o._internalRoot);u.call(e)}}La(function(){null!=e?o.legacy_renderSubtreeIntoContainer(e,t,i):o.render(t,i)})}return Wa(o._internalRoot)}function $a(e,t){var n=2=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},Ue=Ia,Ae=ja,Fe=function(){oa||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&&(La(function(){Ga(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return $a.apply(void 0,arguments)},unstable_batchedUpdates:Ia,unstable_interactiveUpdates:ja,flushSync:function(e,t){oa&&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)||oa||Oa(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[L,j,D,P.injectEventPluginsByName,y,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){}})(i({},e,{findHostInstanceByFiber:function(e){return null===(e=rn(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null}}))}({findFiberByHostInstance:I,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(335)},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,i=!1,o=3,a=-1,l=-1,u=!1,c=!1;function s(){if(!u){var e=r.expirationTime;c?g():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 i=o,a=l;o=e,l=t;try{var u=n()}finally{o=i,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=i;i=e;try{if(e)for(;null!==r;){var o=t.unstable_now();if(!(r.expirationTime<=o))break;do{f()}while(null!==r&&r.expirationTime<=o)}else if(null!==r)do{f()}while(null!==r&&!y())}finally{u=!1,i=n,null!==r?s():c=!1,p()}}var h,m,v,g,y,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],g=C[1],y=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))},g=function(){T=null},y=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,U=-1,A=!1,F=!1,I=0,L=33,j=33;y=function(){return I<=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=U;O=null,U=-1;var r=t.unstable_now(),i=!1;if(0>=I-r){if(!(-1!==n&&n<=r))return A||(A=!0,_(R)),O=e,void(U=n);i=!0}if(null!==e){F=!0;try{e(i)}finally{F=!1}}}},!1);var R=function(e){if(null!==O){_(R);var t=e-I+j;tt&&(t=8),j=tt?window.postMessage(D,"*"):A||(A=!0,_(R))},g=function(){O=null,M=!1,U=-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=o,i=a;o=e,a=t.unstable_now();try{return n()}finally{o=r,a=i,p()}},t.unstable_scheduleCallback=function(e,n){var i=-1!==a?a:t.unstable_now();if("object"==typeof n&&null!==n&&"number"==typeof n.timeout)n=i+n.timeout;else switch(o){case 1:n=i+-1;break;case 2:n=i+250;break;case 5:n=i+1073741823;break;case 4:n=i+1e4;break;default:n=i+5e3}if(e={callback:e,priorityLevel:o,expirationTime:n,next:null,previous:null},null===r)r=e.next=e.previous=e,s();else{i=null;var l=r;do{if(l.expirationTime>n){i=l;break}l=l.next}while(l!==r);null===i?i=r:i===r&&(r=e,s()),(n=i.previous).next=i.previous=e,e.next=i,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=o;return function(){var r=o,i=a;o=n,a=t.unstable_now();try{return e.apply(this,arguments)}finally{o=r,a=i,p()}}},t.unstable_getCurrentPriorityLevel=function(){return o},t.unstable_shouldYield=function(){return!i&&(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:'',
metamenuTheme:config.metamenuTheme,
isAdmin:config.json_isAdmin
};
this.initMetaHeader = this.initMetaHeader.bind(this);
this.updateDimensions = this.updateDimensions.bind(this);
this.onSwitchStyle = this.onSwitchStyle.bind(this);
//this.getUser = this.getUser.bind(this);
}
componentWillMount() {
this.updateDimensions();
}
componentDidMount() {
this.initMetaHeader();
//this.initMetamenuTheme();
}
componentWillUnmount(){
window.removeEventListener("resize", this.updateDimensions);
window.removeEventListener("orientationchange",this.updateDimensions);
}
initMetaHeader(){
window.addEventListener("resize", this.updateDimensions);
window.addEventListener("orientationchange",this.updateDimensions);
//this.getUser();
}
fetchMetaheaderThemeSettings(){
let url = 'https://www.opendesktop.org/membersetting/getsettings';
if (location.hostname.endsWith('cc') || location.hostname.endsWith('local')) {
url = 'https://www.opendesktop.cc/membersetting/getsettings';
}
fetch(url,{
mode: 'cors',
credentials: 'include'
})
.then(response => response.json())
.then(data => {
const results = data.results;
if(results.length>0)
{
const theme = results.filter(r => r.member_setting_item_id == 1);
if(theme.length>0 && theme[0].value==1)
{
this.setState({metamenuTheme:'metamenu-theme-dark'});
}
}
});
}
// change metamenu class
onSwitchStyle(evt){
let url = 'https://www.opendesktop.org/membersetting/setsettings/itemid/1/itemvalue/';
if (location.hostname.endsWith('cc') || location.hostname.endsWith('local')) {
url = 'https://www.opendesktop.cc/membersetting/setsettings/itemid/1/itemvalue/';
}
url = url +(evt.target.checked?'1':'0');
const isChecked = evt.target.checked;
fetch(url,{
mode: 'cors',
credentials: 'include'
})
.then(response => response.json())
.then(data => {
this.setState({metamenuTheme:`${isChecked?'metamenu-theme-dark':''}`});
});
}
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 >= 1015){
device = "large";
} else if (width < 1015 && width >= 730){
device = "mid";
} else if (width < 730){
device = "tablet";
}
this.setState({device:device});
}
render(){
let domainsMenuDisplay;
if (this.state.device === "tablet"){
domainsMenuDisplay = (
)
} else {
domainsMenuDisplay = (
)
}
const metamenuCls = `metamenu ${this.state.metamenuTheme}`;
let paraChecked = false;
if(this.state.metamenuTheme){
paraChecked=true;
}
return (
)
}
}
class DomainsMenu extends React.Component {
constructor(props){
super(props);
this.state = {
};
}
render(){
let moreMenuItemDisplay, adminsDropDownMenuDisplay, myOpendesktopMenuDisplay;
if (this.props.device !== "large"){
moreMenuItemDisplay = (
)
}
return (
openDesktop.org :
{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}>
Store Listings
);
}
}
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 DevelopmentDropDownMenu 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(){
let issuesMenuItem;
if (this.props.isAdmin){
issuesMenuItem = (
Issues
)
}
let gitfaqLinkItem;
if (config.isExternal === false){
gitfaqLinkItem = (Git FAQ );
} else {
gitfaqLinkItem = (Git FAQ );
}
return (
this.node = node} id="admins-dropdown-menu" className={this.state.dropdownClass}>
Development
Projects
{issuesMenuItem}
{gitfaqLinkItem}
)
}
}
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}
)
}
}
function SwitchItem(props){
return(
)
}
class UserMenu extends React.Component {
constructor(props){
super(props);
this.state = {};
}
render(){
let userDropdownDisplay, userAppsContextDisplay, developmentAppMenuDisplay;
if (this.props.user && this.props.user.member_id){
userDropdownDisplay = (
);
userAppsContextDisplay = (
);
developmentAppMenuDisplay = (
);
} 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 );
}
let switchItem;
if (this.props.user && this.props.user.member_id && this.props.isAdmin){
switchItem =( );
}
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;
const gitlabLink = self.state.gitlabLink;
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(){
/*
// BU CODE
*/
const urlEnding = config.baseUrl.split('opendesktop.')[1];
let contextMenuDisplay;
if (this.props.isAdmin){
contextMenuDisplay = (
);
} else {
contextMenuDisplay = (
);
}
return (
this.node = node} id="user-context-menu-container">
{contextMenuDisplay}
)
}
}
class DevelopmentAppMenu extends React.Component {
constructor(props){
super(props);
- this.state = {
- gitlabLink:config.gitlabUrl+"/dashboard/issues?assignee_id="
- };
+ this.state = {};
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();
+ componentDidMount() {
}
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(){
- const urlEnding = config.baseUrl.split('opendesktop.')[1];
-
+
return (
this.node = node} id="development-app-menu-container">
)
}
}
class UserLoginMenuContainerVersionTwo 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},function(){
if (dropdownClass === "open"){
$('body').addClass('drawer-open');
} else {
$('body').removeClass('drawer-open');
}
});
}
render(){
return (
)
}
}
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 (
)
}
}
class UserTabs extends React.Component {
constructor(props){
super(props);
this.state = {
currentTab:'comments',
searchPhrase:''
};
this.onTabMenuItemClick = this.onTabMenuItemClick.bind(this);
this.onUserSearchInputChange = this.onUserSearchInputChange.bind(this);
this.getUsersAutocompleteList = this.getUsersAutocompleteList.bind(this);
this.selectUserFromAutocompleteList = this.selectUserFromAutocompleteList.bind(this);
}
onTabMenuItemClick(val){
this.setState({currentTab:val});
}
onUserSearchInputChange(e){
const searchPhrase = e.target.value;
this.setState({searchPhrase:e.target.value},function(){
let showUserList;
if (searchPhrase.length > 2){
showUserList = true;
} else {
showUserList = false;
}
this.setState({showUserList:showUserList,selectedUser:''},function(){
this.getUsersAutocompleteList(searchPhrase);
});
});
}
getUsersAutocompleteList(searchPhrase){
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
self.setState({usersList:res,showUserList:true});
}
};
xhttp.open("GET", "https://www.opendesktop.cc/home/searchmember?username="+searchPhrase, true);
xhttp.send();
}
selectUserFromAutocompleteList(user){
this.setState({selectedUser:user,searchPhrase:user.username,showUserList:false});
}
render(){
let usersAutocompleteList;
if (this.state.usersList && this.state.showUserList){
const users = this.state.usersList.map((u,index) => (
this.selectUserFromAutocompleteList(u)} key={index}>
{u.username}
));
usersAutocompleteList = (
);
}
let tabContentDisplay;
if (this.state.currentTab === 'comments'){
tabContentDisplay = (
);
} else if (this.state.currentTab === 'search'){
if (this.state.selectedUser){
tabContentDisplay = (
);
} else {
tabContentDisplay = (
search user
);
}
}
return(
);
}
}
class UserCommentsTab extends React.Component {
constructor(props){
super(props);
this.state = {
loading:true
};
this.getUserOdComments = this.getUserOdComments.bind(this);
this.getUserForumComments = this.getUserForumComments.bind(this);
}
componentDidMount() {
this.setState({odComments:[],forumComments:[],loading:true},function(){
this.getUserOdComments();
});
}
getUserOdComments(){
const user = this.props.user;
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
self.setState({odComments:res.commentsOpendeskop,loading:false},function(){
self.getUserForumComments();
});
}
};
xhttp.open("GET", "home/memberjson?member_id="+user.member_id, true);
xhttp.send();
}
getUserForumComments(){
const user = this.props.user;
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
self.setState({forumComments:res.user_actions,loading:false});
}
};
xhttp.open("GET", "https://forum.opendesktop.cc/user_actions.json?offset=0&username=" + user.username + "&filter=5", true);
xhttp.send();
}
render(){
let contentDisplay;
if (!this.state.loading){
let odCommentsDisplay, forumCommentsDisplay;
if (this.state.odComments.length > 0){
odCommentsDisplay = (
);
}
if (this.state.forumComments.length > 0){
forumCommentsDisplay = (
);
}
contentDisplay = (
{odCommentsDisplay}
{forumCommentsDisplay}
)
} else {
contentDisplay = (
loading
);
}
return(
)
}
}
class UserSearchTab extends React.Component {
constructor(props){
super(props);
this.state = {
loading:true
};
this.getUserOdComments = this.getUserOdComments.bind(this);
this.getUserForumComments = this.getUserForumComments.bind(this);
}
componentDidMount() {
this.setState({odComments:[],forumComments:[],loading:true},function(){
this.getUserOdComments();
});
}
getUserOdComments(){
const user = this.props.user;
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
self.setState({odComments:res.commentsOpendeskop,loading:false},function(){
self.getUserForumComments();
});
} else {
console.log('what happends here');
console.log(this);
}
};
xhttp.open("GET", "home/memberjson?member_id="+user.member_id, true);
xhttp.send();
}
getUserForumComments(){
const user = this.props.user;
const self = this;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
console.log('this ');
if (this.readyState == 4 && this.status == 200) {
const res = JSON.parse(this.response);
self.setState({forumComments:res.user_actions,loading:false});
}
};
xhttp.open("GET", "https://forum.opendesktop.cc/user_actions.json?offset=0&username=" + user.username + "&filter=5", true);
xhttp.send();
}
render(){
let contentDisplay;
if (!this.state.loading){
let odCommentsDisplay, forumCommentsDisplay;
if (this.state.odComments.length > 0){
odCommentsDisplay = (
);
}
if (this.state.forumComments.length > 0){
forumCommentsDisplay = (
);
}
contentDisplay = (
{odCommentsDisplay}
{forumCommentsDisplay}
)
} else {
contentDisplay = (
loading
);
}
return(
)
}
}
class UserCommentsTabThreadsContainer extends React.Component {
constructor(props){
super(props);
this.state = {};
}
componentDidMount() {
let siteInfo;
if (this.props.type === 'od'){
siteInfo = {
address:'openDesktop.org',
url:'https://www.opendesktop.org'
}
} else if (this.props.type === 'forum'){
siteInfo = {
address:'forum',
url:'https://forum.opendesktop.org'
}
}
let threads = [];
this.props.comments.forEach(function(c,index){
if (threads.indexOf(c.title) === -1){
const thread = {
title:c.title,
id:c.project_id
}
threads.push(thread)
}
});
this.setState({siteInfo:siteInfo,comments:this.props.comments,threads:threads});
}
render(){
const t = this.state.siteInfo;
const comments = this.state.comments;
const user = this.props.user;
let headerDisplay, threadsDisplay, threadCommentsDisplay;
if (this.state.threads){
threadsDisplay = this.state.threads.map((tr,index) => (
));
headerDisplay = (
);
}
return (
{headerDisplay}
{threadCommentsDisplay}
)
}
}
class UserCommentsTabThread extends React.Component {
constructor(props){
super(props);
this.state = {};
this.filterCommentsByThread = this.filterCommentsByThread.bind(this);
}
filterCommentsByThread(comment){
if (comment.title === this.props.thread.title){
return comment;
}
}
render(){
let commentsDisplay;
if (this.props.comments){
const user = this.props.user;
commentsDisplay = this.props.comments.filter(this.filterCommentsByThread).map((c,index) => (
));
}
return (
);
}
}
class UserCommentsTabThreadCommentItem extends React.Component {
constructor(props){
super(props);
this.state = {};
}
render(){
const c = this.props.comment;
const user = this.props.user;
let repliedUsernameDisplay;
if (c.p_comment_member_id){
repliedUsernameDisplay = ( {c.p_username}
)
}
let userImage = user.avatar;
if (this.props.uType === 'search'){
userImage = user.profile_image_url;
}
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";
}
}
const self = this;
setTimeout(function () {
console.log('time out');
self.setState({overlayClass:overlayClass});
}, 200);
}
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() {
const stylesheetElement = document.createElement('link');
stylesheetElement.rel = 'stylesheet';
stylesheetElement.href = 'https://www.opendesktop.org/theme/react/assets/css/metaheader.css';
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 if (location.hostname.endsWith('local')) {
stylesheetElement.href = '/theme/react/assets/css/metaheader.css';
}
else{
stylesheetElement.href = 'https://www.opendesktop.org/theme/react/assets/css/metaheader.css';
}
this.appendChild(stylesheetElement);
await initConfig(this.getAttribute('config-target'),window.location.href);
const metaheaderElement = document.createElement('div');
metaheaderElement.id = 'metaheader';
ReactDOM.render(React.createElement(MetaHeader, null), metaheaderElement);
// 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(metaheaderElement);
}
});