Mercurial > hg > extraction-interface
diff views/Extractapp/TaggingText.php @ 62:3fb9e3884401 extractapp
New: insert selected wordlist into textarea at cursor position when editing regex
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 31 Mar 2015 14:55:58 +0200 |
parents | c6fa7f83c5bf |
children | 3395385476d1 |
line wrap: on
line diff
--- a/views/Extractapp/TaggingText.php Tue Mar 31 12:34:57 2015 +0200 +++ b/views/Extractapp/TaggingText.php Tue Mar 31 14:55:58 2015 +0200 @@ -885,20 +885,27 @@ _postForContineTagging(form); - /* - if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { - document.body.appendChild(form); - form.submit(); - } else { - form.submit(); // works under IE and Chrome, but not FF - } - */ } $(document).on("change", '#smartRegexPopUpSelectWord', function (e) { + var wordlistArray = JSON.parse('<?php echo json_encode($wordlistArray) ?>'); + for (var i = 0; i < wordlistArray.length; i++) { + var wordlistValue = wordlistArray[i]; + if ($('#smartRegexPopUpSelectWord').val() == wordlistValue[0]) { + var textarea_text = $('#smartRegexPopUpText').val(); + // insert selected wordlist into textarea at cursor position + var cursorPosition = $('#smartRegexPopUpText').prop("selectionStart"); + // cut textarea_text by cursorPosition + var text_before_cursor = textarea_text.substring(0,cursorPosition); + var text_after_cursor = textarea_text.substring(cursorPosition, textarea_text.length); + $('#smartRegexPopUpText').val( text_before_cursor+" ["+wordlistValue[2]+"] "+text_after_cursor); + } + } + +/* <?php foreach ( $wordlistArray as $wordlistValue ) { echo "if ( $('#smartRegexPopUpSelectWord').val() == \"".$wordlistValue[0]."\") {"; @@ -906,6 +913,7 @@ echo "}"; } ?> +*/ }); @@ -915,14 +923,16 @@ <div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; "> </div> - -<div class="" style="margin:10 30 10 30;max-width:1270;height:70px;overflow:scroll;overflow-x:hidden;"> - <p class="bg-danger" style=""> <?php echo $messages['error']; ?> </p> - <p class="bg-warning" style=""> <?php echo $messages['warning']; ?> - <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" class="btn btn-xs btn-default" style="display:none;">Load Latest Version</button> +<!-- +<div class="info-board" style="margin:10 30 10 30;max-width:1270;height:70px;overflow:scroll;overflow-x:hidden;"> +--> +<div class="info-board"> + <p class="bg-danger"> <?php echo $messages['error']; ?> </p> + <p class="bg-warning"> <?php echo $messages['warning']; ?> + <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Load Latest Version</button> </p> - <p class="bg-info" style=""> <?php echo $messages['info']; ?> </p> - <p class="bg-default" style=""> <?php echo $messages['debug']; ?> </p> + <p class="bg-info"> <?php echo $messages['info']; ?> </p> + <p class="bg-default"> <?php echo $messages['debug']; ?> </p> </div> <table width="1270" border="1" style="margin:10 30 10 30;"> @@ -988,9 +998,6 @@ <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Save</button> <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Load</button> <button onclick="smartRegexEmpty()" style="height: 35px; width: 70px">Clear</button></br> - <!-- - <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button> - --> </fieldset> <fieldset> @@ -1016,9 +1023,6 @@ <button onclick="editText()" id="editTextId" style="height: 35px; width: 220px">Edit the text</button></br> </br> <button onclick="window.open('./EditWordlist')" style="height: 35px; width: 220px">Manage Word List</button></br> - <!-- - <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br> - --> <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 220px">Manage Tag List</button></br> </fieldset>