Feature #1355
Mis à jour par Matthieu Decorde il y a environ 9 ans
Allow user to link a sequence of words from an edition page to its concordance.
h3. Solution 1 - implemented in TXM 0.7.7 beta2
- get the words sequence string from the browser selection
- build a CQP query with that sequence
- call concordance
Use the "evaluate" SWT browser Javascript API method with the following Javascript code:
<pre>
static String SCRIPT01 = "var html = \"\";"+
"if (typeof window.getSelection != \"undefined\") {"+
"var sel = window.getSelection();"+
"if (sel.rangeCount) {"+
"var container = document.createElement(\"div\");"+
"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+
"container.appendChild(sel.getRangeAt(i).cloneContents());"+
"}"+
"html = container.innerHTML;"+
"}"+
"} else if (typeof document.selection != \"undefined\") {"+
"if (document.selection.type == \"Text\") {"+
"html = document.selection.createRange().htmlText;"+
"}" +
"}" +
"return html";
</pre>
h3. Solution 1 bis
Do the same thing with the SynopticEditionEditor. SynopticEdition.
implemented for TXM 0.7.8
h3. Solution 2
Get the word ids forms from the selected SPAN contents. By manipulating DOM using Javascript.
h3. Solution 3
Solution 2 + Über and ultimate solution that allow the user to select the word properties involved (word, pos, lemma, etc.).
h3. Solution 4
Solution 3 and makes coffee.
h3. Solution 1 - implemented in TXM 0.7.7 beta2
- get the words sequence string from the browser selection
- build a CQP query with that sequence
- call concordance
Use the "evaluate" SWT browser Javascript API method with the following Javascript code:
<pre>
static String SCRIPT01 = "var html = \"\";"+
"if (typeof window.getSelection != \"undefined\") {"+
"var sel = window.getSelection();"+
"if (sel.rangeCount) {"+
"var container = document.createElement(\"div\");"+
"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+
"container.appendChild(sel.getRangeAt(i).cloneContents());"+
"}"+
"html = container.innerHTML;"+
"}"+
"} else if (typeof document.selection != \"undefined\") {"+
"if (document.selection.type == \"Text\") {"+
"html = document.selection.createRange().htmlText;"+
"}" +
"}" +
"return html";
</pre>
h3. Solution 1 bis
Do the same thing with the SynopticEditionEditor. SynopticEdition.
implemented for TXM 0.7.8
h3. Solution 2
Get the word ids forms from the selected SPAN contents. By manipulating DOM using Javascript.
h3. Solution 3
Solution 2 + Über and ultimate solution that allow the user to select the word properties involved (word, pos, lemma, etc.).
h3. Solution 4
Solution 3 and makes coffee.