diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..4789577 Binary files /dev/null and b/.DS_Store differ diff --git a/chromeExtension/.DS_Store b/chromeExtension/.DS_Store new file mode 100644 index 0000000..8d2a2e0 Binary files /dev/null and b/chromeExtension/.DS_Store differ diff --git a/chromeExtension/icon.png b/chromeExtension/icon.png index 76a3a13..7f0d2c9 100644 Binary files a/chromeExtension/icon.png and b/chromeExtension/icon.png differ diff --git a/chromeExtension/icon1.png b/chromeExtension/icon1.png new file mode 100644 index 0000000..76a3a13 Binary files /dev/null and b/chromeExtension/icon1.png differ diff --git a/chromeExtension/manifest.json b/chromeExtension/manifest.json index ca841a8..13d4a2f 100644 --- a/chromeExtension/manifest.json +++ b/chromeExtension/manifest.json @@ -23,7 +23,8 @@ "content_scripts": [{ "matches": [ "https://www.104.com.tw/job/*", - "http://www.104.com.tw/job/*" + "http://www.104.com.tw/job/*", + "http://www.1111.com.tw/job-bank/job-description*" ], "js": ["./dist/content-bundle.js"] }] diff --git a/front-end/app/API/createJob.js b/front-end/app/API/createJob.js index 72f9e7f..71552f9 100644 --- a/front-end/app/API/createJob.js +++ b/front-end/app/API/createJob.js @@ -5,14 +5,14 @@ import { import config from '../../../config.json' -export default function createJob({company_name, job_name, e04_job_no}) { +export default function createJob({company_name, job_name, e04_job_no, eeee_job_no}) { const {backend} = config const options = { headers: { "Content-Type": "application/json" }, method: 'POST', - body: JSON.stringify({company_name, job_name, e04_job_no}), + body: JSON.stringify({company_name, job_name, e04_job_no, eeee_job_no}), mode: 'cors' } return fetch(`${backend}/jobs`, options) diff --git a/front-end/app/API/fetchJob.js b/front-end/app/API/fetchJob.js index 26ff50c..a5fe89f 100644 --- a/front-end/app/API/fetchJob.js +++ b/front-end/app/API/fetchJob.js @@ -8,7 +8,8 @@ import config from '../../../config.json' export default function fetchJob({ company_name, job_name, - e04_job_no + e04_job_no, + eeee_job_no }) { const { backend @@ -19,7 +20,7 @@ export default function fetchJob({ mode: 'cors' } - const url = `${backend}/jobs?company_name=${company_name}&job_name=${job_name}&e04_job_no=${e04_job_no}` + const url = `${backend}/jobs?company_name=${company_name}&job_name=${job_name}&e04_job_no=${e04_job_no}&eeee_job_no=${eeee_job_no}` return fetch(url, options) .then(checkStatus) .then(parseJSON) diff --git a/front-end/app/actions/createJob.js b/front-end/app/actions/createJob.js index b3e1395..503c120 100644 --- a/front-end/app/actions/createJob.js +++ b/front-end/app/actions/createJob.js @@ -6,14 +6,22 @@ export const SUCCESS_CREATE_JOB = 'SUCCESS_CREATE_JOB' export function requestCreateJob({ company_name, job_name, - e04_job_no + e04_job_no="null", + eeee_job_no="null" }) { + console.log('requestCreateJob:::',{ + company_name, + job_name, + e04_job_no, + eeee_job_no +}); return { type: REQUEST_CREATE_JOB, params: { company_name, job_name, - e04_job_no + e04_job_no, + eeee_job_no } } } diff --git a/front-end/app/actions/fetchJob.js b/front-end/app/actions/fetchJob.js index c10737b..942a129 100644 --- a/front-end/app/actions/fetchJob.js +++ b/front-end/app/actions/fetchJob.js @@ -3,10 +3,10 @@ export const FAIL_TO_FETCH_JOB = 'FAIL_TO_FETCH_JOB' export const SUCCESS_FETCH_JOB = 'SUCCESS_FETCH_JOB' -export function requestFetchJob({company_name, job_name, e04_job_no}) { +export function requestFetchJob({company_name, job_name, e04_job_no="null", eeee_job_no="null"}) { return { type: REQUEST_FETCH_JOB, - query: {company_name, job_name, e04_job_no} + query: {company_name, job_name, e04_job_no, eeee_job_no} } } diff --git a/front-end/app/components/StatusBlock/index.js b/front-end/app/components/StatusBlock/index.js index 87aa6cd..1b6f1fa 100644 --- a/front-end/app/components/StatusBlock/index.js +++ b/front-end/app/components/StatusBlock/index.js @@ -9,7 +9,7 @@ class StatusBlock extends React.Component { comments } = this.props - if (comments.data.length !== 0) { + let statNumbers = { good: 0, bad: 0, @@ -45,7 +45,6 @@ class StatusBlock extends React.Component { ) - } } diff --git a/front-end/app/containers/App.js b/front-end/app/containers/App.js index 60435cc..9f128cc 100644 --- a/front-end/app/containers/App.js +++ b/front-end/app/containers/App.js @@ -53,21 +53,17 @@ class App extends React.Component { componentWillMount() { const { - dispatch + dispatch, user } = this.props chrome.storage.sync.get('access_token', (item) => { - console.log('item ==>', item); if (!!item['access_token']) { dispatch(requestLogin(item['access_token'])) - } else { - console.log('access token not found'); } }) chrome.storage.sync.get('anonymous', (item) => { if (item['anonymous'] !== undefined) { - console.log('item ==>', item['anonymous']); if (user.anonymous !== item['anonymous']) { dispatch(changeUserIdentity()) } diff --git a/front-end/app/providers/104.js b/front-end/app/providers/104.js index 80f664a..7d8890b 100644 --- a/front-end/app/providers/104.js +++ b/front-end/app/providers/104.js @@ -1,11 +1,14 @@ const get_job_name = () => document.querySelector('#job h1') .firstChild .textContent.trim() + const get_company_name = () => document.querySelector('#job .company a') .firstChild .textContent.trim() + const get_e04_job_no = () => location.search.match(/\?jobno=([^\&]+)/)[1] + const provider = { get_job_name, get_company_name, diff --git a/front-end/app/providers/1111.js b/front-end/app/providers/1111.js new file mode 100644 index 0000000..c50de4e --- /dev/null +++ b/front-end/app/providers/1111.js @@ -0,0 +1,11 @@ +const get_job_name = () => document.querySelector('#commonTop h1').innerText.trim() +const get_company_name = () => document.querySelector('#commonTop .navbar a').innerText.trim() +const get_eeee_job_no = () => location.search.match(/\?eNo=([0-9]+)/)[1] + +const provider = { + get_job_name, + get_company_name, + get_eeee_job_no +} + +export default provider \ No newline at end of file diff --git a/front-end/app/providers/index.js b/front-end/app/providers/index.js index 456de54..206d2d1 100644 --- a/front-end/app/providers/index.js +++ b/front-end/app/providers/index.js @@ -1,7 +1,9 @@ import p104 from './104.js' +import p1111 from './1111.js' const rootProvider = { - ["104"]: p104 + ["104"]: p104, + ["1111"]: p1111 } export function getProviderName() { @@ -13,9 +15,11 @@ export function getProviderName() { export function getJobQuery(provider) { const jobQuery = {} + Object.keys(provider).forEach(key => { jobQuery[key.substring(4)] = provider[key]() }) + return jobQuery } diff --git a/front-end/popup.js b/front-end/popup.js index 57fb745..18a0609 100644 --- a/front-end/popup.js +++ b/front-end/popup.js @@ -1,9 +1,22 @@ + class Popup extends React.Component { render() { return ( -
-

Popup

- chrome.tabs.create({'url': "/options.html" } )}>選項 +
+

Clairvoyance

+
+ chrome.tabs.create({'url': "/options.html" } )}>

設置與說明書

+
+
+

關於 Clairvoyance

+
+ 臉書專頁:Clairvoyance - 求職天眼通 +
+
+ Source code: Clairvoyance +
+
+
) } diff --git a/tests/front-end/actions/createJob.spec.js b/tests/front-end/actions/createJob.spec.js index 130f7d3..d72202d 100644 --- a/tests/front-end/actions/createJob.spec.js +++ b/tests/front-end/actions/createJob.spec.js @@ -23,7 +23,8 @@ describe('Actions/ Create job', () => { params: { company_name, job_name, - e04_job_no + e04_job_no, + eeee_job_no: "null" } } const actual = requestCreateJob({ diff --git a/tests/front-end/actions/fetchJob.spec.js b/tests/front-end/actions/fetchJob.spec.js index a7d357e..684455a 100644 --- a/tests/front-end/actions/fetchJob.spec.js +++ b/tests/front-end/actions/fetchJob.spec.js @@ -23,7 +23,8 @@ describe('Actions/ Fetch job', () => { query: { company_name, job_name, - e04_job_no + e04_job_no, + eeee_job_no: "null" } } const actual = requestFetchJob({