Skip to content

Commit 7f84d54

Browse files
fixed bugs and added lang-panel to challenge view
1 parent 8fd6548 commit 7f84d54

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

CTFd/plugins/inlineTranslation/assets/js/inlineTranslation.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@ import { langPanel } from './lang-panel';
44
window.customElements.define("lang-panel", langPanel);
55

66
//filter out lang-panels
7-
(async ()=>{
7+
const callback = async ()=>{
88
var found = false
9-
109
const lang = document.cookie
1110
.split(";")
1211
.find((row)=> row.startsWith("language="))
1312
?.split("=")[1];
14-
console.log(lang)
1513
$("lang-panel").hide();
1614
const found_panels = $(`lang-panel[lang=${lang}]`);
17-
console.log(found_panels);
1815
if(found_panels.length > 0){
1916
found_panels.show();
2017
found = true;
@@ -26,4 +23,13 @@ window.customElements.define("lang-panel", langPanel);
2623
$(`lang-panel[lang=${res.data}]`).show();
2724
});
2825
}
29-
})();
26+
};
27+
28+
callback();
29+
30+
//challenge view
31+
const observer = new MutationObserver(callback);
32+
const woppy = $("#challenge-window")[0];
33+
observer.observe(woppy,{attributes: true});
34+
35+

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 from ${oldValue} to ${newValue}`);
30+
3131
}
3232
}
3333

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

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

CTFd/plugins/inlineTranslation/staticAssets/assets/js/inlineTranslation-C1evHmXA.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/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
]
1818
},
1919
"assets/js/inlineTranslation.js": {
20-
"file": "assets/js/inlineTranslation-BQ3jON7h.js",
20+
"file": "assets/js/inlineTranslation-C1evHmXA.js",
2121
"name": "js/inlineTranslation",
2222
"src": "assets/js/inlineTranslation.js",
2323
"isEntry": true,

0 commit comments

Comments
 (0)