Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "Empty" button to shortcut #1310

Merged
1 commit merged into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 58 additions & 27 deletions ui/satus/satus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/*--------------------------------------------------------------
>>> CORE:
----------------------------------------------------------------
Expand Down Expand Up @@ -818,7 +818,7 @@ satus.render = function (skeleton, container, skip, property) {
}

return component;
};
};
/*--------------------------------------------------------------
>>> COLOR:
----------------------------------------------------------------
Expand Down Expand Up @@ -934,7 +934,7 @@ satus.color.hslToRgb = function (array) {
}

return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
};
};
/*--------------------------------------------------------------
>>> PLUVIAM
--------------------------------------------------------------*/
Expand Down Expand Up @@ -965,10 +965,10 @@ satus.events.add('render', function (component, skeleton) {
component.addEventListener('mousedown', createPluviam);
component.addEventListener('mouseover', createPluviam);
}
});
});
/*--------------------------------------------------------------
>>> EXTENSION STORAGE
--------------------------------------------------------------*/
--------------------------------------------------------------*/
/*--------------------------------------------------------------
>>> INDEXEDDB:
----------------------------------------------------------------
Expand Down Expand Up @@ -1390,7 +1390,7 @@ satus.indexeddb.search = function (items, callback) {
}

handle();
};
};
/*--------------------------------------------------------------
>>> SORTABLE
--------------------------------------------------------------*/
Expand Down Expand Up @@ -1484,7 +1484,7 @@ satus.events.add('render', function (component, skeleton) {
return false;
});
}
});
});
/*--------------------------------------------------------------
>>> USER
--------------------------------------------------------------*/
Expand Down Expand Up @@ -1820,7 +1820,7 @@ satus.user = function () {


return data;
};
};
/*--------------------------------------------------------------
>>> UUID
--------------------------------------------------------------*/
Expand All @@ -1829,7 +1829,7 @@ satus.uuid = function () {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (match) {
return (match ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> match / 4).toString(16)
});
};
};
/*--------------------------------------------------------------
>>> CONTEXT MENU
--------------------------------------------------------------*/
Expand Down Expand Up @@ -1860,7 +1860,7 @@ satus.events.add('render', function (component, skeleton) {
return false;
});
}
});
});
/*--------------------------------------------------------------
>>> BASE
--------------------------------------------------------------*/
Expand All @@ -1871,7 +1871,7 @@ satus.components.base = function (skeleton) {
component.base = component;

return component;
};
};
/*--------------------------------------------------------------
>>> RADIO
--------------------------------------------------------------*/
Expand Down Expand Up @@ -1913,7 +1913,7 @@ satus.components.radio = function (skeleton) {
component.appendChild(radio);

return component;
};
};
/*--------------------------------------------------------------
>>> CHECKBOX
--------------------------------------------------------------*/
Expand Down Expand Up @@ -1945,7 +1945,7 @@ satus.components.checkbox = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> SELECT
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2009,7 +2009,7 @@ satus.components.select = function (skeleton) {
component.appendChild(component_value);

return component;
};
};
/*--------------------------------------------------------------
>>> SHORTCUT
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2306,6 +2306,37 @@ satus.components.shortcut = function (skeleton) {
}
}
},
empty: {
component: 'button',
text: 'empty',
on: {
click: function () {
component.data = {
"alt": false,
"ctrl": false,
"shift": false,
"keys": {
"0": {
"code": "Lang1",
"key": ""
}
},
"wheel": 0
};

component.storageValue = component.data;

component.storageChange();

component.render(component.valueElement);

this.parentNode.parentNode.parentNode.close();

window.removeEventListener('keydown', component.keydown);
window.removeEventListener('wheel', component.mousewheel);
}
}
},
cancel: {
component: 'button',
text: 'cancel',
Expand Down Expand Up @@ -2348,7 +2379,7 @@ satus.components.shortcut = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> SWITCH
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2382,7 +2413,7 @@ satus.components.switch = function (skeleton) {
component.appendChild(component_thumb);

return component;
};
};
/*--------------------------------------------------------------
>>> LAYERS
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2438,7 +2469,7 @@ satus.components.layers = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> INPUT
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2493,7 +2524,7 @@ satus.components.input = function (skeleton) {
}

return component;
};
};
/*--------------------------------------------------------------
>>> MENUBAR
--------------------------------------------------------------*/
Expand All @@ -2519,7 +2550,7 @@ satus.components.menubar = function (skeleton) {
}

return createList(skeleton.items);
};
};
/*--------------------------------------------------------------
>>> TEXTAREA
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2581,7 +2612,7 @@ satus.components.textarea = function (skeleton) {
line_number.update(1);

return component;
};
};
/*--------------------------------------------------------------
>>> DIVIDER
--------------------------------------------------------------*/
Expand All @@ -2590,7 +2621,7 @@ satus.components.divider = function () {
var component = document.createElement('div');

return component;
};
};
/*--------------------------------------------------------------
>>> TEXT FIELD
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2783,7 +2814,7 @@ satus.components.textField = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> TABS
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2840,7 +2871,7 @@ satus.components.tabs = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> ALERT
--------------------------------------------------------------*/
Expand All @@ -2849,7 +2880,7 @@ satus.components.alert = function (skeleton) {
var component = document.createElement('div');

return component;
};
};
/*--------------------------------------------------------------
>>> SLIDER
--------------------------------------------------------------*/
Expand Down Expand Up @@ -2970,7 +3001,7 @@ satus.components.slider = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> COLOR PICKER
--------------------------------------------------------------*/
Expand Down Expand Up @@ -3153,7 +3184,7 @@ satus.components.colorPicker = function (skeleton) {
});

return component;
};
};
/*--------------------------------------------------------------
>>> LIST
--------------------------------------------------------------*/
Expand Down Expand Up @@ -3185,7 +3216,7 @@ satus.components.list = function (skeleton) {
}

return ul;
};
};
/*--------------------------------------------------------------
>>> MODAL
--------------------------------------------------------------*/
Expand Down