Số sao thể hiện mức độ công nhận của cộng đồng, chứ không phải thu nhập. Thu nhập của nhà phân phối không được đảm bảo và phụ thuộc vào nỗ lực cá nhân.
Cùng nhau tận hưởng đêm nay
Người mà bạn yêu thương đang gặp khó khăn trong việc ngủ.
Liên kết của bạn, ngôn ngữ của bạn, cộng đồng của bạn. Đó chính là cốt lõi của mọi chuyện.
var FB={apiKey:"AIzaSyB5tTrcs8q8-avMJurjiSxzL9QimPVr_jo",authDomain:"sleepm-bd88a.firebaseapp.com",projectId:"sleepm-bd88a"};var AMP=String.fromCharCode(38);var DOOR="/sign-in/";function el(i){return document.getElementById(i);}function ajax(fields,cb){var x=new XMLHttpRequest();x.open("POST","/wp-admin/admin-ajax.php");x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");x.onload=function(){var j=null;try{j=JSON.parse(x.responseText);}catch(e){}cb(j);};x.onerror=function(){cb(null);};x.send(fields);}function ini(n){var p=n.split(" ");var s=p[0].charAt(0);if(p.length!==1){s=s+p[p.length-1].charAt(0);}return s.toUpperCase();}function chip(st){var s=document.createElement("span");s.className="pepchip "+(st==="publish"?"chipLive":"chipPending");s.textContent=(st==="publish"?"Live on the wall":"Awaiting the nod");return s;}function row(title,st){var d=document.createElement("div");d.className="peprow";var t=document.createElement("span");t.textContent=title;d.appendChild(t);d.appendChild(chip(st));return d;}function renderMine(posts){var box=el("pepMine");while(box.firstChild){box.removeChild(box.firstChild);}if(!posts){box.appendChild(document.createElement("p"));box.firstChild.className="pepempty";box.firstChild.textContent="Nothing shared yet — your first post starts here.";return;}if(posts.length===0){var e0=document.createElement("p");e0.className="pepempty";e0.textContent="Nothing shared yet — your first post starts here.";box.appendChild(e0);return;}var i;for(i=0;i!==posts.length;i++){box.appendChild(row(posts[i].title,posts[i].status));}}function showDist(d){if(d){var c2=el("pepDist");c2.style.display="";c2.textContent="Distributor "+d+" \u00b7 unverified";el("pepDid").value=d;el("pepDgo").textContent="Update my ID";}}function boot(){if(!window.firebase){return false;}if(!firebase.apps.length){firebase.initializeApp(FB);}if(!el("pepName")){return false;}if(el("pepName").getAttribute("data-on")==="1"){return true;}el("pepName").setAttribute("data-on","1");var auth=firebase.auth();auth.onAuthStateChanged(function(u){if(!u){location.href=DOOR;return;}var nm=u.displayName;if(!nm){nm=u.email.split("@")[0];}el("pepName").textContent=nm.split(" ")[0];el("pepPname").textContent=nm;el("pepPemail").textContent=u.email;if(u.photoURL){el("pepAvaImg").src=u.photoURL;el("pepAvaImg").style.display="";el("pepMono").style.display="none";}else{el("pepMono").textContent=ini(nm);}u.getIdToken().then(function(t){ajax("action=pepper_fp_mine"+AMP+"fp_token="+encodeURIComponent(t),function(j){if(j){if(j.success){renderMine(j.data.posts);showDist(j.data.dist);}}});});});el("pepOut").addEventListener("click",function(e){e.preventDefault();auth.signOut().then(function(){location.href=DOOR;});});el("pepGo").addEventListener("click",function(e){e.preventDefault();var T=el("pepT").value,B=el("pepB").value,M=el("pepMsg");M.textContent="";if(T.replace(/\s/g,"")===""){M.textContent="Give it a short title first.";return;}el("pepGo").style.pointerEvents="none";el("pepGo").style.opacity=".55";auth.currentUser.getIdToken().then(function(t){ajax("action=pepper_fp_submit"+AMP+"fp_token="+encodeURIComponent(t)+AMP+"fp_title="+encodeURIComponent(T)+AMP+"fp_body="+encodeURIComponent(B),function(j){el("pepGo").style.pointerEvents="";el("pepGo").style.opacity="";if(j){if(j.success){M.textContent=j.data.msg;var box=el("pepMine");var emp=box.querySelector(".pepempty");if(emp){box.removeChild(emp);}box.insertBefore(row(T,"pending"),box.firstChild);el("pepT").value="";el("pepB").value="";return;}if(j.data){M.textContent=j.data.msg;return;}}M.textContent="Something slipped — try again.";});});});el("pepDgo").addEventListener("click",function(e){e.preventDefault();var D=el("pepDid").value,M=el("pepDmsg");M.textContent="";if(D.replace(/\s/g,"")===""){M.textContent="Type your ID first.";return;}auth.currentUser.getIdToken().then(function(t){ajax("action=pepper_fp_sync"+AMP+"fp_token="+encodeURIComponent(t)+AMP+"fp_dist_id="+encodeURIComponent(D),function(j){if(j){if(j.success){M.textContent=j.data.msg;showDist(j.data.dist);return;}if(j.data){M.textContent=j.data.msg;return;}}M.textContent="Something slipped — try again.";});});});return true;}var kn=0;var kt=setInterval(function(){kn++;if(boot()){clearInterval(kt);}if(kn===30){clearInterval(kt);}},400);
var cn=0;var ct=setInterval(function(){cn++;var done=false;if(window.firebase){if(firebase.apps.length){firebase.auth().onAuthStateChanged(function(u){if(u){var links=document.querySelectorAll("nav a, .lb-menu a");var i;for(i=0;i!==links.length;i++){if(links[i].textContent.replace(/\s/g,"")==="SignIn"){links[i].textContent="My Desk";}}}});done=true;}}if(done){clearInterval(ct);}if(cn===30){clearInterval(ct);}},500);
var fzn=0;var fzt=setInterval(function(){fzn++;var t=document.getElementById("pepT");var ok=false;if(t){if(t.getAttribute("data-on2")!=="1"){var touch=("ontouchstart" in window);var narrow=Math.max(window.innerWidth,820)===820;if(!touch){if(!narrow){t.setAttribute("data-on2","1");t.focus({preventScroll:true});ok=true;}else{ok=true;}}else{ok=true;}}else{ok=true;}}if(ok){clearInterval(fzt);}if(fzn===24){clearInterval(fzt);}},500);