PageSourceSearch

https://carlosgalan.net/wp-content/cache/min/1/wp-content/plugins/…/assets/js/newjavascript.js?ver=1790006005

js carlosgalan.net collected 2026-10-04 01:50:19 UTC 9,627 bytes, 20 lines download raw bytes

1var investmentsData;var interestData;var patrimonyData;var initialInvestment;var interest_lastvalue;var investments_lastvalue;var years;var investmentChart;var investmentChartCircle;document.getElementById('investment-duration').addEventListener('input',function(e){let value=parseInt(e.target.value);if(value>100){}});document.getElementById('interest-rate').addEventListener('input',function(e){let value=parseInt(e.target.value);if(value>50){}});document.getElementById('calculate-button').addEventListener('click',calculate);function calculate(){const initialInvestment=parseFloat(document.getElementById('initial-investment').value.replace(/\./g,''),10)||0;const monthlyContribution=parseFloat(document.getElementById('monthly-contribution').value.replace(/\./g,''),10)||0;const investmentDuration=parseInt(document.getElementById('investment-duration').value)||0;const interestRate=parseFloat(document.getElementById('interest-rate').value)||0;if(!initialInvestment||!investmentDuration||!interestRate){event.preventDefault();alert("Por favor, complete todos los campos obligatorios.");if(!initialInvestment){document.getElementById("initial-investment").setProperty('border-color','red','!important')}else{document.getElementById("initial-investment").setProperty('border-color','','!important')}
2if(!investmentDuration){document.getElementById("investment-duration").setProperty('border-color','red','!important')}else{document.getElementById("investment-duration").setProperty('border-color','','!important')}
3if(!interestRate){document.getElementById("interest-rate").setProperty('border-color','red','!important')}else{document.getElementById("interest-rate").setProperty('border-color','','!important')}}else{document.querySelectorAll('.result-pie').forEach(function(element){element.style.display='block'});document.querySelectorAll('#investmentChart').forEach(function(element){element.style.display='block'});const yearlyContribution=monthlyContribution*12;const investments=[];for(let year=1;year<=investmentDuration;year++){const totalInvestment=yearlyContribution+initialInvestment;const interest=totalInvestment*interestRate/100;const finalValue=totalInvestment+interest;if(year===1){investments.push({año:year,inversión:totalInvestment,interés:interest/100,patrimonio:finalValue});var caluclate1=(yearlyContribution+finalValue)*interestRate/100;var caluclate=parseFloat(caluclate1.toFixed())+interest/100;var caluclate2=interest+parseFloat(caluclate1.toFixed());var newtotalInvestment=yearlyContribution+totalInvestment;var newone=parseFloat(caluclate1.toFixed())+yearlyContribution+finalValue}else{investments.push({año:year,inversión:newtotalInvestment,interés:caluclate2/100,patrimonio:newone});var newtotalInvestment=newtotalInvestment+yearlyContribution;var caluclate1=(newone+yearlyContribution)*interestRate/100;var caluclate=Math.floor(caluclate1+interest/100);var caluclate2=Math.floor(caluclate2)+caluclate1;var newone=parseFloat(caluclate2.toFixed())+newtotalInvestment}}
4const tableBody=document.getElementById('investment-table');tableBody.innerHTML='';const thead=document.createElement('thead');const headerRow=document.createElement('tr');thead.style.backgroundColor='#f4f4f4';const yearHeader=document.createElement('th');yearHeader.textContent='Año';headerRow.appendChild(yearHeader);const investmentHeader=document.createElement('th');let content='Inversión Inicial + \nAportación acumulada';investmentHeader.innerHTML=content.replace('\n','<br>');headerRow.appendChild(investmentHeader);const interestHeader=document.createElement('th');interestHeader.textContent='Interés acumulado';headerRow.appendChild(interestHeader);const patrimonyHeader=document.createElement('th');patrimonyHeader.textContent='Patrimonio';headerRow.appendChild(patrimonyHeader);thead.appendChild(headerRow);const table=document.querySelector('table');table.prepend(thead);investments.forEach((investment,index)=>{const row=document.createElement('tr');if(index%2===1){row.classList.add('alternate-row')}
5const yearCell=document.createElement('td');yearCell.textContent=investment.año;row.appendChild(yearCell);
5const investmentCell=document.createElement('td');investmentCell.textContent=`${parseFloat(investment.inversión.toFixed()).toLocaleString('de-DE')}€`;row.appendChild(investmentCell);const interestCell=document.createElement('td');interestCell.textContent=`${parseFloat((investment.interés * 100).toFixed()).toLocaleString('de-DE')}€`;row.appendChild(interestCell);const patrimonyCell=document.createElement('td');patrimonyCell.textContent=`${parseFloat(investment.patrimonio.toFixed()).toLocaleString('de-DE')}€`;row.appendChild(patrimonyCell);tableBody.appendChild(row)});const years=investments.map(inv=>inv.año);const investmentsData=investments.map(inv=>inv.inversión);const interestData=investments.map(inv=>inv.interés*100);const patrimonyData=investments.map(inv=>inv.patrimonio);var investments_lastvalue=investmentsData[investmentsData.length-1];var interest_lastvalue=interestData[interestData.length-1];var patrimony_lastvalue=patrimonyData[patrimonyData.length-1];var investmentDetailsSpan=document.getElementById("investment_details");
5var final_out=document.getElementById("final");const total=initialInvestment+interest_lastvalue+investments_lastvalue-initialInvestment;final_out.innerHTML=`<h2 >En<b> ${investmentDuration} </b> años, tendrás un Capital Final de <b>${parseFloat(total.toFixed()).toLocaleString('de-DE')}€.</b> </h2>
6   <p style="font-size:14px">Si inviertes <b>${parseFloat(initialInvestment.toFixed()).toLocaleString('de-DE')} € </b>inicialmente, e inviertes <b>${parseFloat(monthlyContribution.toFixed()).toLocaleString('de-DE')} € </b>cada mes, durante <b>${investmentDuration} años</b>, con una rentabilidad del<b> ${interestRate} %</b> anual, gracias al interés compuesto, tendrás <b>${parseFloat(total.toFixed()).toLocaleString('de-DE')} €</b></p></div>
7`;investmentDetailsSpan.innerHTML=`
8<div>
9  <span id="color-1">1</span>&nbsp;<b>Inversión Inicial:</b> ${parseFloat(initialInvestment.toFixed()).toLocaleString('de-DE')}€<br>
10  <span id="color-2">2</span>&nbsp;<b>Aportación acumulada:</b> ${parseFloat((investments_lastvalue - initialInvestment).toFixed()).toLocaleString('de-DE')}€<br>
11<span id="color-3">3</span>&nbsp;<b>Interés acumulado:</b> ${parseFloat(interest_lastvalue.toFixed()).toLocaleString('de-DE')}€<br>
12<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Capital Final : </b>${parseFloat(total.toFixed()).toLocaleString('de-DE')}€  
13<hr style='margin-bottom: 20px;margin-top: 20px;'>
14  
15`;if(investmentChart){investmentChart.destroy()}
16if(investmentChartCircle){investmentChartCircle.destroy()}
17const ctx=document.getElementById('investmentChart').getContext('2d');const initialInvestmentArray=years.map(year=>initialInvestment);investmentChart=new Chart(ctx,{type:'bar',data:{labels:years.map((_,index)=>index+1),datasets:[{label:'Inversión Inicial',data:initialInvestmentArray,backgroundColor:'#ffbc00',hoverBackgroundColor:'#ff8c00',},{label:'Aportación acumulada',data:investmentsData.map(value=>value-initialInvestment),backgroundColor:'#e6a800',hoverBackgroundColor:'#e28f00',},{label:'Interés acumulado',data:interestData,backgroundColor:'#a86d00',hoverBackgroundColor:'#9c6100',}],},options:{responsive:!0,plugins:{legend:{display:!0,position:'top',labels:{display:!0,font:{size:18,},},},tooltip:{enabled:!0,mode:'index',backgroundColor:'white',titleColor:'black',bodyColor:'black',titleFont:{size:16,weight:'bold',},bodyFont:{size:16,weight:'normal',},callbacks:{title:function(tooltipItems){return'Año '+tooltipItems[0].label},label:function(tooltipItem){const valueFormatted=new Intl.NumberFormat('de-DE',{style:'currency',currency:'EUR',minimumFractionDigits:0,maximumFractionDigits:0}).format(tooltipItem.raw);return tooltipItem.dataset.label+': '+valueFormatted}}}},scales:{x:{stacked:!0,min:1,},y:{stacked:!0,ticks:{callback:function(value){return new Intl.NumberFormat('de-DE').format(value)}}}}}});const ctx2=document.getElementById('investmentChart_circle').getContext('2d');investmentChartCircle=new Chart(ctx2,{type:'pie',data:{labels:['Inversión Inicial','Aportación acumulada','Interés acumulado'],datasets:[{data:[initialInvestment,investments_lastvalue-initialInvestment,interest_lastvalue],backgroundColor:['#ffbc00','#e6a800','#a86d00'],}]},options:{plugins:{legend:{display:!1,position:'top',},tooltip:{enabled:!0,mode:'index',backgroundColor:'white',titleColor:'black',bodyColor:'black',titleFont:{size:20,}
17,bodyFont:{size:20,},callbacks:{label:function(tooltipItem){return new Intl.NumberFormat('de-DE',{style:'currency',currency:'EUR',minimumFractionDigits:0,maximumFractionDigits:0}).format(tooltipItem.raw)}}}}}})}};calculate();function formatToSpanish(input){let value=input.value.replace(/\./g,'');value=value.replace(',','.');if(value.trim()!==""){let formattedValue=Number(value).toLocaleString('de-DE');input.value=formattedValue}}
18function handleInput(event){const input=event.target;if(!/^\d*[,]?\d*$/.test(input.value)){input.value=input.value.replace(/[^0-9,]/g,'')}
19formatToSpanish(input)}
20const investedInput=document.getElementById("initial-investment");const monthlyContributionInput=document.getElementById("monthly-contribution");const investmentDurationInput=document.getElementById("investment-duration");const interestRateInput=document.getElementById("interest-rate");[investedInput,monthlyContributionInput,investmentDurationInput,interestRateInput].forEach(input=>{input.setAttribute('inputmode','numeric');input.addEventListener('input',handleInput)})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.