// Función de debounce para optimizar el rendimiento function debounce(func, wait) { let timeout; return function executedFunction(...args) { const later = () => { clearTimeout(timeout); func(...args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; } jQuery(document).ready(function($) { // Initialize color pickers $('.color-picker').wpColorPicker({ change: function(event, ui) { updateStyles(); } }); // Initialize html2canvas var script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js'; document.head.appendChild(script); script.onload = function() { console.log('html2canvas loaded'); $('.download-jpg').prop('disabled', false); }; // Optimized zoom handling const handleZoom = debounce(function(target, value) { const zoomValue = value/100; const template = $(target).closest('.preview-box').find('.sunset-template'); template.css('transform', `scale(${zoomValue})`); }, 16); // Zoom control event listener $('.zoom-range').on('input', function() { const value = $(this).val(); $(this).siblings('.zoom-value').text(value + '%'); handleZoom(this, value); }); // Toggle excerpt position field visibility $('#cwpai_show_excerpt').on('change', function() { $('#excerpt_position').toggle(this.checked); updateStyles(); }); // Update styles function function updateStyles() { const lineColor = $('#cwpai_line_color').val(); const lineWidth = $('#cwpai_line_width').val() + 'px'; const marginTop = $('#cwpai_line_margin_top').val() + 'px'; const marginBottom = $('#cwpai_line_margin_bottom').val() + 'px'; const marginLeft = $('#cwpai_line_margin_left').val() + 'px'; const marginRight = $('#cwpai_line_margin_right').val() + 'px'; const categoryTop = $('#cwpai_category_position_top').val() + 'px'; const websiteTop = $('#cwpai_website_position_top').val() + 'px'; const titleTop = $('#cwpai_title_position_top').val() + 'px'; const excerptTop = $('#cwpai_excerpt_position_top').val() + 'px'; const categoryLeft = $('#cwpai_category_position_left').val() + 'px'; const websiteLeft = $('#cwpai_website_position_left').val() + 'px'; const titleLeft = $('#cwpai_title_position_left').val() + 'px'; const titleSize = $('#cwpai_title_font_size').val() + 'px'; const categorySize = $('#cwpai_category_font_size').val() + 'px'; const websiteSize = $('#cwpai_website_font_size').val() + 'px'; // Update visibility states const showCategory = $('#cwpai_show_category').prop('checked'); const showWebsite = $('#cwpai_show_website').prop('checked'); const showTitle = $('#cwpai_show_title').prop('checked'); const showExcerpt = $('#cwpai_show_excerpt').prop('checked'); $('.vertical-line').css({ 'background-color': lineColor, 'width': lineWidth, 'top': marginTop, 'height': `calc(100% - (${marginTop} + ${marginBottom}))`, 'left': marginLeft, 'margin-right': marginRight }); $('.category-tag').css({ 'display': showCategory ? 'block' : 'none', 'top': categoryTop, 'left': categoryLeft, 'font-size': categorySize }); $('.website-link').css({ 'display': showWebsite ? 'block' : 'none', 'top': websiteTop, 'left': websiteLeft, 'font-size': websiteSize }); $('.title').css({ 'display': showTitle ? 'block' : 'none', 'top': titleTop, 'left': titleLeft, 'font-size': titleSize }); $('.excerpt-preview').css({ 'display': showExcerpt ? 'block' : 'none', 'top': excerptTop, 'left': titleLeft }); } // Copy buttons functionality with improved feedback $('.copy-excerpt, .copy-hashtags').on('click', function() { const button = $(this); const content = button.data('content'); const originalText = button.text(); // Create temporary textarea const textarea = document.createElement('textarea'); textarea.value = content; textarea.style.position = 'absolute'; textarea.style.left = '-9999px'; document.body.appendChild(textarea); try { // Select and copy text textarea.select(); document.execCommand('copy'); // Visual feedback button.text('¡Copiado!'); button.css('background-color', '#4CAF50'); // Reset button after delay setTimeout(() => { button.text(originalText); button.css('background-color', ''); }, 2000); } catch(err) { console.error('Error al copiar:', err); button.text('Error al copiar'); button.css('background-color', '#f44336'); setTimeout(() => { button.text(originalText); button.css('background-color', ''); }, 2000); } finally { document.body.removeChild(textarea); } }); // Canvas optimization function function optimizeCanvas(canvas, format) { const ctx = canvas.getContext('2d'); // Enable image smoothing ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = 'high'; // Set dimensions based on format switch(format) { case 'rectangular': canvas.width = 1200; canvas.height = 630; break; case 'vertical': canvas.width = 500; canvas.height = 890; break; case 'horizontal': canvas.width = 864; canvas.height = 864; break; } return canvas; } // Image download functionality with improved error handling $('.download-jpg').on('click', function() { const button = $(this); const format = button.data('format'); const template = button.closest('.preview-box').find('.sunset-template')[0]; // Disable button and show loading state button.text('Generando...').prop('disabled', true); const options = { scale: 2, // Higher quality useCORS: true, allowTaint: true, backgroundColor: '#000000', logging: false, // Disable logging in production onclone: function(clonedDoc) { const clonedElement = clonedDoc.querySelector('.sunset-template'); if (clonedElement) { // Reset zoom for export clonedElement.style.transform = 'scale(1)'; // Set dimensions based on format switch(format) { case 'rectangular': clonedElement.style.width = '1200px'; clonedElement.style.height = '630px'; break; case 'vertical': clonedElement.style.width = '500px'; clonedElement.style.height = '890px'; break; case 'horizontal': clonedElement.style.width = '864px'; clonedElement.style.height = '864px'; break; } } } }; // Wait for all images to load Promise.all(Array.from(template.getElementsByTagName('img')).map(img => { return new Promise((resolve, reject) => { if (img.complete) { resolve(); } else { img.onload = resolve; img.onerror = reject; } }); })) .then(() => { return html2canvas(template, options); }) .then(canvas => { // Optimize canvas canvas = optimizeCanvas(canvas, format); // Convert to blob return new Promise((resolve, reject) => { canvas.toBlob(resolve, 'image/jpeg', 0.95); }); }) .then(blob => { // Generate filename const postTitle = template.dataset.title; const timestamp = new Date().getTime(); const fileName = `${postTitle}-${format}-${timestamp}.jpg`; // Save file saveAs(blob, fileName); // Reset button button.text('Descargar ' + ( format === 'vertical' ? 'Vertical' : format === 'horizontal' ? 'Horizontal' : 'Rectangular' )).prop('disabled', false); }) .catch(error => { console.error('Error:', error); button.text('Error - Intentar de nuevo').prop('disabled', false) .css('background-color', '#f44336'); setTimeout(() => { button.css('background-color', ''); button.text('Descargar ' + ( format === 'vertical' ? 'Vertical' : format === 'horizontal' ? 'Horizontal' : 'Rectangular' )); }, 3000); }); }); // Line and position controls $('#cwpai_line_width, #cwpai_line_margin_top, #cwpai_line_margin_bottom, #cwpai_line_margin_left, #cwpai_line_margin_right, #cwpai_category_position_top, #cwpai_website_position_top, #cwpai_title_position_top, #cwpai_excerpt_position_top, #cwpai_category_position_left, #cwpai_website_position_left, #cwpai_title_position_left, #cwpai_title_font_size, #cwpai_category_font_size, #cwpai_website_font_size') .on('change input', debounce(updateStyles, 100)); // Visibility controls $('#cwpai_show_category, #cwpai_show_website, #cwpai_show_title, #cwpai_show_excerpt') .on('change', updateStyles); // Global error handler window.onerror = function(msg, url, lineNo, columnNo, error) { console.error('Error: ', { message: msg, url: url, lineNumber: lineNo, columnNumber: columnNo, error: error }); return false; }; // Initial styles update updateStyles(); });
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/diariocosta.com/httpdocs/wp-content/plugins/social-media-stories/social-media-stories.php:1) in /var/www/vhosts/diariocosta.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":13252,"date":"2018-01-21T13:24:56","date_gmt":"2018-01-21T12:24:56","guid":{"rendered":"http:\/\/diariocosta.com\/?p=13252"},"modified":"2018-01-21T13:25:21","modified_gmt":"2018-01-21T12:25:21","slug":"andalucia-contara-con-un-codigo-de-autorregulacion-para-el-sector-inmobiliario","status":"publish","type":"post","link":"https:\/\/diariocosta.com\/andalucia-contara-con-un-codigo-de-autorregulacion-para-el-sector-inmobiliario\/","title":{"rendered":"Andaluc\u00eda contar\u00e1 con un c\u00f3digo de autorregulaci\u00f3n para el sector inmobiliario"},"content":{"rendered":"

Andalu<\/span>c\u00eda se convierte en la primera c<\/span>omunidad\u00a0<\/span>a<\/span>ut\u00f3noma en disponer de un modelo de c\u00f3digo de este tipo en el sector inmobiliario, que pretende convertirse en referencia y protecci\u00f3n de los leg\u00edtimos intereses econ\u00f3micos y sociales de las personas consumidoras y proporcionar a las empresas y profesionales del sector una \u00fatil herramienta de trabajo.\u00a0<\/span>La secretaria general de Salud P\u00fablica y Consumo, Josefa Ruiz, ha participado<\/span>\u00a0<\/span>esta ma\u00f1ana<\/span>\u00a0en la presentaci\u00f3n del C\u00f3digo Andaluz de Calidad Inmobiliaria, una iniciativa\u00a0<\/span>de autorregulaci\u00f3n\u00a0<\/span>impulsada por\u00a0<\/span>el propio sector empresarial que<\/span>\u00a0tiene como objeto constituir una gu\u00eda para unificar criterios y mejorar la calidad de los servicios profesionales de intermediaci\u00f3n inmobiliaria.\u00a0<\/span><\/p>\n

La iniciativa, que parti<\/span>\u00f3 desde las prop<\/span>ias empresas y profesionales del sector de la intermediaci\u00f3n inmobiliaria,\u00a0<\/span>encabezados por Unexia,\u00a0<\/span>ha contado con la colaboraci\u00f3n de la Direcci\u00f3n General de Consumo de la Junta de Andaluc\u00eda que ha realizado diferentes aportaciones t\u00e9cnicas para completar el documento.<\/span>\u00a0<\/span>Como ha indicado la secretaria general, \u201cla Junta de Andaluc\u00eda ha querido formar parte de la iniciativa desde su inicio, por entender que es un proyecto de gran inter\u00e9s que va a contribuir a mejorar la calidad de los servicios profesionales de intermediaci\u00f3n inmobiliaria, y con ello, a proteger los intereses de las personas consumidoras y usuarias en este \u00e1mbito.\u201d<\/span><\/p>\n

Con este fin, e<\/span>l C\u00f3digo, de adhesi\u00f3n voluntaria, cuenta con veinte art\u00edculos que incluyen protocolos de actuaci\u00f3n, requisitos de la publicidad comercial, informaci\u00f3n a\u00a0<\/span>personas consumidoras<\/span>, forma de adhesi\u00f3n o resoluci\u00f3n de conflictos a trav\u00e9s de procedimientos de mediaci\u00f3n y arbitrajes de derecho.\u00a0<\/span><\/p>\n

Entre los aspectos m\u00e1s novedosos, se incluye la obligaci\u00f3n para las empresas adheridas de informar detalladamente de los honorarios que se devengar\u00e1n por el servicio prestado y el IVA correspondiente. Por otra parte, el c\u00f3digo disminuye a\u00a0<\/span>cinco<\/span>\u00a0d\u00edas el tiempo m\u00e1ximo para responder por parte de la empresa a una posible hoja de quejas y reclamaciones, frente al plazo m\u00e1ximo legalmente establecido de 10 d\u00edas h\u00e1biles.<\/span><\/p>\n

Asimismo, las empresas deber\u00e1n estar adheridas al sistema de notificaci\u00f3n administrativa electr\u00f3nica, as\u00ed como al Sistema Arbitral de Consumo, lo que ofrece una garant\u00eda adicional a las personas consumidoras y usuarias, que pueden optar a una v\u00eda alternativa a la judicial para la resoluci\u00f3n de los posibles conflictos que pudieran surgir.<\/span><\/p>\n

Otra de las novedades garantistas m\u00e1s destacadas del c\u00f3digo para las empresas que se adhieran al mismo es la p\u00f3liza de seguro de responsabilidad civil por un m\u00ednimo de 600.000 euros que garantice los da\u00f1os y perjuicios que puedan causar durante el ejercicio de su actividad y el seguro de cauci\u00f3n por las cantidades entregadas a cuenta por importe m\u00ednimo de 10.000 euros.\u00a0<\/span><\/p>\n

El C\u00f3digo Andaluz de Calidad Inmobiliaria ha sido promovido por la Asociaci\u00f3n Profesional de Expertos Inmobiliarios, Habitale, el Colegio Profesional de Agentes de la Propiedad Inmobiliaria de Sevilla y la asociaci\u00f3n empresarial Unexia Andaluc\u00eda.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

Andaluc\u00eda se convierte en la primera comunidad\u00a0aut\u00f3noma en disponer de un modelo de c\u00f3digo de este tipo en el sector inmobiliario, que pretende convertirse en referencia y protecci\u00f3n de los leg\u00edtimos intereses econ\u00f3micos y sociales de las personas consumidoras y proporcionar a las empresas y profesionales del sector una \u00fatil herramienta de trabajo.\u00a0La secretaria general […]<\/p>\n","protected":false},"author":3,"featured_media":13251,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":{"0":"post-13252","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-andalucia"},"_links":{"self":[{"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/posts\/13252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/comments?post=13252"}],"version-history":[{"count":0,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/posts\/13252\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/media\/13251"}],"wp:attachment":[{"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/media?parent=13252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/categories?post=13252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/tags?post=13252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}