Skip to content

Instantly share code, notes, and snippets.

@hssktm
Last active September 26, 2024 22:04
Show Gist options
  • Save hssktm/81b16075724075356580bd90361597b7 to your computer and use it in GitHub Desktop.
Save hssktm/81b16075724075356580bd90361597b7 to your computer and use it in GitHub Desktop.
JSON OXYGEN
{"component":{"id":500,"name":"ct_div_block","options":{"ct_id":500,"ct_parent":100004,"selector":"div_block-500-72","original":[],"nicename":"Element Countdown"},"depth":5,"children":[{"id":520,"name":"ct_code_block","options":{"ct_id":520,"ct_parent":500,"selector":"code_block-520-72","original":{"code-js":"function updateTimers() {\n if (window.angular) return;\n\n var now = new Date();\n var containers = document.querySelectorAll(\".x-count\");\n\n containers.forEach(function(container) {\n var future = new Date(\n container.getAttribute(\"data-count-year\"),\n parseInt(container.getAttribute(\"data-count-mo\")) - 1,\n parseInt(container.getAttribute(\"data-count-day\")) + 0\n );\n\n var diff = future - now;\n\n var days = Math.floor(diff / (1000 * 60 * 60 * 24));\n var hours = Math.floor(diff / (1000 * 60 * 60)) % 24;\n var mins = Math.floor(diff / (1000 * 60)) % 60;\n var secs = Math.floor(diff / 1000) % 60;\n\n var daysElement = container.querySelector(\".x-count__days\");\n var hoursElement = container.querySelector(\".x-count__hours\");\n var minsElement = container.querySelector(\".x-count__mins\");\n var secsElement = container.querySelector(\".x-count__secs\");\n\n // Verificar si los elementos existen antes de actualizar su contenido\n if (daysElement) {\n if (daysElement.textContent !== days.toString()) {\n daysElement.textContent = days;\n }\n }\n if (hoursElement) {\n if (hoursElement.textContent !== hours.toString()) {\n hoursElement.textContent = hours;\n }\n }\n if (minsElement) {\n if (minsElement.textContent !== mins.toString()) {\n minsElement.textContent = mins;\n }\n }\n if (secsElement) {\n if (secsElement.textContent !== secs.toString()) {\n secsElement.textContent = secs;\n }\n }\n });\n\n requestAnimationFrame(updateTimers);\n}\n\nupdateTimers();\n","code-php":"<!---->"},"nicename":"Code Sale Countdown Timer","activeselector":false},"depth":6},{"id":538,"name":"ct_div_block","options":{"ct_id":538,"ct_parent":500,"selector":"div_block-538-72","original":{"globalconditions":[{"name":"ZZOXYVSBDYNAMIC","operator":9,"value":"","oxycode":"[oxygen ct_sign_sha256='38fca11e3874504b9e8d39ecac509cf4bc065c5afc38974a1b07ec2aed478077' data='phpfunction' function='woo_field' arguments='date_on_sale_to_day' ]"},{"name":"ZZOXYVSBDYNAMIC","operator":0,"value":"yes","oxycode":"[oxygen ct_sign_sha256='328c0f15a900a8da08328d337062b1b94c019d6356c3802d53cab36d8ed4eaa9' data='phpfunction' function='woo_field' arguments='is_on_sale' ]"}],"margin-bottom":"40"},"nicename":"Content Countdown","activeselector":""},"depth":6,"children":[{"id":539,"name":"ct_div_block","options":{"ct_id":539,"ct_parent":538,"selector":"div_block-539-72","original":{"text-align":"left","flex-direction":"row","display":"flex","align-items":"center","margin-bottom":"10","gap":"5"},"nicename":"Div (#58)"},"depth":7,"children":[{"id":540,"name":"ct_fancy_icon","options":{"ct_id":540,"ct_parent":539,"selector":"fancy_icon-540-72","original":{"icon-id":"FontAwesomeicon-fire","icon-size":"22","icon-color":"#764be9"},"nicename":"Icon (#60)"},"depth":8},{"id":541,"name":"ct_text_block","options":{"ct_id":541,"ct_parent":539,"selector":"text_block-541-72","original":{"font-weight":"600","color":"#764be9"},"nicename":"Text (#61)","ct_content":"Hurry up ! Sale end in:"},"depth":8}]},{"id":542,"name":"ct_div_block","options":{"ct_id":542,"ct_parent":538,"selector":"div_block-542-72","original":{"custom-attributes":[{"name":"data-count-year","value":"[oxygen ct_sign_sha256='6f5816bfce91465bd8158b4fc49da6972b8f4d2746e28ebc452ac6fd79cb0620' data='phpfunction' function='woo_field' arguments='date_on_sale_to_year' ]"},{"name":"data-count-mo","value":"[oxygen ct_sign_sha256='a080ce8907ad22eeed2100d65bac9ce206c940a5f5b74856cfcea46585f726de' data='phpfunction' function='woo_field' arguments='date_on_sale_to_month' ]"},{"name":"data-count-day","value":"[oxygen ct_sign_sha256='38fca11e3874504b9e8d39ecac509cf4bc065c5afc38974a1b07ec2aed478077' data='phpfunction' function='woo_field' arguments='date_on_sale_to_day' ]"}]},"nicename":"Sale Countdown","classes":["x-count"]},"depth":7,"children":[{"id":543,"name":"ct_div_block","options":{"ct_id":543,"ct_parent":542,"selector":"div_block-543-72","original":[],"nicename":"Contain Days","classes":["x-count__number-content"]},"depth":8,"children":[{"id":544,"name":"ct_text_block","options":{"ct_id":544,"ct_parent":543,"selector":"text_block-544-72","original":[],"nicename":"Date","ct_content":"0","classes":["x-count__number","x-count__days"]},"depth":9},{"id":545,"name":"ct_text_block","options":{"ct_id":545,"ct_parent":543,"selector":"text_block-545-72","original":[],"nicename":"Text","ct_content":"DAYS","classes":["x-count__text"]},"depth":9}]},{"id":546,"name":"ct_div_block","options":{"ct_id":546,"ct_parent":542,"selector":"div_block-546-72","original":[],"nicename":"Contain Hrs","classes":["x-count__number-content"]},"depth":8,"children":[{"id":547,"name":"ct_text_block","options":{"ct_id":547,"ct_parent":546,"selector":"text_block-547-72","original":[],"nicename":"Date","ct_content":"0","classes":["x-count__number","x-count__hours"]},"depth":9},{"id":548,"name":"ct_text_block","options":{"ct_id":548,"ct_parent":546,"selector":"text_block-548-72","original":[],"nicename":"Text","ct_content":"HRS","classes":["x-count__text"]},"depth":9}]},{"id":549,"name":"ct_div_block","options":{"ct_id":549,"ct_parent":542,"selector":"div_block-549-72","original":[],"nicename":"Contain Mins","classes":["x-count__number-content"]},"depth":8,"children":[{"id":550,"name":"ct_text_block","options":{"ct_id":550,"ct_parent":549,"selector":"text_block-550-72","original":[],"nicename":"Date","ct_content":"0","classes":["x-count__number","x-count__mins"]},"depth":9},{"id":551,"name":"ct_text_block","options":{"ct_id":551,"ct_parent":549,"selector":"text_block-551-72","original":[],"nicename":"Text","ct_content":"MINS","classes":["x-count__text"]},"depth":9}]},{"id":552,"name":"ct_div_block","options":{"ct_id":552,"ct_parent":542,"selector":"div_block-552-72","original":[],"nicename":"Contain Secs","classes":["x-count__number-content"]},"depth":8,"children":[{"id":553,"name":"ct_text_block","options":{"ct_id":553,"ct_parent":552,"selector":"text_block-553-72","original":[],"nicename":"Date","ct_content":"0","classes":["x-count__number","x-count__secs"]},"depth":9},{"id":554,"name":"ct_text_block","options":{"ct_id":554,"ct_parent":552,"selector":"text_block-554-72","original":[],"nicename":"Text","ct_content":"SECS<br>","classes":["x-count__text"]},"depth":9}]}]}]}]},"classes":{"x-count":{"key":"x-count","original":{"width-unit":"%","width":"100","flex-direction":"row","display":"flex","gap":"10"}},"x-count__number-content":{"key":"x-count__number-content","original":{"flex-direction":"column","display":"flex","align-items":"center","min-width":"60","min-height":"60","justify-content":"center","border-radius":"8","background-color":"#efeaff","color":"#764be9","font-weight":"500","border-top-width":"1","border-right-width":"1","border-bottom-width":"1","border-left-width":"1","border-all-width":"1","border-top-style":"solid","border-right-style":"solid","border-bottom-style":"solid","border-left-style":"solid","border-all-style":"solid","border-top-color":"#d5c9ff","border-right-color":"#d5c9ff","border-bottom-color":"#d5c9ff","border-left-color":"#d5c9ff","border-all-color":"#d5c9ff"}},"x-count__number":{"key":"x-count__number","original":{"font-size":"22","line-height":"1"}},"x-count__days":{"key":"x-count__days","original":{"selector-locked":"true"}},"x-count__text":{"key":"x-count__text","original":{"font-size":"14","line-height":"1"}},"x-count__hours":{"key":"x-count__hours","original":{"selector-locked":"true"}},"x-count__mins":{"key":"x-count__mins","original":{"selector-locked":"true"}},"x-count__secs":{"key":"x-count__secs","original":{"selector-locked":"true"}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment