Skip to content

Commit 8fd6548

Browse files
Merge branch 'main_inline' into inlineTranslation
2 parents 5b6ab0e + 1d52800 commit 8fd6548

16 files changed

Lines changed: 337 additions & 63 deletions

CTFd/plugins/inlineTranslation/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def load(app):
1919

2020
app.register_blueprint(inlineTranslation,url_prefix='/inlinetranslation')
2121

22-
registerTemplate('page.html','inlinepage.html')
22+
registerTemplate('base.html','inlinebase.html')
23+
registerTemplate('admin/base.html','admininlinebase.html')
24+
registerTemplate('page.html',"inlinepage.html")
25+
registerTemplate('admin/page.html',"inlinepage.html")
2326

2427
@app.route("/admin/inlineTranslation/config/<configType>",methods=['GET'])
2528
@admins_only
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import $ from "jquery";
2+
import { langPanel } from './lang-panel';
3+
4+
window.customElements.define("lang-panel", langPanel);
5+
6+
//filter out lang-panels
7+
(async ()=>{
8+
var found = false
9+
10+
const lang = document.cookie
11+
.split(";")
12+
.find((row)=> row.startsWith("language="))
13+
?.split("=")[1];
14+
console.log(lang)
15+
$("lang-panel").hide();
16+
const found_panels = $(`lang-panel[lang=${lang}]`);
17+
console.log(found_panels);
18+
if(found_panels.length > 0){
19+
found_panels.show();
20+
found = true;
21+
22+
}
23+
if(!found){
24+
//enable standard language
25+
$.get("/admin/inlineTranslation/standardlanguage",function(res){
26+
$(`lang-panel[lang=${res.data}]`).show();
27+
});
28+
}
29+
})();

CTFd/plugins/inlineTranslation/assets/js/lang-panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class langPanel extends HTMLElement{
2727
}
2828

2929
attributeChangedCallback(name, oldValue, newValue) {
30-
console.log(`Attribute ${name} has changed.`);
30+
console.log(`Attribute ${name} has changed from ${oldValue} to ${newValue}`);
3131
}
3232
}
3333

CTFd/plugins/inlineTranslation/staticAssets/assets/index-B0cMktUh.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

CTFd/plugins/inlineTranslation/staticAssets/assets/jquery-DBlGzj9j.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CTFd/plugins/inlineTranslation/staticAssets/assets/js/config-CWCHQjAi.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

CTFd/plugins/inlineTranslation/staticAssets/assets/js/config-UuSjKF7a.js

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CTFd/plugins/inlineTranslation/staticAssets/assets/js/inlineTranslation-BQ3jON7h.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CTFd/plugins/inlineTranslation/staticAssets/assets/js/page-DQbRQ-8d.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

CTFd/plugins/inlineTranslation/staticAssets/manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
"file": "assets/echarts-l0sNRNKZ.js",
44
"name": "echarts"
55
},
6-
"_index-B0cMktUh.js": {
7-
"file": "assets/index-B0cMktUh.js",
8-
"name": "index"
6+
"_jquery-DBlGzj9j.js": {
7+
"file": "assets/jquery-DBlGzj9j.js",
8+
"name": "jquery"
99
},
1010
"assets/js/config.js": {
11-
"file": "assets/js/config-CWCHQjAi.js",
11+
"file": "assets/js/config-UuSjKF7a.js",
1212
"name": "js/config",
1313
"src": "assets/js/config.js",
1414
"isEntry": true,
1515
"imports": [
16-
"_index-B0cMktUh.js"
16+
"_jquery-DBlGzj9j.js"
1717
]
1818
},
19-
"assets/js/page.js": {
20-
"file": "assets/js/page-DQbRQ-8d.js",
21-
"name": "js/page",
22-
"src": "assets/js/page.js",
19+
"assets/js/inlineTranslation.js": {
20+
"file": "assets/js/inlineTranslation-BQ3jON7h.js",
21+
"name": "js/inlineTranslation",
22+
"src": "assets/js/inlineTranslation.js",
2323
"isEntry": true,
2424
"imports": [
25-
"_index-B0cMktUh.js"
25+
"_jquery-DBlGzj9j.js"
2626
]
2727
}
2828
}

0 commit comments

Comments
 (0)