Implemented game table row editing.

Text input is made editable on double click.
This commit is contained in:
WrinklyNinja
2014-07-12 15:20:17 +01:00
parent 4e900ffc01
commit b2d0f15d9c
4 changed files with 52 additions and 17 deletions
+8
View File
@@ -373,3 +373,11 @@ li.warn{
.dialog .buttons {
text-align: center;
}
input[readonly] {
border: none;
-webkit-user-select: none;
}
td input {
width: 100%;
}
+26 -8
View File
@@ -463,14 +463,32 @@ function processURLParams() {
var clone = document.importNode(content, true);
gameTable.appendChild(clone);
clone = gameTable.lastElementChild;
clone.children[0].textContent = data.games[i].name;
clone.children[1].textContent = data.games[i].type;
clone.children[2].textContent = data.games[i].folder;
clone.children[3].textContent = data.games[i].masterFile;
clone.children[4].textContent = data.games[i].url;
clone.children[5].textContent = data.games[i].branch;
clone.children[6].textContent = data.games[i].path;
clone.children[7].textContent = data.games[i].registryKey;
clone.querySelector('.name').value = data.games[i].name;
var inputs = clone.getElementsByTagName('input');
for (var j = 0; j < inputs.length; ++j) {
inputs[j].addEventListener('dblclick', function(evt){
if (evt.target.readOnly) {
evt.target.removeAttribute('readonly');
} else {
evt.target.setAttribute('readonly', '');
}
});
}
for (var j = 0; j < data.gameTypes.length; ++j) {
var option = document.createElement('option');
option.value = data.gameTypes[j];
option.textContent = data.gameTypes[j];
clone.querySelector('.type').appendChild(option);
}
clone.querySelector('.type').value = data.games[i].type;
clone.querySelector('.folder').value = data.games[i].folder;
clone.querySelector('.masterFile').value = data.games[i].masterFile;
clone.querySelector('.url').value = data.games[i].url;
clone.querySelector('.branch').value = data.games[i].branch;
clone.querySelector('.path').value = data.games[i].path;
clone.querySelector('.registryKey').value = data.games[i].registryKey;
}
/* Now fill in language options. */
+12 -9
View File
@@ -9,15 +9,18 @@
</head>
<body>
<template id="gameRow">
<tr contenteditable>
<td >Name
<td>Base Game
<td>LOOT Folder
<td>Master File
<td>Masterlist Repository URL
<td>Masterlist Repository Branch
<td>Install Path
<td>Install Path Registry Key
<tr>
<td><input class="name" type="text" readonly>
<td>
<select class="type" >
<!-- Game <option> elements go here. -->
</select>
<td><input class="folder" type="text" readonly>
<td><input class="masterFile" type="text" readonly>
<td><input class="url" type="text" readonly>
<td><input class="branch" type="text" readonly>
<td><input class="path" type="text" readonly>
<td><input class="registryKey" type="text" readonly>
</template>
<template id="pluginNav">
<li>
+6
View File
@@ -998,6 +998,12 @@ var data = {
"registryKey": "Software\\Bethesda Softworks\\FalloutNV\\Installed Path",
},
],
"gameTypes": [
"Oblivion",
"Skyrim",
"Fallout3",
"FalloutNV",
],
"languages": [
"None Specified",
"English",