Skip to content

Commit

Permalink
change code wrapper style
Browse files Browse the repository at this point in the history
  • Loading branch information
xqdoo00o committed Oct 9, 2023
1 parent a099824 commit 6e66d67
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@
transition: color 250ms;
}

.m-mdic-copy-wrapper span.u-mdic-copy-code_lang::before,
.m-mdic-copy-wrapper div.u-mdic-copy-notify::before,
.m-mdic-copy-wrapper button.u-mdic-copy-btn::before {
content: attr(text);
}

.m-mdic-copy-wrapper button.u-mdic-copy-btn:hover {
color: var(--lighter-text-color);
}
Expand Down Expand Up @@ -3428,10 +3434,10 @@
ele.textContent = num + translations[locale]["chats"];
});
document.querySelectorAll(".u-mdic-copy-btn").forEach(ele => {
ele.textContent = translations[locale]["copyCode"];
ele.setAttribute("text", translations[locale]["copyCode"]);
})
document.querySelectorAll(".u-mdic-copy-notify").forEach(ele => {
ele.textContent = translations[locale]["copySuccess"];
ele.setAttribute("text", translations[locale]["copySuccess"]);
})
if (editingIdx !== void 0) {
document.querySelector("[data-i18n-key='send']").textContent = translations[locale]["update"];
Expand Down Expand Up @@ -4505,7 +4511,7 @@
return (res && res[1]) || "";
},
getFragment(str = "") {
return str ? `<span class="u-mdic-copy-code_lang">${str}</span>` : "";
return str ? `<span class="u-mdic-copy-code_lang" text="${str}"></span>` : "";
},
};
const getCodeLangFragment = (oriStr = "") => {
Expand Down Expand Up @@ -4554,11 +4560,8 @@
const tpls = [
'<div class="m-mdic-copy-wrapper">',
`${langFrag}`,
`<div class="u-mdic-copy-notify" style="display:none;">${successText}</div>`,
'<button ',
'class="u-mdic-copy-btn j-mdic-copy-btn" ',
`data-mdic-notify-delay="${successTextDelay}" `,
`onclick="copyClickCode(this)">${btnText}</button>`,
`<div class="u-mdic-copy-notify" style="display:none;" text="${successText}"></div>`,
`<button class="u-mdic-copy-btn j-mdic-copy-btn" text="${btnText}" data-mdic-notify-delay="${successTextDelay}" onclick="copyClickCode(this)"></button>`,
'</div>',
];
return originResult.replace("</pre>", `${tpls.join("")}</pre>`);
Expand Down

0 comments on commit 6e66d67

Please sign in to comment.