上传文件至 app/templates
parent
9aa4dc1e38
commit
045352f8aa
|
@ -86,7 +86,7 @@
|
|||
<div>
|
||||
<p><small class="text-muted" id="source">{{ today_article['source'] }}</small></p><br/>
|
||||
</div>
|
||||
|
||||
|
||||
<p><b id="question">{{ today_article['question'] }}</b></p><br/>
|
||||
<script type="text/javascript">
|
||||
function toggle_visibility(id) { {# https://css-tricks.com/snippets/javascript/showhide-element/#}
|
||||
|
@ -109,22 +109,22 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" id="highlightCheckbox" onclick="toggleHighlighting()" />生词高亮
|
||||
<input type="checkbox" id="readCheckbox" onclick="onReadClick()" />大声朗读
|
||||
<input type="checkbox" id="chooseCheckbox" onclick="onChooseClick()" />划词入库
|
||||
<input type="checkbox" onclick="toggleHighlighting()" checked/>生词高亮
|
||||
<input type="checkbox" onclick="onReadClick()" checked/>大声朗读
|
||||
<input type="checkbox" onclick="onChooseClick()" checked id="test1"/>划词入库
|
||||
<div class="range">
|
||||
<div class="field">
|
||||
<div class="sliderValue">
|
||||
<span id="rangeValue">1×</span>
|
||||
</div>
|
||||
<input type="range" id="rangeComponent" min="0.5" max="2" value="1" step="0.25" />
|
||||
<input type="range" id="rangeComponent" min="0.5" max="2" value="1" step="0.25"/>
|
||||
</div>
|
||||
</div>
|
||||
<p><b>收集生词吧</b> (可以在正文中划词,也可以复制黏贴)</p>
|
||||
<form method="post" action="/{{ username }}/userpage">
|
||||
<textarea name="content" id="selected-words" rows="10" cols="120"></textarea><br/>
|
||||
<button class="btn btn-primary btn-lg" type="submit" onclick="Reader.stopRead()">把生词加入我的生词库</button>
|
||||
<button class="btn btn-primary btn-lg" type="reset" onclick="clearSelectedWords()">清除</button>
|
||||
<button class="btn btn-primary btn-lg" type="reset">清除</button>
|
||||
</form>
|
||||
{% if session.get['thisWord'] %}
|
||||
<script type="text/javascript">
|
||||
|
@ -139,7 +139,7 @@
|
|||
|
||||
{% if d_len > 0 %}
|
||||
<p>
|
||||
<b>我的生词簿</b>
|
||||
<b>我的生词簿</b>
|
||||
<label for="move_dynamiclly">
|
||||
<input type="checkbox" name="move_dynamiclly" id="move_dynamiclly" checked>
|
||||
允许动态调整顺序
|
||||
|
@ -166,6 +166,7 @@
|
|||
<input id="selected-words2" type="hidden" value="{{ words }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
<label id="selected-words3" type="hidden">
|
||||
{{ yml['footer'] | safe }}
|
||||
{% if yml['js']['bottom'] %}
|
||||
{% for js in yml['js']['bottom'] %}
|
||||
|
@ -174,54 +175,11 @@
|
|||
{% endif %}
|
||||
<script type="text/javascript">
|
||||
window.onload = function () { // 页面加载时执行
|
||||
const settings = {
|
||||
// initialize settings from localStorage
|
||||
highlightChecked: localStorage.getItem('highlightChecked') !== 'false', // localStorage stores strings, default to true. same below
|
||||
readChecked: localStorage.getItem('readChecked') !== 'false',
|
||||
chooseChecked: localStorage.getItem('chooseChecked') !== 'false',
|
||||
rangeValue: localStorage.getItem('rangeValue') || '1',
|
||||
selectedWords: localStorage.getItem('selectedWords') || ''
|
||||
};
|
||||
|
||||
const elements = {
|
||||
highlightCheckbox: document.querySelector('#highlightCheckbox'),
|
||||
readCheckbox: document.querySelector('#readCheckbox'),
|
||||
chooseCheckbox: document.querySelector('#chooseCheckbox'),
|
||||
rangeComponent: document.querySelector('#rangeComponent'),
|
||||
rangeValueDisplay: document.querySelector('#rangeValue'),
|
||||
selectedWordsInput: document.querySelector('#selected-words')
|
||||
};
|
||||
// 应用设置到页面元素
|
||||
elements.highlightCheckbox.checked = settings.highlightChecked;
|
||||
elements.readCheckbox.checked = settings.readChecked;
|
||||
elements.chooseCheckbox.checked = settings.chooseChecked;
|
||||
elements.rangeComponent.value = settings.rangeValue;
|
||||
elements.rangeValueDisplay.textContent = `${settings.rangeValue}x`;
|
||||
elements.selectedWordsInput.value = settings.selectedWords;
|
||||
|
||||
// 刷新页面或进入页面时判断,若不是首篇文章,则上一篇按钮可见
|
||||
if (sessionStorage.getItem('pre_page_button') !== 'display' && sessionStorage.getItem('pre_page_button')) {
|
||||
if(sessionStorage.getItem('pre_page_button')!="display" && sessionStorage.getItem('pre_page_button')){
|
||||
$('#load_pre_article').show();
|
||||
}
|
||||
|
||||
// 事件监听器
|
||||
elements.selectedWordsInput.addEventListener('input', () => {
|
||||
localStorage.setItem('selectedWords', elements.selectedWordsInput.value);
|
||||
});
|
||||
|
||||
elements.rangeComponent.addEventListener('input', () => {
|
||||
const rangeValue = elements.rangeComponent.value;
|
||||
elements.rangeValueDisplay.textContent = `${rangeValue}x`;
|
||||
localStorage.setItem('rangeValue', rangeValue);
|
||||
});
|
||||
};
|
||||
|
||||
function clearSelectedWords() {
|
||||
localStorage.removeItem('selectedWords');
|
||||
document.querySelector('#selected-words').value = '';
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
function load_next_article(){
|
||||
$.ajax({
|
||||
url: '/get_next_article/{{username}}',
|
||||
|
@ -291,7 +249,7 @@
|
|||
</body>
|
||||
<style>
|
||||
mark {
|
||||
color: #{{ yml['highlight']['color'] }};
|
||||
color:#{{ yml['highlight']['color'] }};
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue