diff views/Extractapp/TaggingText.php @ 87:fb5049fc5dd7 extractapp_dev

New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 02 Jun 2015 16:52:05 +0200
parents 0141df465205
children e681d693240e
line wrap: on
line diff
--- a/views/Extractapp/TaggingText.php	Thu Apr 30 10:52:05 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Tue Jun 02 16:52:05 2015 +0200
@@ -216,6 +216,7 @@
     });
     // ---
 
+
     //--- for popups ---
     //run once
     var el=$('#popups');
@@ -252,7 +253,7 @@
     var info = JSON.parse('<?php echo json_encode($info) ?>');
     // the first time to this section. without branch_id and file_id
     if (info['file_id'] == 0) {  // or info['branch_id'] == 0, means new file
-        $( "#saveTextToLGService_id").text( "Create(Save) Branch to LGService" );
+        $( "#save_text_to_LGService_id").text( "Create(Save) Branch to LGService" );
 
     }
     handleFileVersionConflict();
@@ -271,7 +272,7 @@
 
         // TOOD: ask user to modify/decide tags
         // showing taglist_infile and taglistArray
-        alert("Warning: taglist is deprecated in the current file.");
+        //alert("Warning: taglist is deprecated in the current file.");
 
     }
 
@@ -290,15 +291,20 @@
     container = document.createElement("div");
     container.appendChild(selection.getRangeAt(0).cloneContents());
 
-    if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
+    if(selection && (selection_plain = new String(selection).replace(/^\s+|\s+$/g,''))) {
         try{
         	var newdiv = document.createElement("div");
-            newdiv.id = "tagItemDivId";
-            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';
-            
+            //newdiv.id = "tagItemDivId";
+            //newdiv.setAttribute("class", "tagItemDivClass");
+            $(newdiv).id = "tagItemDivId";
+            $(newdiv).addClass("tagItemDivClass");
+            newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+';';
             //console.log(selection.getRangeAt(0).cloneContents());
             if ( container.innerHTML.indexOf( "br" ) != -1 ) {
+                // when selected words containing tags (i.e. has 'br' in the selected string), 
+                // which means user want to apply Title / or tags all in once at each line
+                // This may not be the best checking solution, since 'br' also appears between not-tagged words
+
                 var newselect = document.createElement("select");
                 newselect.id = "TitletagType";
                 //console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>'));
@@ -319,8 +325,6 @@
                 } else {
                     newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>";
                 }
-
-
                 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>";
                 
                 /*
@@ -340,57 +344,52 @@
                 newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>";
             } else {
      			// for pop up window on edit-area for tag list
-                newdiv.innerHTML = "Tagging word: "+String(selection)+"<br>";
-                
+                // newdiv.innerHTML = "Tagging word: "+String(selection)+"<br>";
+                var tagging_words = document.createElement("div");
+                $(tagging_words).addClass("bg-info");
+                $(tagging_words).text("Tagging words: " + String(selection_plain));
+
+                newdiv.appendChild(tagging_words);
+
+                var tagging_tags = document.createElement("div");
+                $(tagging_tags).addClass("bg-white");
+                $(tagging_tags).text("Tag as: ");
+
+                tagging_tags.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection_plain)+"' )\">Title</button></br>";
+               
                 <?php 
                 foreach ( $taglistArray as $taglistValue ) {
-
                     if ($taglistValue[2] == $topic_tag) {
-                    	echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                        echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(without new line)</button>\";\n";
-                        echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                        
-                        /*
-                        echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
-                        echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                        echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                		*/
+                    	echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection_plain)+\"', '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n";
+                        echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(without new line)</button>\";\n";
+                        echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
                         break;
                 	}
                 }
