Skip to content

Commit

Permalink
Merge pull request #21 from khengyun/edu@v3
Browse files Browse the repository at this point in the history
Edu@v3
  • Loading branch information
khengyun authored Nov 11, 2022
2 parents 816f969 + e45fb05 commit e47ace7
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
5 changes: 3 additions & 2 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.2.3",
"version": "3.3.5",
"description": "This automatic grading tool on edunext\n__Hovilo__",
"manifest_version": 3,
"permissions": [
Expand All @@ -27,7 +27,7 @@
"scripting"
],
"host_permissions": [
"<all_urls>"
"https://api.github.com/repos/khengyun/*"
],
"content_scripts": [
{
Expand All @@ -46,6 +46,7 @@
"doc_script/*.js",
"doc_script/*.css",
"pop_script/*.js",
"pop_script/*/*.js",
"pop_script/*.css",
"assets/*.png"
],
Expand Down
26 changes: 24 additions & 2 deletions pop_script/active_page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
console.log("some thign")
function check_version(data) {
let local_version = version
let github_version = data.tag_name.replace('v', '')

console.log(github_version, local_version);

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}`)
document.getElementById("version").style.position = 'static';
}
}


chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {

//call api check version
let repo_api = "https://api.github.com/repos/khengyun/autonext/releases/latest";
fetch(repo_api).then(res => res.json()).then(jsonData => {

check_version(jsonData)

})

let url = tabs[0].url;
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>'
document.getElementById('container').innerHTML = '<div>Please Switch To <a href="https://fu.edunext.vn"> EDUNEXT </a> Tab To Edit Settings</div>'
}
});
13 changes: 0 additions & 13 deletions pop_script/bachground.js
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@



chrome.action.onClicked.addListener((tab) => {

console.log("some thign")
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
let url = tabs[0].url;
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.
5 changes: 4 additions & 1 deletion pop_script/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ image {
padding-left: 10px;
display: inline-block;
font-weight: bold;
cursor: context-menu;

}

Expand Down Expand Up @@ -340,6 +341,9 @@ footer {
right: 20px;
/* left: 5px; */
font-size: small;
cursor: context-menu;
text-align: center;
padding: 5px;
}


Expand All @@ -354,4 +358,3 @@ footer {




1 change: 1 addition & 0 deletions pop_script/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ <h5 class="name_setting_block">Presentation Grading</h5>
</div>
</footer>

<script src="./github_version/checkgit.js" type="text/javascript"></script>
<script src="./active_page.js" type="text/javascript"></script>
<script src="./popup.js" type="text/javascript"></script>
</body>
Expand Down

0 comments on commit e47ace7

Please sign in to comment.