Skip to content

Commit

Permalink
✨ and language selection to main index (on github pages)
Browse files Browse the repository at this point in the history
also fixes a bug from unchanged copy paste to language tweak actually
gets applied (instead of using timing value!)
  • Loading branch information
WillForan committed May 16, 2024
1 parent d71ada5 commit 475734b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
11 changes: 3 additions & 8 deletions out/extra/loeffeeg.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<title>Landscape Choice Loeffler EEG</title>
<script src="tweaks.js"> </script>
<!-- // qs, yyyymmdd, get_anchor, add_timing_choices -->
<!-- // qs, yyyymmdd, get_anchor, add_timing_choices, add_language -->

<script>
var browser_lang = navigator.language || navigator.userLanguage;
Expand Down Expand Up @@ -32,7 +32,8 @@
add_landscape_choices();
timing_choices = ['randomA','randomB']
add_timing_choices();
if(browser_lang != "en-US") { document.querySelector("#lang").value = "es"; }
add_language();
if(browser_lang != "en-US") { document.querySelector("#lang").value = "es"; }
}
</script>
</head>
Expand All @@ -44,12 +45,6 @@ <h1> Task specifications </h1>
<td><input name=id type="text" size=5> </td></tr>
<tr><td><label for="run">run number:</label></td>
<td><input name="runnum" type="text" size=1 value=1> </td></tr>

<tr><td><label for="lang">language</label></td>
<td><select id="lang">
<option>en</option>
<option>es</option>
</select></td></tr>
</table>
<input type="submit" value="Go!">
</form>
Expand Down
17 changes: 16 additions & 1 deletion out/extra/tweaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function get_anchor(){
//selectedOptions[landscape.selectedIndex].value;
let ltype = "landscape=" + (landscape?landscape.value:"ocean");
let ttype = "timing=" + (timing?timing.value:"random");
let langv = "lang=" + (lang?timing.value:"en");
let langv = "lang=" + (lang?lang.value:"en");
let tweakstr = Object.keys(tweaks)
.map(x=>ifchecked(x))
.filter(x=>x!="")
Expand All @@ -74,10 +74,25 @@ function add_timing_choices(){
f.innerHTML += html;
}

function add_language(){
let html = '<tr><td><label for="lang">language</label></td>\
<td><select id="lang">\
<option>en</option>\
<option>es</option>\
</select></td></tr>';

let f = document.querySelector("#task_setting_tweaks");
f.innerHTML += html;

//var browser_lang = navigator.language || navigator.userLanguage;
//if(browser_lang != "en-US") { document.querySelector("#lang").value = "es"; }
}

// put tweak checkboxs in link
function add_tweaks(){
add_landscape_choices();
add_timing_choices();
add_language();

let f = document.querySelector("#task_setting_tweaks");
Object.keys(tweaks).forEach(x =>
Expand Down

0 comments on commit 475734b

Please sign in to comment.