Permalink
Browse files

TurkerHub is now TurkerView Forum.

  • Loading branch information...
Kadauchi committed Dec 20, 2018
1 parent 42410e0 commit fe8e3ee375fe7b99ed6b13a1fb9b8e9077ba59db
Showing with 21 additions and 19 deletions.
  1. +5 −5 background/hit-exporter.js
  2. +1 −1 hit-finder/hit-finder.html
  3. +1 −1 hit-finder/hit-finder.js
  4. +3 −3 manifest.json
  5. +11 −9 mturk/hit-exporter.js
@@ -419,7 +419,7 @@ async function hitExporterMarkdown(request, sender, sendResponse) {
function turkerHubFetchDaily() {
return new Promise(async (resolve, reject) => {
const response = await window.fetch(
`https://turkerhub.com/forums/daily-mturk-hits-threads.2/?order=post_date&direction=desc`,
`https://forum.turkerview.com/forums/daily-mturk-hits-threads.2/?order=post_date&direction=desc`,
{
credentials: `include`
}
@@ -451,7 +451,7 @@ function turkerHubFetchDaily() {
function turkerHubCheckPosts(hit, thread) {
return new Promise(async (resolve, reject) => {
const response = await window.fetch(
`https://turkerhub.com/hub.php?action=getPosts&thread_id=${thread}&order_by=post_date`,
`https://forum.turkerview.com/hub.php?action=getPosts&thread_id=${thread}&order_by=post_date`,
{
credentials: `include`
}
@@ -476,7 +476,7 @@ function turkerHubCheckPosts(hit, thread) {
function turkerHubPostExport(thread, token, string) {
return new Promise(async (resolve, reject) => {
const response = await window.fetch(
`https://turkerhub.com/threads/${thread}/add-reply`,
`https://forum.turkerview.com/threads/${thread}/add-reply`,
{
credentials: `include`,
method: `post`,
@@ -503,13 +503,13 @@ async function hitExporterTurkerHub(request, sender, sendResponse) {
await turkerHubPostExport(data.thread, data.token, modified);
hitExporterNotification(
`HIT Exporter Successful!`,
`Turker Hub export posted on TurkerHub.com`
`TurkerView Forum export posted on Forum.TurkerView.com`
);
sendResponse({ success: true, id: request.hit.hit_set_id });
} catch (error) {
hitExporterNotification(
`HIT Exporter Failed!`,
`Turker Hub export failed with the error ${error}`
`TurkerView Forum export failed with the error ${error}`
);
sendResponse({ success: false, id: request.hit.hit_set_id });
}
@@ -462,7 +462,7 @@ <h5 class="modal-title">Share HIT</h5>
<button class="btn btn-primary w-100 hit-sharer" id="hit-export-markdown">Markdown</button>
</div>
<div class="col-6 mb-2">
<button class="btn btn-primary w-100 hit-sharer" id="hit-export-turkerhub">Turker Hub</button>
<button class="btn btn-primary w-100 hit-sharer" id="hit-export-turkerhub">TurkerView Forum</button>
</div>
<div class="col-6 mb-2">
<button class="btn btn-primary w-100 hit-sharer" id="hit-export-mturkcrowd">Mturk Crowd</button>
@@ -1449,7 +1449,7 @@ document.getElementById(`hit-export-markdown`).addEventListener(`click`, (event)
})

document.getElementById(`hit-export-turkerhub`).addEventListener(`click`, (event) => {
const result = window.prompt(`Are you sure you want to export this HIT to TurkerHub.com?`)
const result = window.prompt(`Are you sure you want to export this HIT to Forum.TurkerView.com?`)

if (result !== null) {
const key = event.target.dataset.key
@@ -60,7 +60,7 @@
"notifications",
"clipboardWrite",
"*://*.mturk.com/*",
"*://*.turkerhub.com/*",
"*://*.turkerview.com/*",
"*://*.mturkcrowd.com/*",
"https://www.amazon.com/ap/signin?*openid.return_to=https://worker.mturk.com/projects/*/tasks/accept_random*"
],
@@ -70,8 +70,8 @@
"externally_connectable": {
"matches": [
"https://worker.mturk.com/*",
"https://turkerhub.com/*",
"http://www.mturkcrowd.com/*"
"https://forum.turkerview.com//*",
"https://www.mturkcrowd.com/*"
]
},

@@ -8,7 +8,7 @@ function hitExporterPopover(button, hit) {
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="plain">Plain</button>
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="markdown">Markdown</button>
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="bbcode">BBCode</button>
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="turkerhub">Turker Hub</button>
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="turkerhub">TurkerView Forum</button>
<button class="btn btn-primary btn-sm" data-hit-json="${json}" data-type="mturkcrowd">MTurk Crowd</button>
</div>`;

@@ -41,19 +41,21 @@ function hitExporterPopoverButton(event, type, json) {
if (method === `turkerhub` || method === `mturkcrowd`) {
// eslint-disable-next-line no-alert
const result = window.prompt(
`Are you sure you want to export this HIT to ${method}.com?`
`Are you sure you want to export this HIT to ${
method === 'turkerhub' ? 'turkerview.forum' : method
}.com?`,
);

if (result !== null) {
chrome.runtime.sendMessage(
{ hit, hitExporter: method, message: result },
hitExporterMarkButton
hitExporterMarkButton,
);
}
} else {
chrome.runtime.sendMessage(
{ hit, hitExporter: method },
hitExporterMarkButton
hitExporterMarkButton,
);
}
}
@@ -63,7 +65,7 @@ async function hitExporter() {
ReactDOM(`HitSetTable`, `TaskQueueTable`),
ReactProps(`HitSetTable`, `TaskQueueTable`),
StorageGetKey(`options`),
Enabled(`hitExporter`)
Enabled(`hitExporter`),
]);

const { bodyData } = props;
@@ -76,14 +78,14 @@ async function hitExporter() {
.querySelector(`.project-name-column`)
.insertAdjacentHTML(
`afterbegin`,
HTML`<span class="btn btn-sm fa fa-share text-primary" tabIndex="0" data-hit="${hit}"></span>`
HTML`<span class="btn btn-sm fa fa-share text-primary" tabIndex="0" data-hit="${hit}"></span>`,
);
});

[...dom.querySelectorAll(`[data-hit]`)].forEach(button => {
[...dom.querySelectorAll(`[data-hit]`)].forEach((button) => {
const hit = JSON.parse(button.dataset.hit);

button.addEventListener(`click`, event => {
button.addEventListener(`click`, (event) => {
event.stopImmediatePropagation();

if (hitExporterType !== `all`)
@@ -93,7 +95,7 @@ async function hitExporter() {
if (hitExporterType === `all`) hitExporterPopover(button, hit);
});

document.addEventListener(`click`, event => {
document.addEventListener(`click`, (event) => {
if (event.target.matches(`[data-hit-json]`)) {
hitExporterPopoverButton(event);
}

0 comments on commit fe8e3ee

Please sign in to comment.