Fix QR character count.

This commit is contained in:
ccd0 2015-05-03 22:44:46 -07:00
parent 68d43b3b79
commit a1f3af15f9
2 changed files with 5 additions and 9 deletions

View File

@ -1159,13 +1159,6 @@ input[name="Default Volume"] {
float: right; float: right;
padding: 0 3px; padding: 0 3px;
} }
#qr .warning {
min-height: 1.6em;
vertical-align: middle;
padding: 0 1px;
border-width: 1px;
border-style: solid;
}
.qr-link-container { .qr-link-container {
text-align: center; text-align: center;
} }
@ -1490,6 +1483,9 @@ a:only-of-type > .remove {
right: 1px; right: 1px;
pointer-events: none; pointer-events: none;
} }
#char-count.warning {
color: red;
}
/* Menu */ /* Menu */
.menu-button:not(.fa-bars) { .menu-button:not(.fa-bars) {

View File

@ -291,10 +291,10 @@ QR =
characterCount: -> characterCount: ->
counter = QR.nodes.charCount counter = QR.nodes.charCount
count = QR.nodes.com.textLength count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length
counter.textContent = count counter.textContent = count
counter.hidden = count < 1000 counter.hidden = count < 1000
(if count > 1500 then $.addClass else $.rmClass) counter, 'warning' (if count > 2000 then $.addClass else $.rmClass) counter, 'warning'
getFile: -> getFile: ->
$.event 'QRFile', QR.selected?.file $.event 'QRFile', QR.selected?.file