Skip to content

Instantly share code, notes, and snippets.

View wpeasy's full-sized avatar

Alan Blair wpeasy

  • WPEasy Pty Ltd
  • Brisbane Australia
View GitHub Profile
@wpeasy
wpeasy / template.json
Last active August 18, 2024 12:08
Bricks Remote Slider Buttons
{"content":[{"id":"chbcen","name":"section","parent":0,"children":["dssnom"],"settings":{}},{"id":"dssnom","name":"container","parent":"chbcen","children":["ipncxv"],"settings":{"_display":"grid","_gridGap":"1rem","_gridTemplateColumns":"repeat(2, minmax(0, 1fr))"}},{"id":"dbe55a","name":"block","parent":"ipncxv","children":["771f25","909e90","a7136e","iwrkdr","2686bd"],"settings":{"_direction":"row","_cssGlobalClasses":["mkgizl"],"_attributes":[{"id":"jlzjql","name":"data-wpe-splide-id","value":"brxe-oennwd"},{"id":"hsqwec","name":"aria-role","value":"tablist"}],"tag":"ul"},"label":"WPE Splide Buttons"},{"id":"771f25","name":"div","parent":"dbe55a","children":["693011"],"settings":{"tag":"li","_cssGlobalClasses":["etqxgn"],"_attributes":[{"id":"bvagrz","name":"role","value":"presentation"}]},"label":"LI"},{"id":"693011","name":"button","parent":"771f25","children":[],"settings":{"text":"About","style":"primary","_cssGlobalClasses":["bggreh"],"tag":"button","_attributes":[{"id":"wycehu","name":"role","value":
@wpeasy
wpeasy / template.json
Created July 7, 2024 06:35
Bricks Builder Splitting JS
{"content":[{"id":"nzmpxb","name":"code","parent":0,"children":[],"settings":{"code":"<link rel=\"stylesheet\" href=\"https://unpkg.com/splitting/dist/splitting.css\" />\n<link rel=\"stylesheet\" href=\"https://unpkg.com/splitting/dist/splitting-cells.css\" />\n<script src=\"https://unpkg.com/splitting/dist/splitting.min.js\"></script>\n\n<script type=\"module\">\n Splitting(); \n</script>","executeCode":true,"noRoot":true,"signature":"388e5749bc3a3f681d4be4dc49285866","user_id":1,"time":1720330112}},{"id":"yqnnjo","name":"section","parent":0,"children":["vtzawa"],"settings":{}},{"id":"vtzawa","name":"container","parent":"yqnnjo","children":["pudafr"],"settings":{"_alignItems":"center"}},{"id":"pudafr","name":"text-basic","parent":"vtzawa","children":[],"settings":{"text":"Select any part of","tag":"p","_cssGlobalClasses":["kekkpn"],"_attributes":[{"id":"wcvkrk","name":"data-splitting"}]},"label":"Split Text"}],"source":"bricksCopiedElements","sourceUrl":"https://acss-at-based.local","version":"1.9.9","globa
@wpeasy
wpeasy / template.json
Created July 7, 2024 23:32
ACSS A11Y Contrast Checker
{"content":[{"id":"zpoqdc","name":"section","parent":0,"children":["hxxvtj","eqyrql","tnchrj"],"settings":{},"label":"A11Y"},{"id":"hxxvtj","name":"code","parent":"zpoqdc","children":[],"settings":{"executeCode":true,"noRoot":true,"signature":"ef34dcb5f72679007750c01717fcfdf7","user_id":1,"time":1720392610,"code":"<script type=\"module\">\n // Function to convert RGB to Luminance\n const rgbToLuminance = (rgb) => {\n const rgbArr = rgb.match(/\\d+/g).map(Number);\n const [r, g, b] = rgbArr.map((value) => {\n value /= 255;\n return value <= 0.03928 ? value / 12.92 : Math.pow((value + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n }\n\n // Function to calculate the contrast ratio\n const calculateContrastRatio = (luminance1, luminance2) => {\n const brighter = Math.max(luminance1, luminance2);\n const darker = Math.min(luminance1, luminance2);\n return (brighter + 0.05) / (darker + 0.05);\n }\n\n // Function to check A11Y compliance\n const ch
@wpeasy
wpeasy / styles.css
Created September 13, 2024 02:12
Bricks Interaction Animations Util Class
/* Available globally */
:root {
--wpe-transition-distance: 15px;
--wpe-transition-rotation: 15deg;
/* use as globals if you wish to
e.g. var(--wpe-animation-duration--fast);
*/
--wpe-animation-duration--fast: 0.2s;
@wpeasy
wpeasy / template.json
Created September 18, 2024 20:28
Bricks Example Run Once code with Accordion
{"content":[{"id":"eada11","name":"section","parent":0,"children":["hzsuiu","gbxdvt"],"settings":{}},{"id":"hzsuiu","name":"container","parent":"eada11","children":["dbxacc"],"settings":[]},{"id":"dbxacc","name":"block","parent":"hzsuiu","children":["iamhht","abvaos"],"settings":{"_cssGlobalClasses":["hrqmoc"]},"label":"WPEasy Accordion (CSS)"},{"id":"iamhht","name":"accordion-nested","parent":"dbxacc","children":["pchmwm","viyjzy"],"settings":{"_cssGlobalClasses":["eikstu"]}},{"id":"pchmwm","name":"block","parent":"iamhht","children":["jhnvvm","kljwky"],"settings":{"_cssGlobalClasses":["ozntht"]},"label":"Item"},{"id":"jhnvvm","name":"block","parent":"pchmwm","children":["wnkirt"],"settings":{"_alignItems":"center","_direction":"row","_justifyContent":"space-between","_hidden":{"_cssClasses":"accordion-title-wrapper"},"tag":"custom","customTag":"h3","_cssGlobalClasses":["dfpgrd"]},"label":"Heading"},{"id":"wnkirt","name":"block","parent":"jhnvvm","children":["fknsni","jajptx"],"settings":{"tag":"custom","cus
@wpeasy
wpeasy / template.json
Created September 28, 2024 22:52
Bricks Title Animations
{"content":[{"id":"fyecqm","name":"section","parent":0,"children":["qzlujg","zktbjl"],"settings":{"_cssGlobalClasses":["azghyr"]}},{"id":"zktbjl","name":"container","parent":"fyecqm","children":["mqcylv"],"settings":[]},{"id":"mqcylv","name":"div","parent":"zktbjl","children":["lsmava","jrzudn","pnnpsg"],"settings":{"_cssGlobalClasses":["soqrhe","mjjnlw"]},"label":"WPE Title 1"},{"id":"lsmava","name":"text-basic","parent":"mqcylv","children":[],"settings":{"text":"WPE Title 1","tag":"p","_cssGlobalClasses":["xgjnoo"]},"label":"Upper Title"},{"id":"pnnpsg","name":"text-basic","parent":"mqcylv","children":[],"settings":{"text":"Lower Title","tag":"p","_cssGlobalClasses":["xuiylk"]},"label":"Lower Title"},{"id":"jrzudn","name":"divider","parent":"mqcylv","children":[],"settings":{"_cssGlobalClasses":["pefdqc"]}},{"id":"inoygc","name":"text","parent":"qzlujg","children":[],"settings":{"text":"<p>Isn't that fantastic that you can create an almighty tree that fast? Every day I learn. Be so very light. Be a gentle w
@wpeasy
wpeasy / code.js
Created October 7, 2024 00:42
Bricks MetaBox Events Multi Timezone
document.addEventListener('DOMContentLoaded', () => {
// Function to convert Unix timestamp to local date time string
function convertUnixToLocalDateTime(unixTimestamp) {
const date = new Date(unixTimestamp * 1000); // Convert Unix timestamp to milliseconds
const options = {
month: 'long', // Full month name
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour12: true // AM/PM format
@wpeasy
wpeasy / bricks-color-palette-default.json
Created October 21, 2024 23:27
Newbies to Bricks Code
{
"id": "f05f0d",
"name": "Default",
"colors": [
{
"hex": "#257cda",
"id": "atasgw",
"name": "fw-primary"
},
{
@wpeasy
wpeasy / template.json
Created November 16, 2024 05:58
Elementor Expandable Search
{"content":[{"id":"41c39ea4","settings":{"content_width":"full","flex_direction":"row","flex_align_items":"center","_element_id":"search-container","custom_css":"#search-container{\r\n --open-width: 200px;\r\n}\r\n.search-icon-wrapper {\r\n position: relative;\r\n display: inline-block;\r\n \r\n}\r\n\r\n.search-toggle {\r\n display: none;\r\n}\r\n\r\n.search-icon {\r\n cursor: pointer;\r\n font-size: 20px;\r\n display: inline-block;\r\n padding: 5px;\r\n transition: color 0.3s;\r\n color: #333;\r\n}\r\n\r\n.search-icon:hover {\r\n color: #0073e6;\r\n}\r\n\r\n#search-container .e-search-input {\r\n max-width: 0;\r\n width: var(--open-width)x;\r\n opacity: 0;\r\n transition: max-width 0.6s ease, opacity 0.3s ease;\r\n}\r\n\r\n#search-container:has(:checked) .e-search-input {\r\n max-width: var(--open-width);\r\n opacity: 1;\r\n}","_title":"Search Container"},"elements":[{"id":"6e60c52d","settings":{"html":"<div class=\"search-icon-wrapper\">\r\n <input type
@wpeasy
wpeasy / javascript.js
Created December 22, 2024 22:22
Bricks Builder Focus Trap
(() => {
/* INIT WPE Object */
window.WPE = window.WPE || { scripts: [] };
const scriptName = 'wpeFocusTrap'; /* Must be unique */
const blockSelector = '.wpe-focus-trap';
class MainClass {
constructor() {
this.debug = false;