Prevent blank names from being entered
This commit is contained in:
parent
3e1298302b
commit
7143c75df0
13
popup.js
13
popup.js
|
@ -81,6 +81,7 @@ function renderWindow(windowdata, winnum) {
|
|||
var input = element('input', {
|
||||
_parent: namestringspan,
|
||||
value:name,
|
||||
"data-original":name,
|
||||
type:"text",
|
||||
_onblur:function(ev){
|
||||
if(ev && ev.keyCode) {
|
||||
|
@ -88,7 +89,17 @@ function renderWindow(windowdata, winnum) {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
if(this.value.trim().length==0) {
|
||||
this.value = this.getAttribute("data-original")
|
||||
this.focus()
|
||||
this.setSelectionRange(0,9999)
|
||||
this.classList.add("nope")
|
||||
var theinput = this
|
||||
setTimeout(function(){
|
||||
theinput.classList.remove("nope")
|
||||
}, 450)
|
||||
return
|
||||
}
|
||||
console.log("Rename window #"+winnum+" to "+this.value)
|
||||
tabbro.ui_rename_window(winnum, this.value)
|
||||
namestringspan.innerHTML = this.value
|
||||
|
|
18
style.css
18
style.css
|
@ -72,6 +72,24 @@ body {
|
|||
max-height: 700px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
@-webkit-keyframes nopenopenope {
|
||||
0% {
|
||||
left: 0px;
|
||||
}
|
||||
25% {
|
||||
left: -10px;
|
||||
}
|
||||
75% {
|
||||
left: 10px;
|
||||
}
|
||||
100% {
|
||||
left: 0px;
|
||||
}
|
||||
}
|
||||
.nope {
|
||||
position: relative;
|
||||
-webkit-animation: nopenopenope .15s linear 0s 3 normal;
|
||||
}
|
||||
|
||||
|
||||
/* Options panel appears on hove */
|
||||
|
|
Loading…
Reference in New Issue