|
159 | 159 | function getTranslations(r){ |
160 | 160 | //parse existing data |
161 | 161 | $('#div_parent_field_annotation textarea').val($('#div_parent_field_annotation textarea').val().replace(/\n([^@])/g, "<br>$1")); |
162 | | - var data = $('#div_parent_field_annotation textarea').val().replace(/___/g, '@'); |
163 | | - var tags = data.split('\n'); |
| 162 | + var data = $('#div_parent_field_annotation textarea').val(); |
| 163 | + var tags = data.split('@'); |
164 | 164 | var id; |
165 | 165 | var questions = {}; |
166 | 166 | var answers = {}; |
|
170 | 170 | var survey_translations = {"surveytitle":"Survey Title","surveyinstructions":"Survey Instructions","surveyacknowledgment":"Survey Response"} |
171 | 171 | var others = ''; |
172 | 172 | for(id in tags){ |
173 | | - if(tags[id].indexOf('@p1000lang') > -1){ |
174 | | - questions = JSON.parse(tags[id].replace('@p1000lang','')); |
| 173 | + tags[id] = tags[id].replace(/___/g, '@'); |
| 174 | + if(tags[id].indexOf('p1000lang') > -1){ |
| 175 | + questions = JSON.parse(tags[id].replace('p1000lang','')); |
175 | 176 | } |
176 | | - else if(tags[id].indexOf('@p1000answers') > -1){ |
177 | | - answers = JSON.parse(tags[id].replace('@p1000answers','')); |
| 177 | + else if(tags[id].indexOf('p1000answers') > -1){ |
| 178 | + answers = JSON.parse(tags[id].replace('p1000answers','')); |
178 | 179 | } |
179 | | - else if(tags[id].indexOf('@p1000errors') > -1){ |
180 | | - errors = JSON.parse(tags[id].replace('@p1000errors','')); |
| 180 | + else if(tags[id].indexOf('p1000errors') > -1){ |
| 181 | + errors = JSON.parse(tags[id].replace('p1000errors','')); |
181 | 182 | } |
182 | | - else if(tags[id].indexOf('@p1000notes') > -1){ |
183 | | - notes = JSON.parse(tags[id].replace('@p1000notes','')); |
| 183 | + else if(tags[id].indexOf('p1000notes') > -1){ |
| 184 | + notes = JSON.parse(tags[id].replace('p1000notes','')); |
184 | 185 | } |
185 | | - else if(tags[id].indexOf('@p1000surveytext') > -1){ |
186 | | - survey_text = JSON.parse(tags[id].replace('@p1000surveytext','')); |
| 186 | + else if(tags[id].indexOf('p1000surveytext') > -1){ |
| 187 | + survey_text = JSON.parse(tags[id].replace('p1000surveytext','')); |
187 | 188 | } |
188 | 189 | else{ |
189 | 190 | others += tags[id] + '\n'; |
|
272 | 273 | if(counter > 0){ |
273 | 274 | var questions = {}; |
274 | 275 | $(this).children().val($(this).children().val().replace(/\n([^@])/g, "<br>$1")); |
275 | | - var data = $(this).children().val().replace(/___/g, '@'); |
276 | | - var tags = data.split('\n'); |
| 276 | + var data = $(this).children().val(); |
| 277 | + var tags = data.split('@'); |
277 | 278 |
|
278 | 279 | for(id in tags){ |
279 | | - if(tags[id].indexOf('@p1000lang') > -1){ |
280 | | - questions = JSON.parse(tags[id].replace('@p1000lang','')); |
| 280 | + tags[id] = tags[id].replace(/___/g, '@'); |
| 281 | + if(tags[id].indexOf('p1000lang') > -1){ |
| 282 | + questions = JSON.parse(tags[id].replace('p1000lang','')); |
281 | 283 | } |
282 | | - else if(tags[id].indexOf('@p1000answers') > -1){ |
283 | | - answers = JSON.parse(tags[id].replace('@p1000answers','')); |
| 284 | + else if(tags[id].indexOf('p1000answers') > -1){ |
| 285 | + answers = JSON.parse(tags[id].replace('p1000answers','')); |
284 | 286 | } |
285 | 287 | } |
286 | 288 |
|
|
0 commit comments