mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 02:44:01 +00:00
Add gulp and ignore compiled code
This commit is contained in:
parent
8c76a75924
commit
a9d3a17eb6
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
|
||||
node_modules
|
||||
src/public/main.js
|
14
gulpfile.js
Normal file
14
gulpfile.js
Normal file
@ -0,0 +1,14 @@
|
||||
var gulp = require('gulp');
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch('src/js/main.js', ['build']);
|
||||
});
|
||||
|
||||
gulp.task('build', ['uglify']);
|
||||
|
||||
gulp.task('uglify', function() {
|
||||
gulp.src('src/js/main.js')
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('src/public'));
|
||||
});
|
@ -9,6 +9,8 @@
|
||||
"express": "^4.13.3",
|
||||
"express-session": "^1.12.1",
|
||||
"express-socket.io-session": "^1.3.1",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"mustache-express": "^1.2.2",
|
||||
"serve-favicon": "^2.3.0",
|
||||
"shortid": "^2.2.4",
|
||||
|
@ -1 +0,0 @@
|
||||
var fs=window.RequestFileSystem||window.webkitRequestFileSystem;$(function(){function e(e){var n="";n+=1===e.numUsers?"There's 1 participant":"There are "+e.numUsers+" participants",a(n)}function n(){R=window.username,fs?fs(window.TEMPORARY,100,a.bind(a,"WARNING: Your browser is not in incognito mode!"),a.bind(a,"Your browser is in incognito mode.")):console.log("no fs"),R&&(A.show(),D=C.focus(),U.emit("add user",R))}function t(){var e=C.val();e=l(e),e&&J&&(C.val(""),s({username:R,message:e}),U.emit("new message",o(e)))}function o(e){return CryptoJS.AES.encrypt(e,k.val()).toString()}function i(e){return CryptoJS.AES.decrypt(e,k.val()).toString(CryptoJS.enc.Utf8)||e}function a(e,n){var t,o=n&&n.html===!0||!1;t=o?$("<li>").addClass("log").html(e):$("<li>").addClass("log").text(e),u(t,n)}function s(e,n){var t=f(e);n=n||{},0!==t.length&&(n.fade=!1,t.remove());var o=$('<span class="username"/>').text(e.username).css("color",d(e.username)),i=$('<span class="messageBody">').text(e.message),a=e.typing?"typing":"",s=$('<li class="message"/>').data("username",e.username).addClass(a).append(o,i);u(s,n)}function r(e){e.typing=!0,e.message="is typing",s(e)}function c(e){f(e).fadeOut(function(){$(this).remove()})}function u(e,n){var t=$(e);n||(n={}),"undefined"==typeof n.fade&&(n.fade=!0),"undefined"==typeof n.prepend&&(n.prepend=!1),n.fade&&t.hide().fadeIn(y),n.prepend?S.prepend(t):S.append(t),S[0].scrollTop=S[0].scrollHeight}function l(e){return $("<div/>").text(e).text()}function p(){J&&(F||(F=!0,U.emit("typing")),I=(new Date).getTime(),setTimeout(function(){var e=(new Date).getTime(),n=e-I;n>=h&&F&&(U.emit("stop typing"),F=!1)},h))}function f(e){return $(".typing.message").filter(function(n){return $(this).data("username")===e.username})}function d(e){for(var n=7,t=0;t<e.length;t++)n=e.charCodeAt(t)+(n<<5)-n;var o=Math.abs(n%w.length);return w[o]}var m=!1,g=0,y=150,h=400,w=["#e21400","#91580f","#f8a700","#f78b00","#58dc00","#287b00","#a8f07a","#4ae8c4","#3b88eb","#3824aa","#a700ff","#d300e7"];window.favicon=new Favico({animation:"pop",type:"rectangle"});var v=$(window),b=$(".usernameInput"),S=$(".messages"),C=$(".inputMessage"),k=$("#key"),T=$("#new_key"),x=$("#remove_key"),A=$(".chat.page"),M=CryptoJS.SHA3(Math.random().toString(36).substring(7)).toString();k.val(M);var R,I,J=!1,F=!1,D=b.focus(),E=new Clipboard(".copyable"),H=window.location.pathname.length?window.location.pathname:null;if(H){var U=io(H);$("#roomIdKey").text(H.replace("/","")),v.keydown(function(e){13===e.which&&$(".inputMessage").is(":focus")&&(t(),U.emit("stop typing"),F=!1),13===e.which&&$("input#key").is(":focus")&&$("#key-modal").modal("hide")}),C.on("input",function(){p()}),C.click(function(){C.focus()}),T.click(function(){var e=CryptoJS.SHA3(Math.random().toString(36).substring(7)).toString();k.val(e)}),x.click(function(){k.val("")}),U.on("login",function(n){J=!0;var t="Fatty.chat - Anonymous Chat - Room ID: "+H.replace("/","")+' <button class="btn btn-default btn-xs copyable" data-clipboard-text="https://fatty.chat'+H+'">Copy link to share</button>';a(t,{prepend:!0,html:!0}),t="This chatroom is destroyed after all participants exit. Chat history is client side only and not persistent.",a(t),e(n)}),U.on("new message",function(e){m||(g++,favicon.badge(g)),e.message=i(e.message),s(e)}),U.on("user joined",function(n){a(n.username+" joined"),e(n)}),U.on("user left",function(n){a(n.username+" left"),e(n),c(n)}),U.on("typing",function(e){r(e)}),U.on("stop typing",function(e){c(e)}),U.on("first",function(){$(".modal").modal("show")}),n(),$("span.key-btn").click(function(){$("#key-modal").modal("show")}),window.onfocus=function(){m=!0,g=0,favicon.reset()},window.onblur=function(){m=!1},E.on("success",function(e){$(e.trigger).tooltip({title:"Copied!",trigger:"manual",placement:"auto"}),$(e.trigger).tooltip("show"),setTimeout(function(){$(e.trigger).tooltip("hide")},2e3),e.clearSelection()}),E.on("error",function(e){$(e.trigger).tooltip({title:"Press ⌘C to copy",trigger:"manual",placement:"auto"}),$(e.trigger).tooltip("show"),setTimeout(function(){$(e.trigger).tooltip("hide")},2e3)})}});
|
Loading…
x
Reference in New Issue
Block a user