Mercurial > hg > extraction-interface
comparison views/Extractapp/TaggingText.php @ 104:e542b161d907 extractapp
bug fixed: for only lowercase accepted in html tag.
| author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
|---|---|
| date | Fri, 05 Aug 2016 13:34:55 +0200 |
| parents | 2cc65ff46174 |
| children | 7f2c5d542616 |
comparison
equal
deleted
inserted
replaced
| 103:2cc65ff46174 | 104:e542b161d907 |
|---|---|
| 379 tagging_tags.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection_plain)+"' )\">Title</button></br>"; | 379 tagging_tags.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection_plain)+"' )\">Title</button></br>"; |
| 380 | 380 |
| 381 | 381 |
| 382 console.log(selection); | 382 console.log(selection); |
| 383 | 383 |
| 384 console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>')); | |
| 385 | |
| 386 console.log(JSON.parse('<?php echo json_encode($topic_tag) ?>')); | |
| 387 | |
| 384 | 388 |
| 385 <?php | 389 <?php |
| 390 | |
| 386 foreach ( $taglistArray as $taglistValue ) { | 391 foreach ( $taglistArray as $taglistValue ) { |
| 387 if ($taglistValue[2] == $topic_tag) { | 392 if ($taglistValue[2] == $topic_tag) { |
| 388 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n"; | 393 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n"; |
| 389 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(without new line)</button>\";\n"; | 394 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(without new line)</button>\";\n"; |
| 390 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; | 395 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; |
| 910 saveUndoText(); | 915 saveUndoText(); |
| 911 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); | 916 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); |
| 912 var topic_tag2 = topic_tag+"2"; | 917 var topic_tag2 = topic_tag+"2"; |
| 913 | 918 |
| 914 var documentFragment = range.extractContents(); | 919 var documentFragment = range.extractContents(); |
| 915 | 920 |
| 916 | 921 console.log("topic_tag: "+ topic_tag + ", topic_tag2: " + topic_tag2); |
| 922 | |
| 917 var stringSelection = "" | 923 var stringSelection = "" |
| 918 var childNodes = documentFragment.childNodes | 924 var childNodes = documentFragment.childNodes |
| 919 for (var i = 0; i < childNodes.length; i++){ | 925 for (var i = 0; i < childNodes.length; i++){ |
| 920 if (childNodes[i].outerHTML == undefined) { | 926 if (childNodes[i].outerHTML == undefined) { |
| 921 stringSelection += childNodes[i].textContent | 927 stringSelection += childNodes[i].textContent |
| 922 } else { | 928 } else { |
| 923 stringSelection += childNodes[i].outerHTML | 929 stringSelection += childNodes[i].outerHTML |
| 924 } | 930 } |
| 925 | 931 |
| 926 } | 932 } |
| 933 | |
| 934 | |
| 935 //console.log("stringSelection: " + stringSelection); | |
| 936 | |
| 937 | |
| 927 range.deleteContents(); | 938 range.deleteContents(); |
| 928 | 939 |
| 929 if ( tag==topic_tag2) { | 940 if ( tag==topic_tag2) { |
| 930 var newdiv = document.createElement(topic_tag); | 941 var newdiv = document.createElement(topic_tag); |
| 931 newdiv.innerHTML = stringSelection; | 942 newdiv.innerHTML = stringSelection; |
