disable copying link when password not completed
This commit is contained in:
parent
9410defab6
commit
046f227003
3 changed files with 19 additions and 3 deletions
|
@ -57,6 +57,7 @@ module.exports = function(state, emit) {
|
||||||
input.disabled = true;
|
input.disabled = true;
|
||||||
const copyBtn = document.getElementById('copy-btn');
|
const copyBtn = document.getElementById('copy-btn');
|
||||||
copyBtn.disabled = true;
|
copyBtn.disabled = true;
|
||||||
|
copyBtn.classList.add('success');
|
||||||
copyBtn.replaceChild(
|
copyBtn.replaceChild(
|
||||||
html`<img src="${assets.get('check-16.svg')}" class="icon-check">`,
|
html`<img src="${assets.get('check-16.svg')}" class="icon-check">`,
|
||||||
copyBtn.firstChild
|
copyBtn.firstChild
|
||||||
|
@ -64,6 +65,7 @@ module.exports = function(state, emit) {
|
||||||
await delay(2000);
|
await delay(2000);
|
||||||
input.disabled = false;
|
input.disabled = false;
|
||||||
copyBtn.disabled = false;
|
copyBtn.disabled = false;
|
||||||
|
copyBtn.classList.remove('success');
|
||||||
copyBtn.textContent = state.translate('copyUrlFormButton');
|
copyBtn.textContent = state.translate('copyUrlFormButton');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,20 @@ module.exports = function(state, emit) {
|
||||||
</form>
|
</form>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
function togglePasswordInput() {
|
function togglePasswordInput(e) {
|
||||||
document.querySelector('.setPassword').classList.toggle('hidden');
|
document.querySelector('.setPassword').classList.toggle('hidden');
|
||||||
|
document
|
||||||
|
.getElementById('copy')
|
||||||
|
.classList.toggle('wait-password', e.target.checked);
|
||||||
|
document.getElementById('copy-btn').disabled = e.target.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPassword(event) {
|
function setPassword(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const password = document.getElementById('unlock-input').value;
|
const password = document.getElementById('unlock-input').value;
|
||||||
if (password.length > 0) {
|
if (password.length > 0) {
|
||||||
|
document.getElementById('copy').classList.remove('wait-password');
|
||||||
|
document.getElementById('copy-btn').disabled = false;
|
||||||
emit('password', { password, file });
|
emit('password', { password, file });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -553,6 +553,11 @@ tbody {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#copy.wait-password #link,
|
||||||
|
#copy.wait-password #copy-btn {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
#copy-text {
|
#copy-text {
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
|
@ -596,13 +601,16 @@ tbody {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
#copy-btn:hover {
|
#copy-btn:not(:disabled):hover {
|
||||||
background-color: #0287e8;
|
background-color: #0287e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
#copy-btn:disabled {
|
#copy-btn.success {
|
||||||
background: #05a700;
|
background: #05a700;
|
||||||
border: 1px solid #05a700;
|
border: 1px solid #05a700;
|
||||||
|
}
|
||||||
|
|
||||||
|
#copy-btn:disabled {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue