From c01c1ef8e5e2348d753e27b24c21eea2ff9e748e Mon Sep 17 00:00:00 2001 From: simran Date: Sun, 21 Jun 2020 20:32:00 +0530 Subject: [PATCH] modified the main front page with css --- frontend-js/modules/search.js | 2 +- ...8a53838292cbbbcf6f8bd88da10b1e46e7a0eb6ad6 | 1 + ...f6416d6c440cde793158865d0969ba319bd0d4db4c | 2 + public/main-bundled.js | 2 +- public/main.css | 88 ++++++++++++++++++- views/404.ejs | 2 +- views/home-guest.ejs | 57 ++++++++++-- views/includes/footer.ejs | 2 +- views/includes/header.ejs | 28 +----- 9 files changed, 146 insertions(+), 38 deletions(-) create mode 100644 node_modules/.cache/terser-webpack-plugin/content-v2/sha512/fd/c1/eba397bbe9e351ab4881706b3a703e046343e5f91fc9d618cc7093df5ccc6169c34240b5ece703ef568a53838292cbbbcf6f8bd88da10b1e46e7a0eb6ad6 create mode 100644 node_modules/.cache/terser-webpack-plugin/index-v5/2b/56/ce419404f3d26e9167f6416d6c440cde793158865d0969ba319bd0d4db4c diff --git a/frontend-js/modules/search.js b/frontend-js/modules/search.js index d141ccc4..ba058604 100644 --- a/frontend-js/modules/search.js +++ b/frontend-js/modules/search.js @@ -48,7 +48,7 @@ export default class Search { } sendRequest() { - axios.post('/search', {_csrf: this.csrf,searchTerm: this.inputField.value}).then(response => { + axios.post('/search', {_csrf: this._csrf,searchTerm: this.inputField.value}).then(response => { console.log(response.data) this.renderResultsHTML(response.data) }).catch(() => { diff --git a/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/fd/c1/eba397bbe9e351ab4881706b3a703e046343e5f91fc9d618cc7093df5ccc6169c34240b5ece703ef568a53838292cbbbcf6f8bd88da10b1e46e7a0eb6ad6 b/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/fd/c1/eba397bbe9e351ab4881706b3a703e046343e5f91fc9d618cc7093df5ccc6169c34240b5ece703ef568a53838292cbbbcf6f8bd88da10b1e46e7a0eb6ad6 new file mode 100644 index 00000000..69481d00 --- /dev/null +++ b/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/fd/c1/eba397bbe9e351ab4881706b3a703e046343e5f91fc9d618cc7093df5ccc6169c34240b5ece703ef568a53838292cbbbcf6f8bd88da10b1e46e7a0eb6ad6 @@ -0,0 +1 @@ +{"code":"!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,\"a\",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p=\"\",r(r.s=28)}([function(e,t,r){\"use strict\";var n=r(3),i=r(12),o=Object.prototype.toString;function a(e){return\"[object Array]\"===o.call(e)}function s(e){return null!==e&&\"object\"==typeof e}function c(e){return\"[object Function]\"===o.call(e)}function u(e,t){if(null!=e)if(\"object\"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r/gm),b=v(/^data-[\\-\\w.\\u00B7-\\uFFFF]/),w=v(/^aria-[\\-\\w]+$/),T=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),x=v(/^(?:\\w+script|data):/i),S=v(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g),L=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e};function E(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:M(),f=function(t){return e(t)};if(f.version=\"1.0.10\",f.removed=[],!a||!a.document||9!==a.document.nodeType)return f.isSupported=!1,f;var d=a.document,h=!1,v=!1,C=a.document,D=a.DocumentFragment,N=a.HTMLTemplateElement,H=a.Node,_=a.NodeFilter,j=a.NamedNodeMap,F=void 0===j?a.NamedNodeMap||a.MozNamedAttrMap:j,q=a.Text,P=a.Comment,U=a.DOMParser,I=a.TrustedTypes;if(\"function\"==typeof N){var z=C.createElement(\"template\");z.content&&z.content.ownerDocument&&(C=z.content.ownerDocument)}var B=R(I,d),V=B?B.createHTML(\"\"):\"\",W=C,G=W.implementation,Y=W.createNodeIterator,$=W.getElementsByTagName,X=W.createDocumentFragment,J=d.importNode,K={};f.isSupported=G&&void 0!==G.createHTMLDocument&&9!==C.documentMode;var Z=y,Q=g,ee=b,te=w,re=x,ne=S,ie=T,oe=null,ae=p({},[].concat(E(t),E(r),E(n),E(i),E(o))),se=null,ce=p({},[].concat(E(s),E(c),E(u),E(l))),ue=null,le=null,fe=!0,de=!0,he=!1,pe=!1,me=!1,ve=!1,ye=!1,ge=!1,be=!1,we=!1,Te=!1,xe=!0,Se=!0,Le=!1,Ee={},Ae=p({},[\"audio\",\"head\",\"math\",\"script\",\"style\",\"template\",\"svg\",\"video\"]),ke=p({},[\"audio\",\"video\",\"img\",\"source\",\"image\"]),Oe=p({},[\"alt\",\"class\",\"for\",\"id\",\"label\",\"name\",\"pattern\",\"placeholder\",\"summary\",\"title\",\"value\",\"style\",\"xmlns\"]),Me=null,Re=C.createElement(\"form\"),Ce=function(e){Me&&Me===e||(e&&\"object\"===(void 0===e?\"undefined\":L(e))||(e={}),oe=\"ALLOWED_TAGS\"in e?p({},e.ALLOWED_TAGS):ae,se=\"ALLOWED_ATTR\"in e?p({},e.ALLOWED_ATTR):ce,ue=\"FORBID_TAGS\"in e?p({},e.FORBID_TAGS):{},le=\"FORBID_ATTR\"in e?p({},e.FORBID_ATTR):{},Ee=\"USE_PROFILES\"in e&&e.USE_PROFILES,fe=!1!==e.ALLOW_ARIA_ATTR,de=!1!==e.ALLOW_DATA_ATTR,he=e.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=e.SAFE_FOR_JQUERY||!1,me=e.SAFE_FOR_TEMPLATES||!1,ve=e.WHOLE_DOCUMENT||!1,be=e.RETURN_DOM||!1,we=e.RETURN_DOM_FRAGMENT||!1,Te=e.RETURN_DOM_IMPORT||!1,ge=e.FORCE_BODY||!1,xe=!1!==e.SANITIZE_DOM,Se=!1!==e.KEEP_CONTENT,Le=e.IN_PLACE||!1,ie=e.ALLOWED_URI_REGEXP||ie,me&&(de=!1),we&&(be=!0),Ee&&(oe=p({},[].concat(E(o))),se=[],!0===Ee.html&&(p(oe,t),p(se,s)),!0===Ee.svg&&(p(oe,r),p(se,c),p(se,l)),!0===Ee.svgFilters&&(p(oe,n),p(se,c),p(se,l)),!0===Ee.mathMl&&(p(oe,i),p(se,u),p(se,l))),e.ADD_TAGS&&(oe===ae&&(oe=m(oe)),p(oe,e.ADD_TAGS)),e.ADD_ATTR&&(se===ce&&(se=m(se)),p(se,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&p(Oe,e.ADD_URI_SAFE_ATTR),Se&&(oe[\"#text\"]=!0),ve&&p(oe,[\"html\",\"head\",\"body\"]),oe.table&&p(oe,[\"tbody\"]),O&&O(e),Me=e)},De=function(e){f.removed.push({element:e});try{e.parentNode.removeChild(e)}catch(t){e.outerHTML=V}},Ne=function(e,t){try{f.removed.push({attribute:t.getAttributeNode(e),from:t})}catch(e){f.removed.push({attribute:null,from:t})}t.removeAttribute(e)},He=function(e){var t=void 0,r=void 0;if(ge)e=\"\"+e;else{var n=e.match(/^[\\s]+/);(r=n&&n[0])&&(e=e.slice(r.length))}if(h)try{t=(new U).parseFromString(e,\"text/html\")}catch(e){}if(v&&p(ue,[\"title\"]),!t||!t.documentElement){var i=(t=G.createHTMLDocument(\"\")).body;i.parentNode.removeChild(i.parentNode.firstElementChild),i.outerHTML=B?B.createHTML(e):e}return r&&t.body.insertBefore(C.createTextNode(r),t.body.childNodes[0]||null),$.call(t,ve?\"html\":\"body\")[0]};f.isSupported&&(function(){try{He('

').querySelector(\"svg img\")&&(h=!0)}catch(e){}}(),function(){try{He(\"</title><img>\").querySelector(\"title\").innerHTML.match(/<\\/title/)&&(v=!0)}catch(e){}}());var _e=function(e){return Y.call(e.ownerDocument||e,e,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT,(function(){return _.FILTER_ACCEPT}),!1)},je=function(e){return!(e instanceof q||e instanceof P||\"string\"==typeof e.nodeName&&\"string\"==typeof e.textContent&&\"function\"==typeof e.removeChild&&e.attributes instanceof F&&\"function\"==typeof e.removeAttribute&&\"function\"==typeof e.setAttribute)},Fe=function(e){return\"object\"===(void 0===H?\"undefined\":L(H))?e instanceof H:e&&\"object\"===(void 0===e?\"undefined\":L(e))&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName},qe=function(e,t,r){K[e]&&K[e].forEach((function(e){e.call(f,t,r,Me)}))},Pe=function(e){var t=void 0;if(qe(\"beforeSanitizeElements\",e,null),je(e))return De(e),!0;var r=e.nodeName.toLowerCase();if(qe(\"uponSanitizeElement\",e,{tagName:r,allowedTags:oe}),!oe[r]||ue[r]){if(Se&&!Ae[r]&&\"function\"==typeof e.insertAdjacentHTML)try{var n=e.innerHTML;e.insertAdjacentHTML(\"AfterEnd\",B?B.createHTML(n):n)}catch(e){}return De(e),!0}return\"noscript\"===r&&e.innerHTML.match(/<\\/noscript/i)||\"noembed\"===r&&e.innerHTML.match(/<\\/noembed/i)?(De(e),!0):(!pe||e.firstElementChild||e.content&&e.content.firstElementChild||!/</g.test(e.textContent)||(f.removed.push({element:e.cloneNode()}),e.innerHTML?e.innerHTML=e.innerHTML.replace(/</g,\"<\"):e.innerHTML=e.textContent.replace(/</g,\"<\")),me&&3===e.nodeType&&(t=(t=(t=e.textContent).replace(Z,\" \")).replace(Q,\" \"),e.textContent!==t&&(f.removed.push({element:e.cloneNode()}),e.textContent=t)),qe(\"afterSanitizeElements\",e,null),!1)},Ue=function(e,t,r){if(xe&&(\"id\"===t||\"name\"===t)&&(r in C||r in Re))return!1;if(de&&ee.test(t));else if(fe&&te.test(t));else{if(!se[t]||le[t])return!1;if(Oe[t]);else if(ie.test(r.replace(ne,\"\")));else if(\"src\"!==t&&\"xlink:href\"!==t||\"script\"===e||0!==r.indexOf(\"data:\")||!ke[e])if(he&&!re.test(r.replace(ne,\"\")));else if(r)return!1}return!0},Ie=function(e){var t=void 0,r=void 0,n=void 0,i=void 0,o=void 0;qe(\"beforeSanitizeAttributes\",e,null);var a=e.attributes;if(a){var s={attrName:\"\",attrValue:\"\",keepAttr:!0,allowedAttributes:se};for(o=a.length;o--;){var c=t=a[o],u=c.name,l=c.namespaceURI;if(r=t.value.trim(),n=u.toLowerCase(),s.attrName=n,s.attrValue=r,s.keepAttr=!0,qe(\"uponSanitizeAttribute\",e,s),r=s.attrValue,\"name\"===n&&\"IMG\"===e.nodeName&&a.id)i=a.id,a=A(k,a,[]),Ne(\"id\",e),Ne(u,e),a.indexOf(i)>o&&e.setAttribute(\"id\",i.value);else{if(\"INPUT\"===e.nodeName&&\"type\"===n&&\"file\"===r&&(se[n]||!le[n]))continue;\"id\"===u&&e.setAttribute(u,\"\"),Ne(u,e)}if(s.keepAttr){me&&(r=(r=r.replace(Z,\" \")).replace(Q,\" \"));var d=e.nodeName.toLowerCase();if(Ue(d,n,r))try{l?e.setAttributeNS(l,u,r):e.setAttribute(u,r),f.removed.pop()}catch(e){}}}qe(\"afterSanitizeAttributes\",e,null)}},ze=function e(t){var r=void 0,n=_e(t);for(qe(\"beforeSanitizeShadowDOM\",t,null);r=n.nextNode();)qe(\"uponSanitizeShadowNode\",r,null),Pe(r)||(r.content instanceof D&&e(r.content),Ie(r));qe(\"afterSanitizeShadowDOM\",t,null)};return f.sanitize=function(e,t){var r=void 0,n=void 0,i=void 0,o=void 0,s=void 0;if(e||(e=\"\\x3c!--\\x3e\"),\"string\"!=typeof e&&!Fe(e)){if(\"function\"!=typeof e.toString)throw new TypeError(\"toString is not a function\");if(\"string\"!=typeof(e=e.toString()))throw new TypeError(\"dirty is not a string, aborting\")}if(!f.isSupported){if(\"object\"===L(a.toStaticHTML)||\"function\"==typeof a.toStaticHTML){if(\"string\"==typeof e)return a.toStaticHTML(e);if(Fe(e))return a.toStaticHTML(e.outerHTML)}return e}if(ye||Ce(t),f.removed=[],Le);else if(e instanceof H)1===(n=(r=He(\"\\x3c!--\\x3e\")).ownerDocument.importNode(e,!0)).nodeType&&\"BODY\"===n.nodeName?r=n:r.appendChild(n);else{if(!be&&!me&&!ve&&-1===e.indexOf(\"<\"))return B?B.createHTML(e):e;if(!(r=He(e)))return be?null:V}r&&ge&&De(r.firstChild);for(var c=_e(Le?e:r);i=c.nextNode();)3===i.nodeType&&i===o||Pe(i)||(i.content instanceof D&&ze(i.content),Ie(i),o=i);if(o=null,Le)return e;if(be){if(we)for(s=X.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return Te&&(s=J.call(d,s,!0)),s}var u=ve?r.outerHTML:r.innerHTML;return me&&(u=(u=u.replace(Z,\" \")).replace(Q,\" \")),B?B.createHTML(u):u},f.setConfig=function(e){Ce(e),ye=!0},f.clearConfig=function(){Me=null,ye=!1},f.isValidAttribute=function(e,t,r){Me||Ce({});var n=e.toLowerCase(),i=t.toLowerCase();return Ue(n,i,r)},f.addHook=function(e,t){\"function\"==typeof t&&(K[e]=K[e]||[],K[e].push(t))},f.removeHook=function(e){K[e]&&K[e].pop()},f.removeHooks=function(e){K[e]&&(K[e]=[])},f.removeAllHooks=function(){K={}},f}()}()},function(e,t,r){\"use strict\";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){\"use strict\";var n=r(0);function i(e){return encodeURIComponent(e).replace(/%40/gi,\"@\").replace(/%3A/gi,\":\").replace(/%24/g,\"$\").replace(/%2C/gi,\",\").replace(/%20/g,\"+\").replace(/%5B/gi,\"[\").replace(/%5D/gi,\"]\")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var a=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+=\"[]\":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),a.push(i(t)+\"=\"+i(e))})))})),o=a.join(\"&\")}if(o){var s=e.indexOf(\"#\");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf(\"?\")?\"?\":\"&\")+o}return e}},function(e,t,r){\"use strict\";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){\"use strict\";(function(t){var n=r(0),i=r(18),o={\"Content-Type\":\"application/x-www-form-urlencoded\"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e[\"Content-Type\"])&&(e[\"Content-Type\"]=t)}var s,c={adapter:((void 0!==t&&\"[object process]\"===Object.prototype.toString.call(t)||\"undefined\"!=typeof XMLHttpRequest)&&(s=r(7)),s),transformRequest:[function(e,t){return i(t,\"Accept\"),i(t,\"Content-Type\"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,\"application/x-www-form-urlencoded;charset=utf-8\"),e.toString()):n.isObject(e)?(a(t,\"application/json;charset=utf-8\"),JSON.stringify(e)):e}],transformResponse:[function(e){if(\"string\"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:\"XSRF-TOKEN\",xsrfHeaderName:\"X-XSRF-TOKEN\",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:\"application/json, text/plain, */*\"}},n.forEach([\"delete\",\"get\",\"head\"],(function(e){c.headers[e]={}})),n.forEach([\"post\",\"put\",\"patch\"],(function(e){c.headers[e]=n.merge(o)})),e.exports=c}).call(this,r(17))},function(e,t,r){\"use strict\";var n=r(0),i=r(19),o=r(4),a=r(21),s=r(22),c=r(8);e.exports=function(e){return new Promise((function(t,u){var l=e.data,f=e.headers;n.isFormData(l)&&delete f[\"Content-Type\"];var d=new XMLHttpRequest;if(e.auth){var h=e.auth.username||\"\",p=e.auth.password||\"\";f.Authorization=\"Basic \"+btoa(h+\":\"+p)}if(d.open(e.method.toUpperCase(),o(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf(\"file:\"))){var r=\"getAllResponseHeaders\"in d?a(d.getAllResponseHeaders()):null,n={data:e.responseType&&\"text\"!==e.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:r,config:e,request:d};i(t,u,n),d=null}},d.onabort=function(){d&&(u(c(\"Request aborted\",e,\"ECONNABORTED\",d)),d=null)},d.onerror=function(){u(c(\"Network Error\",e,null,d)),d=null},d.ontimeout=function(){u(c(\"timeout of \"+e.timeout+\"ms exceeded\",e,\"ECONNABORTED\",d)),d=null},n.isStandardBrowserEnv()){var m=r(23),v=(e.withCredentials||s(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;v&&(f[e.xsrfHeaderName]=v)}if(\"setRequestHeader\"in d&&n.forEach(f,(function(e,t){void 0===l&&\"content-type\"===t.toLowerCase()?delete f[t]:d.setRequestHeader(t,e)})),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if(\"json\"!==e.responseType)throw t}\"function\"==typeof e.onDownloadProgress&&d.addEventListener(\"progress\",e.onDownloadProgress),\"function\"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener(\"progress\",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){d&&(d.abort(),u(e),d=null)})),void 0===l&&(l=null),d.send(l)}))}},function(e,t,r){\"use strict\";var n=r(20);e.exports=function(e,t,r,i,o){var a=new Error(e);return n(a,t,r,i,o)}},function(e,t,r){\"use strict\";var n=r(0);e.exports=function(e,t){t=t||{};var r={};return n.forEach([\"url\",\"method\",\"params\",\"data\"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),n.forEach([\"headers\",\"auth\",\"proxy\"],(function(i){n.isObject(t[i])?r[i]=n.deepMerge(e[i],t[i]):void 0!==t[i]?r[i]=t[i]:n.isObject(e[i])?r[i]=n.deepMerge(e[i]):void 0!==e[i]&&(r[i]=e[i])})),n.forEach([\"baseURL\",\"transformRequest\",\"transformResponse\",\"paramsSerializer\",\"timeout\",\"withCredentials\",\"adapter\",\"responseType\",\"xsrfCookieName\",\"xsrfHeaderName\",\"onUploadProgress\",\"onDownloadProgress\",\"maxContentLength\",\"validateStatus\",\"maxRedirects\",\"httpAgent\",\"httpsAgent\",\"cancelToken\",\"socketPath\"],(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r}},function(e,t,r){\"use strict\";function n(e){this.message=e}n.prototype.toString=function(){return\"Cancel\"+(this.message?\": \"+this.message:\"\")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){\"use strict\";var n=r(0),i=r(3),o=r(13),a=r(9);function s(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var c=s(r(6));c.Axios=o,c.create=function(e){return s(a(c.defaults,e))},c.Cancel=r(10),c.CancelToken=r(26),c.isCancel=r(5),c.all=function(e){return Promise.all(e)},c.spread=r(27),e.exports=c,e.exports.default=c},function(e,t){\n/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\ne.exports=function(e){return null!=e&&null!=e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){\"use strict\";var n=r(0),i=r(4),o=r(14),a=r(15),s=r(9);function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){\"string\"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method=e.method?e.method.toLowerCase():\"get\";var t=[a,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=s(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\\?/,\"\")},n.forEach([\"delete\",\"get\",\"head\",\"options\"],(function(e){c.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach([\"post\",\"put\",\"patch\"],(function(e){c.prototype[e]=function(t,r,i){return this.request(n.merge(i||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){\"use strict\";var n=r(0);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){\"use strict\";var n=r(0),i=r(16),o=r(5),a=r(6),s=r(24),c=r(25);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.baseURL&&!s(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach([\"delete\",\"get\",\"head\",\"post\",\"put\",\"patch\",\"common\"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return u(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){\"use strict\";var n=r(0);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error(\"setTimeout has not been defined\")}function a(){throw new Error(\"clearTimeout has not been defined\")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r=\"function\"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n=\"function\"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||l||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title=\"browser\",i.browser=!0,i.env={},i.argv=[],i.version=\"\",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error(\"process.binding is not supported\")},i.cwd=function(){return\"/\"},i.chdir=function(e){throw new Error(\"process.chdir is not supported\")},i.umask=function(){return 0}},function(e,t,r){\"use strict\";var n=r(0);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){\"use strict\";var n=r(8);e.exports=function(e,t,r){var i=r.config.validateStatus;!i||i(r.status)?e(r):t(n(\"Request failed with status code \"+r.status,r.config,null,r.request,r))}},function(e,t,r){\"use strict\";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){\"use strict\";var n=r(0),i=[\"age\",\"authorization\",\"content-length\",\"content-type\",\"etag\",\"expires\",\"from\",\"host\",\"if-modified-since\",\"if-unmodified-since\",\"last-modified\",\"location\",\"max-forwards\",\"proxy-authorization\",\"referer\",\"retry-after\",\"user-agent\"];e.exports=function(e){var t,r,o,a={};return e?(n.forEach(e.split(\"\\n\"),(function(e){if(o=e.indexOf(\":\"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]=\"set-cookie\"===t?(a[t]?a[t]:[]).concat([r]):a[t]?a[t]+\", \"+r:r}})),a):a}},function(e,t,r){\"use strict\";var n=r(0);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement(\"a\");function i(e){var n=e;return t&&(r.setAttribute(\"href\",n),n=r.href),r.setAttribute(\"href\",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,\"\"):\"\",host:r.host,search:r.search?r.search.replace(/^\\?/,\"\"):\"\",hash:r.hash?r.hash.replace(/^#/,\"\"):\"\",hostname:r.hostname,port:r.port,pathname:\"/\"===r.pathname.charAt(0)?r.pathname:\"/\"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){\"use strict\";var n=r(0);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,a){var s=[];s.push(e+\"=\"+encodeURIComponent(t)),n.isNumber(r)&&s.push(\"expires=\"+new Date(r).toGMTString()),n.isString(i)&&s.push(\"path=\"+i),n.isString(o)&&s.push(\"domain=\"+o),!0===a&&s.push(\"secure\"),document.cookie=s.join(\"; \")},read:function(e){var t=document.cookie.match(new RegExp(\"(^|;\\\\s*)(\"+e+\")=([^;]*)\"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,\"\",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){\"use strict\";e.exports=function(e){return/^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(e)}},function(e,t,r){\"use strict\";e.exports=function(e,t){return t?e.replace(/\\/+$/,\"\")+\"/\"+t.replace(/^\\/+/,\"\"):e}},function(e,t,r){\"use strict\";var n=r(10);function i(e){if(\"function\"!=typeof e)throw new TypeError(\"executor must be a function.\");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){\"use strict\";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){\"use strict\";r.r(t);var n=r(1),i=r.n(n),o=r(2),a=r.n(o);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,e),this._csrf=document.querySelector('[name=\"_csrf\"]').value,this.injectHTML(),this.headerSearchIcon=document.querySelector(\".header-search-icon\"),this.overlay=document.querySelector(\".search-overlay\"),this.closeIcon=document.querySelector(\".close-live-search\"),this.inputField=document.querySelector(\"#live-search-field\"),this.resultsArea=document.querySelector(\".live-search-results\"),this.loaderIcon=document.querySelector(\".circle-loader\"),this.typingWaitTimer,this.previousValue=\"\",this.events()}var t,r,n;return t=e,(r=[{key:\"events\",value:function(){var e=this;this.inputField.addEventListener(\"keyup\",(function(){return e.keyPressHandler()})),this.closeIcon.addEventListener(\"click\",(function(){return e.closeOverlay()})),this.headerSearchIcon.addEventListener(\"click\",(function(t){t.preventDefault(),e.openOverlay()}))}},{key:\"keyPressHandler\",value:function(){var e=this,t=this.inputField.value;\"\"==t&&(clearTimeout(this.typingWaitTimer),this.hideLoaderIcon(),this.hideResultsArea()),\"\"!=t&&t!=this.previousValue&&(clearTimeout(this.typingWaitTimer),this.showLoaderIcon(),this.hideResultsArea(),this.typingWaitTimer=setTimeout((function(){return e.sendRequest()}),750)),this.previousValue=t}},{key:\"sendRequest\",value:function(){var e=this;i.a.post(\"/search\",{_csrf:this._csrf,searchTerm:this.inputField.value}).then((function(t){console.log(t.data),e.renderResultsHTML(t.data)})).catch((function(){alert(\"Hello, the request failed.\")}))}},{key:\"renderResultsHTML\",value:function(e){e.length?this.resultsArea.innerHTML=a.a.sanitize('<div class=\"list-group shadow-sm\">\\n <div class=\"list-group-item active\"><strong>Search Results</strong> ('.concat(e.length>1?\"\".concat(e.length,\" items found\"):\"1 item found\",\")</div>\\n \").concat(e.map((function(e){var t=new Date(e.createDate);return'<a href=\"/post/'.concat(e._id,'\" class=\"list-group-item list-group-item-action\">\\n <img class=\"avatar-tiny\" src=\"').concat(e.author.avatar,'\"> <strong>').concat(e.title,'</strong>\\n <span class=\"text-muted small\">by ').concat(e.author.username,\" on \").concat(t.getMonth()+1,\"/\").concat(t.getDate(),\"/\").concat(t.getFullYear(),\"</span>\\n </a>\")})).join(\"\"),\"\\n </div>\")):this.resultsArea.innerHTML='<p class=\"alert alert-danger text-center shadow-sm\">Sorry, we could not find any results for that search.</p>',this.hideLoaderIcon(),this.showResultsArea()}},{key:\"showLoaderIcon\",value:function(){this.loaderIcon.classList.add(\"circle-loader--visible\")}},{key:\"hideLoaderIcon\",value:function(){this.loaderIcon.classList.remove(\"circle-loader--visible\")}},{key:\"showResultsArea\",value:function(){this.resultsArea.classList.add(\"live-search-results--visible\")}},{key:\"hideResultsArea\",value:function(){this.resultsArea.classList.remove(\"live-search-results--visible\")}},{key:\"openOverlay\",value:function(){var e=this;this.overlay.classList.add(\"search-overlay--visible\"),setTimeout((function(){return e.inputField.focus()}),50)}},{key:\"closeOverlay\",value:function(){this.overlay.classList.remove(\"search-overlay--visible\")}},{key:\"injectHTML\",value:function(){document.body.insertAdjacentHTML(\"beforeend\",'<div class=\"search-overlay\">\\n <div class=\"search-overlay-top shadow-sm\">\\n <div class=\"container container--narrow\">\\n <label for=\"live-search-field\" class=\"search-overlay-icon\"><i class=\"fas fa-search\"></i></label>\\n <input type=\"text\" id=\"live-search-field\" class=\"live-search-field\" placeholder=\"What are you interested in?\">\\n <span class=\"close-live-search\"><i class=\"fas fa-times-circle\"></i></span>\\n </div>\\n </div>\\n\\n <div class=\"search-overlay-bottom\">\\n <div class=\"container container--narrow py-3\">\\n <div class=\"circle-loader\"></div>\\n <div class=\"live-search-results\"></div>\\n </div>\\n </div>\\n </div>')}}])&&s(t.prototype,r),n&&s(t,n),e}();function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,e),this.openedYet=!1,this.chatWrapper=document.querySelector(\"#chat-wrapper\"),this.openIcon=document.querySelector(\".header-chat-icon\"),this.injectHTML(),this.chatLog=document.querySelector(\"#chat\"),this.chatField=document.querySelector(\"#chatField\"),this.chatForm=document.querySelector(\"#chatForm\"),this.closeIcon=document.querySelector(\".chat-title-bar-close\"),this.events()}var t,r,n;return t=e,(r=[{key:\"events\",value:function(){var e=this;this.chatForm.addEventListener(\"submit\",(function(t){t.preventDefault(),e.sendMessageToServer()})),this.openIcon.addEventListener(\"click\",(function(){return e.showChat()})),this.closeIcon.addEventListener(\"click\",(function(){return e.hideChat()}))}},{key:\"sendMessageToServer\",value:function(){this.socket.emit(\"chatMessageFromBrowser\",{message:this.chatField.value}),this.chatLog.insertAdjacentHTML(\"beforeend\",a.a.sanitize('\\n <div class=\"chat-self\">\\n <div class=\"chat-message\">\\n <div class=\"chat-message-inner\">\\n '.concat(this.chatField.value,'\\n </div>\\n </div>\\n <img class=\"chat-avatar avatar-tiny\" src=\"').concat(this.avatar,'\">\\n </div>\\n '))),this.chatLog.scrollTop=this.chatLog.scrollHeight,this.chatField.value=\"\",this.chatField.focus()}},{key:\"hideChat\",value:function(){this.chatWrapper.classList.remove(\"chat--visible\")}},{key:\"showChat\",value:function(){this.openedYet||this.openConnection(),this.openedYet=!0,this.chatWrapper.classList.add(\"chat--visible\"),this.chatField.focus()}},{key:\"openConnection\",value:function(){var e=this;this.socket=io(),this.socket.on(\"welcome\",(function(t){e.username=t.username,e.avatar=t.avatar})),this.socket.on(\"chatMessageFromServer\",(function(t){e.displayMessageFromServer(t)}))}},{key:\"displayMessageFromServer\",value:function(e){this.chatLog.insertAdjacentHTML(\"beforeend\",a.a.sanitize('\\n <div class=\"chat-other\">\\n <a href=\"/profile/'.concat(e.username,'\"><img class=\"avatar-tiny\" src=\"').concat(e.avatar,'\"></a>\\n <div class=\"chat-message\"><div class=\"chat-message-inner\">\\n <a href=\"/profile/').concat(e.username,'\"><strong>').concat(e.username,\":</strong></a>\\n \").concat(e.message,\"\\n </div></div>\\n </div>\\n \"))),this.chatLog.scrollTop=this.chatLog.scrollHeight}},{key:\"injectHTML\",value:function(){this.chatWrapper.innerHTML='\\n <div class=\"chat-title-bar\">Chat <span class=\"chat-title-bar-close\"><i class=\"fas fa-times-circle\"></i></span></div>\\n <div id=\"chat\" class=\"chat-log\"></div>\\n \\n <form id=\"chatForm\" class=\"chat-form border-top\">\\n <input type=\"text\" class=\"chat-field\" id=\"chatField\" placeholder=\"Type a message…\" autocomplete=\"off\">\\n </form>\\n\\n '}}])&&u(t.prototype,r),n&&u(t,n),e}();function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,e),this._csrf=document.querySelector('[name=\"_csrf\"]').value,this.form=document.querySelector(\"#registration-form\"),this.allFields=document.querySelectorAll(\"#registration-form .form-control\"),this.insertValidationElements(),this.username=document.querySelector(\"#username-register\"),this.username.previousValue=\"\",this.email=document.querySelector(\"#email-register\"),this.email.previousValue=\"\",this.password=document.querySelector(\"#password-register\"),this.password.previousValue=\"\",this.username.isUnique=!1,this.email.isUnique=!1,this.events()}var t,r,n;return t=e,(r=[{key:\"events\",value:function(){var e=this;this.form.addEventListener(\"submit\",(function(t){t.preventDefault(),e.formSubmitHandler()})),this.username.addEventListener(\"keyup\",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener(\"keyup\",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener(\"keyup\",(function(){e.isDifferent(e.password,e.passwordHandler)})),this.username.addEventListener(\"blur\",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener(\"blur\",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener(\"blur\",(function(){e.isDifferent(e.password,e.passwordHandler)}))}},{key:\"formSubmitHandler\",value:function(){this.usernameImmediately(),this.usernameAfterDelay(),this.emailAfterDelay(),this.passwordImmediately(),this.passwordAfterDelay(),!this.username.isUnique||this.username.errors||!this.email.isUnique||this.email.errors||this.password.errors||this.form.submit()}},{key:\"isDifferent\",value:function(e,t){e.previousValue!=e.value&&t.call(this),e.previousValue=e.value}},{key:\"usernameHandler\",value:function(){var e=this;this.username.errors=!1,this.usernameImmediately(),clearTimeout(this.username.timer),this.username.timer=setTimeout((function(){return e.usernameAfterDelay()}),800)}},{key:\"passwordHandler\",value:function(){var e=this;this.password.errors=!1,this.passwordImmediately(),clearTimeout(this.password.timer),this.password.timer=setTimeout((function(){return e.passwordAfterDelay()}),800)}},{key:\"passwordImmediately\",value:function(){this.password.value.length>50&&this.showValidationError(this.password,\"Password cannot exceed 50 characters.\"),this.password.errors||this.hideValidationError(this.password)}},{key:\"passwordAfterDelay\",value:function(){this.password.value.length<12&&this.showValidationError(this.password,\"Password must be at least 12 characters.\")}},{key:\"emailHandler\",value:function(){var e=this;this.email.errors=!1,clearTimeout(this.email.timer),this.email.timer=setTimeout((function(){return e.emailAfterDelay()}),800)}},{key:\"emailAfterDelay\",value:function(){var e=this;/^\\S+@\\S+$/.test(this.email.value)||this.showValidationError(this.email,\"You must provide a valid email address.\"),this.email.errors||i.a.post(\"/doesEmailExist\",{_csrf:this._csrf,email:this.email.value}).then((function(t){t.data?(e.email.isUnique=!1,e.showValidationError(e.email,\"That email is already being used.\")):(e.email.isUnique=!0,e.hideValidationError(e.email))})).catch((function(){console.log(\"Please try again later.\")}))}},{key:\"usernameImmediately\",value:function(){\"\"==this.username.value||/^([a-zA-Z0-9]+)$/.test(this.username.value)||this.showValidationError(this.username,\"Username can only contain letters and numbers.\"),this.username.value.length>30&&this.showValidationError(this.username,\"Username cannot exceed 30 characters.\"),this.username.errors||this.hideValidationError(this.username)}},{key:\"hideValidationError\",value:function(e){e.nextElementSibling.classList.remove(\"liveValidateMessage--visible\")}},{key:\"showValidationError\",value:function(e,t){e.nextElementSibling.innerHTML=t,e.nextElementSibling.classList.add(\"liveValidateMessage--visible\"),e.errors=!0}},{key:\"usernameAfterDelay\",value:function(){var e=this;this.username.value.length<3&&this.showValidationError(this.username,\"Username must be at least 3 characters.\"),this.username.errors||i.a.post(\"/doesUsernameExist\",{_csrf:this._csrf,username:this.username.value}).then((function(t){t.data?(e.showValidationError(e.username,\"That username is already taken.\"),e.username.isUnique=!1):e.username.isUnique=!0})).catch((function(){console.log(\"Please try again later.\")}))}},{key:\"insertValidationElements\",value:function(){this.allFields.forEach((function(e){e.insertAdjacentHTML(\"afterend\",'<div class=\"alert alert-danger small liveValidateMessage\"></div>')}))}}])&&f(t.prototype,r),n&&f(t,n),e}();document.querySelector(\"#registration-form\")&&new d,document.querySelector(\"#chat-wrapper\")&&new l,document.querySelector(\".header-search-icon\")&&new c}]);","extractedComments":[]} \ No newline at end of file diff --git a/node_modules/.cache/terser-webpack-plugin/index-v5/2b/56/ce419404f3d26e9167f6416d6c440cde793158865d0969ba319bd0d4db4c b/node_modules/.cache/terser-webpack-plugin/index-v5/2b/56/ce419404f3d26e9167f6416d6c440cde793158865d0969ba319bd0d4db4c new file mode 100644 index 00000000..e32cb27e --- /dev/null +++ b/node_modules/.cache/terser-webpack-plugin/index-v5/2b/56/ce419404f3d26e9167f6416d6c440cde793158865d0969ba319bd0d4db4c @@ -0,0 +1,2 @@ + +6769b1642ade9e66a903441ed5cc5d81c0829697 {"key":"{\"terser\":\"4.7.0\",\"node_version\":\"v12.16.3\",\"terser-webpack-plugin\":\"1.4.4\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.m?js(\\\\?.*)?$\", \"i\"),\"chunkFilter\":() => true,\"warningsFilter\":() => true,\"extractComments\":false,\"sourceMap\":false,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"output\":{\"comments\":new RegExp(\"^\\\\**!|@preserve|@license|@cc_on\", \"i\")}}},\"hash\":\"57c5258c28742f7da9abc1f7102b588b\"}","integrity":"sha512-/cHro5e76eNRq0iBcGs6cD4EY0Pl+R/J1hjMcJPfXMxhacNCQLXs5wPvVopTg4KSy7vPb4vYjaELHkbnoOtq1g==","time":1592748430688,"size":45299} \ No newline at end of file diff --git a/public/main-bundled.js b/public/main-bundled.js index 64f363a1..3dd1e1a7 100644 --- a/public/main-bundled.js +++ b/public/main-bundled.js @@ -5,4 +5,4 @@ * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ -e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(0),i=r(4),o=r(14),a=r(15),s=r(9);function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=s(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,r,i){return this.request(n.merge(i||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){"use strict";var n=r(0);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){"use strict";var n=r(0),i=r(16),o=r(5),a=r(6),s=r(24),c=r(25);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.baseURL&&!s(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return u(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||l||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t,r){var i=r.config.validateStatus;!i||i(r.status)?e(r):t(n("Request failed with status code "+r.status,r.config,null,r.request,r))}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var n=r(0),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,a={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([r]):a[t]?a[t]+", "+r:r}})),a):a}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,a){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(i)&&s.push("path="+i),n.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(10);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";r.r(t);var n=r(1),i=r.n(n),o=r(2),a=r.n(o);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._csrf=document.querySelector('[name="_csrf"]').value,this.injectHTML(),this.headerSearchIcon=document.querySelector(".header-search-icon"),this.overlay=document.querySelector(".search-overlay"),this.closeIcon=document.querySelector(".close-live-search"),this.inputField=document.querySelector("#live-search-field"),this.resultsArea=document.querySelector(".live-search-results"),this.loaderIcon=document.querySelector(".circle-loader"),this.typingWaitTimer,this.previousValue="",this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.inputField.addEventListener("keyup",(function(){return e.keyPressHandler()})),this.closeIcon.addEventListener("click",(function(){return e.closeOverlay()})),this.headerSearchIcon.addEventListener("click",(function(t){t.preventDefault(),e.openOverlay()}))}},{key:"keyPressHandler",value:function(){var e=this,t=this.inputField.value;""==t&&(clearTimeout(this.typingWaitTimer),this.hideLoaderIcon(),this.hideResultsArea()),""!=t&&t!=this.previousValue&&(clearTimeout(this.typingWaitTimer),this.showLoaderIcon(),this.hideResultsArea(),this.typingWaitTimer=setTimeout((function(){return e.sendRequest()}),750)),this.previousValue=t}},{key:"sendRequest",value:function(){var e=this;i.a.post("/search",{_csrf:this.csrf,searchTerm:this.inputField.value}).then((function(t){console.log(t.data),e.renderResultsHTML(t.data)})).catch((function(){alert("Hello, the request failed.")}))}},{key:"renderResultsHTML",value:function(e){e.length?this.resultsArea.innerHTML=a.a.sanitize('<div class="list-group shadow-sm">\n <div class="list-group-item active"><strong>Search Results</strong> ('.concat(e.length>1?"".concat(e.length," items found"):"1 item found",")</div>\n ").concat(e.map((function(e){var t=new Date(e.createDate);return'<a href="/post/'.concat(e._id,'" class="list-group-item list-group-item-action">\n <img class="avatar-tiny" src="').concat(e.author.avatar,'"> <strong>').concat(e.title,'</strong>\n <span class="text-muted small">by ').concat(e.author.username," on ").concat(t.getMonth()+1,"/").concat(t.getDate(),"/").concat(t.getFullYear(),"</span>\n </a>")})).join(""),"\n </div>")):this.resultsArea.innerHTML='<p class="alert alert-danger text-center shadow-sm">Sorry, we could not find any results for that search.</p>',this.hideLoaderIcon(),this.showResultsArea()}},{key:"showLoaderIcon",value:function(){this.loaderIcon.classList.add("circle-loader--visible")}},{key:"hideLoaderIcon",value:function(){this.loaderIcon.classList.remove("circle-loader--visible")}},{key:"showResultsArea",value:function(){this.resultsArea.classList.add("live-search-results--visible")}},{key:"hideResultsArea",value:function(){this.resultsArea.classList.remove("live-search-results--visible")}},{key:"openOverlay",value:function(){var e=this;this.overlay.classList.add("search-overlay--visible"),setTimeout((function(){return e.inputField.focus()}),50)}},{key:"closeOverlay",value:function(){this.overlay.classList.remove("search-overlay--visible")}},{key:"injectHTML",value:function(){document.body.insertAdjacentHTML("beforeend",'<div class="search-overlay">\n <div class="search-overlay-top shadow-sm">\n <div class="container container--narrow">\n <label for="live-search-field" class="search-overlay-icon"><i class="fas fa-search"></i></label>\n <input type="text" id="live-search-field" class="live-search-field" placeholder="What are you interested in?">\n <span class="close-live-search"><i class="fas fa-times-circle"></i></span>\n </div>\n </div>\n\n <div class="search-overlay-bottom">\n <div class="container container--narrow py-3">\n <div class="circle-loader"></div>\n <div class="live-search-results"></div>\n </div>\n </div>\n </div>')}}])&&s(t.prototype,r),n&&s(t,n),e}();function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.openedYet=!1,this.chatWrapper=document.querySelector("#chat-wrapper"),this.openIcon=document.querySelector(".header-chat-icon"),this.injectHTML(),this.chatLog=document.querySelector("#chat"),this.chatField=document.querySelector("#chatField"),this.chatForm=document.querySelector("#chatForm"),this.closeIcon=document.querySelector(".chat-title-bar-close"),this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.chatForm.addEventListener("submit",(function(t){t.preventDefault(),e.sendMessageToServer()})),this.openIcon.addEventListener("click",(function(){return e.showChat()})),this.closeIcon.addEventListener("click",(function(){return e.hideChat()}))}},{key:"sendMessageToServer",value:function(){this.socket.emit("chatMessageFromBrowser",{message:this.chatField.value}),this.chatLog.insertAdjacentHTML("beforeend",a.a.sanitize('\n <div class="chat-self">\n <div class="chat-message">\n <div class="chat-message-inner">\n '.concat(this.chatField.value,'\n </div>\n </div>\n <img class="chat-avatar avatar-tiny" src="').concat(this.avatar,'">\n </div>\n '))),this.chatLog.scrollTop=this.chatLog.scrollHeight,this.chatField.value="",this.chatField.focus()}},{key:"hideChat",value:function(){this.chatWrapper.classList.remove("chat--visible")}},{key:"showChat",value:function(){this.openedYet||this.openConnection(),this.openedYet=!0,this.chatWrapper.classList.add("chat--visible"),this.chatField.focus()}},{key:"openConnection",value:function(){var e=this;this.socket=io(),this.socket.on("welcome",(function(t){e.username=t.username,e.avatar=t.avatar})),this.socket.on("chatMessageFromServer",(function(t){e.displayMessageFromServer(t)}))}},{key:"displayMessageFromServer",value:function(e){this.chatLog.insertAdjacentHTML("beforeend",a.a.sanitize('\n <div class="chat-other">\n <a href="/profile/'.concat(e.username,'"><img class="avatar-tiny" src="').concat(e.avatar,'"></a>\n <div class="chat-message"><div class="chat-message-inner">\n <a href="/profile/').concat(e.username,'"><strong>').concat(e.username,":</strong></a>\n ").concat(e.message,"\n </div></div>\n </div>\n "))),this.chatLog.scrollTop=this.chatLog.scrollHeight}},{key:"injectHTML",value:function(){this.chatWrapper.innerHTML='\n <div class="chat-title-bar">Chat <span class="chat-title-bar-close"><i class="fas fa-times-circle"></i></span></div>\n <div id="chat" class="chat-log"></div>\n \n <form id="chatForm" class="chat-form border-top">\n <input type="text" class="chat-field" id="chatField" placeholder="Type a message…" autocomplete="off">\n </form>\n\n '}}])&&u(t.prototype,r),n&&u(t,n),e}();function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._csrf=document.querySelector('[name="_csrf"]').value,this.form=document.querySelector("#registration-form"),this.allFields=document.querySelectorAll("#registration-form .form-control"),this.insertValidationElements(),this.username=document.querySelector("#username-register"),this.username.previousValue="",this.email=document.querySelector("#email-register"),this.email.previousValue="",this.password=document.querySelector("#password-register"),this.password.previousValue="",this.username.isUnique=!1,this.email.isUnique=!1,this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.form.addEventListener("submit",(function(t){t.preventDefault(),e.formSubmitHandler()})),this.username.addEventListener("keyup",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener("keyup",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener("keyup",(function(){e.isDifferent(e.password,e.passwordHandler)})),this.username.addEventListener("blur",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener("blur",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener("blur",(function(){e.isDifferent(e.password,e.passwordHandler)}))}},{key:"formSubmitHandler",value:function(){this.usernameImmediately(),this.usernameAfterDelay(),this.emailAfterDelay(),this.passwordImmediately(),this.passwordAfterDelay(),!this.username.isUnique||this.username.errors||!this.email.isUnique||this.email.errors||this.password.errors||this.form.submit()}},{key:"isDifferent",value:function(e,t){e.previousValue!=e.value&&t.call(this),e.previousValue=e.value}},{key:"usernameHandler",value:function(){var e=this;this.username.errors=!1,this.usernameImmediately(),clearTimeout(this.username.timer),this.username.timer=setTimeout((function(){return e.usernameAfterDelay()}),800)}},{key:"passwordHandler",value:function(){var e=this;this.password.errors=!1,this.passwordImmediately(),clearTimeout(this.password.timer),this.password.timer=setTimeout((function(){return e.passwordAfterDelay()}),800)}},{key:"passwordImmediately",value:function(){this.password.value.length>50&&this.showValidationError(this.password,"Password cannot exceed 50 characters."),this.password.errors||this.hideValidationError(this.password)}},{key:"passwordAfterDelay",value:function(){this.password.value.length<12&&this.showValidationError(this.password,"Password must be at least 12 characters.")}},{key:"emailHandler",value:function(){var e=this;this.email.errors=!1,clearTimeout(this.email.timer),this.email.timer=setTimeout((function(){return e.emailAfterDelay()}),800)}},{key:"emailAfterDelay",value:function(){var e=this;/^\S+@\S+$/.test(this.email.value)||this.showValidationError(this.email,"You must provide a valid email address."),this.email.errors||i.a.post("/doesEmailExist",{_csrf:this._csrf,email:this.email.value}).then((function(t){t.data?(e.email.isUnique=!1,e.showValidationError(e.email,"That email is already being used.")):(e.email.isUnique=!0,e.hideValidationError(e.email))})).catch((function(){console.log("Please try again later.")}))}},{key:"usernameImmediately",value:function(){""==this.username.value||/^([a-zA-Z0-9]+)$/.test(this.username.value)||this.showValidationError(this.username,"Username can only contain letters and numbers."),this.username.value.length>30&&this.showValidationError(this.username,"Username cannot exceed 30 characters."),this.username.errors||this.hideValidationError(this.username)}},{key:"hideValidationError",value:function(e){e.nextElementSibling.classList.remove("liveValidateMessage--visible")}},{key:"showValidationError",value:function(e,t){e.nextElementSibling.innerHTML=t,e.nextElementSibling.classList.add("liveValidateMessage--visible"),e.errors=!0}},{key:"usernameAfterDelay",value:function(){var e=this;this.username.value.length<3&&this.showValidationError(this.username,"Username must be at least 3 characters."),this.username.errors||i.a.post("/doesUsernameExist",{_csrf:this._csrf,username:this.username.value}).then((function(t){t.data?(e.showValidationError(e.username,"That username is already taken."),e.username.isUnique=!1):e.username.isUnique=!0})).catch((function(){console.log("Please try again later.")}))}},{key:"insertValidationElements",value:function(){this.allFields.forEach((function(e){e.insertAdjacentHTML("afterend",'<div class="alert alert-danger small liveValidateMessage"></div>')}))}}])&&f(t.prototype,r),n&&f(t,n),e}();document.querySelector("#registration-form")&&new d,document.querySelector("#chat-wrapper")&&new l,document.querySelector(".header-search-icon")&&new c}]); \ No newline at end of file +e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(0),i=r(4),o=r(14),a=r(15),s=r(9);function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=s(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,r,i){return this.request(n.merge(i||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){"use strict";var n=r(0);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){"use strict";var n=r(0),i=r(16),o=r(5),a=r(6),s=r(24),c=r(25);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.baseURL&&!s(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return u(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||l||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t,r){var i=r.config.validateStatus;!i||i(r.status)?e(r):t(n("Request failed with status code "+r.status,r.config,null,r.request,r))}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var n=r(0),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,a={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([r]):a[t]?a[t]+", "+r:r}})),a):a}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,a){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(i)&&s.push("path="+i),n.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(10);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";r.r(t);var n=r(1),i=r.n(n),o=r(2),a=r.n(o);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._csrf=document.querySelector('[name="_csrf"]').value,this.injectHTML(),this.headerSearchIcon=document.querySelector(".header-search-icon"),this.overlay=document.querySelector(".search-overlay"),this.closeIcon=document.querySelector(".close-live-search"),this.inputField=document.querySelector("#live-search-field"),this.resultsArea=document.querySelector(".live-search-results"),this.loaderIcon=document.querySelector(".circle-loader"),this.typingWaitTimer,this.previousValue="",this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.inputField.addEventListener("keyup",(function(){return e.keyPressHandler()})),this.closeIcon.addEventListener("click",(function(){return e.closeOverlay()})),this.headerSearchIcon.addEventListener("click",(function(t){t.preventDefault(),e.openOverlay()}))}},{key:"keyPressHandler",value:function(){var e=this,t=this.inputField.value;""==t&&(clearTimeout(this.typingWaitTimer),this.hideLoaderIcon(),this.hideResultsArea()),""!=t&&t!=this.previousValue&&(clearTimeout(this.typingWaitTimer),this.showLoaderIcon(),this.hideResultsArea(),this.typingWaitTimer=setTimeout((function(){return e.sendRequest()}),750)),this.previousValue=t}},{key:"sendRequest",value:function(){var e=this;i.a.post("/search",{_csrf:this._csrf,searchTerm:this.inputField.value}).then((function(t){console.log(t.data),e.renderResultsHTML(t.data)})).catch((function(){alert("Hello, the request failed.")}))}},{key:"renderResultsHTML",value:function(e){e.length?this.resultsArea.innerHTML=a.a.sanitize('<div class="list-group shadow-sm">\n <div class="list-group-item active"><strong>Search Results</strong> ('.concat(e.length>1?"".concat(e.length," items found"):"1 item found",")</div>\n ").concat(e.map((function(e){var t=new Date(e.createDate);return'<a href="/post/'.concat(e._id,'" class="list-group-item list-group-item-action">\n <img class="avatar-tiny" src="').concat(e.author.avatar,'"> <strong>').concat(e.title,'</strong>\n <span class="text-muted small">by ').concat(e.author.username," on ").concat(t.getMonth()+1,"/").concat(t.getDate(),"/").concat(t.getFullYear(),"</span>\n </a>")})).join(""),"\n </div>")):this.resultsArea.innerHTML='<p class="alert alert-danger text-center shadow-sm">Sorry, we could not find any results for that search.</p>',this.hideLoaderIcon(),this.showResultsArea()}},{key:"showLoaderIcon",value:function(){this.loaderIcon.classList.add("circle-loader--visible")}},{key:"hideLoaderIcon",value:function(){this.loaderIcon.classList.remove("circle-loader--visible")}},{key:"showResultsArea",value:function(){this.resultsArea.classList.add("live-search-results--visible")}},{key:"hideResultsArea",value:function(){this.resultsArea.classList.remove("live-search-results--visible")}},{key:"openOverlay",value:function(){var e=this;this.overlay.classList.add("search-overlay--visible"),setTimeout((function(){return e.inputField.focus()}),50)}},{key:"closeOverlay",value:function(){this.overlay.classList.remove("search-overlay--visible")}},{key:"injectHTML",value:function(){document.body.insertAdjacentHTML("beforeend",'<div class="search-overlay">\n <div class="search-overlay-top shadow-sm">\n <div class="container container--narrow">\n <label for="live-search-field" class="search-overlay-icon"><i class="fas fa-search"></i></label>\n <input type="text" id="live-search-field" class="live-search-field" placeholder="What are you interested in?">\n <span class="close-live-search"><i class="fas fa-times-circle"></i></span>\n </div>\n </div>\n\n <div class="search-overlay-bottom">\n <div class="container container--narrow py-3">\n <div class="circle-loader"></div>\n <div class="live-search-results"></div>\n </div>\n </div>\n </div>')}}])&&s(t.prototype,r),n&&s(t,n),e}();function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.openedYet=!1,this.chatWrapper=document.querySelector("#chat-wrapper"),this.openIcon=document.querySelector(".header-chat-icon"),this.injectHTML(),this.chatLog=document.querySelector("#chat"),this.chatField=document.querySelector("#chatField"),this.chatForm=document.querySelector("#chatForm"),this.closeIcon=document.querySelector(".chat-title-bar-close"),this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.chatForm.addEventListener("submit",(function(t){t.preventDefault(),e.sendMessageToServer()})),this.openIcon.addEventListener("click",(function(){return e.showChat()})),this.closeIcon.addEventListener("click",(function(){return e.hideChat()}))}},{key:"sendMessageToServer",value:function(){this.socket.emit("chatMessageFromBrowser",{message:this.chatField.value}),this.chatLog.insertAdjacentHTML("beforeend",a.a.sanitize('\n <div class="chat-self">\n <div class="chat-message">\n <div class="chat-message-inner">\n '.concat(this.chatField.value,'\n </div>\n </div>\n <img class="chat-avatar avatar-tiny" src="').concat(this.avatar,'">\n </div>\n '))),this.chatLog.scrollTop=this.chatLog.scrollHeight,this.chatField.value="",this.chatField.focus()}},{key:"hideChat",value:function(){this.chatWrapper.classList.remove("chat--visible")}},{key:"showChat",value:function(){this.openedYet||this.openConnection(),this.openedYet=!0,this.chatWrapper.classList.add("chat--visible"),this.chatField.focus()}},{key:"openConnection",value:function(){var e=this;this.socket=io(),this.socket.on("welcome",(function(t){e.username=t.username,e.avatar=t.avatar})),this.socket.on("chatMessageFromServer",(function(t){e.displayMessageFromServer(t)}))}},{key:"displayMessageFromServer",value:function(e){this.chatLog.insertAdjacentHTML("beforeend",a.a.sanitize('\n <div class="chat-other">\n <a href="/profile/'.concat(e.username,'"><img class="avatar-tiny" src="').concat(e.avatar,'"></a>\n <div class="chat-message"><div class="chat-message-inner">\n <a href="/profile/').concat(e.username,'"><strong>').concat(e.username,":</strong></a>\n ").concat(e.message,"\n </div></div>\n </div>\n "))),this.chatLog.scrollTop=this.chatLog.scrollHeight}},{key:"injectHTML",value:function(){this.chatWrapper.innerHTML='\n <div class="chat-title-bar">Chat <span class="chat-title-bar-close"><i class="fas fa-times-circle"></i></span></div>\n <div id="chat" class="chat-log"></div>\n \n <form id="chatForm" class="chat-form border-top">\n <input type="text" class="chat-field" id="chatField" placeholder="Type a message…" autocomplete="off">\n </form>\n\n '}}])&&u(t.prototype,r),n&&u(t,n),e}();function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._csrf=document.querySelector('[name="_csrf"]').value,this.form=document.querySelector("#registration-form"),this.allFields=document.querySelectorAll("#registration-form .form-control"),this.insertValidationElements(),this.username=document.querySelector("#username-register"),this.username.previousValue="",this.email=document.querySelector("#email-register"),this.email.previousValue="",this.password=document.querySelector("#password-register"),this.password.previousValue="",this.username.isUnique=!1,this.email.isUnique=!1,this.events()}var t,r,n;return t=e,(r=[{key:"events",value:function(){var e=this;this.form.addEventListener("submit",(function(t){t.preventDefault(),e.formSubmitHandler()})),this.username.addEventListener("keyup",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener("keyup",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener("keyup",(function(){e.isDifferent(e.password,e.passwordHandler)})),this.username.addEventListener("blur",(function(){e.isDifferent(e.username,e.usernameHandler)})),this.email.addEventListener("blur",(function(){e.isDifferent(e.email,e.emailHandler)})),this.password.addEventListener("blur",(function(){e.isDifferent(e.password,e.passwordHandler)}))}},{key:"formSubmitHandler",value:function(){this.usernameImmediately(),this.usernameAfterDelay(),this.emailAfterDelay(),this.passwordImmediately(),this.passwordAfterDelay(),!this.username.isUnique||this.username.errors||!this.email.isUnique||this.email.errors||this.password.errors||this.form.submit()}},{key:"isDifferent",value:function(e,t){e.previousValue!=e.value&&t.call(this),e.previousValue=e.value}},{key:"usernameHandler",value:function(){var e=this;this.username.errors=!1,this.usernameImmediately(),clearTimeout(this.username.timer),this.username.timer=setTimeout((function(){return e.usernameAfterDelay()}),800)}},{key:"passwordHandler",value:function(){var e=this;this.password.errors=!1,this.passwordImmediately(),clearTimeout(this.password.timer),this.password.timer=setTimeout((function(){return e.passwordAfterDelay()}),800)}},{key:"passwordImmediately",value:function(){this.password.value.length>50&&this.showValidationError(this.password,"Password cannot exceed 50 characters."),this.password.errors||this.hideValidationError(this.password)}},{key:"passwordAfterDelay",value:function(){this.password.value.length<12&&this.showValidationError(this.password,"Password must be at least 12 characters.")}},{key:"emailHandler",value:function(){var e=this;this.email.errors=!1,clearTimeout(this.email.timer),this.email.timer=setTimeout((function(){return e.emailAfterDelay()}),800)}},{key:"emailAfterDelay",value:function(){var e=this;/^\S+@\S+$/.test(this.email.value)||this.showValidationError(this.email,"You must provide a valid email address."),this.email.errors||i.a.post("/doesEmailExist",{_csrf:this._csrf,email:this.email.value}).then((function(t){t.data?(e.email.isUnique=!1,e.showValidationError(e.email,"That email is already being used.")):(e.email.isUnique=!0,e.hideValidationError(e.email))})).catch((function(){console.log("Please try again later.")}))}},{key:"usernameImmediately",value:function(){""==this.username.value||/^([a-zA-Z0-9]+)$/.test(this.username.value)||this.showValidationError(this.username,"Username can only contain letters and numbers."),this.username.value.length>30&&this.showValidationError(this.username,"Username cannot exceed 30 characters."),this.username.errors||this.hideValidationError(this.username)}},{key:"hideValidationError",value:function(e){e.nextElementSibling.classList.remove("liveValidateMessage--visible")}},{key:"showValidationError",value:function(e,t){e.nextElementSibling.innerHTML=t,e.nextElementSibling.classList.add("liveValidateMessage--visible"),e.errors=!0}},{key:"usernameAfterDelay",value:function(){var e=this;this.username.value.length<3&&this.showValidationError(this.username,"Username must be at least 3 characters."),this.username.errors||i.a.post("/doesUsernameExist",{_csrf:this._csrf,username:this.username.value}).then((function(t){t.data?(e.showValidationError(e.username,"That username is already taken."),e.username.isUnique=!1):e.username.isUnique=!0})).catch((function(){console.log("Please try again later.")}))}},{key:"insertValidationElements",value:function(){this.allFields.forEach((function(e){e.insertAdjacentHTML("afterend",'<div class="alert alert-danger small liveValidateMessage"></div>')}))}}])&&f(t.prototype,r),n&&f(t,n),e}();document.querySelector("#registration-form")&&new d,document.querySelector("#chat-wrapper")&&new l,document.querySelector(".header-search-icon")&&new c}]); \ No newline at end of file diff --git a/public/main.css b/public/main.css index e907fbbd..96fc87b4 100644 --- a/public/main.css +++ b/public/main.css @@ -3,6 +3,10 @@ body, .tooltip font-family: 'Open Sans', sans-serif; } +body{ + background-color:#dee2e6; +} + .header-bar { background-color: #292929; } @@ -366,4 +370,86 @@ textarea.tall-textarea { border: none; outline: none; font-size: .75rem; -} \ No newline at end of file +} + + + + +#landing-header { + z-index: 1; + position: relative; + text-align: center; + padding-top: 40vh; +} + +#landing-header h1 { + color: #fff; +} + +.slideshow { + position: fixed; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 0; + list-style: none; + margin-top: 0; + padding: 0;} + +.slideshow li { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + background-size: cover; + background-position: 50% 50%; + background-repeat: no-repeat; + opacity: 0; + z-index: 0; + animation: imageAnimation 50s linear infinite; +} + +.slideshow li:nth-child(1) { + background-image: url(http://i.imgur.com/K3mPv14.jpg) +} +.slideshow li:nth-child(2) { + background-image: url(http://i.imgur.com/SBEmFpv.jpg); + animation-delay: 10s; +} +.slideshow li:nth-child(3) { + background-image: url(http://i.imgur.com/emvhOnb.jpg); + animation-delay: 20s; +} +.slideshow li:nth-child(4) { + background-image: url(http://i.imgur.com/2LSMCmJ.jpg); + animation-delay: 30s; +} +.slideshow li:nth-child(5) { + background-image: url(http://i.imgur.com/TVGe0Ef.jpg); + animation-delay: 40s; +} + +@keyframes imageAnimation { + 0% { + opacity: 0; + animation-timing-function: ease-in; + } + 10% { + opacity: 1; + animation-timing-function: ease-out; + } + 20% { + opacity: 1 + } + 30% { + opacity: 0 + } +} + +/* Older browser support - .no-cssanimations class added by modernizr */ +.no-cssanimations .slideshow li { + opacity: 1; +} + diff --git a/views/404.ejs b/views/404.ejs index efe9dad6..d2591626 100644 --- a/views/404.ejs +++ b/views/404.ejs @@ -4,7 +4,7 @@ <div class="container py-md-5 container--narrow"> <div class="text-center"> - <h2>Whoops, we cannot find that page.</h2> + <h2>Whoops, we cannot find that page but all those who get 404 are not Lost!!</h2> <p class="lead text-muted">You can always visit the <a href="/">homepage</a> to get a fresh start.</p> </div> </div> diff --git a/views/home-guest.ejs b/views/home-guest.ejs index 5fb90902..f2ece8a1 100644 --- a/views/home-guest.ejs +++ b/views/home-guest.ejs @@ -1,13 +1,46 @@ -<%- include("includes/header")%> - -<div class="container py-md-5"> +<!doctype html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title><%=typeof(title)== "undefined" ? 'NomadicLusts' : `${title} | NomadicLusts` %> + + + + + + +

+
+
+

NomadicLusts

+
+
+
+ +
+
+ +
+
+ + +
+
+
+ +
+
<%- include("includes/flash")%>
-

Remember Writing?

-

Are you sick of short tweets and impersonal “shared” posts that are reminiscent of the late 90’s email forwards? We believe getting back to actually writing is the key to enjoying the internet again.

+

Go See Write!!

+

“The World is a Book and those who do not travel read only pages.”

+

Do you love to Travel, mishap and adventure in this beautiful and bizarre world? Then let’s explore these mesmerizingly beautiful + destinations from all over the world!

@@ -18,7 +51,7 @@
- +
@@ -30,14 +63,20 @@
- - + +
- +
    +
  • +
  • +
  • +
  • +
  • +
<%- include("includes/footer")%> \ No newline at end of file diff --git a/views/includes/footer.ejs b/views/includes/footer.ejs index 6bc1b3ca..3fd6c917 100644 --- a/views/includes/footer.ejs +++ b/views/includes/footer.ejs @@ -1,5 +1,5 @@
-

Copyright © 2019 OurApp. All rights reserved.

+

Copyright © 2020 NomadicLusts. All rights reserved.

<%if (user){%> diff --git a/views/includes/header.ejs b/views/includes/header.ejs index b82403e6..38b26edf 100644 --- a/views/includes/header.ejs +++ b/views/includes/header.ejs @@ -4,7 +4,7 @@ - <%=typeof(title)== "undefined" ? 'OurApp' : `${title} | OurApp` %> + <%=typeof(title)== "undefined" ? 'NomadicLusts' : `${title} | NomadicLusts` %> @@ -13,7 +13,7 @@
-

OurApp

+

NomadicLusts

<% if(user){%> @@ -25,27 +25,9 @@
-
-
- + <% }else{ %> - - - - - - - OurApp - - - - - - -
-
-
@@ -60,9 +42,7 @@
-
-
- + <% }%>