mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-14 16:33:54 +08:00
.
This commit is contained in:
parent
6e95678be8
commit
006c6b0f0e
@ -2468,17 +2468,22 @@ class mdict(cishubase):
|
|||||||
contents = []
|
contents = []
|
||||||
idx = 0
|
idx = 0
|
||||||
for _, foldflow, title, res in allres:
|
for _, foldflow, title, res in allres:
|
||||||
idx += 1
|
klass2='tab-pane_mdict_internal'
|
||||||
|
klass1='tab-button_mdict_internal'
|
||||||
|
if idx==0:
|
||||||
|
klass2+=' active'
|
||||||
|
klass1+=' active'
|
||||||
btns.append(
|
btns.append(
|
||||||
"""<button type="button" onclick="onclickbtn_mdict_internal('buttonid_mdict_internal{idx}')" id="buttonid_mdict_internal{idx}" class="tab-button_mdict_internal" data-tab="tab_mdict_internal{idx}">{title}</button>""".format(
|
"""<button type="button" onclick="onclickbtn_mdict_internal('buttonid_mdict_internal{idx}')" id="buttonid_mdict_internal{idx}" class="{klass}" data-tab="tab_mdict_internal{idx}">{title}</button>""".format(
|
||||||
idx=idx, title=title
|
idx=idx, title=title, klass=klass1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
contents.append(
|
contents.append(
|
||||||
"""<div id="tab_mdict_internal{idx}" class="tab-pane_mdict_internal">{res}</div>""".format(
|
"""<div id="tab_mdict_internal{idx}" class="{klass}">{res}</div>""".format(
|
||||||
idx=idx, res=res
|
idx=idx, res=res, klass=klass2
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
idx += 1
|
||||||
commonstyle = """
|
commonstyle = """
|
||||||
<script>
|
<script>
|
||||||
function onclickbtn_mdict_internal(_id) {
|
function onclickbtn_mdict_internal(_id) {
|
||||||
@ -2506,11 +2511,12 @@ function onclickbtn_mdict_internal(_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tab-widget_mdict_internal .tab-button_mdict_internal {
|
.tab-widget_mdict_internal .tab-button_mdict_internal {
|
||||||
padding: 10px 20px;
|
padding: 5px 20px;
|
||||||
background-color: #cccccccc;
|
background-color: #cccccccc;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
line-height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-widget_mdict_internal .tab-button_mdict_internal.active {
|
.tab-widget_mdict_internal .tab-button_mdict_internal.active {
|
||||||
@ -2541,10 +2547,6 @@ function onclickbtn_mdict_internal(_id) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
if(document.querySelectorAll('.tab-widget_mdict_internal .tab-button_mdict_internal').length)
|
|
||||||
document.querySelectorAll('.tab-widget_mdict_internal .tab-button_mdict_internal')[0].click()
|
|
||||||
</script>
|
|
||||||
""".format(
|
""".format(
|
||||||
commonstyle=commonstyle, btns="".join(btns), contents="".join(contents)
|
commonstyle=commonstyle, btns="".join(btns), contents="".join(contents)
|
||||||
)
|
)
|
||||||
@ -2558,7 +2560,7 @@ document.querySelectorAll('.tab-widget_mdict_internal .tab-button_mdict_internal
|
|||||||
|
|
||||||
.collapsible-header {
|
.collapsible-header {
|
||||||
background-color: #dddddd50;
|
background-color: #dddddd50;
|
||||||
padding: 10px;
|
padding: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
var scriptElementss = []
|
var scriptElementss = []
|
||||||
var scriptElementsssrc = []
|
var scriptElementsssrc = []
|
||||||
for (var iiii = 0; iiii < dictionaryInfo.length; iiii++) {
|
for (var iiii = 0; iiii < dictionaryInfo.length; iiii++) {
|
||||||
htmltabbuttons += '<button type="button" onclick="onclickbtn(\'' + dictionaryInfo[iiii]['dict'] + '\')" id="luna_dict_btn_' + dictionaryInfo[iiii]['dict'] + '" class="tab-button">' + dictionaryInfo[iiii]['name'] + '</button>'
|
htmltabbuttons += '<button type="button" onclick="onclickbtn(\'' + dictionaryInfo[iiii]['dict'] + '\')" id="luna_dict_btn_' + dictionaryInfo[iiii]['dict'] + '" class="tab-button' + (iiii == 0 ? ' active' : '') + '">' + dictionaryInfo[iiii]['name'] + '</button>'
|
||||||
|
|
||||||
var tempParent = document.createElement('div');
|
var tempParent = document.createElement('div');
|
||||||
tempParent.innerHTML = decodeURIComponent(dictionaryContent[dictionaryInfo[iiii]['dict']]);
|
tempParent.innerHTML = decodeURIComponent(dictionaryContent[dictionaryInfo[iiii]['dict']]);
|
||||||
@ -68,7 +68,7 @@
|
|||||||
fragment.appendChild(tempParent.firstChild);
|
fragment.appendChild(tempParent.firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlcontents += '<div id="luna_dict_tab_' + dictionaryInfo[iiii]['dict'] + '" class="tab-pane">' + fragment.innerHTML + '</div>'
|
htmlcontents += '<div id="luna_dict_tab_' + dictionaryInfo[iiii]['dict'] + '" class="tab-pane' + (iiii == 0 ? ' active' : '') + '">' + fragment.innerHTML + '</div>'
|
||||||
var scriptElements = fragment.getElementsByTagName('script');
|
var scriptElements = fragment.getElementsByTagName('script');
|
||||||
|
|
||||||
for (var jjjj = 0; jjjj < scriptElements.length; jjjj++) {
|
for (var jjjj = 0; jjjj < scriptElements.length; jjjj++) {
|
||||||
@ -86,9 +86,6 @@
|
|||||||
document.head.appendChild(newScript);
|
document.head.appendChild(newScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dictionaryInfo.length > 0) {
|
|
||||||
onclickbtn(dictionaryInfo[0]['dict'])
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function playAudio(audioId) {
|
function playAudio(audioId) {
|
||||||
|
@ -39,11 +39,12 @@
|
|||||||
|
|
||||||
|
|
||||||
.tab-widget .tab-button {
|
.tab-widget .tab-button {
|
||||||
padding: 10px 20px;
|
padding: 5px 20px;
|
||||||
background-color: #cccccccc;
|
background-color: #cccccccc;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
line-height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-widget .tab-button.active {
|
.tab-widget .tab-button.active {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user