320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
this.xTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px";
let nUsefulErrorWidth = ((xNodeErr.offsetLeft + xNodeErr.offsetWidth) > nArrowLimit) ? (nArrowLimit - xNodeErr.offsetLeft) : xNodeErr.offsetWidth;
this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((nUsefulErrorWidth / 2)) - 4) + "px"; // 4 is half the width of the arrow.
this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
this.xTooltip.style.left = (xNodeErr.offsetLeft > nTooltipLeftLimit) ? nTooltipLeftLimit + "px" : xNodeErr.offsetLeft + "px";
if (xNodeErr.dataset.error_type === "grammar") {
// grammar error
if (xNodeErr.dataset.gc_message.includes(" ##")) {
let n = xNodeErr.dataset.gc_message.indexOf(" ##");
document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message.slice(0, n);
document.getElementById("grammalecte_tooltip_rule_id").textContent = "Règle : " + xNodeErr.dataset.gc_message.slice(n+2);
document.getElementById("grammalecte_tooltip_rule_id").style.display = "block";
} else {
document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message;
document.getElementById("grammalecte_tooltip_rule_id").style.display = "none";
|
>
>
|
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
this.xTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px";
let nUsefulErrorWidth = ((xNodeErr.offsetLeft + xNodeErr.offsetWidth) > nArrowLimit) ? (nArrowLimit - xNodeErr.offsetLeft) : xNodeErr.offsetWidth;
this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((nUsefulErrorWidth / 2)) - 4) + "px"; // 4 is half the width of the arrow.
this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
this.xTooltip.style.left = (xNodeErr.offsetLeft > nTooltipLeftLimit) ? nTooltipLeftLimit + "px" : xNodeErr.offsetLeft + "px";
if (xNodeErr.dataset.error_type === "grammar") {
// grammar error
document.getElementById("grammalecte_tooltip_add_word").style.display = "none";
if (xNodeErr.dataset.gc_message.includes(" ##")) {
// display rule id
let n = xNodeErr.dataset.gc_message.indexOf(" ##");
document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message.slice(0, n);
document.getElementById("grammalecte_tooltip_rule_id").textContent = "Règle : " + xNodeErr.dataset.gc_message.slice(n+2);
document.getElementById("grammalecte_tooltip_rule_id").style.display = "block";
} else {
document.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message;
document.getElementById("grammalecte_tooltip_rule_id").style.display = "none";
|
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
this.xTooltipSuggBlock.textContent = "Aucune.";
}
}
if (xNodeErr.dataset.error_type === "spelling") {
// spelling mistake
document.getElementById("grammalecte_tooltip_message").textContent = "Mot inconnu du dictionnaire.";
document.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id;
document.getElementById("grammalecte_tooltip_url").dataset.url = "";
document.getElementById("grammalecte_tooltip_url").style.display = "none";
document.getElementById("grammalecte_tooltip_rule_id").style.display = "none";
this.clearSuggestionBlock();
this.xTooltipSuggBlock.textContent = "Recherche de graphies possibles…";
xGrammalectePort.postMessage({
sCommand: "getSpellSuggestions",
dParam: {sWord: xNodeErr.textContent},
dInfo: {sErrorId: xNodeErr.dataset.error_id}
});
|
>
>
>
>
>
|
>
|
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
this.xTooltipSuggBlock.textContent = "Aucune.";
}
}
if (xNodeErr.dataset.error_type === "spelling") {
// spelling mistake
document.getElementById("grammalecte_tooltip_message").textContent = "Mot inconnu du dictionnaire.";
document.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id;
document.getElementById("grammalecte_tooltip_rule_id").style.display = "none";
document.getElementById("grammalecte_tooltip_url").dataset.url = "";
document.getElementById("grammalecte_tooltip_url").style.display = "none";
if (xNodeErr.dataset.gc_message.includes(" ##")) {
// display rule id
document.getElementById("grammalecte_tooltip_add_word").style.display = "block";
} else {
document.getElementById("grammalecte_tooltip_add_word").style.display = "none";
}
this.clearSuggestionBlock();
this.xTooltipSuggBlock.textContent = "Recherche de graphies possibles…";
xGrammalectePort.postMessage({
sCommand: "getSpellSuggestions",
dParam: {sWord: xNodeErr.textContent},
dInfo: {sErrorId: xNodeErr.dataset.error_id}
});
|