# HG changeset patch # User Zoe Hong # Date 1427806558 -7200 # Node ID 3fb9e3884401fdcf94b454d82028729483f30640 # Parent c6fa7f83c5bf50782dbd9c66c30652cbda38f014 New: insert selected wordlist into textarea at cursor position when editing regex diff -r c6fa7f83c5bf -r 3fb9e3884401 css/taggingtext.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/css/taggingtext.css Tue Mar 31 14:55:58 2015 +0200 @@ -0,0 +1,25 @@ +.bg-danger{ + background-color: #FFD1D1; +} + +.bg-warning{ + background-color: #FFFF99; +} + +.bg-info{ + background-color: #E7F3FF; + +} + +.bg-default{ + background-color: #F4F4F4; + +} + +.info-board{ + margin:10 30 10 30; + max-width:1270; + height:70px; + overflow:scroll; + overflow-x:hidden; +} \ No newline at end of file diff -r c6fa7f83c5bf -r 3fb9e3884401 data/regex_files/test_regex.txt --- a/data/regex_files/test_regex.txt Tue Mar 31 12:34:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -物產 testwdfvvvv234testQQQ空白v222vQQQ空白wdfw \ No newline at end of file diff -r c6fa7f83c5bf -r 3fb9e3884401 models/extractapp.php --- a/models/extractapp.php Tue Mar 31 12:34:57 2015 +0200 +++ b/models/extractapp.php Tue Mar 31 14:55:58 2015 +0200 @@ -264,13 +264,6 @@ $this->messages['info'] .= ", file id: ".$this->file_id; $this->messages['info'] .= "
"; - /* - $this->messages .= "Info: "; - $this->messages .= "file_id=".$this->file_id.", section_id=".$this->section_id; - $this->messages .= ", user_id=".$this->user_id.", branch_id=".$this->branch_id.", topic_id=".$this->topic; - $this->messages .= ", book_id=".$this->book_id.", book_name=".$this->book_name.", section_name=".$this->section_name; - $this->messages .= ", current_fileId=".$this->current_fileId."
"; - */ $data['messages'] = $this->messages; @@ -303,32 +296,6 @@ } public function UpdateInfoByResponseFromLGService($response) { - - /* - $response_file = $response["file"]; - $response_branch = $response["branch"]; - - - $status = (string)$response["status"]; - - if ((string)$response["status"] == "error") { - $response_currentFile = $response["currentFile"]; - - $this->current_fileId = (string)$response_currentFile['id']; - $this->messages .= "saving does not success! ".(string)$response["message"]; - - - } else { - - $this->messages .= "saving success."; - var_dump((string)$response_file["id"]); - - $this->file_id = (string)$response_file["id"]; - $this->branch_id = (string)$response_branch["id"]; - - } - */ - $response_file = $response["file"]; $response_branch = $response["branch"]; @@ -336,7 +303,6 @@ $status = (string)$response["status"]; if ($status == "ok") { $this->messages['info'] .= "[Info] Saving success.
"; - //$this->messages .= "Saving success."; $this->file_id = (string)$response_file["id"]; $this->branch_id = (string)$response_branch["id"]; @@ -345,12 +311,7 @@ $this->messages['error'] .= "[Error] Saving Failed! ".(string)$response["message"]."
"; $this->messages['warning'] .= "[Warning] Please check branch ".$this->branch_id." in LGService, and modify from the latest version.
"; - /* - $this->messages .= "Saving Failed! ".(string)$response["message"]."
"; - $this->messages .= "Please check branch ".$this->branch_id." in LGService, and modify from the latest version.
"; - */ $response_currentFile = $response["currentFile"]; - //$this->current_fileId = $response["currentFileId"]; $this->current_fileId = (string)$response_currentFile["id"]; } diff -r c6fa7f83c5bf -r 3fb9e3884401 views/Extractapp/TaggingText.php --- 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(''); + 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); + } + } + +/* +*/ }); @@ -915,14 +923,16 @@
- -
-

-

- + +

+

+

+

-

-

+

+

@@ -988,9 +998,6 @@
-
@@ -1016,9 +1023,6 @@


-
diff -r c6fa7f83c5bf -r 3fb9e3884401 views/maintemplate.php --- a/views/maintemplate.php Tue Mar 31 12:34:57 2015 +0200 +++ b/views/maintemplate.php Tue Mar 31 14:55:58 2015 +0200 @@ -4,15 +4,8 @@ + - - - diff -r c6fa7f83c5bf -r 3fb9e3884401 views/maintemplate_local.php --- a/views/maintemplate_local.php Tue Mar 31 12:34:57 2015 +0200 +++ b/views/maintemplate_local.php Tue Mar 31 14:55:58 2015 +0200 @@ -4,15 +4,8 @@ + - - -