Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code containers as selectable #11

Merged
merged 1 commit into from
Jul 20, 2022
Merged
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
12 changes: 12 additions & 0 deletions educative_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ def fix_all_svg_tags_inside_object_tags(driver):
}''')


def make_code_selectable(driver):
driver.execute_script('''
let code_containers = document.getElementsByClassName('monaco-editor');
for(let i=0;i<code_containers.length;i++){
if ( code_containers[i].classList.contains('no-user-select') )
code_containers[i].classList.remove('no-user-select');
}
''')

def get_pagecontent_using_singleFile(driver, file_name, quiz_html):
print("Get HTML Page Content Using Single File Function")

Expand All @@ -256,6 +265,9 @@ def get_pagecontent_using_singleFile(driver, file_name, quiz_html):
document.getElementsByTagName('head')[0].appendChild(inject);
''')
sleep(2)

make_code_selectable(driver)

page_content = driver.execute_script('''
const { content, title, filename } = await singlefile.getPageData({
removeImports: true,
Expand Down