Skip to content

Commit 4cc9da9

Browse files
update image submission logic
1 parent ad73705 commit 4cc9da9

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

client/firewall-client-rewrite.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function checkIfCorrectState() {
8686
}
8787

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

@@ -117,7 +118,9 @@ function setupUI() {
117118
// add 'Firewall' button to bottom of page that lets user edit their name & toggle autocomplete
118119
// TODO: figure out why the autocomplete toggle isn't working
119120
const suggestChecked = autocompleteEnabled ? ' checked' : '';
120-
$('#fsr, #lh, #ft, .wrapper_imgfrom_box').append(
121+
const $foo = $('#fsr, #lh, #ft, .wrapper_imgfrom_box')
122+
console.log('[$foo]', $foo);
123+
$foo.append(
121124
'<div id="firewall">' +
122125
'<a href="#firewall" id="firewall-show" class="skin_from_link">Firewall</a>' +
123126
'<form action="#" id="firewall-form" autocomplete="off">' +
@@ -198,6 +201,7 @@ function setupUI() {
198201
$("#firewall-intro").addClass("inverted");
199202
}
200203
function hide_intro(e) {
204+
console.log('[hide_intro]', e)
201205
e.preventDefault();
202206
var name = $("#firewall-intro-name").val();
203207
if (name == "") {
@@ -287,6 +291,7 @@ function setupMessageListener() {
287291
} else if (e.type == "images_loading") {
288292
$(document.body).addClass("firewall-loading");
289293
} else if (e.type == "close_intro") {
294+
console.log('[close_intro]', e)
290295
$(document.body).removeClass("firewall-intro");
291296
$("#firewall-client-id").val(e.name);
292297
} else if (e.type == "user_activity") {
@@ -399,11 +404,11 @@ function main() {
399404
submitImagesToWordpress(() => {
400405
console.log("[main] submitImagesToWordpress callback, unlocking search boxes");
401406
})
407+
submitImages(() => {
408+
console.log("[main] submitImages callback")
409+
setState(states.DONE)
410+
})
402411
}
403-
submitImages(() => {
404-
console.log("[main] submitImages callback")
405-
setState(states.DONE)
406-
})
407412
} else {
408413
console.log("waiting for submitImages to finish")
409414
}

0 commit comments

Comments
 (0)