mirror of
https://github.com/NotoChen/Jetbrains-Help.git
synced 2025-05-24 15:06:43 +08:00
commit
b455aa58fc
|
@ -59,8 +59,11 @@ $(document).ready(function() {
|
||||||
$.post('/generateLicense', JSON.stringify(data))
|
$.post('/generateLicense', JSON.stringify(data))
|
||||||
.then(response => {
|
.then(response => {
|
||||||
copyText(response)
|
copyText(response)
|
||||||
.then((result) => {
|
.then(() => {
|
||||||
alert(result);
|
alert("已复制成功");
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
alert("系统不支持复制功能,或者当前非SSL访问,若为Local环境,请使用127.0.0.1或者localhost访问.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -68,11 +71,19 @@ $(document).ready(function() {
|
||||||
// Function to copy text to clipboard
|
// Function to copy text to clipboard
|
||||||
const copyText = async (val) => {
|
const copyText = async (val) => {
|
||||||
if (navigator.clipboard && navigator.permissions) {
|
if (navigator.clipboard && navigator.permissions) {
|
||||||
await navigator.clipboard.writeText(val);
|
return navigator.clipboard.writeText(val);
|
||||||
return "已复制成功";
|
|
||||||
} else {
|
} else {
|
||||||
console.log(val);
|
console.log(val);
|
||||||
return "系统不支持复制功能,或者当前非SSL访问,若为Local环境,请使用127.0.0.1或者localhost访问.";
|
const textArea = document.createElement('textarea')
|
||||||
|
textArea.value = val
|
||||||
|
// 使text area不在viewport,同时设置不可见
|
||||||
|
document.body.appendChild(textArea)
|
||||||
|
textArea.focus()
|
||||||
|
textArea.select()
|
||||||
|
return new Promise((res, rej) => {
|
||||||
|
document.execCommand('copy') ? res() : rej()
|
||||||
|
textArea.remove()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
th:text="${product.getName()}"></h1>
|
th:text="${product.getName()}"></h1>
|
||||||
<p title="复制到剪贴板" class="truncate text-sm text-grey" onclick="copyLicense(this)"
|
<p title="复制到剪贴板" class="truncate text-sm text-grey" onclick="copyLicense(this)"
|
||||||
data-content="复制到剪贴板">
|
data-content="复制到剪贴板">
|
||||||
**********
|
*********************************************************************************************************************************************************
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mask"></div>
|
<div class="mask"></div>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
th:text="${plugin.getName()}"></h1>
|
th:text="${plugin.getName()}"></h1>
|
||||||
<p title="复制到剪贴板" class="truncate text-sm text-grey" onclick="copyLicense(this)"
|
<p title="复制到剪贴板" class="truncate text-sm text-grey" onclick="copyLicense(this)"
|
||||||
data-content="复制到剪贴板">
|
data-content="复制到剪贴板">
|
||||||
**********
|
*********************************************************************************************************************************************************
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mask"></div>
|
<div class="mask"></div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user