diff views/Extractapp/TaggingText.php @ 78:960ba96efce1 extractapp

Update: click to popup remove-tag-window; select to popup tag-window
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 20 Apr 2015 15:44:54 +0200
parents 97c1e5102a22
children e6e213b26454
line wrap: on
line diff
--- a/views/Extractapp/TaggingText.php	Thu Apr 16 14:53:22 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Mon Apr 20 15:44:54 2015 +0200
@@ -1,9 +1,9 @@
 <?php
 /*! \file 
-* This is the view for TaggingText.
-* It shows the extraction-interface application itself.
-* It contains the tagging area and toolbox on the right side.
-*  
+ * This is the view for TaggingText.
+ * It shows the extraction-interface application itself.
+ * It contains the tagging area and toolbox on the right side.
+ *  
 */
 
 // --- initialize config file and input text ---
@@ -92,7 +92,7 @@
 
 function reloadText() {
     /**
-    * Reload the text when there is a new version of this branch.
+     * Reload the text when there is a new version of this branch.
     */
     // confirm to reload
     var r = confirm("Are you sure you want to load the latest version (in a new tab)?");
@@ -134,6 +134,28 @@
     
 }
 
+// on click on tagged words, call removeTagNewDiv() for the popup window
+// popup-window overlapping issue
+var pop_remove_tag_window = true;
+var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>');
+for (var i = 0; i < taglistArray.length; i++) {
+    var taglistValue = taglistArray[i];
+
+    $(document).on("click", taglistValue[2], function (e) {
+        if ($("#editTextId").html() != "Edit the text") return 0;
+        var tagName = $(this).prop("tagName").toLowerCase();
+        /*
+        if ($(this).prop("tagName").toLowerCase() != taglistValue[2]) {
+            return 0;
+        }
+        */
+        if (pop_remove_tag_window) {
+            removeTagNewDiv( e, tagName , $(this));
+        };
+    });
+};
+
+/*
 <?php 
 foreach ( $taglistArray as $taglistValue ) {
 	echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n";
@@ -143,6 +165,7 @@
 	echo "});\n";
 }
 ?>
+*/
 
 $(document).ready(function(){
     
@@ -225,7 +248,6 @@
 });
 
 $(document).on("mouseup", '#editable-area', function (e) {
-
     $('.questionMarkClass').remove();
     $('.tagItemDivClass').remove();
    
@@ -244,7 +266,6 @@
         newdiv.setAttribute("class", "tagItemDivClass");
         newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px; z-index:4';
         
-
         //console.log(selection.getRangeAt(0).cloneContents());
         if ( container.innerHTML.indexOf( "br" ) != -1 ) {
             var newselect = document.createElement("select");
@@ -341,8 +362,16 @@
         
         $('#TitletagType').val(lastAddTag);
 
+        // selected some words, so hide popping up remove-tag-window
+        pop_remove_tag_window = false;   // questionMarkID
+
+    } else {
+        // without selecting any word, so pop up remove-tag-window
+        pop_remove_tag_window = true;
     }
 
+
+
     //e.stopPropagation();