|
|
@@ -1,14 +1,14 @@
|
|
|
-function g(b,a){this.id=b.id;this.name=b.name;this.b=parseFloat(b.last_read);this.a={};if(b.members)for(var c=0,e=b.members.length;c<e;c++){var f=h(a,b.members[c]);this.a[f.id]=f;f.c[this.id]=this}}function m(b,a){var c=[];this.id=a.id;this.a={};for(var e=0,f=a.members.length;e<f;e++){var d=h(b,a.members[e]);this.a[a.members[e]]=d;d.c[this.id]=this;c.push(d.name)}this.name=c.join(", ");this.b=parseFloat(a.last_read)}function q(b,a){this.id=a.id;this.f=b;this.b=parseFloat(a.last_read)}
|
|
|
-function r(b){this.id=b.id;this.name=b.name;this.status=b.status;this.b={w:b.profile.image_24,A:b.profile.image_32,j:b.profile.image_48,m:b.profile.image_72,u:b.profile.image_192,C:b.profile.image_512};this.c={};this.a=null}function u(b){this.id=b.id;this.name=b.name;this.b={B:b.icons.image_36,j:b.icons.image_48,m:b.icons.image_72};this.c={};this.a=null}function v(){this.c={};this.b={};this.f={};this.a={};this.h=null;this.i={}}function h(b,a){return b.a[a]||b.i[a]||null}
|
|
|
-"undefined"!==typeof module&&(module.l.o=v);function w(b){this.g=parseFloat(b.ts);this.raw=b}function x(b,a,c){this.id="string"===typeof b?b:b.id;this.a=[];this.b=a;c&&y(this,c)}function y(b,a){var c=0;a.forEach(function(b){c=Math.max(this.push(b),c)}.bind(b))}x.prototype.push=function(b){for(var a=parseFloat(b.ts),c=0,e=this.a.length;c<e;c++)if(this.a[c].g===a)return a;for(this.a.push(new w(b));this.a.length>this.b;)this.a.shift();return a};"undefined"!==typeof module&&(module.l.s=x);function z(){var b=document.createDocumentFragment(),a=A.a.h?Object.keys(A.a.h.c):[];a.sort(function(b,a){return b[0]!==a[0]?b[0]-a[0]:(A.a.c[b]||A.a.b[b]).name.localeCompare((A.a.c[a]||A.a.b[a]).name)});a.forEach(function(a){a=A.a.c[a]||A.a.b[a];var c=document.createElement("li");c.id=a.id;"D"===a.id[0]?c.className="slack-context-room slack-ims":"G"===a.id[0]?c.className="slack-context-room slack-group":"C"===a.id[0]&&(c.className="slack-context-room slack-channel");c.textContent=a.name;c&&b.appendChild(c)});
|
|
|
-a=A.a.a?Object.keys(A.a.a):[];a.sort(function(b,a){return A.a.a[b].name.localeCompare(A.a.a[a].name)});a.forEach(function(a){a=A.a.a[a].a;var c=document.createElement("li");c.id=a.id;c.className="slack-context-room";c.textContent=a.f.name;c&&b.appendChild(c)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(b)}function B(b){b?document.body.classList.remove("no-network"):document.body.classList.add("no-network")}
|
|
|
-function C(b,a){var c=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div"),d=document.createElement("div"),l=document.createElement("img"),n=document.createElement("span"),k=document.createElement("ul"),p=document.createElement("li"),t=a.raw.user?A.a.a[a.raw.user]:A.a.i[a.raw.bot_id];c.id=b+"_"+a.g;c.className="slackmsg-item";e.className="slackmsg-ts";f.className="slackmsg-msg";d.className="slackmsg-author";l.className="slackmsg-author-img";n.className="slackmsg-author-name";
|
|
|
-k.className="slackmsg-hover";p.className="slackmsg-hover-reply";e.textContent=(new Date(1E3*a.g)).toLocaleTimeString();f.textContent=a.raw.text;n.textContent=t?t.name:a.raw.username||"?";l.src=t?t.b.j:"";d.appendChild(l);d.appendChild(n);k.appendChild(p);c.appendChild(d);c.appendChild(f);c.appendChild(e);c.appendChild(k);return c}function D(){var b=0,a;for(a in E)E.hasOwnProperty(a)&&(b+=E[a]);document.title=(b?"("+b+")":"")+" - gate"}
|
|
|
-function F(){var b=G;E[b.id]&&(E[b.id]=0,D());b=document.getElementById(b.id);b.classList.remove("unread");b.classList.remove("unreadHi")}function H(){var b=document.createDocumentFragment(),a=G.id;document.getElementById("chatWindow").textContent="";A.b[a]&&A.b[a].a.forEach(function(c){b.appendChild(C(a,c))});var c=document.getElementById("chatWindow");c.appendChild(b);c.scrollTop=c.scrollHeight-c.clientHeight}
|
|
|
-function I(b){for(;b.target!==b.currentTarget&&b.target;){if(b.target.classList.contains("slack-context-room")){if((b=A.a.c[b.target.id]||A.a.f[b.target.id]||A.a.b[b.target.id])&&b!==G){G&&document.getElementById(G.id).classList.remove("selected");document.getElementById(b.id).classList.add("selected");document.body.classList.remove("no-room-selected");G=b;b=void 0;var a=G.name||(G.f?G.f.name:void 0);if(!a){a=[];for(b in G.a)a.push(G.a[b].name);a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=
|
|
|
-a;H();F();G.b&&!A.b[G.id]&&(b=new XMLHttpRequest,b.open("GET","api/hist?room="+G.id,!0),b.send(null))}break}b.target=b.target.parentElement}}
|
|
|
-function J(b){for(var a=b.target;a!==b.currentTarget&&a&&!a.classList.contains("slackmsg-hover");){if(a.classList.contains("slackmsg-hover-reply")){a:{for(a=a||b.target;a!==b.currentTarget&&a;){if(a.classList.contains("slackmsg-item")){b=a.id;break a}a=a.parentElement}b=void 0}if(b){b=parseFloat(b.split("_")[1]);for(var a=A.b[G.id].a,c=0,e=a.length;c<e&&a[c].g<=b;c++)if(a[c].g===b){console.log("Replying to ",a[c]);break}}break}a=a.parentElement}}
|
|
|
-document.addEventListener("DOMContentLoaded",function(){document.getElementById("chatList").addEventListener("click",I);document.getElementById("chatWindow").addEventListener("click",J);document.getElementById("msgForm").addEventListener("submit",function(b){b.preventDefault();b=document.getElementById("msgInput");if(G&&b.value){var a=new XMLHttpRequest;a.open("POST","api/msg?room="+G.id+"&text="+encodeURIComponent(b.value),!0);a.send(null);b.value=""}return!1});window.addEventListener("blur",function(){window.hasFocus=
|
|
|
-!1});window.addEventListener("focus",function(){window.hasFocus=!0;G&&F()});window.hasFocus=!0;K()});var A,E={};A=new function(){this.f=0;this.a=new v;this.b={}};var L=0,G=null;function M(b){var a=new XMLHttpRequest;a.timeout=6E4;a.onreadystatechange=function(){if(4===a.readyState)if(a.status){var c=null,e=2===Math.floor(a.status/100);if(e){L&&(L=0,B(!0));c=a.response;try{c=JSON.parse(c)}catch(f){c=null}}else L?(L+=Math.floor((L||5)/2),L=Math.min(60,L)):(L=5,B(!1));b(e,c)}else L&&(L=0,B(!0)),M(b)};a.open("GET","api?v="+A.f,!0);a.send(null)}
|
|
|
-function N(b,a){if(b){if(a){var c=A;a.v&&(c.f=a.v);if(a["static"]){for(var e=c.a,f=a["static"],d=0,l=f.bots.length;d<l;d++)e.i[f.bots[d].id]=new u(f.bots[d]);d=0;for(l=f.users.length;d<l;d++)e.a[f.users[d].id]=new r(f.users[d]);d=0;for(l=f.ims.length;d<l;d++){var n=h(e,f.ims[d].user);n&&(n.a=new q(n,f.ims[d]),e.f[n.a.id]=n.a)}d=0;for(l=f.channels.length;d<l;d++)e.c[f.channels[d].id]=new g(f.channels[d],e);d=0;for(l=f.groups.length;d<l;d++)e.b[f.groups[d].id]=new m(e,f.groups[d]);e.h=h(e,f.self.id);
|
|
|
-z()}if(a.live){for(var k in a.live)(e=c.b[k])?y(e,a.live[k]):c.b[k]=new x(k,500,a.live[k]);for(var p in a.live)k=c.a,k=k.c[p]||k.f[p]||k.b[p]||null,e=a.live[p],!k||k===G&&window.hasFocus||(document.getElementById(k.id).classList.add("unread"),E[k.id]=(E[k.id]||0)+e.length,D()),G&&a.live[G.id]&&H()}}K()}else setTimeout(K,1E3*L)}function K(){M(N)};
|
|
|
+function g(a){this.id=a.id;this.name=a.name}function h(a,b){this.id=a.id;this.name=a.name;this.b=parseFloat(a.last_read);this.a={};if(a.members)for(var c=0,d=a.members.length;c<d;c++){var f=m(b,a.members[c]);this.a[f.id]=f;f.c[this.id]=this}}function q(a,b){var c=[];this.id=b.id;this.a={};for(var d=0,f=b.members.length;d<f;d++){var e=m(a,b.members[d]);this.a[b.members[d]]=e;e.c[this.id]=this;c.push(e.name)}this.name=c.join(", ");this.b=parseFloat(b.last_read)}
|
|
|
+function r(a,b){this.id=b.id;this.f=a;this.b=parseFloat(b.last_read)}function u(a){this.id=a.id;this.name=a.name;this.status=a.status;this.b={A:a.profile.image_24,B:a.profile.image_32,l:a.profile.image_48,o:a.profile.image_72,w:a.profile.image_192,D:a.profile.image_512};this.c={};this.a=null}function v(a){this.id=a.id;this.name=a.name;this.b={C:a.icons.image_36,l:a.icons.image_48,o:a.icons.image_72};this.c={};this.a=null}
|
|
|
+function w(){this.j=null;this.c={};this.b={};this.f={};this.a={};this.h=null;this.i={}}function m(a,b){return a.a[b]||a.i[b]||null}"undefined"!==typeof module&&(module.m.s=w);function x(a){this.g=parseFloat(a.ts);this.raw=a}function y(a,b,c){this.id="string"===typeof a?a:a.id;this.a=[];this.b=b;c&&z(this,c)}function z(a,b){var c=0;b.forEach(function(a){c=Math.max(this.push(a),c)}.bind(a))}y.prototype.push=function(a){for(var b=parseFloat(a.ts),c=0,d=this.a.length;c<d;c++)if(this.a[c].g===b)return b;for(this.a.push(new x(a));this.a.length>this.b;)this.a.shift();return b};"undefined"!==typeof module&&(module.m.u=y);function A(){var a=document.createDocumentFragment(),b=B.a.h?Object.keys(B.a.h.c):[];b.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:(B.a.c[a]||B.a.b[a]).name.localeCompare((B.a.c[b]||B.a.b[b]).name)});b.forEach(function(b){b=B.a.c[b]||B.a.b[b];var c=document.createElement("li");c.id=b.id;"D"===b.id[0]?c.className="slack-context-room slack-ims":"G"===b.id[0]?c.className="slack-context-room slack-group":"C"===b.id[0]&&(c.className="slack-context-room slack-channel");c.textContent=b.name;c&&a.appendChild(c)});
|
|
|
+b=B.a.a?Object.keys(B.a.a):[];b.sort(function(a,b){return B.a.a[a].name.localeCompare(B.a.a[b].name)});b.forEach(function(b){b=B.a.a[b].a;var c=document.createElement("li");c.id=b.id;c.className="slack-context-room";c.textContent=b.f.name;c&&a.appendChild(c)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a)}function C(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network")}
|
|
|
+function D(a,b){var c=document.createElement("div"),d=document.createElement("div"),f=document.createElement("div"),e=document.createElement("div"),l=document.createElement("img"),n=document.createElement("span"),k=document.createElement("ul"),p=document.createElement("li"),t=b.raw.user?B.a.a[b.raw.user]:B.a.i[b.raw.bot_id];c.id=a+"_"+b.g;c.className="slackmsg-item";d.className="slackmsg-ts";f.className="slackmsg-msg";e.className="slackmsg-author";l.className="slackmsg-author-img";n.className="slackmsg-author-name";
|
|
|
+k.className="slackmsg-hover";p.className="slackmsg-hover-reply";d.textContent=(new Date(1E3*b.g)).toLocaleTimeString();f.textContent=b.raw.text;n.textContent=t?t.name:b.raw.username||"?";l.src=t?t.b.l:"";e.appendChild(l);e.appendChild(n);k.appendChild(p);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(k);return c}function E(){var a=0,b;for(b in F)F.hasOwnProperty(b)&&(a+=F[b]);document.title=(a?"("+a+") - ":"")+B.a.j.name}
|
|
|
+function G(){var a=H;F[a.id]&&(F[a.id]=0,E());a=document.getElementById(a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}function I(){var a=document.createDocumentFragment(),b=H.id;document.getElementById("chatWindow").textContent="";B.b[b]&&B.b[b].a.forEach(function(c){a.appendChild(D(b,c))});var c=document.getElementById("chatWindow");c.appendChild(a);c.scrollTop=c.scrollHeight-c.clientHeight}
|
|
|
+function J(a){for(;a.target!==a.currentTarget&&a.target;){if(a.target.classList.contains("slack-context-room")){if((a=B.a.c[a.target.id]||B.a.f[a.target.id]||B.a.b[a.target.id])&&a!==H){H&&document.getElementById(H.id).classList.remove("selected");document.getElementById(a.id).classList.add("selected");document.body.classList.remove("no-room-selected");H=a;a=void 0;var b=H.name||(H.f?H.f.name:void 0);if(!b){b=[];for(a in H.a)b.push(H.a[a].name);b=b.join(", ")}document.getElementById("currentRoomTitle").textContent=
|
|
|
+b;I();G();H.b&&!B.b[H.id]&&(a=new XMLHttpRequest,a.open("GET","api/hist?room="+H.id,!0),a.send(null))}break}a.target=a.target.parentElement}}
|
|
|
+function K(a){for(var b=a.target;b!==a.currentTarget&&b&&!b.classList.contains("slackmsg-hover");){if(b.classList.contains("slackmsg-hover-reply")){a:{for(b=b||a.target;b!==a.currentTarget&&b;){if(b.classList.contains("slackmsg-item")){a=b.id;break a}b=b.parentElement}a=void 0}if(a){a=parseFloat(a.split("_")[1]);for(var b=B.b[H.id].a,c=0,d=b.length;c<d&&b[c].g<=a;c++)if(b[c].g===a){console.log("Replying to ",b[c]);break}}break}b=b.parentElement}}
|
|
|
+document.addEventListener("DOMContentLoaded",function(){document.getElementById("chatList").addEventListener("click",J);document.getElementById("chatWindow").addEventListener("click",K);document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("msgInput");if(H&&a.value){var b=new XMLHttpRequest;b.open("POST","api/msg?room="+H.id+"&text="+encodeURIComponent(a.value),!0);b.send(null);a.value=""}return!1});window.addEventListener("blur",function(){window.hasFocus=
|
|
|
+!1});window.addEventListener("focus",function(){window.hasFocus=!0;H&&G()});window.hasFocus=!0;L()});var B,F={};B=new function(){this.f=0;this.a=new w;this.b={}};var M=0,H=null;function N(a){var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState)if(b.status){var c=null,d=2===Math.floor(b.status/100);if(d){M&&(M=0,C(!0));c=b.response;try{c=JSON.parse(c)}catch(f){c=null}}else M?(M+=Math.floor((M||5)/2),M=Math.min(60,M)):(M=5,C(!1));a(d,c)}else M&&(M=0,C(!0)),N(a)};b.open("GET","api?v="+B.f,!0);b.send(null)}
|
|
|
+function O(a,b){if(a){if(b){var c=B;b.v&&(c.f=b.v);if(b["static"]){for(var d=c.a,f=b["static"],e=0,l=f.bots.length;e<l;e++)d.i[f.bots[e].id]=new v(f.bots[e]);e=0;for(l=f.users.length;e<l;e++)d.a[f.users[e].id]=new u(f.users[e]);e=0;for(l=f.ims.length;e<l;e++){var n=m(d,f.ims[e].user);n&&(n.a=new r(n,f.ims[e]),d.f[n.a.id]=n.a)}e=0;for(l=f.channels.length;e<l;e++)d.c[f.channels[e].id]=new h(f.channels[e],d);e=0;for(l=f.groups.length;e<l;e++)d.b[f.groups[e].id]=new q(d,f.groups[e]);d.j=new g(f.team);
|
|
|
+d.h=m(d,f.self.id);A()}if(b.live){for(var k in b.live)(d=c.b[k])?z(d,b.live[k]):c.b[k]=new y(k,500,b.live[k]);for(var p in b.live)k=c.a,k=k.c[p]||k.f[p]||k.b[p]||null,d=b.live[p],!k||k===H&&window.hasFocus||(document.getElementById(k.id).classList.add("unread"),F[k.id]=(F[k.id]||0)+d.length,E()),H&&b.live[H.id]&&I()}}L()}else setTimeout(L,1E3*M)}function L(){N(O)};
|