Commit c27d842a authored by Melroy van den Berg's avatar Melroy van den Berg

Idea is to create ask if a user want to upload an image at all

parent abf1a214
......@@ -8,4 +8,7 @@ Reference
* https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMChromeWindow
* https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowUtils
* https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFilePicker
* http://ecg-marktplaats.github.io/marktplaats-api/authentication.html
* view-source:https://s.marktplaats.com/aurora/res/javascript/dist/ee1c54f1/pages/Syi.js
......@@ -8,7 +8,7 @@ __version__= 1.0
# Shipping trick only works in Chrome not in Firefox! Arrrg! Try setting hidden fields via javascript instead or other hacking when required.
# True, user need to press the button him/herself. False, the system automatically press the button after uploading pictures.
USER_FINAL_APPROVAL_REQUIRED=False
USER_FINAL_APPROVAL_REQUIRED=True
print ("Running Marktplaats Batch %s" % str(__version__))
......
......@@ -64,6 +64,10 @@ class Marktplaats(MozRepl):
blocking_url = b'"' + blocking_url.encode('utf-8')
# Trigger file picker
# TODO: I could ask the user if he/she wants to upload an image in the first place? If not, directly submit the form.
# Otherwise, we can look for the change event of the hidden fields (image.ids, ..)
# If the user want to upload an image can already be put in the Excel sheet! So no additional pop-up required if filled-in.
# TODO: Check either:
# 1. If a file picker (nsIFilePicker) is currently active in FF, or:
# 2. Connect some onchange event of the click, and write something like document.temp=1 on the onclick event of the file picker. So you know when the user closed this windows
......@@ -91,7 +95,7 @@ class Marktplaats(MozRepl):
self.scroll_down_page()
else:
# Just wait a bit longer in order to process the images
sleep(0.5)
sleep(2.5)
# Document is focused again, pop-up must be closed now. Place the ad!
self.place_advertisement()
# Check if URL is changed
......@@ -125,7 +129,7 @@ class Marktplaats(MozRepl):
def close_pop_up_frontpage(self, success_popup):
"""
Close spam, and directly scroll down
Close spam, and directly scroll down or place advertisement
success_popup - True if the pop-up was working correctly (user get file picker automatically)
"""
......@@ -143,7 +147,9 @@ class Marktplaats(MozRepl):
else:
# Directly trigger to place the advertisement.
# NOTE: This only works if the user actually did upload a picture (otherwise you don't get this spam pop-up in the first place)
self.place_advertisement()
# Just wait a bit longer in order to process the images
sleep(2.5)
self.place_advertisement()
def place_advertisement(self):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment