Skip to content

Instantly share code, notes, and snippets.

View ofmarconi's full-sized avatar

Orlando Marconi ofmarconi

  • Marks
  • São Paulo
View GitHub Profile
@ofmarconi
ofmarconi / JetEngine Visibility Toggle Bookmarklet
Last active October 2, 2024 14:35
Create a new bookmark in your browser, edit it, and paste the code above into the URL field. Click the bookmark while editing a page in Elementor to toggle the visibility of elements.
javascript:(function(){var i=document.getElementById('elementor-preview-iframe');if(i&&i.contentWindow){var d=i.contentWindow.document;function t(){d.querySelectorAll('.jedv-enabled--yes,.marks-jedv-enabled--yes').forEach(e=>{e.classList.toggle('jedv-enabled--yes');e.classList.toggle('marks-jedv-enabled--yes')})}t()}else{alert('Iframe not found or inaccessible')}})();
@ofmarconi
ofmarconi / functions.php
Last active September 21, 2023 16:22
JetEngine • Transformando o primeiro item do Repeater em um botão que adiciona um novo item no topo ao invés de no final.
// Inverte a lógica e ordem de criação de novo item do Repeater
add_action( 'admin_head', function () { ?>
<style>
/* CSS */
.cx-ui-repeater-item:first-child .cheryr-ui-repeater-content-box {
display: none;
}
@ofmarconi
ofmarconi / javascript.js
Created June 19, 2022 13:08
inside each .box copy the data-elementor-lightbox property of the element with the .elementor-custom-embed-image-overlay class and paste in the elements with the .title class inside that .box (by askjarvis.io)
const caixas = document.querySelectorAll('.caixa');
caixas.forEach(caixa => {
const dataElementorLightbox = caixa.querySelector('.elementor-custom-embed-image-overlay').getAttribute('data-elementor-lightbox');
const titles = caixa.querySelectorAll('.title');
titles.forEach(title => {
title.setAttribute('data-elementor-lightbox', dataElementorLightbox);
});
@ofmarconi
ofmarconi / javascript.js
Last active June 19, 2022 13:08
inside each .item when mouse hovers over element .trigger add .open class to .triggered element inside each .item when mouse moves over element .trigger remove .open class to .triggered element (by askjarvis.io)
var acionadores = document.querySelectorAll('.item .acionador');
for (var i = 0; i < acionadores.length; i++) {
acionadores[i].addEventListener('mouseover', function() {
this.parentNode.querySelector('.acionado').classList.add('aberto');
});
acionadores[i].addEventListener('mouseout', function() {
this.parentNode.querySelector('.acionado').classList.remove('aberto');
});
}
@ofmarconi
ofmarconi / functions.php
Last active June 19, 2022 13:08
Check if the upload file name contains .gif If it does, refuse to upload it to the media gallery (by askjarvis.io)
function wpse_check_file_type( $file ) {
$filetype = wp_check_filetype( $file['name'] );
$ext = $filetype['ext'];
$type = $filetype['type'];
$proper_filename = $file['name'];
$wp_filetype = wp_check_filetype( $proper_filename, null );
$ext = $wp_filetype['ext'];
$type = $wp_filetype['type'];
$proper_filename = preg_replace('/\.[^.]+$/', '', basename( $file['name'] ) );
$filename = $proper_filename . '.' . $ext;