// 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":12755,"date":"2017-11-20T22:22:55","date_gmt":"2017-11-20T21:22:55","guid":{"rendered":"http:\/\/diariocosta.com\/?p=12755"},"modified":"2017-11-20T22:23:09","modified_gmt":"2017-11-20T21:23:09","slug":"los-centros-coordinadores-del-061-reciben-un-12-mas-de-peticiones-de-asistencia-por-accidente-de-trafico-durante-este-ano-en-andalucia","status":"publish","type":"post","link":"https:\/\/diariocosta.com\/los-centros-coordinadores-del-061-reciben-un-12-mas-de-peticiones-de-asistencia-por-accidente-de-trafico-durante-este-ano-en-andalucia\/","title":{"rendered":"Los centros coordinadores del 061 reciben un 12% m\u00e1s de peticiones de asistencia por accidente de tr\u00e1fico durante este a\u00f1o en Andaluc\u00eda"},"content":{"rendered":"
\u200bLos\u00a0<\/span>centros coordinadores de urg<\/span>encias y emergencias de la Consejer\u00eda de Salud de la Junta de Andaluc\u00eda<\/span>, gestionados por la Empresa P\u00fablica de Emergencias Sanitarias<\/span>,<\/span>\u00a0atendieron\u00a0<\/span>de enero a octubre de este a\u00f1o\u00a0<\/span>24.918<\/span>\u00a0<\/span>peticiones de asistencia\u00a0<\/span>por accidente de tr\u00e1fico<\/span>, lo que ha supuesto un 12<\/span>% m\u00e1s de demandas por este motivo con respecto al mismo periodo del a\u00f1o anterior<\/span>\u00a0que tambi\u00e9n registr\u00f3 un incremento del 25%<\/span>. Por provincias<\/span>,<\/span>\u00a0el n\u00famero de\u00a0<\/span>solicitudes<\/span>\u00a0ha sido la\u00a0<\/span>siguiente:<\/span>2.4<\/span>69<\/span>\u00a0<\/span>en Almer\u00eda,\u00a0<\/span>3.<\/span>771<\/span>\u00a0<\/span>en C\u00e1diz,\u00a0<\/span>1.<\/span>563<\/span>\u00a0<\/span>en C\u00f3rdoba,<\/span>\u00a03.053<\/span>\u00a0en Granada,\u00a0<\/span>1.<\/span>281<\/span>\u00a0en Huelva,<\/span>\u00a01.1<\/span>74<\/span>\u00a0en Ja\u00e9n,\u00a0<\/span>5.457<\/span>\u00a0en M\u00e1laga y\u00a0<\/span>6.1<\/span>50<\/span>\u00a0en Sevilla.\u00a0<\/span>En cuanto al incremento de las demandas asistenciales por este motivo destaca<\/span>\u00a0la provincia de M\u00e1laga, con m\u00e1s de un 50% de incremento, seguidas de Huelva (9%)<\/span>, Granada<\/span>\u00a0(6%), C\u00e1diz<\/span>\u00a0<\/span>(5%), Almer\u00eda (3%) y Sevilla (2%).<\/span><\/p>\n \u200bDe las<\/span>\u00a0<\/span>2<\/span>4<\/span>.<\/span>9<\/span>1<\/span>8\u00a0<\/span>solicitudes de asistencia<\/span>\u00a0recibidas<\/span>\u00a0en los centros coordinadores,<\/span>fue necesaria la intervenci\u00f3n de los equipos sanitarios\u00a0<\/span>de urgencias y emergencias\u00a0<\/span>para la atenci<\/span>\u00f3n de los accidente<\/span>s de tr\u00e1fico en\u00a0<\/span>13.252<\/span>\u00a0ocasiones<\/span>, un\u00a0<\/span>9<\/span>% m\u00e1s que\u00a0<\/span>en 201<\/span>6<\/span>.<\/span>Para la atenci\u00f3n de estos accidentes de tr\u00e1fico, fueron activado<\/span>s<\/span>\u00a0e<\/span>n<\/span>\u00a0<\/span>7.859<\/span>\u00a0<\/span>ocasiones<\/span>\u00a0los dispositivos de cuidados cr<\/span>\u00edticos y urgencias<\/span>\u00a0y\u00a0<\/span>en\u00a0<\/span>5.393<\/span>\u00a0<\/span>casos<\/span>\u00a0los\u00a0<\/span>equipos d<\/span>e emergencia\u00a0<\/span>sanitarias del<\/span>\u00a0061, moviliz\u00e1ndose los<\/span>\u00a0helic\u00f3ptero<\/span>s<\/span>\u00a0sanitario<\/span>s<\/span>\u00a0<\/span>para asistir a<\/span>238<\/span>\u00a0<\/span>paciente<\/span>s<\/span>.<\/span><\/p>\n \u200bLos equipos asistenciales han atendido\u00a0<\/span>el 68<\/span>% de los casos en las provincias de Sevilla<\/span>\u00a0\u00a0(3.137), M\u00e1laga (3.687<\/span>)<\/span>\u00a0y<\/span>\u00a0C<\/span>\u00e1diz (2.1<\/span>68<\/span>). En volumen, le siguen las provincias de\u00a0<\/span>Granada (1.065),\u00a0<\/span>Ja\u00e9n<\/span>\u00a0(<\/span>879)<\/span>,\u00a0<\/span>y\u00a0<\/span>Almer\u00ed<\/span>a (868<\/span>), Huelva (7<\/span>99) y C\u00f3rdoba (655<\/span>).\u00a0<\/span>En cuanto a l<\/span>os motivos por los c<\/span>uales se ha solicitado la ayuda,\u00a0<\/span>destacan por su gravedad 250 casos por choque frontal o de gran violencia, siendo la mayor\u00eda motivados por\u00a0<\/span>accidentes por colisi\u00f3n de veh\u00edculos<\/span>\u00a0(4.4<\/span>97<\/span>)<\/span>,\u00a0<\/span>ca\u00eddas de motos y bicicletas\u00a0<\/span>(2.<\/span>399<\/span>)<\/span>,<\/span>atropellos (1.82<\/span>7<\/span>) y salidas de v\u00eda (<\/span>1<\/span>.<\/span>339<\/span>)<\/span>.<\/span><\/p>\n \u200bCon motivo del D\u00eda Mundial de R<\/span>ecuerdo a las\u00a0<\/span>V\u00edctimas de Accidentes de T<\/span>r\u00e1fico, la Empresa P\u00fablica de Emergencias Sanitarias recomienda a las personas que pued<\/span>an encontrarse ante estos casos seguir unas pautas b\u00e1sicas como \u00a0protegerse y proteger a los heridos, se\u00f1al<\/span>izando<\/span>\u00a0la\u00a0<\/span>zona;<\/span>\u00a0apagar\u00a0<\/span>bien su coche y avisar<\/span>\u00a0a los dem\u00e1s conductores<\/span>, as\u00ed como apagar el motor del veh\u00edculo accidentado,\u00a0<\/span>y ante posibles heridos<\/span>,<\/span>\u00a0alertar al servicio 112 o al 061, ya que la r\u00e1pida actuaci\u00f3n de quienes presencian una situaci\u00f3n cr\u00edtica incrementa las posibilidades de salvar la vida de los afectados o paliar en gran medida las secuelas que puedan padecer.\u00a0<\/span><\/p>\n \n Recursos del 061 en Andaluc\u00eda<\/span><\/strong><\/p>\n \u200bLa plantilla asistencial para la atenci\u00f3n de las emergenci<\/span>as en la comunidad asciende a 6<\/span>7<\/span>3<\/span>\u00a0profesionales distribuidos en tres categor\u00edas, m\u00e9dic<\/span>os (260), enfermeros (212<\/span>) y t\u00e9cnicos de emergencias (20<\/span>1<\/span>). El servicio de emergencias sanitarias dispone para la atenci\u00f3n sanitaria a las emergencias de 30 equipos asistenciales compuestos de personal m\u00e9dico, de enfermer\u00eda y t\u00e9cnico de emergencias dotados de UVI m\u00f3viles equipadas para la atenci\u00f3n sanitaria in situ. Adem\u00e1s cuenta con 5 helic\u00f3pteros medicalizados con personal m\u00e9dico y de enfermer\u00eda, 5 equipos de coordinaci\u00f3n avanzada (ECA) con profesionales de enfermer\u00eda y t\u00e9cnicos de emergencias<\/span>, tres con base en M\u00e1laga y dos en Sevilla,<\/span>\u00a0as\u00ed como con una unidad de soporte vital b\u00e1sico<\/span>\u00a0(SVB)<\/span>\u00a0ubicada en Sevilla<\/span>, 14 equipos de traslado de pacientes cr\u00edticos y 9 veh\u00edculos de apoyo log\u00edstico<\/span>\u00a0(VAL)<\/span>\u00a0para su movilizaci\u00f3n en situaciones de cat\u00e1strofe o accidentes con m\u00faltiples v\u00edctimas.<\/span>\u00a0uno por provincia m\u00e1s otro ubicado en el Campo de Gibraltar y cinco helic\u00f3pteros medicalizados, ubicados en Sevilla, C\u00e1diz, M\u00e1laga, Baza (Granada) y C\u00f3rdoba.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":" \u200bLos\u00a0centros coordinadores de urgencias y emergencias de la Consejer\u00eda de Salud de la Junta de Andaluc\u00eda, gestionados por la Empresa P\u00fablica de Emergencias Sanitarias,\u00a0atendieron\u00a0de enero a octubre de este a\u00f1o\u00a024.918\u00a0peticiones de asistencia\u00a0por accidente de tr\u00e1fico, lo que ha supuesto un 12% m\u00e1s de demandas por este motivo con respecto al mismo periodo del a\u00f1o anterior\u00a0que […]<\/p>\n","protected":false},"author":3,"featured_media":12754,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":{"0":"post-12755","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\/12755","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=12755"}],"version-history":[{"count":0,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/posts\/12755\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/media\/12754"}],"wp:attachment":[{"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/media?parent=12755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/categories?post=12755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diariocosta.com\/wp-json\/wp\/v2\/tags?post=12755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}