Mise à jour des descriptions des relations avec les mots saisis.
This commit is contained in:
parent
ca04fbfe81
commit
69fe0cdd1e
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
code.zip
|
code.zip
|
||||||
vp.log
|
vp.log
|
||||||
|
*~
|
||||||
|
|
|
@ -130,20 +130,20 @@ if(!isset($_SESSION['userId']))
|
||||||
<label for="word-"></label>
|
<label for="word-"></label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="word-"/>
|
<input class="word" type="text" id="word-"/>
|
||||||
<span class="status">●</span>
|
<span class="status">●</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="r1-"/><label class="r1" for="r1-">Blabla</label>
|
<input type="checkbox" id="r1-"/><label class="r1 relationLabel" for="r1-">Blabla</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="r2-"/><label class="r2" for="r2-">Blabla</label>
|
<input type="checkbox" id="r2-"/><label class="r2 relationLabel" for="r2-">Blabla</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="r3-"/><label class="r3" for="r3-">Blabla</label>
|
<input type="checkbox" id="r3-"/><label class="r3 relationLabel" for="r3-">Blabla</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="r4-"/><label class="r4" for="r4-">Blabla</label>
|
<input type="checkbox" id="r4-"/><label class="r4 relationLabel" for="r4-">Blabla</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -27,8 +27,6 @@ $(function() {
|
||||||
.clone()
|
.clone()
|
||||||
.changeId(i)
|
.changeId(i)
|
||||||
.addClass(i%2==0 ? "lightLine" : "")
|
.addClass(i%2==0 ? "lightLine" : "")
|
||||||
// .find("label").attr("for", "word"+i).text(i).end()
|
|
||||||
// .find("input").attr("id", "word"+i).end()
|
|
||||||
.appendTo(".wordLinesTable tbody");
|
.appendTo(".wordLinesTable tbody");
|
||||||
|
|
||||||
(function (i) {
|
(function (i) {
|
||||||
|
@ -44,19 +42,40 @@ $(function() {
|
||||||
// $(truc.children("option").get(2 /* ou 1 */))
|
// $(truc.children("option").get(2 /* ou 1 */))
|
||||||
};
|
};
|
||||||
|
|
||||||
var displayRelations = function() {
|
var updateRelationLabels = function() {
|
||||||
$(".r1").text(relations[$("#relation1").val()]);
|
$('#relations option').each(function(i,e) {
|
||||||
$(".r2").text(relations[$("#relation2").val()]);
|
$(e).text(applyFormat($(e).data("format"), $('#centralWord').val() || 'mot central', '…'));
|
||||||
$(".r3").text(relations[0]);
|
});
|
||||||
$(".r4").text(relations[-1]);
|
|
||||||
|
$('.relationLabel').each(function(i,e) {
|
||||||
|
$(e).text(applyFormat(
|
||||||
|
$(e).data("format"),
|
||||||
|
$('#centralWord').val() || 'mot central',
|
||||||
|
$(e).closest('.wordLine').find('.word').val() || '…'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var displayRelations = function() {
|
||||||
|
$(".r1").data("format", relations[$("#relation1").val()]);
|
||||||
|
$(".r2").data("format", relations[$("#relation2").val()]);
|
||||||
|
$(".r3").data("format", relations[0]);
|
||||||
|
$(".r4").data("format", relations[-1]);
|
||||||
|
updateRelationLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
var applyFormat = function(str, mc, mn) {
|
||||||
|
return str.replace(/%mc/g, mc).replace(/%mn/g, mn);
|
||||||
|
};
|
||||||
|
|
||||||
var displayCentralWordAndRelations = function() {
|
var displayCentralWordAndRelations = function() {
|
||||||
$("#centralWord").focusout(checkWord);
|
$("#centralWord").focusout(checkWord);
|
||||||
|
|
||||||
$.each(relations, function(i, value) {
|
$.each(relations, function(i, value) {
|
||||||
if(i != 0 && i != -1)
|
if(i != 0 && i != -1)
|
||||||
$('<option/>').val(i).text(value).appendTo("#relations select");
|
$('<option/>')
|
||||||
|
.val(i)
|
||||||
|
.data("format", value)
|
||||||
|
.appendTo("#relations select");
|
||||||
});
|
});
|
||||||
$("#relation1, #relation2").change(function() {
|
$("#relation1, #relation2").change(function() {
|
||||||
if ($("#relation1").val() == $("#relation2").val())
|
if ($("#relation1").val() == $("#relation2").val())
|
||||||
|
@ -66,6 +85,7 @@ $(function() {
|
||||||
|
|
||||||
displayRelations();
|
displayRelations();
|
||||||
});
|
});
|
||||||
|
displayRelations();
|
||||||
};
|
};
|
||||||
|
|
||||||
var displayButtons = function () {
|
var displayButtons = function () {
|
||||||
|
@ -77,6 +97,7 @@ $(function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var checkWord = function () {
|
var checkWord = function () {
|
||||||
|
updateRelationLabels();
|
||||||
var input = $(this);
|
var input = $(this);
|
||||||
var word = input.val();
|
var word = input.val();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user