Add calculator form to new tab
This commit is contained in:
@@ -463,7 +463,7 @@ function showSecondsAndCalculator() {
|
||||
let table = contentPane.getElementsByClassName("borderlist")[0];
|
||||
let rows = table.getElementsByTagName("tr");
|
||||
|
||||
let headCell = createCustomElement("th");
|
||||
let headCell = createCustomElement("th", null, "Calcul");
|
||||
rows[0].appendChild(headCell);
|
||||
|
||||
for (let i = 1; i < rows.length; i ++) {
|
||||
@@ -480,7 +480,16 @@ function showSecondsAndCalculator() {
|
||||
let targetPoint = searchPoint(cells[1].textContent);
|
||||
let calculatorCell = createCustomElement("td");
|
||||
let calculatorForm = createCustomElement(
|
||||
"form", {"method": "post", "action": "/?s=tools&m=runtime_calculator&inta=calculate"}
|
||||
"form",
|
||||
{
|
||||
"method": "post",
|
||||
"action": "/?s=tools&m=runtime_calculator&inta=calculate",
|
||||
"title": "Calculateur de trajet",
|
||||
},
|
||||
null,
|
||||
{
|
||||
"display": "inline-block",
|
||||
},
|
||||
);
|
||||
calculatorForm.appendChild(createCustomInput("hidden", "start_x", startPoint.x));
|
||||
calculatorForm.appendChild(createCustomInput("hidden", "start_y", startPoint.y));
|
||||
@@ -495,6 +504,14 @@ function showSecondsAndCalculator() {
|
||||
);
|
||||
calculatorForm.appendChild(calculatorImg);
|
||||
calculatorCell.appendChild(calculatorForm);
|
||||
|
||||
let calculatorFormBlank = calculatorForm.cloneNode(true);
|
||||
calculatorFormBlank.setAttribute("target", "_blank");
|
||||
calculatorFormBlank.setAttribute("title", "Calculateur de trajet dans nouvel onglet");
|
||||
let calculatorBlankImg = calculatorFormBlank.getElementsByTagName("input")[4]
|
||||
calculatorBlankImg.setAttribute("src", chrome.runtime.getURL("images/blank.svg"));
|
||||
calculatorCell.appendChild(calculatorFormBlank);
|
||||
|
||||
rows[i].appendChild(calculatorCell);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user