forked from mrlan/EnglishPal
				
			Merge pull request 'Fix Bug 501. The key fix is the first line in funciton wordTemplate() from word_operation.js, i.e., using double quotes instead of single quotes.' (#183) from Bug501-Hui into Alpha-snapshot20240618
Reviewed-on: mrlan/EnglishPal#183Bug478-Hui
						commit
						fe1d4c29ff
					
				|  | @ -1,7 +1,9 @@ | ||||||
| function familiar(theWord) { | function familiar(theWord) { | ||||||
|     let username = $("#username").text(); |     let username = $("#username").text(); | ||||||
|     let word = $("#word_" + theWord).text(); |     let word = document.getElementById(`word_${theWord}`).innerText; | ||||||
|     let freq = $("#freq_" + theWord).text(); |     let freq = document.getElementById(`freq_${theWord}`).innerText; | ||||||
|  |     console.log(theWord); | ||||||
|  |     console.log(word); | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         type:"GET", |         type:"GET", | ||||||
|         url:"/" + username + "/" + word + "/familiar", |         url:"/" + username + "/" + word + "/familiar", | ||||||
|  | @ -27,8 +29,10 @@ function familiar(theWord) { | ||||||
| 
 | 
 | ||||||
| function unfamiliar(theWord) { | function unfamiliar(theWord) { | ||||||
|     let username = $("#username").text(); |     let username = $("#username").text(); | ||||||
|     let word = $("#word_" + theWord).text(); |     let word = document.getElementById(`word_${theWord}`).innerText; | ||||||
|     let freq = $("#freq_" + theWord).text(); |     let freq = document.getElementById(`freq_${theWord}`).innerText; | ||||||
|  |     console.log(theWord); | ||||||
|  |     console.log(word); | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         type:"GET", |         type:"GET", | ||||||
|         url:"/" + username + "/" + word + "/unfamiliar", |         url:"/" + username + "/" + word + "/unfamiliar", | ||||||
|  | @ -95,14 +99,14 @@ function parseWord(element) { | ||||||
| */ | */ | ||||||
| function wordTemplate(word) { | function wordTemplate(word) { | ||||||
|     // 这个模板应当与 templates/userpage_get.html 中的 <p id='p_${word.word}' class="new-word" > ... </p> 保持一致
 |     // 这个模板应当与 templates/userpage_get.html 中的 <p id='p_${word.word}' class="new-word" > ... </p> 保持一致
 | ||||||
|     return `<p id='p_${word.word}' class="new-word" >
 |     return `<p id="p_${word.word}" class="new-word" >
 | ||||||
|         <a id="word_${word.word}"  class="btn btn-light" href='http://youdao.com/w/eng/${word.word}/#keyfrom=dict2.index' |         <a id="word_${word.word}"  class="btn btn-light" href='http://youdao.com/w/eng/${word.word}/#keyfrom=dict2.index' | ||||||
|            role="button">${word.word}</a> |            role="button">${word.word}</a> | ||||||
|         ( <a id="freq_${word.word}" title="${word.word}">${word.freq}</a> ) |         ( <a id="freq_${word.word}" title="${word.word}">${word.freq}</a> ) | ||||||
|         <a class="btn btn-success" onclick="familiar('${word.word}')" role="button">熟悉</a> |         <a class="btn btn-success" onclick=familiar("${word.word}") role="button">熟悉</a> | ||||||
|         <a class="btn btn-warning" onclick="unfamiliar('${word.word}')" role="button">不熟悉</a> |         <a class="btn btn-warning" onclick=unfamiliar("${word.word}") role="button">不熟悉</a> | ||||||
|         <a class="btn btn-danger" onclick="delete_word('${word.word}')" role="button">删除</a> |         <a class="btn btn-danger" onclick=delete_word("${word.word}") role="button">删除</a> | ||||||
|         <a class="btn btn-info" onclick="read_word('${word.word}')" role="button">朗读</a> |         <a class="btn btn-info" onclick=read_word("${word.word}") role="button">朗读</a> | ||||||
|         <a class="btn btn-primary" onclick="addNote('{{ word }}'); saveNote('{{ word }}')" role="button">笔记</a> <!-- Modify to call addNote and then saveNote --> |         <a class="btn btn-primary" onclick="addNote('{{ word }}'); saveNote('{{ word }}')" role="button">笔记</a> <!-- Modify to call addNote and then saveNote --> | ||||||
|         <input type="text" id="note_{{ word }}" class="note-input" placeholder="输入笔记内容" style="display:none;" oninput="saveNote('{{ word }}')"> <!-- Added oninput event --> |         <input type="text" id="note_{{ word }}" class="note-input" placeholder="输入笔记内容" style="display:none;" oninput="saveNote('{{ word }}')"> <!-- Added oninput event --> | ||||||
|     </p>`; |     </p>`; | ||||||
|  |  | ||||||
|  | @ -179,10 +179,10 @@ | ||||||
|                     <a id="word_{{ word }}"  class="btn btn-light" href='http://youdao.com/w/eng/{{ word }}/#keyfrom=dict2.index' |                     <a id="word_{{ word }}"  class="btn btn-light" href='http://youdao.com/w/eng/{{ word }}/#keyfrom=dict2.index' | ||||||
|                     role="button">{{ word }}</a> |                     role="button">{{ word }}</a> | ||||||
|                     ( <a id="freq_{{ word }}" title="{{ word }}">{{ freq }}</a> ) |                     ( <a id="freq_{{ word }}" title="{{ word }}">{{ freq }}</a> ) | ||||||
|                     <a class="btn btn-success" onclick="familiar('{{ word }}')" role="button">熟悉</a> |                     <a class="btn btn-success" onclick=familiar("{{ word }}") role="button">熟悉</a> | ||||||
|                     <a class="btn btn-warning" onclick="unfamiliar('{{ word }}')" role="button">不熟悉</a> |                     <a class="btn btn-warning" onclick=unfamiliar("{{ word }}") role="button">不熟悉</a> | ||||||
|                     <a class="btn btn-danger" onclick="delete_word('{{ word }}')" role="button">删除</a> |                     <a class="btn btn-danger" onclick=delete_word("{{ word }}") role="button">删除</a> | ||||||
|                     <a class="btn btn-info" onclick="read_word('{{ word }}')" role="button">朗读</a> |                     <a class="btn btn-info" onclick=read_word("{{ word }}") role="button">朗读</a> | ||||||
|                     <a class="btn btn-primary" onclick="addNote('{{ word }}'); saveNote('{{ word }}')" role="button">笔记</a> <!-- Modify to call addNote and then saveNote --> |                     <a class="btn btn-primary" onclick="addNote('{{ word }}'); saveNote('{{ word }}')" role="button">笔记</a> <!-- Modify to call addNote and then saveNote --> | ||||||
|                     <input type="text" id="note_{{ word }}" class="note-input" placeholder="输入笔记内容" style="display:none;" oninput="saveNote('{{ word }}')"> <!-- Added oninput event --> |                     <input type="text" id="note_{{ word }}" class="note-input" placeholder="输入笔记内容" style="display:none;" oninput="saveNote('{{ word }}')"> <!-- Added oninput event --> | ||||||
|                 </p> |                 </p> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue