mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-01-07 22:49:28 +01:00
[feature] add random group name controls
This commit is contained in:
parent
77769041df
commit
0858aae57d
1321
src/js/helper.js
1321
src/js/helper.js
File diff suppressed because it is too large
Load Diff
@ -428,6 +428,8 @@ var link = (function() {
|
|||||||
var groupFormPositionInputWrap = helper.node("div|class:input-wrap");
|
var groupFormPositionInputWrap = helper.node("div|class:input-wrap");
|
||||||
var groupFormPositionLabel = helper.node("label:Position|for:group-form-position");
|
var groupFormPositionLabel = helper.node("label:Position|for:group-form-position");
|
||||||
var groupFormPositionSelect = helper.node("select|id:group-form-position,class:group-form-position mb-0,tabindex:1");
|
var groupFormPositionSelect = helper.node("select|id:group-form-position,class:group-form-position mb-0,tabindex:1");
|
||||||
|
var groupFormRandomNameButtonWrap = helper.node("div|class:button-wrap");
|
||||||
|
var groupFormRandomNameButton = helper.node("button:Random Group Name|class:button mb-0,type:button,tabindex:1");
|
||||||
|
|
||||||
// group name
|
// group name
|
||||||
var groupFormNameInputWrap = helper.node("div|class:input-wrap");
|
var groupFormNameInputWrap = helper.node("div|class:input-wrap");
|
||||||
@ -436,9 +438,11 @@ var link = (function() {
|
|||||||
|
|
||||||
groupFormPositionInputWrap.appendChild(groupFormPositionLabel);
|
groupFormPositionInputWrap.appendChild(groupFormPositionLabel);
|
||||||
groupFormPositionInputWrap.appendChild(groupFormPositionSelect);
|
groupFormPositionInputWrap.appendChild(groupFormPositionSelect);
|
||||||
|
groupFormRandomNameButtonWrap.appendChild(groupFormRandomNameButton);
|
||||||
groupFormNameInputWrap.appendChild(groupFormInputLabel);
|
groupFormNameInputWrap.appendChild(groupFormInputLabel);
|
||||||
groupFormNameInputWrap.appendChild(groupFormInputName);
|
groupFormNameInputWrap.appendChild(groupFormInputName);
|
||||||
fieldset.appendChild(groupFormNameInputWrap);
|
fieldset.appendChild(groupFormNameInputWrap);
|
||||||
|
fieldset.appendChild(groupFormRandomNameButtonWrap);
|
||||||
fieldset.appendChild(groupFormPositionInputWrap);
|
fieldset.appendChild(groupFormPositionInputWrap);
|
||||||
form.appendChild(fieldset);
|
form.appendChild(fieldset);
|
||||||
|
|
||||||
@ -482,6 +486,11 @@ var link = (function() {
|
|||||||
groupFormInputName.addEventListener("input", function(event) {
|
groupFormInputName.addEventListener("input", function(event) {
|
||||||
stagedGroup.group.name = this.value;
|
stagedGroup.group.name = this.value;
|
||||||
}, false);
|
}, false);
|
||||||
|
groupFormRandomNameButton.addEventListener("click", function(event) {
|
||||||
|
var randomName = helper.randomString();
|
||||||
|
stagedGroup.group.name = randomName;
|
||||||
|
groupFormInputName.value = randomName;
|
||||||
|
}, false);
|
||||||
|
|
||||||
return form;
|
return form;
|
||||||
},
|
},
|
||||||
@ -680,6 +689,8 @@ var link = (function() {
|
|||||||
var groupNewFormIndent = helper.node("div|class:form-indent");
|
var groupNewFormIndent = helper.node("div|class:form-indent");
|
||||||
var groupNewInputWrap = helper.node("div|class:input-wrap");
|
var groupNewInputWrap = helper.node("div|class:input-wrap");
|
||||||
var groupNewInput = helper.node("input|type:text,class:link-form-input-new-group mb-0,id:link-form-input-new-group,placeholder:Example group,tabindex:1,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,disabled");
|
var groupNewInput = helper.node("input|type:text,class:link-form-input-new-group mb-0,id:link-form-input-new-group,placeholder:Example group,tabindex:1,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,disabled");
|
||||||
|
var groupNewRandomNameButtonWrap = helper.node("div|class:button-wrap");
|
||||||
|
var groupNewRandomNameButton = helper.node("button:Random Group Name|class:button mb-0,type:button,tabindex:1,disabled");
|
||||||
|
|
||||||
// letter
|
// letter
|
||||||
var displayLetterRadioWrap = helper.node("div|class:input-wrap");
|
var displayLetterRadioWrap = helper.node("div|class:input-wrap");
|
||||||
@ -760,7 +771,9 @@ var link = (function() {
|
|||||||
groupNewLable.appendChild(groupNewLableLableText);
|
groupNewLable.appendChild(groupNewLableLableText);
|
||||||
groupNewRadioWrap.appendChild(groupNewLable);
|
groupNewRadioWrap.appendChild(groupNewLable);
|
||||||
groupNewInputWrap.appendChild(groupNewInput);
|
groupNewInputWrap.appendChild(groupNewInput);
|
||||||
|
groupNewRandomNameButtonWrap.appendChild(groupNewRandomNameButton);
|
||||||
groupNewFormIndent.appendChild(groupNewInputWrap);
|
groupNewFormIndent.appendChild(groupNewInputWrap);
|
||||||
|
groupNewFormIndent.appendChild(groupNewRandomNameButtonWrap);
|
||||||
fieldset.appendChild(groupNewRadioWrap);
|
fieldset.appendChild(groupNewRadioWrap);
|
||||||
fieldset.appendChild(groupNewFormIndent);
|
fieldset.appendChild(groupNewFormIndent);
|
||||||
fieldset.appendChild(helper.node("hr"));
|
fieldset.appendChild(helper.node("hr"));
|
||||||
@ -826,6 +839,7 @@ var link = (function() {
|
|||||||
helper.addClass(groupExistingPositionLabel, "disabled");
|
helper.addClass(groupExistingPositionLabel, "disabled");
|
||||||
groupExistingPosition.setAttribute("disabled", "");
|
groupExistingPosition.setAttribute("disabled", "");
|
||||||
groupNewInput.removeAttribute("disabled");
|
groupNewInput.removeAttribute("disabled");
|
||||||
|
groupNewRandomNameButton.removeAttribute("disabled");
|
||||||
stagedLink.position.group.new = true;
|
stagedLink.position.group.new = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -920,6 +934,7 @@ var link = (function() {
|
|||||||
groupExistingPosition.removeAttribute("disabled");
|
groupExistingPosition.removeAttribute("disabled");
|
||||||
helper.removeClass(groupExistingPositionLabel, "disabled");
|
helper.removeClass(groupExistingPositionLabel, "disabled");
|
||||||
groupNewInput.setAttribute("disabled", "");
|
groupNewInput.setAttribute("disabled", "");
|
||||||
|
groupNewRandomNameButton.setAttribute("disabled", "");
|
||||||
}, false);
|
}, false);
|
||||||
groupExistingGroup.addEventListener("change", function(event) {
|
groupExistingGroup.addEventListener("change", function(event) {
|
||||||
stagedLink.position.destination.group = this.selectedIndex;
|
stagedLink.position.destination.group = this.selectedIndex;
|
||||||
@ -936,10 +951,16 @@ var link = (function() {
|
|||||||
groupExistingPosition.setAttribute("disabled", "");
|
groupExistingPosition.setAttribute("disabled", "");
|
||||||
helper.addClass(groupExistingPositionLabel, "disabled");
|
helper.addClass(groupExistingPositionLabel, "disabled");
|
||||||
groupNewInput.removeAttribute("disabled");
|
groupNewInput.removeAttribute("disabled");
|
||||||
|
groupNewRandomNameButton.removeAttribute("disabled");
|
||||||
}, false);
|
}, false);
|
||||||
groupNewInput.addEventListener("input", function(event) {
|
groupNewInput.addEventListener("input", function(event) {
|
||||||
stagedLink.position.group.name = this.value;
|
stagedLink.position.group.name = this.value;
|
||||||
}, false);
|
}, false);
|
||||||
|
groupNewRandomNameButton.addEventListener("click", function(event) {
|
||||||
|
var randomName = helper.randomString();
|
||||||
|
stagedLink.position.group.name = randomName;
|
||||||
|
groupNewInput.value = randomName;
|
||||||
|
}, false);
|
||||||
displayLetterRadio.addEventListener("change", function(event) {
|
displayLetterRadio.addEventListener("change", function(event) {
|
||||||
stagedLink.link.display = this.value;
|
stagedLink.link.display = this.value;
|
||||||
}, false);
|
}, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user