Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 36 additions & 16 deletions umalauncher/carrotjuicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,13 @@ def run(self):


def stop(self):
global should_stop
should_stop = True
self.should_stop = True


# Evil global to fix quitting
should_stop = False


def setup_helper_page(browser: horsium.BrowserWindow):
Expand Down Expand Up @@ -888,6 +892,7 @@ def setup_helper_page(browser: horsium.BrowserWindow):
gametora_close_ad_banner( browser )

def setup_skill_window(browser: horsium.BrowserWindow):
global should_stop
# Setup callback for window position
browser.execute_script("""
window.send_screen_rect = function() {
Expand All @@ -914,6 +919,8 @@ def setup_skill_window(browser: horsium.BrowserWindow):
# Expand settings
browser.execute_script("""document.querySelector("[class^='utils_padbottom_half_']").querySelector("button").click();""")
while not browser.execute_script("""return document.querySelector("label[for='highlightCheckbox']");"""):
if should_stop:
return
time.sleep(0.25)

# Enable highlight
Expand All @@ -933,9 +940,12 @@ def setup_skill_window(browser: horsium.BrowserWindow):
gametora_close_ad_banner(browser)

def gametora_dark_mode(browser: horsium.BrowserWindow):
global should_stop
# Enable dark mode (the only reasonable color scheme)
browser.execute_script("""document.querySelector("[class^='styles_header_settings_']").click()""")
while not browser.execute_script("""return document.querySelector("[class^='filters_toggle_button_']");"""):
if should_stop:
return
time.sleep(0.25)

dark_enabled = browser.execute_script("""return document.querySelector("[class^='tooltips_tooltip_']").querySelector("[class^='filters_toggle_button_']").childNodes[0].querySelector("input").checked;""")
Expand All @@ -945,28 +955,38 @@ def gametora_dark_mode(browser: horsium.BrowserWindow):


def gametora_remove_cookies_banner(browser: horsium.BrowserWindow):
pass
# TODO: Is the cookies banner gone now?
#times = 20
#found_banner = True
#while not browser.execute_script("""return document.getElementById("adnote");"""):
# times -= 1
# if times <= 0:
# found_banner = False
# logger.warning( "Unable to find cookies banner after 5 seconds")
# break
# time.sleep(0.25)
#
#if found_banner:
# # Hide the cookies banner
# browser.execute_script("""document.getElementById("adnote").style.display = 'none';""")
# Hide the cookies banner(s)
browser.execute_script("""
if( window.removeCookiesId == null ) {
window.removeCookiesId = setInterval( function() {
if( document.getElementById("adnote") != null) {
document.getElementById("adnote").style.display = 'none';
}
}, 5 * 1000);
}
""")
browser.execute_script("""
if( window.removeCookiesId == null ) {
window.removeCookiesId = setInterval( function() {
if( document.getElementById("qc-cmp2-container") != null) {
document.getElementById("qc-cmp2-container").remove();
}
}, 5 * 1000);
}
""")


def gametora_close_ad_banner(browser: horsium.BrowserWindow):
# Close the ad banner at the bottom
browser.execute_script("""
if( window.removeBannerAdId == null ) {
window.removeBannerAdId = setInterval( function() {
if( document.getElementsByClassName("publift-widget-sticky_footer-container")[0] != null ){
document.getElementsByClassName("publift-widget-sticky_footer-container")[0].classList.add("closed")
}""")
}
}, 5 * 1000);
}
""")



Expand Down
2 changes: 1 addition & 1 deletion umalauncher/horsium.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def firefox_setup(helper_url, settings):
firefox_service = FirefoxService(executable_path=driver_path)
firefox_service.creation_flags = CREATE_NO_WINDOW
profile = webdriver.FirefoxProfile(util.get_asset("ff_profile"))
profile.set_preference("security.fileuri.strict_origin_policy", False) # Disable CORS protections
profile.set_preference("security.fileuri.strict_origin_policy", False) # Disable CORS protections TODO this doesn't work, so window position doesn't get saved.
options = webdriver.FirefoxOptions()
options.profile = profile

Expand Down
2 changes: 1 addition & 1 deletion umalauncher/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import gui
import glob

VERSION = "1.16.5"
VERSION = "1.16.6"

def parse_version(version_string: str):
"""Convert version string to tuple."""
Expand Down
Loading