Skip to content

Commit

Permalink
update image submission logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ifearcompilererrors committed Oct 4, 2021
1 parent ad73705 commit 6b48a1b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions client/firewall-client-rewrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function checkIfCorrectState() {
}

function setupUI() {
console.log('[setupUI] appending intros...')
const identity = getSearchEngine()
// redirect to Google Images search (if needed)
if (window.location.host == 'www.google.com' &&
Expand All @@ -94,7 +95,7 @@ function setupUI() {
// Google homepage => Google image search homepage
window.location = 'https://www.google.com/imghp';
if(state !== states.WAITING) setState(states.WAITING)
} else if(window.location.hash == "#intro") {
} else if (window.location.hash == "#intro") {
$(document.body).addClass("firewall-intro");
}

Expand All @@ -117,7 +118,9 @@ function setupUI() {
// add 'Firewall' button to bottom of page that lets user edit their name & toggle autocomplete
// TODO: figure out why the autocomplete toggle isn't working
const suggestChecked = autocompleteEnabled ? ' checked' : '';
$('#fsr, #lh, #ft, .wrapper_imgfrom_box').append(
const $foo = $('#fsr, #lh, #ft, .wrapper_imgfrom_box')
console.log('[$foo]', $foo);
$foo.append(
'<div id="firewall">' +
'<a href="#firewall" id="firewall-show" class="skin_from_link">Firewall</a>' +
'<form action="#" id="firewall-form" autocomplete="off">' +
Expand Down Expand Up @@ -198,6 +201,7 @@ function setupUI() {
$("#firewall-intro").addClass("inverted");
}
function hide_intro(e) {
console.log('[hide_intro]', e)
e.preventDefault();
var name = $("#firewall-intro-name").val();
if (name == "") {
Expand Down Expand Up @@ -287,6 +291,7 @@ function setupMessageListener() {
} else if (e.type == "images_loading") {
$(document.body).addClass("firewall-loading");
} else if (e.type == "close_intro") {
console.log('[close_intro]', e)
$(document.body).removeClass("firewall-intro");
$("#firewall-client-id").val(e.name);
} else if (e.type == "user_activity") {
Expand Down Expand Up @@ -399,11 +404,11 @@ function main() {
submitImagesToWordpress(() => {
console.log("[main] submitImagesToWordpress callback, unlocking search boxes");
})
submitImages(() => {
console.log("[main] submitImages callback")
setState(states.DONE)
})
}
submitImages(() => {
console.log("[main] submitImages callback")
setState(states.DONE)
})
} else {
console.log("waiting for submitImages to finish")
}
Expand Down

0 comments on commit 6b48a1b

Please sign in to comment.