forked from abalone0204/Clairvoyance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request abalone0204#5 from abalone0204/feature/provider
Feature/provider
- Loading branch information
Showing
15 changed files
with
250 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,3 +103,8 @@ | |
## Firfox Plugin | ||
|
||
## Web | ||
|
||
|
||
## Trouble | ||
|
||
- fetch 不能在 header 裡面用中文 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
const getJobTitile = () => document.querySelector('#job h1') | ||
const get_job_name = () => document.querySelector('#job h1') | ||
.firstChild | ||
.textContent.trim() | ||
const getCompanyName = () => document.querySelector('#job .company a') | ||
const get_company_name = () => document.querySelector('#job .company a') | ||
.firstChild | ||
.textContent.trim() | ||
const get_e04_job_no = () => location.search.match(/\?jobno=([^\&]+)/)[1] | ||
|
||
const provider = { | ||
getJobTitile, | ||
getCompanyName | ||
get_job_name, | ||
get_company_name, | ||
get_e04_job_no | ||
} | ||
|
||
export default provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
takeEvery | ||
} from 'redux-saga' | ||
|
||
import { | ||
put, | ||
call | ||
} from 'redux-saga/effects' | ||
|
||
import { | ||
SUCCESS_CREATE_JOB | ||
} from '../actions/createJob.js' | ||
|
||
import { | ||
SUCCESS_FETCH_JOB | ||
} from '../actions/fetchJob.js' | ||
|
||
import { | ||
requestFetchComments | ||
} from '../actions/fetchComments.js' | ||
|
||
export function* transactionOfJobAndComments() { | ||
yield call(takeEvery, [SUCCESS_CREATE_JOB, SUCCESS_FETCH_JOB], sendRequestToFetchComments) | ||
} | ||
|
||
export function* sendRequestToFetchComments(action) { | ||
yield put(requestFetchComments(action.job.id)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import providers from './app/providers' | ||
import getProvider, { | ||
getProviderName, | ||
getJobQuery | ||
} from './app/providers' | ||
import renderApp from './app' | ||
|
||
console.log('load content script'); | ||
|
||
const jobTitle = providers['104'].getJobTitile() | ||
const companyName = providers['104'].getCompanyName() | ||
const providerName = getProviderName() | ||
console.log('providerName:', providerName); | ||
const provider = getProvider() | ||
console.log('provider:', provider); | ||
const jobObject = getJobQuery(provider) | ||
console.log('jobObject:',jobObject); | ||
const {job_name,company_name} = jobObject | ||
|
||
const node = document.createElement('div') | ||
const nodeId = `${jobTitle}Cla` | ||
const nodeId = `${job_name}Cla` | ||
|
||
console.log(jobTitle,companyName); | ||
console.log(job_name, company_name); | ||
node.id = nodeId | ||
document.body.appendChild(node) | ||
|
||
renderApp(nodeId) | ||
renderApp(nodeId, { | ||
job_name, | ||
company_name | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
import Loading from './app/components/Loading' | ||
import fetchJob from './app/API/fetchJob.js' | ||
import createJob from './app/API/createJob.js' | ||
const handler = (e) => { | ||
const company_name = '中文' | ||
const job_name = 'test' | ||
const e04_job_no = 'e0444' | ||
|
||
ReactDOM.render(<Loading/>, document.querySelector('#container')) | ||
fetchJob({ | ||
company_name, | ||
job_name, | ||
e04_job_no | ||
}).then(result => { | ||
console.log('result=>',result); | ||
}) | ||
} | ||
const App = () => ( | ||
<div> | ||
<Loading/> | ||
<button onClick={handler}>fetch job</button> | ||
</div> | ||
) | ||
ReactDOM.render(<App/>, document.querySelector('#container')) |
Oops, something went wrong.