Merge remote-tracking branch 'origin/pr/3940'

This commit is contained in:
Florian Bruhin 2018-06-12 16:32:05 +02:00
commit 68a7387b6b

View File

@ -859,8 +859,13 @@ window._qutebrowser.caret = (function() {
const style = ".CaretBrowsing_Caret {" + const style = ".CaretBrowsing_Caret {" +
" position: absolute;" + " position: absolute;" +
" z-index: 2147483647;" + " z-index: 2147483647;" +
" min-height: 10px;" + " min-height: 1em;" +
" min-width: 0.2em;" +
" background-color: #000;" + " background-color: #000;" +
" animation: blink 1s step-end infinite;" +
"}" +
"@keyframes blink {" +
" 50% { visibility: hidden; }" +
"}"; "}";
const node = document.createElement("style"); const node = document.createElement("style");
node.innerHTML = style; node.innerHTML = style;
@ -1158,6 +1163,8 @@ window._qutebrowser.caret = (function() {
CaretBrowsing.updateCaretOrSelection(true); CaretBrowsing.updateCaretOrSelection(true);
}, 0); }, 0);
} }
CaretBrowsing.stopAnimation();
}; };
CaretBrowsing.moveToBlock = function(paragraph, boundary) { CaretBrowsing.moveToBlock = function(paragraph, boundary) {
@ -1176,6 +1183,8 @@ window._qutebrowser.caret = (function() {
window.setTimeout(() => { window.setTimeout(() => {
CaretBrowsing.updateCaretOrSelection(true); CaretBrowsing.updateCaretOrSelection(true);
}, 0); }, 0);
CaretBrowsing.stopAnimation();
}; };
CaretBrowsing.toggle = function(value) { CaretBrowsing.toggle = function(value) {
@ -1242,6 +1251,17 @@ window._qutebrowser.caret = (function() {
CaretBrowsing.updateIsCaretVisible(); CaretBrowsing.updateIsCaretVisible();
}; };
CaretBrowsing.startAnimation = function() {
CaretBrowsing.caretElement.style.animationIterationCount = "infinite";
};
CaretBrowsing.stopAnimation = function() {
CaretBrowsing.caretElement.style.animationIterationCount = 0;
window.setTimeout(() => {
CaretBrowsing.startAnimation();
}, 1000);
};
CaretBrowsing.init = function() { CaretBrowsing.init = function() {
CaretBrowsing.isWindowFocused = document.hasFocus(); CaretBrowsing.isWindowFocused = document.hasFocus();