+			    foreach ( $taglistArray as $taglistValue ) {
+                    if ($taglistValue[2] == $topic_tag) { 
+                		// pass
+                	} else if ($taglistValue[2] == "post_time") {
+                        echo "tagging_tags.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
+                        echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
+                    } else if ($taglistValue[2] == "office") {
+                        echo "tagging_tags.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n";
+                        echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
+                    } else {
+                        echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n";
+                        echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n";
+                    } 
+                }
                 ?>
 
-                newdiv.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection)+"' )\">Tag As Title</button></br>";
-                
-                <?php 
-                	
-    			    foreach ( $taglistArray as $taglistValue ) {
-                    	/*
-                    	if ( $taglistValue[2] == "person") {
-                            echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(No BR)</button>\";\n";
-                            echo "newdiv.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."2' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                            echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                    	} else */
-                        if ($taglistValue[2] == $topic_tag) { 
-                    		// pass
-                    	} else if ($taglistValue[2] == "post_time") {
-                            echo "newdiv.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                            echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                        } else if ($taglistValue[2] == "office") {
-                            echo "newdiv.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                            echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                        } else {
-                            echo "newdiv.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n";
-                            echo "newdiv.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n";
-                        } 
+                newdiv.appendChild(tagging_tags);
+                // add selected words to generator regex
+                genRegexBySelection(newdiv, selection); // append button to newdiv and handle the selection words
 
-                    }
-                ?>
             }
 
             //$('#tagItemDivId').addClass();  // tagItemDivId is newdiv's id
             $('body').append(newdiv);
-            
             $('#TitletagType').val(lastAddTag);
 
             // selected some words, so hide popping up remove-tag-window
@@ -405,15 +404,9 @@
         pop_remove_tag_window = true;
     }
 
-
-
     //e.stopPropagation();
-
-
-
 });
 
-
 // === for exporttable.php ===
 function exportTable( range, container ) {
     //MsgBox("enter function");
@@ -708,9 +701,13 @@
     var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' );
     var info = JSON.parse('<?php echo json_encode($info) ?>');
 
-
     $('#load_topic_div').html("");
-    $('#load_topic_div').css("display", "block");
+    var popup_status = $('#load_topic_div').css("display");
+    if (popup_status == "block") {
+        $('#load_topic_div').css("display", "none");
+    } else {
+        $('#load_topic_div').css("display", "block");
+    }
     /*
     $('#load_topic_div').css("border", "1px solid black");
     $('#load_topic_div').css("background-color", "White");
@@ -903,9 +900,22 @@
 
 
 </script>
- 
-<div id="dialog-form" title="config tags for topic" style="position:fixed; top: 30px; ">
-</div>
+
+
+<!--
+<fieldset class="info-board">
+    <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#info_board">Information <span class="caret"></span></h5></legend>
+    <div id="info_board" class="collapse in">
+        <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div>
+        <div class="bg-warning"> <?php echo $messages['warning']; ?> 
+            <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button>
+        </div>
+        <div class="bg-info"> <?php echo $messages['info']; ?> </div>
+        <div class="bg-default"> <?php echo $messages['debug']; ?> </div>
+    </div>
+</fieldset>
+
+-->
 
 <div class="info-board">
     <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div>
@@ -916,6 +926,7 @@
     <div class="bg-default"> <?php echo $messages['debug']; ?> </div>
 </div>
 
+
 <table border="1" style="margin:10 30 30 30; width:100%; max-width:1270px; min-width:680px">
     <tr>
         <td style="padding:0 5 0 5; margin: 0 5 0 5;">
@@ -925,6 +936,20 @@
             <div id="popups" style="position:absolute; width:300px; ">
                 <div id="load_topic_div" class="popup-topic popup-frame"></div>
                 <div id="load_regex_div" class="popup-loadregex popup-frame"></div>
+                <div id="regex_generator" class="popup-regex popup-frame">
+                    <h3>Gen Regex</h3>
+                    <div>Pattern 1: 
+                        <div id="regex_pattern1" class="bg-info"></div>
+                    </div>
+                    <div>Pattern 2:
+                        <div id="regex_pattern2" class="bg-info"></div>
+                    </div>
+                    <div>Suggested Regex: 
+                        <div id="generated_regex" class="bg-success"></div>
+                    </div>
+                    <button onclick="genRegexWindowClose()" class="btn btn-default btn-xs">Close</button>
+                    <div id="regex_generator_error_msg" class="bg-white"></div>
+                </div>
                 <div id="smartRegexPopUpDiv" class="popup-regex popup-frame">
                     Name: <input id="smartRegexPopUpName"></input><br><br>
                     Word List: 
@@ -960,75 +985,94 @@
 
             <div id="follow-scroll">
                 <form action="javascript:void(0);">   
-                    <fieldset>
-                        <legend><h5 class="text-success"> Topic: </h5></legend>
-                        <div> Current topic is: <br> 
-                            <?php echo $topic_name['name_en']; ?> 
-                            (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>)
-                            <button onclick="chooseTopic(<?php echo $default_topic_id;?>)" class="btn-xs">Change</button>
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_topic"> Topic: <span class="caret"></span></h5></legend>
+                        <div id="tool_topic" class="collapse in">
+                            <div> Current topic is: <br> 
+                                <?php echo $topic_name['name_en']; ?> 
+                                (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>)
+                                <button onclick="chooseTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-xs">Change</button>
+                            </div>
+                            <div>The topic tag is: <?php echo $topic_tag_ch;?>(<?php echo $topic_tag;?>)</div>
+                            <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" class="btn btn-default btn-block">Edit Tag List</button>
+                            <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Select Existing Tags</button>
                         </div>
-                        <div>The topic tag is: <?php echo $topic_tag_ch;?>(<?php echo $topic_tag;?>)</div>
                     </fieldset>
 
-                    <fieldset>
-                        <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
-                        <div id="smartRegexShowDiv"></div><br>
-                        <!-- <button onclick="smartRegexNew()" class="btn-lg">Add Regex Group</button></br>
-                        -->
-                        <button onclick="smartRegexNew()" class="btn-lg">Search by Patterns (Smart Regex)</button></br>
-                        Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
-                        <button onclick="replaceSmartRun()" class="btn-sm">Run</button>
-                        <button onclick="replaceSmartRunWithBr()" class="btn-md">Run(in new line)</button></br>
-                        <!-- <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between Group)</button></br>
-                        -->
-                        <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between block)</button></br>
-                        <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" class="btn-sm">Save</button>
-                        <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" class="btn-sm">Load</button>
-                        <button onclick="smartRegexEmpty()" class="btn-sm">Clear</button></br>
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_regex"> Replace By <i><b>Smart Regex</b></i>©: <span class="caret"></span></h5></legend>
+                        
+                        <div id="tool_regex" class="collapse in">
+                            <div id="smartRegexShowDiv"></div><br>
+                            <!-- <button onclick="smartRegexNew()" class="btn-lg">Add Regex Group</button></br>
+                            -->
+                            <button onclick="smartRegexNew()" id="smart_regex_new_id" class="btn btn-default btn-block">Search by Patterns (Smart Regex)</button>
+
+                            <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" class="btn btn-default">Load</button>
+                            <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" class="btn btn-default">Save</button>
+                            <button onclick="smartRegexEmpty()" class="btn btn-default">Clear</button></br>
+
+
+                            Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
+                            <button onclick="replaceSmartRun()" class="btn btn-default">Run</button>
+                            <button onclick="replaceSmartRunWithBr()" class="btn btn-default">Run(in new line)</button></br>
+                            <!-- <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between Group)</button></br>
+                            -->
+                            <button onclick="replaceSmartRunSpace()" class="btn btn-default">Run(Allow space between block)</button></br>
+                            <button onclick="Undo()" class="btn btn-default btn-block" id="buttonUndo" disabled="true">Undo</button>
+
+                            <!-- developing...-->
+                            <button onclick="genRegexWindowOpen()" id="gen_regex_window_open_id" class="btn btn-default">Open GenRegex(test)</button></br>
+                        </div>
                     </fieldset>
                     
-                    <fieldset>
-                        <legend><h5 class="text-success"> Tag by rule:</h5></legend>
-                        <button onclick="tagNameWithLastName()" class="btn-lg">Tag Word Begin With Surname</button></br>
-                        <button onclick="tagNameWithLastName2()" style="height: 35px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
+
+                    <?php
+                    if ($default_topic_id == 1) {
+                    ?>
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_rule"> Tag by rule: <span class="caret"></span></h5></legend>
+                        <div id="tool_rule" class="collapse out">
+                            <button onclick="tagNameWithLastName()" class="btn btn-default">Tag Word Begin With Surname</button></br>
+                            <button onclick="tagNameWithLastName2()" class="btn btn-default btn-sm">Tag Word Begin With</button> <input type="text" size="2" id="surname">
+                        </div>
                         <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
                         <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
-                        <button onclick="Undo()" class="btn-lg" id="buttonUndo" disabled="true">Undo</button>
                     </fieldset>
-                                    
-                    <fieldset>
-                        <legend><h5 class="text-success"> Save:</h5></legend>
-                        <button onclick="saveTextToLGService()" id="saveTextToLGService_id" class="btn-lg">Save to LGService</button></br>
-                    </fieldset>
-                                    
-                    <fieldset>
-                        <legend><h5 class="text-success"> Edit:</h5></legend>
+
+                    <?php }?>
+                                     
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_edit"> Edit: <span class="caret"></span></h5></legend>
                         <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
                         <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage -->
                         <!-- 
                         <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
                         -->
-
-                        <button onclick="editText()" id="editTextId" class="btn-lg">Edit the text</button></br>
-                        </br>
-                        <button onclick="window.open('./EditWordlist')" class="btn-lg">Edit Word List</button></br>
-                        <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" class="btn-lg">Edit Tag List</button></br>
-                        <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn-lg">Select Existing Tags</button></br>
+                        <div class="collapse out" id="tool_edit">
+                            <button onclick="editText()" id="editTextId" class="btn btn-default btn-block">Edit the text</button>
+                            <button onclick="window.open('./EditWordlist')" class="btn btn-default btn-block">Edit WordList</button>
+                        </div>
                     </fieldset>
                     
-                    <fieldset>
-                        <legend><h5 class="text-success"> Export:</h5></legend>
-                        Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd">
-                        <button onclick="exportPage(<?php echo $default_topic_id;?>)" class="btn-sm">Export</button></br>
-                        <button onclick="exportAll(<?php echo $default_topic_id;?>)" class="btn-lg">Export All</button></br>
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_save"> Save and Export: <span class="caret"></span></h5></legend>
+                        <div class="collapse in" id="tool_save">
+                            <button onclick="saveTextToLGService()" id="save_text_to_LGService_id" class="btn btn-default btn-block">Save to LGService</button>
+                            <button onclick="exportAll(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Export All</button>
+                            Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd">
+                            <button onclick="exportPage(<?php echo $default_topic_id;?>)" class="btn btn-default btn-sm">Export</button></br>
+                        </div>
                     </fieldset>
                 
-                    <fieldset>
-                        <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
-                        Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
-                        Regex: <input type="text" size="23" id="regexText"></br>
-                        Replace: <input type="text" size="23" id="replaceText"><br>
-                        <button onclick="replaceSmartRegex()">Replace!</button>
+                    <fieldset class="tool-frame">
+                        <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_replace_by"> Replace By <i><b>Regex</b></i>: <span class="caret"></span></h5></legend>
+                        <div class="collapse out" id="tool_replace_by">
+                            Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
+                            Regex: <input type="text" size="23" id="regexText"></br>
+                            Replace: <input type="text" size="23" id="replaceText"><br>
+                            <button onclick="replaceSmartRegex()" class="btn btn-default btn-sm">Replace!</button>
+                        </div>
                     </fieldset>
                 </form>
             </div>