Skip to content

Commit

Permalink
Fix issue with checkboxs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwilarg committed Jun 18, 2020
1 parent 1d0baf2 commit 887c7a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ chrome.storage.sync.get({
allIds: []
}, function(elemsLocal) {
storageAllIds = elemsLocal.allIds;
document.getElementById(id).value = document.getElementById(id).checked;
if (document.getElementById(id).checked) {
storageAllIds.push(id);
} else {
Expand Down
7 changes: 6 additions & 1 deletion js/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ chrome.runtime.onMessage.addListener(function(request, _) {
do {
match = matchs.exec(pageHtml);
if (match !== null) {
let isChecked = false;
if (match[4] !== undefined ) {
var testMatch = pageHtml.match('<input id="' + match[1] + '" type="checkbox"( value="(true|false)")?>');
isChecked = testMatch[2] === "true";
}
let tmpName;
if (elems.displayName === "pretty") {
tmpName = match[2].replace(/\[[^\]]+\]/g, "").replace(/\([^\)]+\)/g, "").replace(/\{[^\}]+\}/g, "").trim();
} else {
tmpName = match[2].trim();
}
finalHtml += '<input id="' + match[1] + '" name="' + tmpName + '" type="checkbox"/>' + tmpName + '<br/>';
finalHtml += '<input id="' + match[1] + '" name="' + tmpName + '" type="checkbox" ' + (isChecked ? "checked" : "") + '/>' + tmpName + '<br/>';
allIds.push(match[1]);
i++;
}
Expand Down

0 comments on commit 887c7a2

Please sign in to comment.