Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language support #169

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 100 additions & 88 deletions docs/index.html

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions docs/js/class_p.js
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ class Puzzle {
let settingstatus_and = answersetting.getElementsByClassName("solcheck");
let settingstatus_or = answersetting.getElementsByClassName("solcheck_or");
var answercheck_opt = [],
message = "<b style=\"color:blue\">Solution checker looks for ALL of the following:</b><ul>";
message = "<b style=\"color:blue\">" + PenpaText.get('solution_checker_all') + "</b><ul>";

// loop through and check if any "AND" settings are selected
let prev_opt = "";
Expand All @@ -2088,7 +2088,7 @@ class Puzzle {
var opt = answercheck_opt_conversion[settingstatus_and[i].id.substring(4)];
if (opt.length !== 0 && opt != prev_opt) {
answercheck_opt.push(opt);
message += "<li>" + answercheck_message[opt] + "</li>";
message += "<li>" + PenpaText.get(`answer_check_${opt}`) + "</li>";
}
prev_opt = opt;
}
Expand All @@ -2097,15 +2097,15 @@ class Puzzle {

// If answercheck list is 0, it means, no "AND" option was selected
if (answercheck_opt.length === 0) {
message = "<b style=\"color:blue\">Solution checker looks for ONE of the following:</b><ul>";
message = "<b style=\"color:blue\">" + PenpaText.get('solution_checker_one') + "</b><ul>";
// loop through and check if any "OR" settings are selected
for (var i = 0; i < settingstatus_or.length; i++) {
if (settingstatus_or[i].checked) {
// ignore initial characters "sol_or_"
let opt = answercheck_opt_conversion[settingstatus_or[i].id.substring(7)];
if (opt.length !== 0 && opt != prev_opt) {
answercheck_opt.push(opt);
message += "<li>" + answercheck_message[opt] + "</li>";
message += "<li>" + PenpaText.get(`answer_check_${opt}`) + "</li>";
}
prev_opt = opt;
}
Expand Down Expand Up @@ -6525,13 +6525,10 @@ class Puzzle {
console.log(this.pu_a_col);
console.log(this);
} else {
text += 'Error - It doesnt support puzzle type ' + header + '\n' +
'Please see instructions (Help) for supported puzzle types\n' +
'For additional genre support please submit your request to penpaplus@gmail.com';
text += PenpaText.get('gmp_unsupported', header);
}
} else {
text += 'Error - Enter the Puzzle type in Header area\n' +
'Please see instructions (Help) for supported puzzle types\n';
text += PenpaText.get('gmp_enter_type');
}

return text;
Expand Down Expand Up @@ -9474,7 +9471,7 @@ class Puzzle {

check_last_cell() {
if (this.centerlist.length == 1) {
infoMsg('<h3 class="info">Last cell cannot be removed using the "Box" mode. For a blank grid use the following approach:</h3><ol><li>Click on "New Grid / Update"</li><li>Set "Gridlines" to "None"</li><li>Set "Gridpoints" to "No"</li><li>Set "Outside frame" to "No"</li><li>Click on "Update display"</li></ol>');
infoMsg(PenpaText.get('box_mode_warning'));
return true;
} else {
return false;
Expand Down
18 changes: 0 additions & 18 deletions docs/js/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,4 @@ const answercheck_opt_conversion = {
"star": "star battle",
"akari": "akari",
"mine": "minesweeper"
}

const answercheck_message = {
"shading": "Shade cells in Dark Grey (DG) or Grey (GR) or Light Grey (LG) or Black (BL)",
"number": "Numbers must be in Green, Blue or Red color",
"cell loop": "Line must be in Green Color",
"edge loop": "Edge must be in Green Color",
"wall": "Walls must be in Green Color",
"square": "Black Squares",
"circle": "White and Black circles of medium (M) size",
"shakashaka": "Half triangles",
"arrow": "Small arrows",
"magnets": "+ and - in black or green color",
"battleship": "Battleship fleet",
"tents": "Tents",
"star battle": "Stars",
"akari": "Light bulbs",
"minesweeper": "Mines"
}
360 changes: 143 additions & 217 deletions docs/js/general.js

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions docs/js/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,56 @@ const PenpaUI = {
document.getElementById(i).classList.toggle('is_hidden', selectedGrid.exceptions.indexOf(i) < 0);
}
// document.getElementById("sub_number4_lb").innerText = (gridtype === 'sudoku') ? 'Quad' : 'Tapa';
},

_liteSelectInstance: undefined,
initPenpaLite() {
let select = document.getElementById("mode_choices");

select.innerHTML = '';

for (var i = 0; i < PenpaText.modes.EN.length; i++) {
var option = document.createElement("option");
option.value = PenpaText.modes.EN[i];
option.text = PenpaText.modes[UserSettings.app_language][i];

if (UserSettings.tab_settings) {
// Load the author defined tab settings if any
if (UserSettings.tab_settings.indexOf(PenpaText.modes.EN[i]) > -1) {
option.setAttribute("selected", true);
}
}
select.appendChild(option);
}

if (this._liteSelectInstance) {
this._liteSelectInstance.destroy();
}

this._liteSelectInstance = new vanillaSelectBox("#mode_choices", {
"disableSelectAll": false,
"maxHeight": 250,
"search": true,
"translations": PenpaText.vanillaSelect[UserSettings.app_language]
});

let selectContainer = document.getElementById('btn-group-#mode_choices').getElementsByClassName('vsb-menu')[0];
let liteModeButton = document.createElement('button');
liteModeButton.id = "tab-dropdown-lite-btn";
liteModeButton.disabled = true;
let tab_initial = getValues('mode_choices');
if (tab_initial.length > 0) {
liteModeButton.innerText = PenpaText.get('disable_penpa_lite');
liteModeButton.setAttribute('data-mode', 'disable');
liteModeButton.disabled = false;
} else {
liteModeButton.innerText = PenpaText.get('enable_penpa_lite');
liteModeButton.setAttribute('data-mode', 'enable');
liteModeButton.disabled = true;
}
liteModeButton.addEventListener('click', advancecontrol_toggle);
selectContainer.appendChild(liteModeButton);

PenpaUI.liteModeButton = liteModeButton;
}
};
Loading