├── assets ├── css │ └── main.min.css ├── fonts │ ├── inter-v12-latin-500.woff2 │ ├── inter-v12-latin-600.woff2 │ ├── inter-v12-latin-800.woff2 │ └── inter-v12-latin-regular.woff2 ├── images │ ├── apple-touch-icon.png │ ├── banner-1544x500.png │ ├── banner-772x250.png │ ├── compounding-frequency.png │ ├── favicon.ico │ ├── icon-128.png │ ├── icon-128x128.png │ ├── icon-16.png │ ├── icon-192.png │ ├── icon-196.png │ ├── icon-256x256.png │ ├── icon-32.png │ ├── icon-48.png │ ├── icon-96.png │ ├── icon-og.png │ ├── icon-rounded.png │ ├── icon-square.png │ ├── illustration-1.png │ ├── illustration-1.svg │ ├── illustration-and.png │ ├── illustration-and.svg │ ├── illustration-els.png │ ├── illustration-els.svg │ ├── illustration-og.png │ ├── screenshot-1.png │ └── screenshot-2.png └── js │ ├── all-calculators.js │ ├── app.js │ ├── calculator.js │ ├── chart.js │ ├── datepicker.js │ ├── dialog-table.js │ ├── dropdown-icon.js │ ├── fractions.js │ ├── functions.js │ ├── hourpicker.js │ ├── lib │ ├── air-datepicker.js │ ├── chartjs │ │ ├── chart.js │ │ ├── chart.js.map │ │ ├── chart.min.js │ │ ├── chart.umd.js │ │ ├── chart.umd.js.map │ │ ├── chunks │ │ │ ├── helpers.core.d.ts │ │ │ ├── helpers.segment.js │ │ │ └── helpers.segment.js.map │ │ ├── helpers.d.ts │ │ ├── helpers.js │ │ ├── helpers.js.map │ │ └── types.d.ts │ ├── input-mask.min.js │ ├── katex │ │ ├── auto-render.min.js │ │ ├── fonts │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ │ ├── KaTeX_Main-BoldItalic.woff │ │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ ├── katex.min.css │ │ └── katex.min.js │ ├── lazysizes.min.js │ └── math.min.js │ ├── mask.js │ ├── module.js │ ├── options.js │ ├── themes.js │ └── timepicker.js ├── ci_interest_calculator.php ├── index.html ├── plugin.php ├── readme.md └── readme.txt /assets/fonts/inter-v12-latin-500.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/fonts/inter-v12-latin-500.woff2 -------------------------------------------------------------------------------- /assets/fonts/inter-v12-latin-600.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/fonts/inter-v12-latin-600.woff2 -------------------------------------------------------------------------------- /assets/fonts/inter-v12-latin-800.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/fonts/inter-v12-latin-800.woff2 -------------------------------------------------------------------------------- /assets/fonts/inter-v12-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/fonts/inter-v12-latin-regular.woff2 -------------------------------------------------------------------------------- /assets/images/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/apple-touch-icon.png -------------------------------------------------------------------------------- /assets/images/banner-1544x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/banner-1544x500.png -------------------------------------------------------------------------------- /assets/images/banner-772x250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/banner-772x250.png -------------------------------------------------------------------------------- /assets/images/compounding-frequency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/compounding-frequency.png -------------------------------------------------------------------------------- /assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/favicon.ico -------------------------------------------------------------------------------- /assets/images/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-128.png -------------------------------------------------------------------------------- /assets/images/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-128x128.png -------------------------------------------------------------------------------- /assets/images/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-16.png -------------------------------------------------------------------------------- /assets/images/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-192.png -------------------------------------------------------------------------------- /assets/images/icon-196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-196.png -------------------------------------------------------------------------------- /assets/images/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-256x256.png -------------------------------------------------------------------------------- /assets/images/icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-32.png -------------------------------------------------------------------------------- /assets/images/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-48.png -------------------------------------------------------------------------------- /assets/images/icon-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-96.png -------------------------------------------------------------------------------- /assets/images/icon-og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-og.png -------------------------------------------------------------------------------- /assets/images/icon-rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-rounded.png -------------------------------------------------------------------------------- /assets/images/icon-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/icon-square.png -------------------------------------------------------------------------------- /assets/images/illustration-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/illustration-1.png -------------------------------------------------------------------------------- /assets/images/illustration-and.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/illustration-and.png -------------------------------------------------------------------------------- /assets/images/illustration-els.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/illustration-els.png -------------------------------------------------------------------------------- /assets/images/illustration-og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/illustration-og.png -------------------------------------------------------------------------------- /assets/images/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/screenshot-1.png -------------------------------------------------------------------------------- /assets/images/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pub-calculator-io/interest-calculator/96048f551bd19e68e23e3a306dee25c98f3aa901/assets/images/screenshot-2.png -------------------------------------------------------------------------------- /assets/js/app.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | window._ = document.getElementById.bind(document); 4 | window.$ = document.querySelector.bind(document); 5 | window.$$ = document.querySelectorAll.bind(document); 6 | 7 | console.log('Script is OK! ༼ つ ◕_◕ ༽つ') 8 | // IS MAIN PAGE 9 | // if(window.location.pathname === '/') document.body.classList.add('isMainPage') 10 | 11 | // DIALOG TABLE 12 | if(document.querySelector('.result-table__dialog')) { 13 | import('./dialog-table.js').then(e => { 14 | console.log("Dialog table loaded (づ ◕‿◕ )づ") 15 | }).catch(e => { 16 | console.log("Sorry, dialog tables not loaded (ಥ﹏ಥ)", e) 17 | }) 18 | } 19 | // MASK 20 | if(document.querySelector('[data-inputmask]')) { 21 | import('./mask.js').then(e => { 22 | console.log("Mask loaded (づ ◕‿◕ )づ") 23 | }).catch(e => { 24 | console.log("Sorry, masks not loaded (ಥ﹏ಥ)", e) 25 | }) 26 | } 27 | // DATEPICKER 28 | if(document.querySelector('.datepicker')) { 29 | import('./datepicker.js').then(e => { 30 | console.log("Datepicker loaded (づ ◕‿◕ )づ") 31 | }).catch(e => { 32 | console.log("Sorry, datepicker not loaded (ಥ﹏ಥ)", e) 33 | }) 34 | } 35 | // TIMEPICKER 36 | if(document.querySelector('.timepicker-input')) { 37 | import('./timepicker.js').then(e => { 38 | console.log("Timepicker loaded (づ ◕‿◕ )づ") 39 | }).catch(e => { 40 | console.log("Sorry, timepicker not loaded (ಥ﹏ಥ)", e) 41 | }) 42 | } 43 | // HOURPICKER 44 | if(document.querySelector('.hourpicker-input')) { 45 | import('./hourpicker.js').then(e => { 46 | console.log("Hourpicker loaded (づ ◕‿◕ )づ") 47 | }).catch(e => { 48 | console.log("Sorry, Hourpicker not loaded (ಥ﹏ಥ)", e) 49 | }) 50 | } 51 | // OPTIONS 52 | if(document.querySelector('.calculator-content--options')) { 53 | import('./options.js').then(e => { 54 | console.log("Options loaded (づ ◕‿◕ )づ") 55 | }).catch(e => { 56 | console.log("Sorry, options not loaded (ಥ﹏ಥ)", e) 57 | }) 58 | } 59 | // ICON DROPDOWN 60 | if(document.querySelector('.dropdown-icon')) { 61 | import('./dropdown-icon.js').then(e => { 62 | console.log("Dropdown-icon loaded (づ ◕‿◕ )づ") 63 | }).catch(e => { 64 | console.log("Sorry, dropdown-icon not loaded (ಥ﹏ಥ)", e) 65 | }) 66 | } 67 | 68 | // MODAL 69 | const MODAL_OPENERS = document.querySelectorAll('.js-modal-open') 70 | const MODAL_CLOSERS = document.querySelectorAll('.js-modal-close') 71 | const MODAL_WINDOW = document.querySelector('.modal-window') 72 | 73 | let currentShare = 0 74 | let isOpenPopupHeader = false; 75 | let focusedElement = 0; 76 | 77 | const closeAll = () => { 78 | MODAL_SEARCH.value = '' 79 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--error') 80 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--active') 81 | MODAL_OPENERS.forEach(MODAL_OPENER => { 82 | const MODAL_ID = MODAL_OPENER.getAttribute('data-modal') 83 | const MODAL = document.querySelector(`.modal-${MODAL_ID}`) 84 | MODAL.classList.remove(`modal-${MODAL_ID}--active`) 85 | }) 86 | } 87 | 88 | window.addEventListener('click', (e) => { 89 | let controllerTheme = document.querySelector('#popup-theme') 90 | let controllerLang = document.querySelector('#popup-lang') 91 | if(isOpenPopupHeader && !(e.composedPath().includes(controllerLang) || e.composedPath().includes(controllerTheme))) { 92 | isOpenPopupHeader = false 93 | document.querySelector('.modal-lang--active')?.classList.remove(`modal-lang--active`) 94 | document.querySelector('.modal-theme--active')?.classList.remove(`modal-theme--active`) 95 | } 96 | }) 97 | 98 | window.addEventListener('keydown', (e) => { 99 | if(e.key === 'Escape') { 100 | MODAL_WINDOW.classList.remove('modal-window--active') 101 | closeAll() 102 | } 103 | 104 | if((e.metaKey && e.key === 'k') || (e.ctrlKey && e.key === 'k')) { 105 | closeAll(); 106 | $('.modal-search__input').focus(); 107 | MODAL_WINDOW.classList.add(`modal-window--active`) 108 | $('.modal-search').classList.toggle(`modal-search--active`); 109 | } 110 | 111 | if(!MODAL_WINDOW) return; 112 | 113 | if(e.key === 'ArrowUp') { 114 | let listItem = [...MODAL_SEARCH_LIST_CONTENT.children] 115 | if(focusedElement - 1 < 0) { 116 | focusedElement = listItem.length - 1 117 | } else { 118 | focusedElement-- 119 | } 120 | listItem[focusedElement]?.focus() 121 | // listItem[focusedElement].scrollIntoView(true) 122 | } 123 | 124 | if(e.key === 'ArrowDown') { 125 | let listItem = [...MODAL_SEARCH_LIST_CONTENT.children] 126 | listItem[focusedElement]?.focus() 127 | if(focusedElement + 1 > listItem.length - 1) { 128 | focusedElement = 0 129 | } else { 130 | focusedElement++ 131 | } 132 | } 133 | }) 134 | 135 | if(MODAL_WINDOW) { 136 | MODAL_WINDOW.addEventListener('click', (e) => { 137 | if(e.target.classList.contains('modal-window')) { 138 | MODAL_WINDOW.classList.remove(`modal-window--active`) 139 | MODAL_WINDOW.classList.remove(`modal-window--active-mini`) 140 | closeAll() 141 | } 142 | }) 143 | } 144 | if(MODAL_OPENERS.length > 0) { 145 | MODAL_OPENERS.forEach(MODAL_OPENER => { 146 | MODAL_OPENER.addEventListener('click', () => { 147 | const MODAL_ID = MODAL_OPENER.getAttribute('data-modal') 148 | const MODAL = document.querySelector(`.modal-${MODAL_ID}`) 149 | 150 | closeAll(); 151 | 152 | if(MODAL_ID !== 'lang' && MODAL_ID !== 'theme') MODAL_WINDOW.classList.toggle(`modal-window--active`) 153 | else isOpenPopupHeader = true 154 | 155 | if(MODAL_ID === 'search') document.querySelector('.modal-search__input').focus() 156 | if(MODAL_ID === 'share') { 157 | console.log($('.modal-share__textarea').value) 158 | $$('.modal-share__textarea')[currentShare].focus() 159 | $$('.modal-share__textarea')[currentShare].setSelectionRange(0, $$('.modal-share__textarea')[currentShare].value.length) 160 | } 161 | 162 | MODAL.classList.toggle(`modal-${MODAL_ID}--active`) 163 | }) 164 | }) 165 | } 166 | if(MODAL_CLOSERS.length > 0) { 167 | MODAL_CLOSERS.forEach(MODAL_CLOSER => { 168 | MODAL_CLOSER.addEventListener('click', () => { 169 | const MODAL_ID = MODAL_CLOSER.getAttribute('data-modal') 170 | const MODAL = document.querySelector(`.modal-${MODAL_ID}`) 171 | 172 | closeAll(); 173 | 174 | if(MODAL_ID !== 'lang' && MODAL_ID !== 'theme') MODAL_WINDOW.classList.toggle(`modal-window--active`) 175 | else isOpenPopupHeader = true 176 | 177 | MODAL.classList.remove(`modal-${MODAL_ID}--active`) 178 | }) 179 | }) 180 | } 181 | 182 | // THEME 183 | const light = document.querySelectorAll('.light-theme'); 184 | const dark = document.querySelectorAll('.dark-theme'); 185 | const system = document.querySelectorAll('.system-theme'); 186 | 187 | light.forEach((i) => 188 | i.addEventListener('click', () => { 189 | document.documentElement.classList = ''; 190 | localStorage.setItem('theme', 'light'); 191 | setActiveThemeButton('light') 192 | if(switchTheme !== null) { 193 | if(typeof switchTheme === 'object') { 194 | switchTheme.forEach(element => element('light')) 195 | } else { 196 | switchTheme('light') 197 | } 198 | } 199 | }), 200 | ); 201 | dark.forEach((i) => 202 | i.addEventListener('click', () => { 203 | document.documentElement.classList = 'dark'; 204 | localStorage.setItem('theme', 'dark'); 205 | setActiveThemeButton('dark') 206 | if(switchTheme !== null) { 207 | if(typeof switchTheme === 'object') { 208 | switchTheme.forEach(element => element('dark')) 209 | } else { 210 | switchTheme('dark') 211 | } 212 | } 213 | }), 214 | ); 215 | system.forEach((i) => 216 | i.addEventListener('click', () => { 217 | document.documentElement.classList = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : ''; 218 | localStorage.setItem('theme', 'system'); 219 | setActiveThemeButton('system') 220 | if(switchTheme !== null) { 221 | if(typeof switchTheme === 'object') { 222 | switchTheme.forEach(element => element(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 223 | } else { 224 | switchTheme(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') 225 | } 226 | } 227 | }), 228 | ); 229 | 230 | // SEARCH 231 | const MODAL_SEARCH = document.querySelector('.modal-search__input') 232 | const MODAL_SEARCH_LIST = document.querySelector('.modal-search__list') 233 | const MODAL_SEARCH_LIST_CONTENT = document.querySelector('.modal-search__list-content') 234 | 235 | if(MODAL_SEARCH) MODAL_SEARCH.addEventListener('input', (e) => { 236 | focusedElement = 0 237 | if(e.target.value.length > 0) { 238 | const FILTERED_JSON = JSON_CALCULATORS.filter(CALCULATOR => { 239 | return (CALCULATOR.description.toLowerCase().match(e.target.value.toLowerCase()) !== null) || 240 | CALCULATOR.title.toLowerCase().match(e.target.value.toLowerCase()) !== null; 241 | }) 242 | if(FILTERED_JSON.length > 0) { 243 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--error') 244 | MODAL_SEARCH_LIST.classList.add('modal-search__list--active') 245 | MODAL_SEARCH_LIST_CONTENT.innerHTML = '' 246 | FILTERED_JSON.forEach(CALCULATOR => { 247 | let calculatorWrapper = document.createElement('a') 248 | calculatorWrapper.classList.add('modal-search-item') 249 | calculatorWrapper.href = CALCULATOR.uri 250 | 251 | let calculatorImg = document.createElement('img') 252 | calculatorImg.classList.add('modal-search-item__img') 253 | calculatorImg.src = CALCULATOR.image 254 | 255 | let calculatorTitle = document.createElement('span') 256 | calculatorTitle.classList.add('modal-search-item__text') 257 | calculatorTitle.innerText = CALCULATOR.title 258 | 259 | calculatorWrapper.append(calculatorImg, calculatorTitle) 260 | MODAL_SEARCH_LIST_CONTENT.append(calculatorWrapper) 261 | }) 262 | } else { 263 | MODAL_SEARCH_LIST_CONTENT.innerHTML = '' 264 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--active') 265 | MODAL_SEARCH_LIST.classList.add('modal-search__list--error') 266 | } 267 | } else { 268 | MODAL_SEARCH_LIST_CONTENT.innerHTML = '' 269 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--active') 270 | MODAL_SEARCH_LIST.classList.remove('modal-search__list--error') 271 | } 272 | }) 273 | 274 | // LANG 275 | const LANG_SELECTS = document.querySelectorAll('.header-lang__select') 276 | 277 | if (LANG_SELECTS){ 278 | let langIsEng = true 279 | 280 | for (const LANG_SELECT of LANG_SELECTS) { 281 | if(LANG_SELECT.innerText !== 'ENG' && window.location.href.match(LANG_SELECT.href) !== null) { 282 | LANG_SELECT.classList.add('header-lang__select--active') 283 | langIsEng = false 284 | } 285 | } 286 | 287 | if(langIsEng) LANG_SELECTS[0]?.classList?.add('header-lang__select--active') 288 | } 289 | 290 | // SHARE 291 | $$('.modal-share__button').forEach((button,index) => { 292 | button.addEventListener('click', () => { 293 | $$('.modal-share__button').forEach(i => i.classList.remove('modal-share__button--active')) 294 | $$('.modal-share__content').forEach(i => i.classList.remove('modal-share__content--active')) 295 | button.classList.add('modal-share__button--active') 296 | $$('.modal-share__content')[index].classList.add('modal-share__content--active') 297 | $$('.modal-share__textarea')[index].setSelectionRange(0, $$('.modal-share__textarea')[index].value.length) 298 | currentShare = index 299 | }) 300 | }) 301 | 302 | window.copyWidget = function (button) { 303 | button.classList.add('button--copy-active') 304 | navigator.clipboard.writeText($$('.modal-share__textarea')[currentShare].value) 305 | setTimeout(() => { 306 | button.classList.remove('button--copy-active') 307 | }, 1000) 308 | } 309 | 310 | window.now = function (suffix = 0){ 311 | let date = new Date(); 312 | date.setDate(date.getDate() + suffix); 313 | return ("0" + date.getHours()).slice(-2) + ':' + ("0" + date.getMinutes()).slice(-2) + ':' + ("0" + date.getSeconds()).slice(-2) 314 | } 315 | 316 | if(window.innerWidth < 1024){ 317 | $$('.calculator-content .button--primary').forEach((button) => { 318 | button.addEventListener('click', () => { 319 | let scrollValue = _('result-container').offsetTop; 320 | window.scrollTo({ top: scrollValue, behavior: 'smooth'}); 321 | }) 322 | }); 323 | } 324 | -------------------------------------------------------------------------------- /assets/js/calculator.js: -------------------------------------------------------------------------------- 1 | function calculate(){ 2 | const principal = input.get('starting_principal').gt(0).val(); 3 | const annualAddition = +input.get('annual_addition').val(); 4 | const monthlyAddition = +input.get('monthly_addition').val(); 5 | const contributeType = input.get('contribute').raw(); 6 | const interest = +input.get('annual_interest').val(); 7 | const years = +input.get('years').val(); 8 | const tax = +input.get('tax_rate').val(); 9 | const inflation = +input.get('inflation_rate').val(); 10 | if(!input.valid()) return; 11 | const amortization = calculateAmortization(principal, annualAddition, monthlyAddition, contributeType, interest, years, tax); 12 | 13 | let annualResults = []; 14 | let chartData = [[], [], [], []]; 15 | let annualInterest = 0; 16 | let annualContribution = 0; 17 | let monthlyResultsHtml = ''; 18 | let annualResultsHtml = ''; 19 | amortization.forEach((item, index) => { 20 | monthlyResultsHtml += `
${i * 5} yr
`; 48 | } 49 | if(years % 5 !== 0){ 50 | chartLegendHtml += `${years} yr
`; 51 | } 52 | annualResults.forEach((r, index) => { 53 | annualResultsHtml += `Hour
22 | 23 |:
25 |Minute
27 | 28 |(parentContext: P, context: T): P extends null ? T : P & T;
339 |
340 | /**
341 | * @alias Chart.helpers.math
342 | * @namespace
343 | */
344 | declare const PI: number;
345 | declare const TAU: number;
346 | declare const PITAU: number;
347 | declare const INFINITY: number;
348 | declare const RAD_PER_DEG: number;
349 | declare const HALF_PI: number;
350 | declare const QUARTER_PI: number;
351 | declare const TWO_THIRDS_PI: number;
352 | declare const log10: (x: number) => number;
353 | declare const sign: (x: number) => number;
354 | declare function almostEquals(x: number, y: number, epsilon: number): boolean;
355 | /**
356 | * Implementation of the nice number algorithm used in determining where axis labels will go
357 | */
358 | declare function niceNum(range: number): number;
359 | /**
360 | * Returns an array of factors sorted from 1 to sqrt(value)
361 | * @private
362 | */
363 | declare function _factorize(value: number): number[];
364 | declare function isNumber(n: unknown): n is number;
365 | declare function almostWhole(x: number, epsilon: number): boolean;
366 | /**
367 | * @private
368 | */
369 | declare function _setMinAndMaxByKey(array: Record Hour : Minute : Second There was an error with your calculation. Interest End Balance: $135,479.01 After Inflation Adjustment: $100,809.11 Total Principal: $99,000.00 Total Interest: $39,224.74 Total Interest after Tax: $36,479.01 Initial investment Interest after tax Contributions Tax 0 yr 5 yr 10 yr {
4 | const OPTION_HEAD = option.querySelector('.calculator-content-head')
5 |
6 | OPTION_HEAD.addEventListener('click', (event) => {
7 |
8 | if(!event.composedPath().includes($('.js-add-button'))) {
9 | option.classList.toggle('calculator-content--active')
10 | }
11 | })
12 | })
--------------------------------------------------------------------------------
/assets/js/themes.js:
--------------------------------------------------------------------------------
1 | const setActiveThemeButton = (theme) => {
2 | document.querySelectorAll('.header-popup__button').forEach(button => {
3 | if(button.classList.contains(`${theme}-theme`)) button.classList.add('header-popup__button--active')
4 | else button.classList.remove('header-popup__button--active')
5 | })
6 | }
7 |
8 | switch (localStorage.getItem('theme')) {
9 | case 'light':
10 | document.documentElement.classList = '';
11 | console.log('Theme: Light');
12 | localStorage.setItem('theme', 'light');
13 | window.addEventListener('DOMContentLoaded', () => {
14 | setActiveThemeButton('light')
15 | })
16 | break;
17 | case 'dark':
18 | document.documentElement.classList = 'dark';
19 | console.log('Theme: Dark');
20 | localStorage.setItem('theme', 'dark');
21 | window.addEventListener('DOMContentLoaded', () => {
22 | setActiveThemeButton('dark')
23 | })
24 | break;
25 | case 'system':
26 | default:
27 | document.documentElement.classList = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : '';
28 | console.log('Theme: System');
29 | localStorage.setItem('theme', 'system');
30 | window.addEventListener('DOMContentLoaded', () => {
31 | setActiveThemeButton('system')
32 | })
33 | }
--------------------------------------------------------------------------------
/assets/js/timepicker.js:
--------------------------------------------------------------------------------
1 | const INPUTS = $$('.timepicker-input');
2 | let timepickerFormat = true
3 | let currentInput = {
4 | input: null,
5 | hour: null,
6 | minute: null,
7 | second: null,
8 | }
9 |
10 | function createTimepicker() {
11 | const TIMEPICKER = document.createElement('div');
12 | const {top, left} = currentInput.input.getBoundingClientRect()
13 | const {offsetHeight} = currentInput.input
14 | const VALUE = currentInput.input.value.split(':')
15 |
16 | TIMEPICKER.classList.add('timepicker');
17 | TIMEPICKER.innerHTML = `
18 | Interest Calculator';
20 | }
21 |
22 |
23 | add_shortcode( 'ci_interest_calculator', 'display_calcio_ci_interest_calculator' );
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
189 |
190 |
249 |
191 |
196 |
197 | #
192 | DEPOSIT
193 | INTEREST
194 | ENDING BALANCE
195 |
198 | 1
199 | $32,400.00
200 | $1,486.44
201 | $33,886.44
202 |
203 | 2
204 | $7,400.00
205 | $1,908.58
206 | $43,195.01
207 |
208 | 3
209 | $7,400.00
210 | $2,350.77
211 | $52,945.78
212 |
213 | 4
214 | $7,400.00
215 | $2,813.97
216 | $63,159.75
217 |
218 | 5
219 | $7,400.00
220 | $3,299.17
221 | $73,858.93
222 |
223 | 6
224 | $7,400.00
225 | $3,807.43
226 | $85,066.35
227 |
228 | 7
229 | $7,400.00
230 | $4,339.82
231 | $96,806.18
232 |
233 | 8
234 | $7,400.00
235 | $4,897.51
236 | $109,103.69
237 |
238 | 9
239 | $7,400.00
240 | $5,481.69
241 | $121,985.38
242 |
243 |
248 | 10
244 | $7,400.00
245 | $6,093.62
246 | $135,479.01
247 |
260 |
261 |
870 |
262 |
267 |
268 | #
263 | DEPOSIT
264 | INTEREST
265 | ENDING BALANCE
266 |
269 | 1
270 | $30,200.00
271 | $117.03
272 | $30,317.03
273 |
274 | 2
275 | $200.00
276 | $118.25
277 | $30,635.28
278 |
279 | 3
280 | $200.00
281 | $119.49
282 | $30,954.77
283 |
284 | 4
285 | $200.00
286 | $120.72
287 | $31,275.49
288 |
289 | 5
290 | $200.00
291 | $121.97
292 | $31,597.46
293 |
294 | 6
295 | $200.00
296 | $123.22
297 | $31,920.67
298 |
299 | 7
300 | $200.00
301 | $124.47
302 | $32,245.14
303 |
304 | 8
305 | $200.00
306 | $125.72
307 | $32,570.87
308 |
309 | 9
310 | $200.00
311 | $126.99
312 | $32,897.85
313 |
314 | 10
315 | $200.00
316 | $128.25
317 | $33,226.11
318 |
319 | 11
320 | $200.00
321 | $129.53
322 | $33,555.63
323 |
324 | 12
325 | $200.00
326 | $130.80
327 | $33,886.44
328 | Year 1 End
329 | 13
330 | $5,200.00
331 | $151.46
332 | $39,237.90
333 |
334 | 14
335 | $200.00
336 | $152.82
337 | $39,590.72
338 |
339 | 15
340 | $200.00
341 | $154.19
342 | $39,944.91
343 |
344 | 16
345 | $200.00
346 | $155.56
347 | $40,300.47
348 |
349 | 17
350 | $200.00
351 | $156.94
352 | $40,657.41
353 |
354 | 18
355 | $200.00
356 | $158.32
357 | $41,015.73
358 |
359 | 19
360 | $200.00
361 | $159.71
362 | $41,375.44
363 |
364 | 20
365 | $200.00
366 | $161.10
367 | $41,736.55
368 |
369 | 21
370 | $200.00
371 | $162.50
372 | $42,099.05
373 |
374 | 22
375 | $200.00
376 | $163.91
377 | $42,462.96
378 |
379 | 23
380 | $200.00
381 | $165.32
382 | $42,828.28
383 |
384 | 24
385 | $200.00
386 | $166.73
387 | $43,195.01
388 | Year 2 End
389 | 25
390 | $5,200.00
391 | $187.53
392 | $48,582.54
393 |
394 | 26
395 | $200.00
396 | $189.03
397 | $48,971.57
398 |
399 | 27
400 | $200.00
401 | $190.54
402 | $49,362.11
403 |
404 | 28
405 | $200.00
406 | $192.05
407 | $49,754.17
408 |
409 | 29
410 | $200.00
411 | $193.57
412 | $50,147.74
413 |
414 | 30
415 | $200.00
416 | $195.10
417 | $50,542.84
418 |
419 | 31
420 | $200.00
421 | $196.63
422 | $50,939.47
423 |
424 | 32
425 | $200.00
426 | $198.17
427 | $51,337.63
428 |
429 | 33
430 | $200.00
431 | $199.71
432 | $51,737.34
433 |
434 | 34
435 | $200.00
436 | $201.26
437 | $52,138.60
438 |
439 | 35
440 | $200.00
441 | $202.81
442 | $52,541.41
443 |
444 | 36
445 | $200.00
446 | $204.37
447 | $52,945.78
448 | Year 3 End
449 | 37
450 | $5,200.00
451 | $225.31
452 | $58,371.10
453 |
454 | 38
455 | $200.00
456 | $226.96
457 | $58,798.06
458 |
459 | 39
460 | $200.00
461 | $228.62
462 | $59,226.68
463 |
464 | 40
465 | $200.00
466 | $230.28
467 | $59,656.96
468 |
469 | 41
470 | $200.00
471 | $231.95
472 | $60,088.90
473 |
474 | 42
475 | $200.00
476 | $233.62
477 | $60,522.52
478 |
479 | 43
480 | $200.00
481 | $235.30
482 | $60,957.82
483 |
484 | 44
485 | $200.00
486 | $236.99
487 | $61,394.81
488 |
489 | 45
490 | $200.00
491 | $238.68
492 | $61,833.49
493 |
494 | 46
495 | $200.00
496 | $240.38
497 | $62,273.87
498 |
499 | 47
500 | $200.00
501 | $242.09
502 | $62,715.95
503 |
504 | 48
505 | $200.00
506 | $243.80
507 | $63,159.75
508 | Year 4 End
509 | 49
510 | $5,200.00
511 | $264.89
512 | $68,624.65
513 |
514 | 50
515 | $200.00
516 | $266.70
517 | $69,091.34
518 |
519 | 51
520 | $200.00
521 | $268.50
522 | $69,559.85
523 |
524 | 52
525 | $200.00
526 | $270.32
527 | $70,030.17
528 |
529 | 53
530 | $200.00
531 | $272.14
532 | $70,502.31
533 |
534 | 54
535 | $200.00
536 | $273.97
537 | $70,976.28
538 |
539 | 55
540 | $200.00
541 | $275.81
542 | $71,452.09
543 |
544 | 56
545 | $200.00
546 | $277.65
547 | $71,929.74
548 |
549 | 57
550 | $200.00
551 | $279.50
552 | $72,409.24
553 |
554 | 58
555 | $200.00
556 | $281.36
557 | $72,890.60
558 |
559 | 59
560 | $200.00
561 | $283.23
562 | $73,373.83
563 |
564 | 60
565 | $200.00
566 | $285.10
567 | $73,858.93
568 | Year 5 End
569 | 61
570 | $5,200.00
571 | $306.35
572 | $79,365.28
573 |
574 | 62
575 | $200.00
576 | $308.32
577 | $79,873.60
578 |
579 | 63
580 | $200.00
581 | $310.29
582 | $80,383.88
583 |
584 | 64
585 | $200.00
586 | $312.26
587 | $80,896.14
588 |
589 | 65
590 | $200.00
591 | $314.25
592 | $81,410.39
593 |
594 | 66
595 | $200.00
596 | $316.24
597 | $81,926.63
598 |
599 | 67
600 | $200.00
601 | $318.24
602 | $82,444.87
603 |
604 | 68
605 | $200.00
606 | $320.25
607 | $82,965.12
608 |
609 | 69
610 | $200.00
611 | $322.26
612 | $83,487.39
613 |
614 | 70
615 | $200.00
616 | $324.29
617 | $84,011.67
618 |
619 | 71
620 | $200.00
621 | $326.32
622 | $84,537.99
623 |
624 | 72
625 | $200.00
626 | $328.36
627 | $85,066.35
628 | Year 6 End
629 | 73
630 | $5,200.00
631 | $349.78
632 | $90,616.14
633 |
634 | 74
635 | $200.00
636 | $351.91
637 | $91,168.05
638 |
639 | 75
640 | $200.00
641 | $354.05
642 | $91,722.10
643 |
644 | 76
645 | $200.00
646 | $356.20
647 | $92,278.30
648 |
649 | 77
650 | $200.00
651 | $358.35
652 | $92,836.65
653 |
654 | 78
655 | $200.00
656 | $360.52
657 | $93,397.17
658 |
659 | 79
660 | $200.00
661 | $362.69
662 | $93,959.86
663 |
664 | 80
665 | $200.00
666 | $364.87
667 | $94,524.73
668 |
669 | 81
670 | $200.00
671 | $367.06
672 | $95,091.79
673 |
674 | 82
675 | $200.00
676 | $369.26
677 | $95,661.04
678 |
679 | 83
680 | $200.00
681 | $371.46
682 | $96,232.50
683 |
684 | 84
685 | $200.00
686 | $373.68
687 | $96,806.18
688 | Year 7 End
689 | 85
690 | $5,200.00
691 | $395.27
692 | $102,401.45
693 |
694 | 86
695 | $200.00
696 | $397.58
697 | $102,999.03
698 |
699 | 87
700 | $200.00
701 | $399.90
702 | $103,598.93
703 |
704 | 88
705 | $200.00
706 | $402.22
707 | $104,201.15
708 |
709 | 89
710 | $200.00
711 | $404.55
712 | $104,805.71
713 |
714 | 90
715 | $200.00
716 | $406.90
717 | $105,412.60
718 |
719 | 91
720 | $200.00
721 | $409.25
722 | $106,021.85
723 |
724 | 92
725 | $200.00
726 | $411.61
727 | $106,633.46
728 |
729 | 93
730 | $200.00
731 | $413.98
732 | $107,247.44
733 |
734 | 94
735 | $200.00
736 | $416.36
737 | $107,863.80
738 |
739 | 95
740 | $200.00
741 | $418.75
742 | $108,482.55
743 |
744 | 96
745 | $200.00
746 | $421.14
747 | $109,103.69
748 | Year 8 End
749 | 97
750 | $5,200.00
751 | $442.93
752 | $114,746.62
753 |
754 | 98
755 | $200.00
756 | $445.42
757 | $115,392.04
758 |
759 | 99
760 | $200.00
761 | $447.92
762 | $116,039.96
763 |
764 | 100
765 | $200.00
766 | $450.43
767 | $116,690.39
768 |
769 | 101
770 | $200.00
771 | $452.95
772 | $117,343.34
773 |
774 | 102
775 | $200.00
776 | $455.48
777 | $117,998.82
778 |
779 | 103
780 | $200.00
781 | $458.02
782 | $118,656.84
783 |
784 | 104
785 | $200.00
786 | $460.57
787 | $119,317.41
788 |
789 | 105
790 | $200.00
791 | $463.13
792 | $119,980.54
793 |
794 | 106
795 | $200.00
796 | $465.70
797 | $120,646.24
798 |
799 | 107
800 | $200.00
801 | $468.28
802 | $121,314.52
803 |
804 | 108
805 | $200.00
806 | $470.87
807 | $121,985.38
808 | Year 9 End
809 | 109
810 | $5,200.00
811 | $492.84
812 | $127,678.23
813 |
814 | 110
815 | $200.00
816 | $495.53
817 | $128,373.76
818 |
819 | 111
820 | $200.00
821 | $498.22
822 | $129,071.98
823 |
824 | 112
825 | $200.00
826 | $500.93
827 | $129,772.91
828 |
829 | 113
830 | $200.00
831 | $503.65
832 | $130,476.55
833 |
834 | 114
835 | $200.00
836 | $506.37
837 | $131,182.92
838 |
839 | 115
840 | $200.00
841 | $509.11
842 | $131,892.03
843 |
844 | 116
845 | $200.00
846 | $511.86
847 | $132,603.89
848 |
849 | 117
850 | $200.00
851 | $514.62
852 | $133,318.50
853 |
854 | 118
855 | $200.00
856 | $517.38
857 | $134,035.89
858 |
859 | 119
860 | $200.00
861 | $520.16
862 | $134,756.05
863 |
864 | 120
865 | $200.00
866 | $522.95
867 | $135,479.01
868 |
869 | Year 10 End Interest Calculator';
20 | }
21 |
22 | add_shortcode( 'ci_interest_calculator', 'display_ci_interest_calculator' );
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Interest Calculator Widget for WordPress
2 |
3 | With this free interest calculator you can compute accumulation schedules, final balances, and accrued interest.
4 |
5 | 
6 |
7 | ## Installation
8 |
9 | 1. [Download](https://github.com/pub-calculator-io/interest-calculator/archive/refs/heads/master.zip) the ZIP file of this repository.
10 | 2. Upload the /interest-calculator-master/ folder to the /wp-content/plugins/ directory.
11 | 3. Activate the [Interest Calculator](https://www.calculator.io/interest-calculator/ "Interest Calculator Homepage") plugin through the "Plugins" menu in WordPress.
12 |
13 | ## Usage
14 | * Add the shortcode `[ci_interest_calculator]` to your page, post or sidebar.
15 | * Or add the following code: `` to your template where you would like the Interest Calculator to appear.
16 |
17 | ## Libraries in Use
18 | 1. https://mathjs.org/
19 | 2. https://katex.org/
20 | 3. https://github.com/aFarkas/lazysizes
21 | 4. https://github.com/RobinHerbots/Inputmask
22 | 5. https://air-datepicker.com/
23 | 6. https://www.chartjs.org/
24 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === CI Interest calculator ===
2 | Contributors: calculatorio
3 | Tags: interest calculator, calculate interest, interest rate calculator, simple interest calculator, compound interest calculator, interest formula, interest on savings, loan interest calculator, mortgage interest calculator, credit card interest calculator
4 | Requires at least: 5.0
5 | Tested up to: 6.4.0
6 | Stable tag: 1.0.0
7 | License: GPLv2 or later
8 | License URI: https://www.gnu.org/licenses/gpl-2.0.html
9 |
10 | With this free interest calculator you can compute accumulation schedules, final balances, and accrued interest.
11 |
12 | [https://www.calculator.io/interest-calculator/](https://www.calculator.io/interest-calculator/)
13 |
14 | == Usage ==
15 |
16 | Add the Interest Calculator shortcode to your page, post or sidebar:
17 |
18 | `[ci_interest_calculator]`
19 |
20 | Add the following code to your template where you would like the Interest Calculator to appear:
21 |
22 | ``
23 |
24 | == Screenshots ==
25 |
26 | 1. The Interest Calculator Input Form.
27 |
28 | == Installation ==
29 |
30 | 1. Upload the Interest Calculator /ci_interest_calculator/ folder to the /wp-content/plugins/ directory.
31 | 2. Activate the Interest Calculator plugin through the "Plugins" menu in WordPress.
32 |
33 | == Changelog ==
34 |
35 | = 1.0.0 =
36 | * Initial release of Interest Calculator
37 |
--------------------------------------------------------------------------------