Skip to content

Commit

Permalink
Merge pull request #23 from khengyun/edu@v3
Browse files Browse the repository at this point in the history
Edu@v3
  • Loading branch information
khengyun authored Nov 13, 2022
2 parents b8a233e + b43c5a5 commit 9ca787b
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 23 deletions.
9 changes: 4 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ let _init_ = run_kk("doc_script/_api_conf.js")
_init_.then(() => {
let init = run_kk("doc_script/_doc_script.js")
init.then(() => {





// let doc_event = run_kk("doc_script/doc_event.js")
// doc_event.then(()=>{
//
// })
})
})

Expand Down
10 changes: 5 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"default_title": "AutoNext",
"default_popup": "pop_script/popup.html"
},
"version": "3.3.6",
"version": "3.4.5",
"description": "This automatic grading tool on edunext\n__Hovilo__",
"manifest_version": 3,
"permissions": [
Expand All @@ -27,8 +27,7 @@
"scripting"
],
"host_permissions": [
"https://api.github.com/repos/khengyun/*",
"*translate.google.com/*"
"https://api.github.com/repos/khengyun/*"
],
"content_scripts": [
{
Expand Down Expand Up @@ -61,7 +60,8 @@
"service_worker": "pop_script/bachground.js"
},
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'",
"sandbox": "sandbox allow-scripts; script-src 'self' 'https://apis.google.com/' 'https://www.gstatic.com/' 'https://*.firebaseio.com' 'https://www.googleapis.com' 'https://ajax.googleapis.com'; object-src 'self'"
"extension_pages": "script-src 'self' ; object-src 'self'",
"sandbox": "sandbox allow-scripts; script-src 'self' 'https://translate.google.com/*' 'https://apis.google.com/' 'https://translate.google.com' 'https://www.gstatic.com/' 'https://*.firebaseio.com' 'https://www.googleapis.com' 'https://ajax.googleapis.com'; object-src 'self'"
}
}

17 changes: 15 additions & 2 deletions pop_script/active_page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}


function check_version(data) {
let local_version = version
let github_version = data.tag_name.replace('v', '')

if (local_version !== github_version) {
let download_link = `https://github.com/khengyun/autonext/archive/refs/tags/${data.tag_name}.zip`
document.getElementById("version").innerHTML = '<div style="color: crimson"> Your version is no longer supported, click <a target="_blank" href=!!!> here</a> to download the new version </div>'.replace('!!!', `${download_link}`)

let text = '<div style="color: crimson"> version is no longer supported, click <a target="_blank" href=!!!> here</a> to download the new_version </div>'
.replace('!!!', `${download_link}`)
.replace('new_version',`v${github_version}`)
.replace('version',`v${local_version}`)


document.getElementById("version").innerHTML = text;
document.getElementById("version").style.position = 'static';
}
}
Expand All @@ -24,4 +36,5 @@ chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
if (!url.includes('https://fu.edunext.vn/')) {
document.getElementById('container').innerHTML = '<div>Please Switch To <a href="https://fu.edunext.vn"> EDUNEXT </a> Tab To Edit Settings</div>'
}
});
});

Empty file.
13 changes: 7 additions & 6 deletions pop_script/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>

<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' https://translate.google.com/* https://api.github.com/*">-->
<title>AutoNext</title>
<link
crossorigin="anonymous"
Expand Down Expand Up @@ -109,8 +110,14 @@ <h5 class="name_setting_block">Presentation Grading</h5>

</div>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

</div>





<div id="version">version</div>
</div>

Expand All @@ -123,12 +130,6 @@ <h5 class="name_setting_block">Presentation Grading</h5>
</div>
</footer>

<script type="text/javascript" >
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
googleTranslateElementInit()
</script>

<script src="./github_version/checkgit.js" type="text/javascript"></script>
<script src="./active_page.js" type="text/javascript"></script>
Expand Down
9 changes: 5 additions & 4 deletions pop_script/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ document.addEventListener("DOMContentLoaded", function () {

let load_on_off = JSON.parse(localStorage.getItem("setting_value")).work;

document.getElementById("present_point").value = JSON.parse(localStorage.getItem("setting_value")).present_point.toString()
document.getElementById("individual_point").value = JSON.parse(localStorage.getItem("setting_value")).Individual_point.toString()
document.getElementById("presentation_grading_checkbox").checked = JSON.parse(localStorage.getItem("setting_value")).presentation_grading
document.getElementById("members_grading_checkbox").checked = JSON.parse(localStorage.getItem("setting_value")).group_members_grading

document.getElementById("present_point").value = JSON.parse(localStorage.getItem("setting_value")).present_point.toString()
document.getElementById("individual_point").value = JSON.parse(localStorage.getItem("setting_value")).Individual_point.toString()
document.getElementById("presentation_grading_checkbox").checked = JSON.parse(localStorage.getItem("setting_value")).presentation_grading
document.getElementById("members_grading_checkbox").checked = JSON.parse(localStorage.getItem("setting_value")).group_members_grading

if (load_on_off) {
on_off_icon.style.fill = '#1db128'
Expand Down
Loading

0 comments on commit 9ca787b

Please sign in to comment.