PageSourceSearch

https://www.winkworth.co.uk/dist/mortgage-calculator.3a3d13d45bd379bb5fd2.js

js winkworth.co.uk collected 2026-10-02 05:00:57 UTC 3,762 bytes, 2 lines download raw bytes

1(window.webpackJsonpDelete=window.webpackJsonpDelete||[]).push([[64],{685:function(t,e,s){},854:function(t,e,s){"use strict";s.r(e),s(685);var i=s(0),r=s(46),n=s(12),a=s(39);function o(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const l=/[^0-9\.]+/g;class u extends i.a{constructor(){super(...arguments),o(this,"_formatInput",t=>{const e=t.value;t.value=Object(a.b)(e),t.addEventListener("input",this._handleInputChange)}),o(this,"_formatDecimalInput",t=>{const e=t.value;t.value=parseFloat(e).toFixed(2),t.addEventListener("input",this._handleInterestChange)}),o(this,"_handleInputChange",t=>{const{value:e}=t.target;if(e.startsWith("0"))return void(t.target.value="");const s=e.replace(/[^0-9]/g,"");s.startsWith("-")?t.target.value="":t.target.value=Object(a.b)(s.substring(0,10))}),o(this,"_handleInterestChange",t=>{let{value:e}=t.target;if(e=e.replace(/[^0-9\.]/g,""),e>99.99)t.target.value="99.99";else{if(e.includes(".")){const[s,i]=e.split(".");if(i.length>2)return void(t.target.value="".concat(s,".").concat(i.substring(0,2)))}t.target.value=e}}),o(this,"_onBack",()=>{this._showForm()}),o(this,"_onSubmit",t=>{t.preventDefault(),this._showResultsIfValid()}),this.gtm=this.options.gtm||{}}static getNamespace(){return"mortgage-calculator"}static getRequiredRefs(){return["form","price","deposit","interest","duration","monthly","interestOnly","back"]}get price(){return this.refs.price.value}get deposit(){return this.refs.deposit.value}get interest(){return this.refs.interest.value}get duration(){return this.refs.duration.value}get loanAmount(){return Number(this.price.replace(l,""))-Number(this.deposit.replace(l,""))}set monthly(t){this.refs.monthly.value=t}set interestOnly(t){this.refs.interestOnly.value=t}onInit(){this.addListener(this.refs.form,"submit",this._onSubmit),this.addListener(this.refs.back,"click",this._onBack),this._initInputs()}_initInputs(){this._formatInput(this.refs.price),this._formatInput(this.refs.deposit),this._formatDecimalInput(this.refs.interest)}_showResultsIfValid(){const t=this.interest,e=this.duration,s=this.loanAmount;if(s<0)return void this._showError("Your deposit can't be more than the property price.");const i=this._getInputErrors(t,s);if(i.length>0)return void this._showErrors(i);const r=this._getMonthlyPayment(t,e,s);Number.isNaN(r)?this._showError("Please enter numbers only"):(this.monthly=Object(a.a)(r),this.interestOnly=Object(a.a)(this._getInterest(t,s)),this._showResults())}_showResults(){this.element.classList.add("is-results-visible"),n.a.send(null,{action:"Mortgage calculator",label:"Mortgage calculator"}),this._handleCustomActivityTracking()}_showForm(){this.element.classList.remove("is-results-visible")}_getInputErrors(t,e){const s=[];return t<0?s.push("The interest rate needs to be positive."):""!==t&&0!==t||s.push("The interest rate needs to be filled in."),e<0?s.push("The loan amount needs to be positive."):""!==e&&0!==e||s.push("The loan amount needs to be filled in."),s}_getMonthlyPayment(t,e,s){const i=t/1200,r=12*e;return(i*s/(1-Math.pow(1+i,-1*r))).toFixed(2)}_getInterest(t,e){return(t*e/1200).toFixed(2)}_showErrors(t){this._showError(t.join(", "))}_showError(t){alert(t)}_handleCustomActivityTracking(){const t=document.querySelector("[data-dc-custom-activity-logger][data-page-level]");if(t){const{detailId:e,itemId:s,valueString:i}=t.dataset,n={PropertyPrice:this.price,Deposit:this.deposit,InterestRate:this.interest,PaidBack:this.duration},a={activityTitle:"Calculated Mortgage",activityType:"CalculatedMortgage",detailId:e,itemId:s,valueString:r.a.addItemsToValueString(i,n)};r.a.send(a)}}}i.c.register(u)}},[[854,0,1]]]);
2//# sourceMappingURL=mortgage-calculator.3a3d13d45bd379bb5fd2.js.map

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.