jobscraper/dist/build/bundle.js
Martin Donnelly 5001bbd798 init
2020-05-19 10:05:04 +01:00

2 lines
9.8 KiB
JavaScript

var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function a(t,e){t.appendChild(e)}function l(t,e,n){t.insertBefore(e,n||null)}function i(t){t.parentNode.removeChild(t)}function u(t){return document.createElement(t)}function f(t){return document.createTextNode(t)}function d(){return f(" ")}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function h(t,e){e=""+e,t.data!==e&&(t.data=e)}let m;function g(t){m=t}const y=[],b=[],$=[],v=[],x=Promise.resolve();let _=!1;function w(t){$.push(t)}let j=!1;const k=new Set;function C(){if(!j){j=!0;do{for(let t=0;t<y.length;t+=1){const e=y[t];g(e),J(e.$$)}for(y.length=0;b.length;)b.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];k.has(e)||(k.add(e),e())}$.length=0}while(y.length);for(;v.length;)v.pop()();_=!1,j=!1,k.clear()}}function J(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(w)}}const S=new Set;function L(t,e){t&&t.i&&(S.delete(t),t.i(e))}function N(t,e,n,r){if(t&&t.o){if(S.has(t))return;S.add(t),(void 0).c.push(()=>{S.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function O(t){t&&t.c()}function A(t,n,s){const{fragment:c,on_mount:a,on_destroy:l,after_update:i}=t.$$;c&&c.m(n,s),w(()=>{const n=a.map(e).filter(o);l?l.push(...n):r(n),t.$$.on_mount=[]}),i.forEach(w)}function T(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function q(t,e){-1===t.$$.dirty[0]&&(y.push(t),_||(_=!0,x.then(C)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function E(e,o,s,c,a,l,u=[-1]){const f=m;g(e);const d=o.props||{},p=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:a,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(f?f.$$.context:[]),callbacks:n(),dirty:u};let h=!1;if(p.ctx=s?s(e,d,(t,n,...r)=>{const o=r.length?r[0]:n;return p.ctx&&a(p.ctx[t],p.ctx[t]=o)&&(p.bound[t]&&p.bound[t](o),h&&q(e,t)),n}):[],p.update(),h=!0,r(p.before_update),p.fragment=!!c&&c(p.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);p.fragment&&p.fragment.l(t),t.forEach(i)}else p.fragment&&p.fragment.c();o.intro&&L(e.$$.fragment),A(e,o.target,o.anchor),C()}g(f)}class D{$destroy(){T(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}function P(e){let n;return{c(){n=u("menu"),n.innerHTML="<h2>Jobs</h2> \n <hr> \n\n <button>Indeed</button>",p(n,"class","svelte-ssrzvc")},m(t,e){l(t,n,e)},p:t,i:t,o:t,d(t){t&&i(n)}}}class R extends D{constructor(t){super(),E(this,t,null,P,s,{})}}const H=[];function z(e,n=t){let r;const o=[];function c(t){if(s(e,t)&&(e=t,r)){const t=!H.length;for(let t=0;t<o.length;t+=1){const n=o[t];n[1](),H.push(n,e)}if(t){for(let t=0;t<H.length;t+=2)H[t][0](H[t+1]);H.length=0}}}return{set:c,update:function(t){c(t(e))},subscribe:function(s,a=t){const l=[s,a];return o.push(l),1===o.length&&(r=n(c)||t),s(e),()=>{const t=o.indexOf(l);-1!==t&&o.splice(t,1),0===o.length&&(r(),r=null)}}}}var M=function t(e){function n(t){return function(e,n){return s(e,Object.assign({method:t},n))}}function r(t){return function(e,n,r){return s(e,Object.assign({method:t,data:n},r))}}function o(t,e,n){if(Array.isArray(t))return t.concat(e);if(e&&"object"==typeof e){var r,s={};if(t)for(r in t)s[n?r.toLowerCase():r]=t[r];for(r in e){var c=n?r.toLowerCase():r;"headers"===c&&(n=!0),s[c]=r in s?o(s[c],e[r],n):e[r]}return s}return e}function s(t,n){"string"!=typeof t&&(t=(n=t).url);var r=o(e,n||{}),s=r.data;if(r.transformRequest)for(var c=0;c<r.transformRequest.length;c++){var a=r.transformRequest[c](s,r.headers);void 0!==a&&(s=a)}var l={};if(s&&"object"==typeof s&&(s=JSON.stringify(s),l["Content-Type"]="application/json"),r.xsrfCookieName)for(var i=document.cookie.split(/ *[;=] */),u=0;u<i.length;u+=2)if(i[u]==r.xsrfCookieName){l[r.xsrfHeaderName]=decodeURIComponent(i[u+1]);break}r.auth&&(l.Authorization=r.auth);var f={};return f.config=n,fetch(t,{method:r.method,body:s,headers:o(r.headers,l,!0)}).then((function(t){var e;for(e in t)"function"!=typeof t[e]&&(f[e]=t[e]);return(r.validateStatus?r.validateStatus(t.status):t.ok)?("stream"===r.responseType?Promise.resolve(t.body):t[r.responseType||"text"]()).then((function(t){return f.data=t,f})):Promise.reject(t)}))}return e=e||{},s.request=s,s.get=n("get"),s.delete=n("delete"),s.options=n("options"),s.post=r("post"),s.put=r("put"),s.patch=r("patch"),s.all=Promise.all,s.spread=function(t){return function(e){return t.apply(this,e)}},s.CancelToken=self.AbortController||Object,s.create=t,s}();const I={jobs:"http://localhost:3000".concat("/jobs")},B=z([]),U=z({}),F={getJobList(){M.get(I.jobs).then(t=>{const e=JSON.parse(t.data);B.set(e)}).catch(t=>{console.error("getJobList",t)})},loadJobDetail(t){if(console.log("loadJobDetail: "+t),t){const e=`${I.jobs}/${t}`;M.get(e).then(t=>{const e=JSON.parse(t.data);U.set(e)}).catch(t=>{console.error("loadJobDetail",t)})}}};function G(t,e,n){const r=t.slice();return r[2]=e[n],r[4]=n,r}function K(t){let e,n,r,s,c,m,g,y,b,$,v,x,_,w,j=t[2].title+"",k=t[2].site+"",C=t[2].company+"",J=t[2].date+"";return{c(){e=u("tr"),n=u("td"),r=f(j),s=d(),c=u("td"),m=f(k),g=d(),y=u("td"),b=f(C),$=d(),v=u("td"),x=f(J),_=d(),p(e,"class","dataRow")},m(i,u,f){var d,p,h,j;l(i,e,u),a(e,n),a(n,r),a(e,s),a(e,c),a(c,m),a(e,g),a(e,y),a(y,b),a(e,$),a(e,v),a(v,x),a(e,_),f&&w(),p="click",h=function(){o(t[1](t[2]._id))&&t[1](t[2]._id).apply(this,arguments)},(d=e).addEventListener(p,h,j),w=()=>d.removeEventListener(p,h,j)},p(e,n){t=e,1&n&&j!==(j=t[2].title+"")&&h(r,j),1&n&&k!==(k=t[2].site+"")&&h(m,k),1&n&&C!==(C=t[2].company+"")&&h(b,C),1&n&&J!==(J=t[2].date+"")&&h(x,J)},d(t){t&&i(e),w()}}}function Q(e){let n,r,o,s,c,f=e[0],h=[];for(let t=0;t<f.length;t+=1)h[t]=K(G(e,f,t));return{c(){n=u("div"),r=u("table"),o=u("thead"),o.innerHTML='<tr><th class="col-5">\n Title\n </th> \n <th class="col-2">\n Site\n </th> \n <th class="col-3">\n Company\n </th> \n <th class="col-2">\n Date\n </th></tr>',s=d(),c=u("tbody");for(let t=0;t<h.length;t+=1)h[t].c();p(r,"class",""),p(n,"class","lister svelte-rqr115")},m(t,e){l(t,n,e),a(n,r),a(r,o),a(r,s),a(r,c);for(let t=0;t<h.length;t+=1)h[t].m(c,null)},p(t,[e]){if(3&e){let n;for(f=t[0],n=0;n<f.length;n+=1){const r=G(t,f,n);h[n]?h[n].p(r,e):(h[n]=K(r),h[n].c(),h[n].m(c,null))}for(;n<h.length;n+=1)h[n].d(1);h.length=f.length}},i:t,o:t,d(t){t&&i(n),function(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}(h,t)}}}function V(t,e,n){let r;c(t,B,t=>n(0,r=t));return[r,t=>{F.loadJobDetail(t)}]}class W extends D{constructor(t){super(),E(this,t,V,Q,s,{})}}function X(t){let e,n,r,o,s,c,m,g,y,b,$,v,x,_,w,j,k,C,J,S,L,N,O,A,T,q,E,D,P,R,H,z,M,I,B,U,F=t[1].title+"",G=t[1].company+"",K=t[1].location+"",Q=t[1].salary+"",V=t[1].date+"",W=t[1].site+"",X=t[1].summary+"";return{c(){e=u("div"),n=u("div"),r=u("div"),o=u("div"),s=f(F),c=d(),m=u("div"),g=u("div"),y=f("Company: "),b=u("span"),$=f(G),v=d(),x=u("div"),_=f("Location: "),w=u("span"),j=f(K),k=d(),C=u("div"),J=u("div"),S=f("Salary: "),L=u("span"),N=f(Q),O=d(),A=u("div"),T=f("Scraped: "),q=u("span"),E=f(V),D=d(),P=u("div"),R=f("Site: "),H=u("a"),z=f(W),I=d(),B=u("blockquote"),U=f(X),p(o,"class","col-12 text-primary lead"),p(r,"class","row svelte-1rxym9d"),p(b,"class","text-primary"),p(g,"class","col-6"),p(w,"class","text-primary"),p(x,"class","col-6"),p(m,"class","row svelte-1rxym9d"),p(L,"class","text-primary"),p(J,"class","col-1-3rd"),p(q,"class","text-primary"),p(A,"class","col-1-3rd"),p(H,"href",M=t[1].url),p(H,"class","text-capitalize"),p(H,"target","_blank"),p(P,"class","col-1-3rd"),p(C,"class","row svelte-1rxym9d"),p(n,"class","detailHead bg-light svelte-1rxym9d"),p(e,"class","detail svelte-1rxym9d")},m(t,i){l(t,e,i),a(e,n),a(n,r),a(r,o),a(o,s),a(n,c),a(n,m),a(m,g),a(g,y),a(g,b),a(b,$),a(m,v),a(m,x),a(x,_),a(x,w),a(w,j),a(n,k),a(n,C),a(C,J),a(J,S),a(J,L),a(L,N),a(C,O),a(C,A),a(A,T),a(A,q),a(q,E),a(C,D),a(C,P),a(P,R),a(P,H),a(H,z),a(e,I),a(e,B),a(B,U)},p(t,e){2&e&&F!==(F=t[1].title+"")&&h(s,F),2&e&&G!==(G=t[1].company+"")&&h($,G),2&e&&K!==(K=t[1].location+"")&&h(j,K),2&e&&Q!==(Q=t[1].salary+"")&&h(N,Q),2&e&&V!==(V=t[1].date+"")&&h(E,V),2&e&&W!==(W=t[1].site+"")&&h(z,W),2&e&&M!==(M=t[1].url)&&p(H,"href",M),2&e&&X!==(X=t[1].summary+"")&&h(U,X)},d(t){t&&i(e)}}}function Y(e){let n,r=e[0]&&X(e);return{c(){r&&r.c(),n=f("")},m(t,e){r&&r.m(t,e),l(t,n,e)},p(t,[e]){t[0]?r?r.p(t,e):(r=X(t),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},i:t,o:t,d(t){r&&r.d(t),t&&i(n)}}}function Z(t,e,n){let r;c(t,U,t=>n(1,r=t));let o=!1;return U.subscribe(t=>{n(0,o=!function(t){for(const e in t)if(t.hasOwnProperty(e))return!1;return!0}(t))}),[o,r]}class tt extends D{constructor(t){super(),E(this,t,Z,Y,s,{})}}function et(e){let n,r,o,s,c,f,h;const m=new R({}),g=new W({}),y=new tt({});return{c(){n=u("main"),r=u("div"),o=u("div"),O(m.$$.fragment),s=d(),c=u("div"),O(g.$$.fragment),f=d(),O(y.$$.fragment),p(o,"class","col-2"),p(c,"class","col-10"),p(r,"class","grid view")},m(t,e){l(t,n,e),a(n,r),a(r,o),A(m,o,null),a(r,s),a(r,c),A(g,c,null),a(c,f),A(y,c,null),h=!0},p:t,i(t){h||(L(m.$$.fragment,t),L(g.$$.fragment,t),L(y.$$.fragment,t),h=!0)},o(t){N(m.$$.fragment,t),N(g.$$.fragment,t),N(y.$$.fragment,t),h=!1},d(t){t&&i(n),T(m),T(g),T(y)}}}const nt=new class extends D{constructor(t){super(),E(this,t,null,et,s,{})}}({target:document.body});return F.getJobList(),nt}();