Mercurial > hg > extraction-interface
annotate views/Extractapp/TaggingText.php @ 98:5bea390e7ca9 extractapp
new: short tag in front of long tag
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 14 Mar 2016 14:43:42 +0100 |
parents | c1bb174a22f3 |
children | c3e149277b58 |
rev | line source |
---|---|
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1 <?php |
81 | 2 /* |
3 * TaggingText.php | |
4 * This file is part of Extraction-interface. | |
5 * | |
6 * Extraction-interface is free software: you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation, either version 3 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * Extraction-interface is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>. | |
18 */ | |
19 | |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
20 /*! \file |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
21 * This is the view for TaggingText. |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
22 * It shows the extraction-interface application itself. |
81 | 23 * The input data for this view come from models/extractapp.php which is handled by controllers/extractapp.php. |
24 * Input data for example, are (1)text string (containing tags if there are any), | |
25 * (2)taglist for the current topic, (3)book and section information, etc. | |
26 * The output data are passed to backend by controller to corresponding method in model/extractapp.php. | |
27 * Output data is the tagged text string. | |
28 * | |
29 * The user interface contains tagging area on the left side, and toolbox on the right side. | |
30 * There are popup windows to assist the tagging task, for example RegEx-editors, tag-window, remove-tag-window, etc. | |
31 * | |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
32 */ |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
33 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
34 // --- initialize config file and input text --- |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
35 $stringInput = $viewmodel['stringInput']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
36 $wordlistArray = $viewmodel['wordlistArray']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
37 $taglistArray = $viewmodel['taglistArray']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
38 $section_id = $viewmodel['section_id']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
39 $topiclistArray = $viewmodel['topiclistArray']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
40 $default_topic_id = $viewmodel['default_topic_id']; |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
41 $topic_name = $viewmodel['topic_name']; // array of names |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
42 $topic_tag = $viewmodel['topic_tag']; |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
43 $topic_tag_ch = $viewmodel['topic_tag_ch']; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
44 $info = $viewmodel['info']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
45 $messages = $viewmodel['messages']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
46 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
47 $taglist_infile = $viewmodel['taglist_infile']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
48 $book_meta = $viewmodel['book_meta']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
49 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
50 ?> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
51 |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
52 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
53 <html> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
54 <head> |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
55 <meta charset="UTF-8"> |
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
56 <title>Extraction Interface</title> |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
57 <meta http-equiv="no-cache"> |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
58 <meta http-equiv="Expires" content="-1"> |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
59 <meta http-equiv="Cache-Control" content="no-cache"> |
93
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
60 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
61 <style> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
62 dynasty |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
63 { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
64 color:red; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
65 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
66 nianhao |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
67 { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
68 color:blue; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
69 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
70 name |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
71 { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
72 color:orange; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
73 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
74 #editable-area { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
75 line-height:160%; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
76 letter-spacing:1.5px; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
77 font-size:21px; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
78 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
79 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
80 <?php |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
81 // color on the tags |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
82 foreach ( $taglistArray as $taglistValue ) { |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
83 echo $taglistValue[2]."\n{\ncolor:".$taglistValue[3]."; cursor: hand;\n}\n"; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
84 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
85 echo ".span_".$taglistValue[2]."\n{\nbackground-color:".$taglistValue[3]."\n}\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
86 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
87 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
88 ?> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
89 </style> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
90 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
91 </head> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
92 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
93 <body> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
94 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
95 <script type="text/javascript"> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
96 |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
97 var cjst = window.cjst; // for pinyin from cjst.js |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
98 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
99 // not use this for now |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
100 function _showTagColor(up_to_date) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
101 var taglistArray = ""; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
102 if (up_to_date) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
103 taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
104 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
105 taglistArray = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
106 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
107 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
108 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
109 for (var i = 0; i < taglistArray.length; i++) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
110 var taglistValue = taglistArray[i]; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
111 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
112 $(taglistValue[2]).css('color', taglistValue[3]); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
113 /*var element = document.querySelectorAll(taglistValue[2]); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
114 for (var j = 0; j < element.length; j++) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
115 element[j].style.color = taglistValue[3]; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
116 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
117 */ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
118 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
119 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
120 |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
121 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
122 |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
123 function reloadText() { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
124 /** |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
125 * Reload the text when there is a new version of this branch. |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
126 */ |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
127 // confirm to reload |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
128 var r = confirm("Are you sure you want to load the latest version (in a new tab)?"); |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
129 if (r != true) { |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
130 return; |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
131 } |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
132 |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
133 var form = document.createElement("form"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
134 form.setAttribute("method", "post"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
135 form.setAttribute("action", "./TaggingText"); // hand to controller |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
136 form.setAttribute("target", "_blank"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
137 |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
138 var hiddenField = document.createElement("input"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
139 hiddenField.setAttribute("name", "topic"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
140 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
141 hiddenField.setAttribute("value", topic_id); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
142 form.appendChild(hiddenField); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
143 |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
144 var hiddenField = document.createElement("input"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
145 hiddenField.setAttribute("name", "func"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
146 hiddenField.setAttribute("value", "ReloadText"); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
147 form.appendChild(hiddenField); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
148 |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
149 _postForContineTagging(form); |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
150 |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
151 } |
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
152 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
153 function handleFileVersionConflict() { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
154 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
58
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
155 // if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){ |
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
156 if (info['current_fileId'] != 0){ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
157 // -- there might be conflicts between different version |
57
5cf9720a2e25
New: add reloadText to load the latest version
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
54
diff
changeset
|
158 alert("Your saving failed! Someone edited this file and saved before you."); |
58
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
159 $('#reloadTextButton').css("display", "block"); |
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
160 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
161 return; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
162 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
163 return; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
164 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
165 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
166 |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
167 // on click on tagged words, call removeTagNewDiv() for the popup window |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
168 // popup-window overlapping issue |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
169 var pop_remove_tag_window = true; |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
170 var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>'); |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
171 for (var i = 0; i < taglistArray.length; i++) { |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
172 var taglistValue = taglistArray[i]; |
93
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
173 |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
174 |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
175 $(document).on("click", taglistValue[2], function (e, taglistValue) { |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
176 if ($("#editTextId").html() != "Edit the text") return 0; |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
177 var tag = $(this).prop("tagName").toLowerCase(); |
93
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
178 //if (tagName != taglistValue[2]) return 0; |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
179 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
180 // pop_remove_tag_window is a global variable which indicates if to show the remove-popup-window |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
181 if (pop_remove_tag_window) { |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
182 removeTagNewDiv( e, tag , $(this)); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
183 |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
184 }; |
93
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
185 return false; |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
186 }); |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
187 |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
188 |
a05491461199
bug fixed: solve the nested tagging issue
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
91
diff
changeset
|
189 |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
190 }; |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
191 |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
192 /* |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
193 <?php |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
194 foreach ( $taglistArray as $taglistValue ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
195 echo '$(document).on("click", "'.$taglistValue[2].'", function (e) {'."\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
196 echo "\t".'if ( $(this).prop("tagName").toLowerCase() != "'.$taglistValue[2].'" ) return 0;'."\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
197 echo "\t".'if ( $("#editTextId").html() != "Edit the text" ) return 0;'."\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
198 echo "\tremoveTagNewDiv( e, \"".$taglistValue[2]."\", $(this) );\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
199 echo "});\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
200 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
201 ?> |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
202 */ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
203 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
204 $(document).ready(function(){ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
205 // --- for sidebar--- |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
206 //run once |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
207 var el=$('#follow-scroll'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
208 var originalelpos=el.offset().top; // take it where it originally is on the page |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
209 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
210 //run on scroll |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
211 $(window).scroll(function(){ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
212 var el = $('#follow-scroll'); // important! (local) |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
213 var elpos = el.offset().top; // take current situation |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
214 var windowpos = $(window).scrollTop(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
215 var finaldestination = windowpos+originalelpos; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
216 //el.stop().animate({'top':finaldestination},500); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
217 el.stop().animate({'top':finaldestination},0); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
218 }); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
219 // --- |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
220 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
221 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
222 //--- for popups --- |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
223 //run once |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
224 var el=$('#popups'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
225 var originalelpos=el.offset().top; // take it where it originally is on the page |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
226 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
227 //run on scroll |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
228 $(window).scroll(function(){ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
229 var el = $('#popups'); // important! (local) |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
230 var elpos = el.offset().top; // take current situation |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
231 var windowpos = $(window).scrollTop(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
232 var finaldestination = windowpos+originalelpos; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
233 //el.stop().animate({'top':finaldestination},500); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
234 el.stop().animate({'top':finaldestination},0); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
235 }); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
236 // --- |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
237 |
60
3239979f6673
New: 1.display messages(style) 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
59
diff
changeset
|
238 |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
239 // === This case only be possible for developing on local machine ==== |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
240 var _GET = JSON.parse('<?php echo json_encode($_GET) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
241 if (_GET['id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
242 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
49
b2c1fae5cf6a
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
47
diff
changeset
|
243 var redirectUrl = "http://localhost:1080/localgazetteers-dev/extraction-interface/Extractapp/TaggingText"; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
244 var section_id = info['section_id']; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
245 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
246 var form = $('<form action="' + redirectUrl + '" method="post">' + |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
247 '<input type="hidden" name="sectionId" value="'+section_id+'" />' + |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
248 '</form>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
249 $('body').append(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
250 $(form).submit(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
251 } |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
252 // -------- |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
253 |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
254 // --- handle file version conflict --- |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
255 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
256 // the first time to this section. without branch_id and file_id |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
257 if (info['file_id'] == 0) { // or info['branch_id'] == 0, means new file |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
258 $( "#save_text_to_LGService_id").text( "Create(Save) Branch to LGService" ); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
259 |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
260 } |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
261 handleFileVersionConflict(); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
262 |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
263 // --- handle taglist deprecation --- |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
264 var taglist_infile = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
265 var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>'); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
266 |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
267 if (taglist_infile == "") { |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
268 console.log("Debug: taglist_infile is empty which means taglist_infile is equal to taglist in db."); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
269 } else { |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
270 console.log("Debug: taglist in file, length=" + taglist_infile.length); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
271 console.log(taglist_infile); |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
272 console.log("Debug: taglist in db, length=" + taglistArray.length); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
273 console.log(taglistArray); |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
274 |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
275 // TOOD: ask user to modify/decide tags (?) |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
276 // showing taglist_infile and taglistArray |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
277 } |
72
6974309983d1
Bug fixed:1.remove tagging popup window on editable-area, 2.close/disable inputs and buttons, when entering edit-text mode.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
278 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
279 }); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
280 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
281 $(document).on("mouseup", '#editable-area', function (e) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
282 $('.questionMarkClass').remove(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
283 $('.tagItemDivClass').remove(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
284 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
285 if ( $("#editTextId").html() != "Edit the text" ) return 0; |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
286 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
287 //var selection = getSelected(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
288 selection = getSelected(); // selection is a global variable |
54
f9e7119339b2
bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
51
diff
changeset
|
289 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
290 range = selection.getRangeAt(0); // range is a global variable |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
291 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
292 container = document.createElement("div"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
293 container.appendChild(selection.getRangeAt(0).cloneContents()); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
294 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
295 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
296 if(selection && (selection_plain = new String(selection).replace(/^\s+|\s+$/g,''))) { |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
297 try{ |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
298 var newdiv = document.createElement("div"); |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
299 //newdiv.id = "tagItemDivId"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
300 //newdiv.setAttribute("class", "tagItemDivClass"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
301 $(newdiv).id = "tagItemDivId"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
302 $(newdiv).addClass("tagItemDivClass"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
303 newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+';'; |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
304 //console.log(selection.getRangeAt(0).cloneContents()); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
305 if ( container.innerHTML.indexOf( "br" ) != -1 ) { |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
306 // when selected words containing tags (i.e. has 'br' in the selected string), |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
307 // which means user want to apply Title / or tags all in once at each line |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
308 // This may not be the best checking solution, since 'br' also appears between not-tagged words |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
309 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
310 var newselect = document.createElement("select"); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
311 newselect.id = "TitletagType"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
312 //console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>')); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
313 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
314 <?php |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
315 foreach ( $taglistArray as $taglistValue ) { |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
316 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
317 } |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
318 ?> |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
319 newdiv.appendChild(newselect); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
320 |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
321 //matchValue = .match(); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
322 myRegexp = new RegExp("〈(.*?)〉", "g") |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
323 matchValue = myRegexp.exec(String(selection)); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
324 |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
325 if ( matchValue != null ) { |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
326 newdiv.innerHTML += "<input id=\"TitletagName\" value=\""+ matchValue[1] +"\"></br>"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
327 } else { |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
328 newdiv.innerHTML += "<input id=\"TitletagName\" value=\"\"></br>"; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
329 } |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
330 newdiv.innerHTML += "<button onclick=\"addTagTitle( range, container )\">Add Title Tag To Each Line</button></br>"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
331 |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
332 /* |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
333 newdiv.innerHTML += "<button onclick=\"exportTable( range, container )\">Export As A Table</button></br></br>"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
334 */ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
335 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
336 var newselect = document.createElement("select"); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
337 newselect.id = "RemoveTitletagType"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
338 <?php |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
339 foreach ( $taglistArray as $taglistValue ) { |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
340 echo "newselect.innerHTML += \"<option value='".$taglistValue[2]."'>".$taglistValue[1]."</option>\";\n"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
341 } |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
342 ?> |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
343 newdiv.appendChild(newselect); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
344 |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
345 newdiv.innerHTML += "<input id=\"RemoveTitletagName\" value=\"\"></br>"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
346 newdiv.innerHTML += "<button onclick=\"removeTagTitle( range, container )\">Remove</button></br>"; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
347 } else { |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
348 // for pop up window on edit-area for tag list |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
349 // newdiv.innerHTML = "Tagging word: "+String(selection)+"<br>"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
350 var tagging_words = document.createElement("div"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
351 $(tagging_words).addClass("bg-info"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
352 $(tagging_words).text("Tagging words: " + String(selection_plain)); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
353 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
354 newdiv.appendChild(tagging_words); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
355 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
356 var tagging_tags = document.createElement("div"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
357 $(tagging_tags).addClass("bg-white"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
358 $(tagging_tags).text("Tag as: "); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
359 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
360 tagging_tags.innerHTML += "<button accesskey=\"2\" onclick=\"tagwithtitle( range, '"+String(selection_plain)+"' )\">Title</button></br>"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
361 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
362 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
363 console.log(selection); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
364 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
365 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
366 <?php |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
367 foreach ( $taglistArray as $taglistValue ) { |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
368 if ($taglistValue[2] == $topic_tag) { |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
369 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n"; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
370 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(without new line)</button>\";\n"; |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
371 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection_plain)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
372 break; |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
373 } |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
374 } |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
375 foreach ( $taglistArray as $taglistValue ) { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
376 if ($taglistValue[2] == $topic_tag) { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
377 // pass |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
378 } else if ($taglistValue[2] == "post_time") { |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
379 // this case could be deprecated |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
380 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"3\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."</button>\";\n"; |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
381 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">Tag as:".$taglistValue[1]."(ALL)</button></br>\";\n"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
382 } else if ($taglistValue[2] == "office") { |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
383 // this case could be deprecated |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
384 echo "tagging_tags.innerHTML += \"<button accesskey=\\\"4\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n"; |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
385 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
386 } else { |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
387 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagwithOnlytag(range, selection, '".$taglistValue[2]."')\\\">".$taglistValue[1]."</button>\";\n"; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
388 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
389 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
390 /* testing... backup the original one |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
391 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
392 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagwithOnlytag( range, '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."</button>\";\n"; |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
393 echo "tagging_tags.innerHTML += \"<button onclick=\\\"tagStringWithTag( '\"+String(selection)+\"', '".$taglistValue[2]."' )\\\">".$taglistValue[1]."(ALL)</button></br>\";\n"; |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
394 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
395 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
396 } |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
397 } |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
398 ?> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
399 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
400 newdiv.appendChild(tagging_tags); |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
401 |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
402 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
403 // add selected words to generator regex |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
404 // remove this feature... |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
405 // genRegexBySelection(newdiv, selection); // append button to newdiv and handle the selection words |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
406 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
407 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
408 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
409 //$('#tagItemDivId').addClass(); // tagItemDivId is newdiv's id |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
410 $('body').append(newdiv); |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
411 $('#TitletagType').val(lastAddTag); |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
412 |
79
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
413 // selected some words, so hide popping up remove-tag-window |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
414 pop_remove_tag_window = false; // questionMarkID |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
415 } |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
416 catch(err){ |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
417 pop_remove_tag_window = true; // questionMarkID |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
418 |
e6e213b26454
Bug fixed: file crashed after saving (preg_replace remove unnecessary symbols within br tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
78
diff
changeset
|
419 } |
78
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
420 } else { |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
421 // without selecting any word, so pop up remove-tag-window |
960ba96efce1
Update: click to popup remove-tag-window; select to popup tag-window
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
77
diff
changeset
|
422 pop_remove_tag_window = true; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
423 } |
54
f9e7119339b2
bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
51
diff
changeset
|
424 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
425 //e.stopPropagation(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
426 }); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
427 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
428 // === for exporttable.php === |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
429 function exportTable( range, container ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
430 //MsgBox("enter function"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
431 var form = document.createElement("form"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
432 form.setAttribute("method", "post"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
433 form.setAttribute("action", "./ExportTable"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
434 form.setAttribute("target", "_blank"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
435 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
436 var hiddenField = document.createElement("input"); |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
437 hiddenField.setAttribute("name", "func"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
438 hiddenField.setAttribute("value", "exportFromExtractionInterface"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
439 form.appendChild(hiddenField); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
440 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
441 var hiddenField = document.createElement("input"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
442 hiddenField.setAttribute("name", "content"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
443 hiddenField.setAttribute("value", container.innerHTML); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
444 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
445 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
446 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
447 hiddenField.setAttribute("name", "sectionid"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
448 hiddenField.setAttribute("value", "<?php echo $section_id; ?>"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
449 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
450 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
451 var hiddenField2 = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
452 hiddenField2.setAttribute("name", "topic"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
453 hiddenField2.setAttribute("value", topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
454 form.appendChild(hiddenField2); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
455 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
456 var info = JSON.parse( '<?php echo json_encode($info) ?>'); |
91
3e11a9c5a672
new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
90
diff
changeset
|
457 var book_meta = JSON.parse( '<?php echo json_encode($book_meta) ?>'); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
458 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
459 if (info) { |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
460 var hiddenField = document.createElement("input"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
461 hiddenField.setAttribute("name", "bookId"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
462 hiddenField.setAttribute("value", info['book_id']); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
463 form.appendChild(hiddenField); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
464 |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
465 var hiddenField = document.createElement("input"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
466 hiddenField.setAttribute("name", "bookName"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
467 hiddenField.setAttribute("value", info['book_name']); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
468 form.appendChild(hiddenField); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
469 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
470 var hiddenField = document.createElement("input"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
471 hiddenField.setAttribute("name", "sectionName"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
472 hiddenField.setAttribute("value", info['section_name']); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
473 form.appendChild(hiddenField); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
474 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
475 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
476 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
477 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
478 document.body.appendChild(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
479 form.submit(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
480 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
481 form.submit(); // works under IE and Chrome, but not FF |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
482 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
483 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
484 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
485 function exportPage(topic_id) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
486 var startPage = $('#exportPageStart').val(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
487 var endPage = $('#exportPageEnd').val(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
488 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
489 var el = document.getElementById("editable-area"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
490 var str="" + el.innerHTML; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
491 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
492 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
493 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
494 var form = document.createElement("form"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
495 form.setAttribute("method", "post"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
496 form.setAttribute("action", "./ExportTable"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
497 form.setAttribute("target", "_blank"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
498 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
499 var hiddenField = document.createElement("input"); |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
500 hiddenField.setAttribute("name", "func"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
501 hiddenField.setAttribute("value", "exportFromExtractionInterface"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
502 form.appendChild(hiddenField); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
503 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
504 var hiddenField = document.createElement("input"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
505 hiddenField.setAttribute("name", "content"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
506 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g"))); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
507 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
508 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
509 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
510 hiddenField.setAttribute("name", "topic"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
511 hiddenField.setAttribute("value", topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
512 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
513 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
514 _postForContineTagging(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
515 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
516 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
517 /* |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
518 var section_id = JSON.parse('<?php echo json_encode($section_id) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
519 console.log("section_id: "+section_id+", topic_id: "+topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
520 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
521 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
522 hiddenField.setAttribute("name", "sectionId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
523 hiddenField.setAttribute("value", section_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
524 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
525 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
526 var info = JSON.parse( '<?php echo json_encode($info) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
527 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
528 if (info) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
529 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
530 hiddenField.setAttribute("name", "bookId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
531 hiddenField.setAttribute("value", info['book_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
532 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
533 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
534 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
535 hiddenField.setAttribute("name", "bookName"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
536 hiddenField.setAttribute("value", info['book_name']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
537 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
538 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
539 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
540 hiddenField.setAttribute("name", "sectionName"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
541 hiddenField.setAttribute("value", info['section_name']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
542 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
543 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
544 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
545 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
546 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
547 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
548 document.body.appendChild(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
549 form.submit(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
550 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
551 form.submit(); // works under IE and Chrome, but not FF |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
552 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
553 */ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
554 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
555 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
556 function exportAll(topic_id) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
557 var el = document.getElementById("editable-area"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
558 var str= "" + el.innerHTML; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
559 var form = document.createElement("form"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
560 form.setAttribute("method", "post"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
561 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
562 form.setAttribute("target", "_blank"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
563 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
564 var hiddenField = document.createElement("input"); |
77
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
565 hiddenField.setAttribute("name", "func"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
566 hiddenField.setAttribute("value", "exportFromExtractionInterface"); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
567 form.appendChild(hiddenField); |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
568 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
569 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
570 |
97c1e5102a22
New: export table for a file from LGService
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
76
diff
changeset
|
571 var hiddenField = document.createElement("input"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
572 hiddenField.setAttribute("name", "content"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
573 hiddenField.setAttribute("value", str); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
574 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
575 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
576 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
577 hiddenField.setAttribute("name", "topic"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
578 hiddenField.setAttribute("value", topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
579 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
580 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
581 _postForContineTagging(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
582 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
583 } |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
584 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
585 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
586 function tagTestX(range, selection, tag) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
587 console.log("selection string: "); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
588 console.log(String(selection)); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
589 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
590 var stringSelection = String(selection); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
591 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
592 saveUndoText(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
593 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
594 var topic_tag2 = topic_tag+"2"; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
595 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
596 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
597 // stringSelection here only contains plain text (string) without the tagging structure |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
598 // how to use the existing tagging structure |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
599 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
600 // --- |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
601 var documentFragment = range.extractContents(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
602 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
603 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
604 var tmpStringSelection = "" |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
605 var childNodes = documentFragment.childNodes |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
606 for (var i = 0; i < childNodes.length; i++){ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
607 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
608 if (childNodes[i].outerHTML == undefined) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
609 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
610 tmpStringSelection += childNodes[i].textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
611 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
612 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
613 tmpStringSelection += childNodes[i].outerHTML |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
614 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
615 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
616 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
617 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
618 stringSelection = tmpStringSelection |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
619 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
620 range.deleteContents(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
621 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
622 if ( tag==topic_tag2) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
623 var newdiv = document.createElement(topic_tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
624 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
625 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
626 var newdiv = document.createElement("br"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
627 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
628 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
629 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
630 var newdiv = document.createElement(tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
631 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
632 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
633 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
634 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
635 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
636 $('.tagItemDivClass').remove(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
637 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
638 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
639 return |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
640 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
641 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
642 // --- |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
643 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
644 console.log("the anchorNode: "); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
645 console.log(selection.anchorNode); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
646 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
647 console.log("the anchorNode's nextSibling"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
648 console.log(next); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
649 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
650 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
651 // TODO if no fragment... bug |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
652 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
653 if ( typeof selection !== 'string' ) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
654 var next = selection.anchorNode.nextSibling; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
655 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
656 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
657 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
658 // TODO fragment at the beginning of selection: anchorNode |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
659 var tmpStringSelection = "" |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
660 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
661 var startInx = selection.anchorOffset |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
662 var endSelectionInx = startInx + stringSelection.length |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
663 var endInx = selection.anchorNode.length |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
664 console.log("startInx=" + startInx + " endInx= " + endInx + "; endSelectionInx= " + endSelectionInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
665 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
666 var anchorText = selection.anchorNode.textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
667 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
668 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
669 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
670 console.log("anchorNode...") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
671 if (selection.anchorNode.nodeType == 3 && next.nodeName != "BR" && next.nodeName != "br") { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
672 // if (next != null && selection.anchorNode.nodeType == 3 && next.nodeName != "BR" && next.nodeName != "br") { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
673 // here the anchor node is text |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
674 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
675 //tmpStringSelection += anchorText.substring(selection.anchorOffset, selection.anchorNode.length); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
676 tmpStringSelection += anchorText.substring(startInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
677 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
678 console.log("append anchorText to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
679 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
680 endInx += endSelectionInx - startInx; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
681 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
682 //endInx += (selection.anchorNode.length - selection.anchorOffset); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
683 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
684 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
685 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
686 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
687 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
688 // TODO when anchorNode is not text, but a node |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
689 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
690 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
691 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
692 if (next != null) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
693 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
694 if (selection.anchorNode.nodeType == 3 && next.nodeName != "BR" && next.nodeName != "br") { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
695 var anchorText = selection.anchorNode.textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
696 // never goes here? |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
697 tmpStringSelection += anchorText.substring(selection.anchorOffset, selection.anchorNode.length); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
698 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
699 console.log("append anchorText to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
700 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
701 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
702 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
703 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
704 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
705 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
706 // TODO parsing stringSelection object in string, with the tagging strucutre |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
707 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
708 var checkExtentNode = true |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
709 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
710 while(next != null && next != undefined && next.nodeName != "BR" && next.nodeName != "br" ) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
711 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
712 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
713 if (endInx >= endSelectionInx) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
714 console.log("startInx=" + startInx + " endInx= " + endInx + "; endSelectionInx= " + endSelectionInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
715 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
716 console.log("debug: end of traverse. next=") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
717 console.log(next) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
718 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
719 break; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
720 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
721 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
722 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
723 startInx = endInx |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
724 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
725 if (next.nodeType == 3) { // text case |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
726 console.log("text case.") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
727 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
728 endInx += next.textContent.length |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
729 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
730 if (endInx > endSelectionInx) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
731 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
732 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
733 tmpStringSelection += next.textContent.substring(0, endSelectionInx-startInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
734 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
735 console.log("startInx=" + startInx + " endInx= " + endInx + "; endSelectionInx= " + endSelectionInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
736 console.log("appened next.textContent.substring tmpStringSelection (text case): " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
737 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
738 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
739 //checkExtentNode = false |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
740 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
741 //break; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
742 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
743 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
744 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
745 tmpStringSelection += next.textContent; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
746 console.log("appened tmpStringSelection (text case): " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
747 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
748 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
749 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
750 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
751 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
752 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
753 } else if (next.nodeType == 1) { // node case |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
754 console.log("node case") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
755 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
756 endInx += next.innerHTML.length |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
757 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
758 if (endInx > endSelectionInx) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
759 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
760 // TODO do something about tmpStringSelection here? |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
761 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
762 console.log("startInx=" + startInx + " endInx= " + endInx + "; endSelectionInx= " + endSelectionInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
763 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
764 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
765 //checkExtentNode = false |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
766 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
767 //break; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
768 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
769 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
770 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
771 tmpStringSelection += next.outerHTML; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
772 console.log("appened tmpStringSelection (node case): " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
773 // endInx += next.outerHTML.length |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
774 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
775 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
776 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
777 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
778 console.log("[debug] case: nodeType=" + next.nodeType) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
779 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
780 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
781 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
782 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
783 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
784 } else if (next.innerHTML != undefined) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
785 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
786 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
787 endInx += next.innerHTML.length; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
788 if (endInx >= endSelectionInx) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
789 break; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
790 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
791 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
792 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
793 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
794 break |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
795 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
796 console.log("startInx= " + startInx + "; endInx= " + endInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
797 if (next.outerHTML != undefined) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
798 tmpStringSelection += next.outerHTML; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
799 console.log("appened tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
800 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
801 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
802 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
803 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
804 console.log("next: "); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
805 console.log(next); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
806 next = next.nextSibling; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
807 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
808 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
809 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
810 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
811 // TODO |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
812 // fragment at the end of selection: extentNode |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
813 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
814 console.log("extentNode...") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
815 console.log("startInx=" + startInx + " endInx= " + endInx + "; endSelectionInx= " + endSelectionInx) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
816 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
817 var extentNode = selection.extentNode |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
818 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
819 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
820 if (checkExtentNode) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
821 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
822 if (endInx < endSelectionInx && startInx < endSelectionInx ) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
823 tmpStringSelection += anchorText.substring(endInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
824 console.log("append anchorText.substring(endInx, endSelectionInx) to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
825 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
826 } else if (extentNode != null) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
827 var extentText = extentNode.textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
828 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
829 tmpStringSelection += extentText.substring(startInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
830 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
831 console.log("append extentNode to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
832 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
833 tmpStringSelection += anchorText.substring(startInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
834 console.log("append anchorText.substring(startInx, endSelectionInx) to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
835 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
836 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
837 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
838 /* |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
839 if (extentNode != null) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
840 if (extentNode.nodeType == 3 ) { // text case |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
841 var extentText = extentNode.textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
842 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
843 if (endInx >= endSelectionInx) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
844 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
845 console.log("tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
846 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
847 console.log(extentText.substring(startInx, selection.extentOffset)) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
848 tmpStringSelection += extentText.substring(startInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
849 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
850 console.log("append extentNode to tmpStringSelection: " + tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
851 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
852 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
853 tmpStringSelection += anchorText.substring(endInx, endSelectionInx); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
854 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
855 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
856 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
857 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
858 */ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
859 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
860 console.log("tmpStringSelection:") |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
861 console.log(tmpStringSelection) |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
862 stringSelection = tmpStringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
863 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
864 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
865 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
866 range.deleteContents(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
867 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
868 if ( tag==topic_tag2) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
869 var newdiv = document.createElement(topic_tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
870 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
871 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
872 var newdiv = document.createElement("br"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
873 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
874 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
875 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
876 var newdiv = document.createElement(tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
877 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
878 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
879 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
880 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
881 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
882 $('.tagItemDivClass').remove(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
883 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
884 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
885 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
886 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
887 function tagwithOnlytag( range, selection, tag ) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
888 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
889 saveUndoText(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
890 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
891 var topic_tag2 = topic_tag+"2"; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
892 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
893 var documentFragment = range.extractContents(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
894 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
895 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
896 var stringSelection = "" |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
897 var childNodes = documentFragment.childNodes |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
898 for (var i = 0; i < childNodes.length; i++){ |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
899 if (childNodes[i].outerHTML == undefined) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
900 stringSelection += childNodes[i].textContent |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
901 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
902 stringSelection += childNodes[i].outerHTML |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
903 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
904 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
905 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
906 range.deleteContents(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
907 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
908 if ( tag==topic_tag2) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
909 var newdiv = document.createElement(topic_tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
910 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
911 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
912 var newdiv = document.createElement("br"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
913 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
914 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
915 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
916 var newdiv = document.createElement(tag); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
917 newdiv.innerHTML = stringSelection; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
918 range.insertNode(newdiv); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
919 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
920 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
921 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
922 $('.tagItemDivClass').remove(); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
923 } |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
924 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
925 function tagwithOnlytag_old( range, stringSelection, tag ) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
926 saveUndoText(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
927 var topic_tag = JSON.parse('<?php echo json_encode($topic_tag) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
928 var topic_tag2 = topic_tag+"2"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
929 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
930 range.deleteContents(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
931 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
932 if ( tag==topic_tag2) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
933 var newdiv = document.createElement(topic_tag); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
934 newdiv.innerHTML = stringSelection; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
935 range.insertNode(newdiv); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
936 var newdiv = document.createElement("br"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
937 range.insertNode(newdiv); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
938 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
939 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
940 var newdiv = document.createElement(tag); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
941 newdiv.innerHTML = stringSelection; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
942 range.insertNode(newdiv); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
943 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
944 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
945 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
946 $('.tagItemDivClass').remove(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
947 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
948 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
949 function replaceSmartRegex() { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
950 saveUndoText(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
951 var startPage = $('#regexPageStart2').val(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
952 var endPage = $('#regexPageEnd2').val(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
953 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
954 var el = document.getElementById("editable-area"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
955 var regexText=document.getElementById("regexText").value; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
956 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
957 <?php |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
958 foreach ( $wordlistArray as $wordlistValue ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
959 echo "\tvar regexText1=\"List ".$wordlistValue[1]."\";\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
960 echo "\tregexText1 = preg_quote(regexText1);\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
961 echo "\tvar replaceText1=\"".$wordlistValue[2]."\";\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
962 echo "\tregexText = regexText.replace(new RegExp(regexText1, \"g\"), replaceText1);\n\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
963 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
964 ?> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
965 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
966 var replaceText=document.getElementById("replaceText").value; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
967 var str="" + el.innerHTML; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
968 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
969 if ( startPage == "" ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
970 alert( "Tagged "+str.match(new RegExp(regexText, "g")).length+" entities!" ); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
971 el.innerHTML = str.replace(new RegExp(regexText, "g"), replaceText); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
972 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
973 var regexText2="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
974 var partString = ""+str.match(new RegExp(regexText2, "g")); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
975 alert(partString); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
976 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
977 alert( "Tagged "+partString.match(new RegExp(regexText, "g")).length+" entities!" ); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
978 var resultString = partString.replace(new RegExp(regexText, "g"), replaceText); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
979 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
980 str="" + el.innerHTML; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
981 el.innerHTML = str.replace(new RegExp(regexText2, "g"), resultString); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
982 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
983 //document.styleSheets[0].addRule("tag001", "color:green;") |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
984 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
985 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
986 function saveTextToLGService() { |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
987 // clean editable-area |
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
988 $('.questionMarkClass').remove(); |
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
989 $('.tagItemDivClass').remove(); |
72
6974309983d1
Bug fixed:1.remove tagging popup window on editable-area, 2.close/disable inputs and buttons, when entering edit-text mode.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
70
diff
changeset
|
990 |
54
f9e7119339b2
bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
51
diff
changeset
|
991 // ------------- |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
992 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
993 var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
994 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
995 // if this is a new branch, ask for label |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
996 // if (info['branch_id'] == 0) { |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
997 if (info['branch_id'] == 0) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
998 //var label = prompt("Please enter your label for this new branch", "section"+info['section_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
999 var today = new Date(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1000 var dd = today.getDate(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1001 var mm = today.getMonth()+1; //January is 0! |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1002 var yyyy = today.getFullYear(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1003 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1004 if(dd<10) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1005 dd='0'+dd |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1006 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1007 if(mm<10) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1008 mm='0'+mm |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1009 } |
54
f9e7119339b2
bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
51
diff
changeset
|
1010 today = dd+'.'+mm+'.'+yyyy; |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1011 var book_name = info['book_name']; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1012 var section_name = info['section_name']; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1013 var period = info['period']; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1014 |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1015 var default_label = ""; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1016 if (book_name == "" || section_name == "" || period == "") { |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1017 default_label = today; |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1018 } else { |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1019 default_label = book_name + "(" + cjst.chineseToPinyin(book_name).join(' ') + ")_" |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1020 + period + "(" + cjst.chineseToPinyin(period).join(' ') + ")_" |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1021 + section_name + "(" + cjst.chineseToPinyin(section_name).join(' ') + ")_" |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1022 + today; |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1023 } |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1024 |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1025 |
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1026 var label = prompt("Please enter your label for this new branch", default_label); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1027 while (label == null) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1028 alert("You haven't saved your editing."); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1029 return; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1030 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1031 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1032 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1033 var form = document.createElement("form"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1034 form.setAttribute("method", "post"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1035 form.setAttribute("action", "./TaggingText"); // hand to controller |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1036 form.setAttribute("target", "_self"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1037 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1038 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1039 hiddenField.setAttribute("name", "func"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1040 hiddenField.setAttribute("value", "SaveFullTextToLGService"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1041 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1042 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1043 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1044 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1045 hiddenField.setAttribute("name", "label"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1046 hiddenField.setAttribute("value", label); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1047 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1048 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1049 var hiddenField = document.createElement("input"); |
95 | 1050 hiddenField.setAttribute("name", "topic"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1051 hiddenField.setAttribute("value", topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1052 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1053 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1054 _postForContineTagging(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1055 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1056 console.log("complete saving to LGService"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1057 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1058 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1059 |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1060 function createTopic(default_topic_id) { |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1061 var popup_status = $('#new_topic_div').css("display"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1062 if (popup_status == "block") { |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1063 $('#new_topic_div').css("display", "none"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1064 } else { |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1065 $('#new_topic_div').css("display", "block"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1066 } |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1067 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1068 var newtopic = document.getElementById("newTopicSubmit"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1069 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1070 newtopic.onclick = function(){ |
95 | 1071 // check if all fields are filled in |
1072 if ($("#newTopicNameEn").val()==""|| $("#newTopicNameCh").val()=="" || $("#newTopicNamePi").val()=="" || | |
1073 $("#newTopicTag").val()=="" || $("#newTopicTagName").val()=="") { | |
1074 alert("Please fill in all the fields for the new topic."); | |
1075 return; | |
1076 } | |
1077 | |
1078 | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1079 var form = document.createElement("form"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1080 form.setAttribute("method", "post"); |
95 | 1081 form.setAttribute("action", "./TaggingText"); // hand to controller |
1082 form.setAttribute("target", "_self"); | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1083 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1084 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1085 hiddenField.setAttribute("name", "func"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1086 hiddenField.setAttribute("value", "CreateNewTopic"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1087 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1088 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1089 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1090 hiddenField.setAttribute("name", "new_topic_name_en"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1091 hiddenField.setAttribute("value", $("#newTopicNameEn").val()); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1092 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1093 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1094 hiddenField.setAttribute("name", "new_topic_name_ch"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1095 hiddenField.setAttribute("value", $("#newTopicNameCh").val()); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1096 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1097 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1098 hiddenField.setAttribute("name", "new_topic_name_pi"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1099 hiddenField.setAttribute("value", $("#newTopicNamePi").val()); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1100 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1101 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1102 hiddenField.setAttribute("name", "new_topic_tag"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1103 hiddenField.setAttribute("value", $("#newTopicTag").val()); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1104 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1105 var hiddenField = document.createElement("input"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1106 hiddenField.setAttribute("name", "new_topic_tag_name"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1107 hiddenField.setAttribute("value", $("#newTopicTagName").val()); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1108 form.appendChild(hiddenField); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1109 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1110 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1111 _postForContineTagging(form); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1112 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1113 } |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1114 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1115 $("#newTopicCancel").attr("onclick", "$('#new_topic_div').css(\"display\", \"none\");"); |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1116 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1117 } |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1118 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1119 function chooseTopic(default_topic_id) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1120 var t = JSON.parse( '<?php echo json_encode($topiclistArray) ?>' ); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1121 var info = JSON.parse('<?php echo json_encode($info) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1122 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1123 $('#load_topic_div').html(""); |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1124 var popup_status = $('#load_topic_div').css("display"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1125 if (popup_status == "block") { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1126 $('#load_topic_div').css("display", "none"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1127 } else { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1128 $('#load_topic_div').css("display", "block"); |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1129 } |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1130 /* |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1131 $('#load_topic_div').css("border", "1px solid black"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1132 $('#load_topic_div').css("background-color", "White"); |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1133 $('#load_topic_div').css("width", "200px"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1134 $('#load_topic_div').css("height", "50px"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1135 $('#load_topic_div').css("top", "20px"); |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1136 $('#load_topic_div').css("left", "-200px"); |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1137 */ |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1138 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1139 var topic_select = document.createElement("select"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1140 topic_select.id = "loadTopiclist"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1141 var selected_topic = t[0]; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1142 topic_select.onchange = function(){ |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1143 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1144 var changeConfirm = confirm("You're going to change topic. \nUnsaved data will be lost."); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1145 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1146 if (changeConfirm) { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1147 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1148 selected_topic = topic_select.options[topic_select.selectedIndex]; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1149 console.log(selected_topic.text); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1150 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1151 var topic_id = selected_topic.value; |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1152 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1153 var form = document.createElement("form"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1154 form.setAttribute("method", "post"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1155 form.setAttribute("action", "./TaggingText"); // hand to controller |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1156 form.setAttribute("target", "_self"); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1157 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1158 var hiddenField = document.createElement("input"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1159 hiddenField.setAttribute("name", "topic"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1160 hiddenField.setAttribute("value", topic_id); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1161 form.appendChild(hiddenField); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1162 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1163 var hiddenField = document.createElement("input"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1164 hiddenField.setAttribute("name", "func"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1165 hiddenField.setAttribute("value", "ContinueTagging"); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1166 form.appendChild(hiddenField); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1167 |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1168 _postForContineTagging(form); |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1169 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1170 |
98
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1171 } else { |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1172 return |
5bea390e7ca9
new: short tag in front of long tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
97
diff
changeset
|
1173 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1174 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1175 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1176 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1177 //Create and append the options |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1178 for (var i = 0; i < t.length; i++) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1179 var option = document.createElement("option"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1180 option.value = t[i]['id']; |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1181 option.text = t[i]['name_en']+" ("+t[i]['name_ch']+", "+t[i]['name_pinyin']+")"; |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1182 if (option.value == default_topic_id) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1183 option.selected = true; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1184 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1185 topic_select.appendChild(option); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1186 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1187 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1188 $('#load_topic_div').append(topic_select); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1189 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1190 var newbutton = document.createElement("button"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1191 $(newbutton).html("Close"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1192 $(newbutton).addClass("btn btn-xs btn-default"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1193 $(newbutton).attr("onclick", "$('#load_topic_div').css(\"display\", \"none\");"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1194 $('#load_topic_div').append(newbutton); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1195 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1196 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1197 |
95 | 1198 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1199 function _postForContineTagging(form) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1200 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1201 hiddenField.setAttribute("name", "text"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1202 var el = document.getElementById("editable-area"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1203 var text = el.innerHTML; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1204 hiddenField.setAttribute("value", text); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1205 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1206 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1207 // pass taglist |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1208 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1209 hiddenField.setAttribute("name", "taglistArray"); |
95 | 1210 |
1211 // use json_encode($taglistArray), which is the up-to-date taglist (in db) instead, | |
1212 // so replace the follwoing code | |
1213 /* | |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1214 var taglistObj = JSON.parse('<?php echo json_encode($taglist_infile) ?>'); |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
1215 // if taglist_infile == "" means the taglist in db is up-to-date, will use taglistArray to save to file |
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
1216 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1217 if (!taglistObj) { |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
1218 // TODO: should pass the user-decided taglist to post['taglistArray'] |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1219 taglistObj = JSON.parse('<?php echo json_encode($taglistArray) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1220 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1221 taglistArray = JSON.stringify(taglistObj); |
95 | 1222 */ |
1223 | |
1224 | |
1225 var taglistArray = JSON.parse('<?php echo json_encode($taglistArray) ?>'); | |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1226 hiddenField.setAttribute("value", taglistArray); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1227 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1228 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1229 // pass book_meta |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1230 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1231 hiddenField.setAttribute("name", "book_meta"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1232 var book_metaObj = JSON.parse('<?php echo json_encode($book_meta) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1233 book_metaArray = JSON.stringify(book_metaObj); |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1234 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1235 hiddenField.setAttribute("value", book_metaArray); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1236 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1237 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1238 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1239 var info = JSON.parse( '<?php echo json_encode($info) ?>'); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1240 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1241 if (info) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1242 if (info['file_id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1243 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1244 hiddenField.setAttribute("name", "fileId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1245 hiddenField.setAttribute("value", info['file_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1246 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1247 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1248 if (info['branch_id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1249 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1250 hiddenField.setAttribute("name", "branchId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1251 hiddenField.setAttribute("value", info['branch_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1252 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1253 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1254 if (info['user_id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1255 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1256 hiddenField.setAttribute("name", "userId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1257 hiddenField.setAttribute("value", info['user_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1258 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1259 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1260 if (info['section_id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1261 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1262 hiddenField.setAttribute("name", "sectionId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1263 hiddenField.setAttribute("value", info['section_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1264 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1265 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1266 if (info['book_id']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1267 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1268 hiddenField.setAttribute("name", "bookId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1269 hiddenField.setAttribute("value", info['book_id']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1270 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1271 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1272 if (info['section_name']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1273 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1274 hiddenField.setAttribute("name", "sectionName"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1275 hiddenField.setAttribute("value", info['section_name']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1276 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1277 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1278 if (info['book_name']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1279 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1280 hiddenField.setAttribute("name", "bookName"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1281 hiddenField.setAttribute("value", info['book_name']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1282 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1283 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1284 if (info['current_fileId']) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1285 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1286 hiddenField.setAttribute("name", "currentFileId"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1287 hiddenField.setAttribute("value", info['current_fileId']); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1288 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1289 }; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1290 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1291 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1292 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1293 document.body.appendChild(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1294 form.submit(); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1295 } else { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1296 form.submit(); // works under IE and Chrome, but not FF |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1297 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1298 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1299 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1300 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1301 function configTagsInTopic(topic_id) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1302 var form = document.createElement("form"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1303 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1304 form.setAttribute("method", "post"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1305 form.setAttribute("action", "./ConfigTagsInTopic"); // hand to controller |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1306 form.setAttribute("target", "_blank"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1307 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1308 var hiddenField = document.createElement("input"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1309 hiddenField.setAttribute("name", "topic"); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1310 hiddenField.setAttribute("value", topic_id); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1311 form.appendChild(hiddenField); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1312 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1313 _postForContineTagging(form); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1314 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1315 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1316 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1317 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1318 $(document).on("change", '#smartRegexPopUpSelectWord', function (e) { |
62
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1319 var wordlistArray = JSON.parse('<?php echo json_encode($wordlistArray) ?>'); |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1320 |
62
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1321 for (var i = 0; i < wordlistArray.length; i++) { |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1322 var wordlistValue = wordlistArray[i]; // wordlistValue is array(id, name, listString) |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1323 if ($('#smartRegexPopUpSelectWord').val() == wordlistValue[0]) { |
62
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1324 var textarea_text = $('#smartRegexPopUpText').val(); |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1325 // insert selected wordlist into textarea at cursor position |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1326 var cursorPosition = $('#smartRegexPopUpText').prop("selectionStart"); |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1327 // cut textarea_text by cursorPosition |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1328 var text_before_cursor = textarea_text.substring(0,cursorPosition); |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1329 var text_after_cursor = textarea_text.substring(cursorPosition, textarea_text.length); |
63
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
1330 |
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
1331 // default length is 1, which means {1,1} |
3395385476d1
bug fixed: popup tag window is closed automatically when saving text file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
62
diff
changeset
|
1332 $('#smartRegexPopUpText').val( text_before_cursor+"["+wordlistValue[2]+"]{1,1}"+text_after_cursor); |
62
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1333 } |
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1334 } |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1335 }); |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1336 |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1337 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1338 </script> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1339 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1340 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1341 <!-- |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1342 <fieldset class="info-board"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1343 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#info_board">Information <span class="caret"></span></h5></legend> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1344 <div id="info_board" class="collapse in"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1345 <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1346 <div class="bg-warning"> <?php echo $messages['warning']; ?> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1347 <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1348 </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1349 <div class="bg-info"> <?php echo $messages['info']; ?> </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1350 <div class="bg-default"> <?php echo $messages['debug']; ?> </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1351 </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1352 </fieldset> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1353 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1354 --> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1355 |
62
3fb9e3884401
New: insert selected wordlist into textarea at cursor position when editing regex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
61
diff
changeset
|
1356 <div class="info-board"> |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1357 <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div> |
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1358 <div class="bg-warning"> <?php echo $messages['warning']; ?> |
76
c49192885290
Bug fixed: ambiguous tag occured at Editing-text mode
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
72
diff
changeset
|
1359 <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Latest Version</button> |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1360 </div> |
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1361 <div class="bg-info"> <?php echo $messages['info']; ?> </div> |
91
3e11a9c5a672
new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
90
diff
changeset
|
1362 <!-- |
65
f9ae94a9b041
New: adding topic names: name_en, name_ch, name_pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
63
diff
changeset
|
1363 <div class="bg-default"> <?php echo $messages['debug']; ?> </div> |
91
3e11a9c5a672
new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
90
diff
changeset
|
1364 --> |
58
a11f9103b8db
New: 1.display messages 2.handle saving conflict:up-to-date or reload text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
57
diff
changeset
|
1365 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1366 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1367 |
86
0141df465205
New: add chinese characters to pinyin
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
81
diff
changeset
|
1368 <table border="1" style="margin:10 30 30 30; width:100%; max-width:1270px; min-width:680px"> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1369 <tr> |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
1370 <td style="padding:0 5 0 5; margin: 0 5 0 5;"> |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1371 <div id="editable-area" class="area" style="max-width:980px; min-width:400px"><?php echo $stringInput; ?></div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1372 </td> |
67
3ada9334ebfc
New: check taglist is deprecated or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
66
diff
changeset
|
1373 <td valign="top" style="min-width:280px; padding:0 5 0 5; margin:0 5 0 5;"> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1374 <div id="popups" style="position:absolute; width:300px; "> |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1375 <div id="load_topic_div" class="popup-topic popup-frame"></div> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1376 <div id="new_topic_div" class="popup-newtopic popup-frame"> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1377 <div class="form-horizontal"> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1378 <h4 class="text-info">New topic name:</h4> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1379 <div class="form-group form-group-sm"> |
95 | 1380 <label for="newTopicNameEn" class="col-sm-5 control-label">name (eng)</label> |
1381 <div class="col-sm-7"> | |
1382 <input type="text" class="form-control" id="newTopicNameEn" placeholder="e.g. Local Product"> | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1383 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1384 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1385 <div class="form-group form-group-sm"> |
95 | 1386 <label for="newTopicNameCh" class="col-sm-5 control-label">name (中文)</label> |
1387 <div class="col-sm-7"> | |
1388 <input type="text" class="form-control" id="newTopicNameCh" placeholder="e.g. 物產"> | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1389 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1390 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1391 <div class="form-group form-group-sm"> |
95 | 1392 <label for="newTopicNamePi" class="col-sm-5 control-label">name (pinyin)</label> |
1393 <div class="col-sm-7"> | |
1394 <input type="text" class="form-control" id="newTopicNamePi" placeholder="e.g. wu chan"> | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1395 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1396 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1397 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1398 |
95 | 1399 <h4 class="text-info">Define the topic tag for the new topic:</h4> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1400 <div class="form-group form-group-sm"> |
95 | 1401 <label for="newTopicTag" class="col-sm-5 control-label">topic tag (eng)</label> |
1402 <div class="col-sm-7"> | |
1403 <input type="text" class="form-control" id="newTopicTag" placeholder="e.g. product_name"> | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1404 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1405 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1406 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1407 <div class="form-group form-group-sm"> |
95 | 1408 <label for="newTopicTagName" class="col-sm-5 control-label">topic tag (中文)</label> |
1409 <div class="col-sm-7"> | |
1410 <input type="text" class="form-control" id="newTopicTagName" placeholder="e.g. 物產名稱"> | |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1411 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1412 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1413 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1414 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1415 <div class="form-group form-group-sm"> |
95 | 1416 <div class="col-sm-offset-5 col-sm-7"> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1417 <button type="submit" id="newTopicSubmit" class="btn btn-primary btn-xs">Submit</button> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1418 <button id="newTopicCancel" class="btn btn-default btn-xs">Cancel</button> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1419 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1420 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1421 </div> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1422 |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1423 </div> |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1424 <div id="load_regex_div" class="popup-loadregex popup-frame"></div> |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1425 <div id="regex_generator" class="popup-frame"> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1426 <h3>Gen Regex</h3> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1427 <div>Pattern 1: |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1428 <div id="regex_pattern1" class="bg-info"></div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1429 </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1430 <div>Pattern 2: |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1431 <div id="regex_pattern2" class="bg-info"></div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1432 </div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1433 <div>Suggested Regex: |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1434 <div id="generated_regex" class="bg-success"></div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1435 </div> |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1436 <button onclick="genRegexAddToSmartRegex()" class="btn btn-info">Add it to SmartRegex</button> |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1437 <button onclick="genRegexWindowClose()" class="btn btn-default">Close</button> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1438 <div id="regex_generator_error_msg" class="bg-white"></div> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1439 </div> |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1440 <div id="smartRegexPopUpDiv" class="popup-frame"> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1441 Name: <input id="smartRegexPopUpName"></input><br><br> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1442 Word List: |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1443 <select id="smartRegexPopUpSelectWord"> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1444 <option value="NULL" selected>無</option> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1445 <?php |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1446 foreach ( $wordlistArray as $wordlistValue ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1447 echo "<option value=\"".$wordlistValue[0]."\">".$wordlistValue[1]."</option>\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1448 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1449 ?> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1450 </select> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1451 <br> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1452 OR (USE "|" TO SEPARATE WORDS):<br> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1453 <TEXTAREA id="smartRegexPopUpText" COLS=30 ROWS=4></TEXTAREA><br><br> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1454 Tag: |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1455 <select id="smartRegexPopUpSelectTag"> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1456 <?php |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1457 foreach ( $taglistArray as $taglistValue ) { |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1458 echo "<option value=\"".$taglistValue[2]."\">".$taglistValue[1]."</option>\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1459 } |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1460 echo "<option value=\"title\">Title</option>\n"; |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1461 ?> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1462 <option value="NOTAG">不標記</option> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1463 </select><br> |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1464 <button id="smartRegexPopUpAdd" onclick="replaceSmartAdd()" class="btn btn-info">Add</button> |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1465 <button id="smartRegexPopUpEdit" onclick="replaceSmartEdit()" class="btn btn-success">Edit/Update</button> |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1466 <button id="smartRegexPopUpDel" onclick="replaceSmartDel()" class="btn btn-danger">Delete</button> |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1467 <button id="smartRegexPopUpBack" onclick="replaceSmartBack()" class="btn btn-default"><<</button> |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1468 <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default">>></button> |
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1469 <button onclick="replaceSmartClose()" class="btn btn-default" >Close</button> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1470 </div> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1471 </div> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1472 |
66
e71a437ae49f
New: responsive. some css style
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
65
diff
changeset
|
1473 <div id="follow-scroll"> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1474 <form action="javascript:void(0);"> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1475 <fieldset class="tool-frame"> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1476 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_topic"> Topic and Tags: <span class="caret"></span></h5></legend> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1477 <div id="tool_topic" class="collapse in"> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1478 <div> Current topic is: |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1479 <?php echo $topic_name['name_en']; ?> (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>) |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1480 <button onclick="chooseTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Change Topic</button> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1481 <!-- |
95 | 1482 <button onclick="createTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Create a New Topic</button> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1483 --> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1484 </div> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1485 |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1486 <div>Main tag: <?php echo $topic_tag_ch;?> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1487 <p class="text-muted">(Only the lines with the tag will be in the exported table.)</p> |
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1488 </div> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1489 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" class="btn btn-default btn-block">Edit Tag List</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1490 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Select Existing Tags</button> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1491 |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1492 </div> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1493 </fieldset> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1494 <!-- |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1495 <fieldset class="tool-frame"> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1496 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_tag"> Tag: <span class="caret"></span></h5></legend> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1497 <div id="tool_tag" class="collapse in"> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1498 <div>The topic tag is: <?php echo $topic_tag_ch;?> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1499 <p class="text-muted">(Only the lines with the tag will be in the exported table.)</p> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1500 </div> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1501 <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" class="btn btn-default btn-block">Edit Tag List</button> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1502 <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Select Existing Tags</button> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1503 |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1504 </div> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1505 </fieldset> |
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1506 --> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1507 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1508 <fieldset class="tool-frame"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1509 <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> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1510 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1511 <div id="tool_regex" class="collapse in"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1512 <div id="smartRegexShowDiv"></div><br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1513 <!-- <button onclick="smartRegexNew()" class="btn-lg">Add Regex Group</button></br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1514 --> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1515 <button onclick="smartRegexNew()" id="smart_regex_new_id" class="btn btn-default btn-block">Search by Patterns (Smart Regex)</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1516 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1517 <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" class="btn btn-default">Load</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1518 <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" class="btn btn-default">Save</button> |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1519 <button onclick="smartRegexEmpty()" class="btn btn-default">Clear</button></br></br> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1520 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1521 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1522 Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br> |
89
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1523 <button onclick="replaceSmartRun()" class="btn btn-default btn-block">Run</button> |
e681d693240e
new: generated regex to SmartRegex
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
87
diff
changeset
|
1524 <button onclick="replaceSmartRunWithBr()" class="btn btn-default btn-block">Run(in new line)</button> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1525 <!-- <button onclick="replaceSmartRunSpace()" class="btn-lg">Run(Allow space between Group)</button></br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1526 --> |
91
3e11a9c5a672
new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
90
diff
changeset
|
1527 <button onclick="replaceSmartRunSpace()" class="btn btn-default btn-block">Run(Allow space between block)</button></br> |
90
94ad33739fa4
modify the position of buttons in sidebar
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
89
diff
changeset
|
1528 |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1529 <button onclick="window.open('./EditWordlist')" class="btn btn-default btn-block">Edit WordList</button></br> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1530 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1531 <!-- developing...--> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1532 <!-- |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1533 <button onclick="genRegexWindowOpen()" id="gen_regex_window_open_id" class="btn btn-default btn-block btn-xs">Open GenRegex (developing...)</button></br> |
97
c1bb174a22f3
Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
95
diff
changeset
|
1534 --> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1535 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1536 </fieldset> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1537 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1538 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1539 <?php |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1540 if ($default_topic_id == 1) { |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1541 ?> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1542 <fieldset class="tool-frame"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1543 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_rule"> Tag by rule: <span class="caret"></span></h5></legend> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1544 <div id="tool_rule" class="collapse out"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1545 <button onclick="tagNameWithLastName()" class="btn btn-default">Tag Word Begin With Surname</button></br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1546 <button onclick="tagNameWithLastName2()" class="btn btn-default btn-sm">Tag Word Begin With</button> <input type="text" size="2" id="surname"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1547 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1548 <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>--> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1549 <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>--> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1550 </fieldset> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1551 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1552 <?php }?> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1553 |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1554 <fieldset class="tool-frame"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1555 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_edit"> Edit: <span class="caret"></span></h5></legend> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1556 <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>--> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1557 <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage --> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1558 <!-- |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1559 <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1560 --> |
90
94ad33739fa4
modify the position of buttons in sidebar
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
89
diff
changeset
|
1561 <div class="collapse in" id="tool_edit"> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1562 <button onclick="editText()" id="editTextId" class="btn btn-default btn-block">Edit the text</button> |
90
94ad33739fa4
modify the position of buttons in sidebar
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
89
diff
changeset
|
1563 <button onclick="Undo()" class="btn btn-default btn-block" id="buttonUndo" disabled="true">Undo</button> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1564 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1565 </fieldset> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1566 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1567 <fieldset class="tool-frame"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1568 <legend><h5 class="tool-topic" data-toggle="collapse" data-target="#tool_save"> Save and Export: <span class="caret"></span></h5></legend> |
94
b0cecc104639
new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
93
diff
changeset
|
1569 <div class="collapse in" id="tool_save"> |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1570 <button onclick="saveTextToLGService()" id="save_text_to_LGService_id" class="btn btn-default btn-block">Save to LGService</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1571 <button onclick="exportAll(<?php echo $default_topic_id;?>)" class="btn btn-default btn-block">Export All</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1572 Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1573 <button onclick="exportPage(<?php echo $default_topic_id;?>)" class="btn btn-default btn-sm">Export</button></br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1574 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1575 </fieldset> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1576 |
87
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1577 <fieldset class="tool-frame"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1578 <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> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1579 <div class="collapse out" id="tool_replace_by"> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1580 Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1581 Regex: <input type="text" size="23" id="regexText"></br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1582 Replace: <input type="text" size="23" id="replaceText"><br> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1583 <button onclick="replaceSmartRegex()" class="btn btn-default btn-sm">Replace!</button> |
fb5049fc5dd7
New:(1)UI(2)generate simple regex by examples(3)coordinates in book metadata
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
86
diff
changeset
|
1584 </div> |
47
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1585 </fieldset> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1586 </form> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1587 </div> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1588 </td> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1589 </tr> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1590 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1591 </table> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1592 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1593 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1594 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1595 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1596 </body> |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1597 |
886f43b26ee2
move/remove develop folder
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1598 </html> |