var DonateApp = { init: function () { if (this.position.includes("bottom")){ jQuery("body").append(this.appContent); }else{ jQuery("body").prepend(this.appContent); } this.createBar(); this.evenListener(); }, position: 'top', appContent : $('\u003Cstyle\u003E\n\u0020\u0020\u0020\u0020\u0023donate\u002Dapp.top\u0020\u007B\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020top\u003A\u00200\u003B\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020width\u003A\u0020100\u0025\u003B\n\u0020\u0020\u0020\u0020\u007D\n\n\u0020\u0020\u0020\u0020\u0023donate\u002Dapp.bottom\u0020\u007B\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020bottom\u003A\u00200\u003B\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020width\u003A\u0020100\u0025\u003B\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020position\u003A\u0020absolute\u003B\n\u0020\u0020\u0020\u0020\u007D\n\u003C\/style\u003E\n\u003Cdiv\u0020id\u003D\u0022donate\u002Dapp\u0022\u0020class\u003D\u0022top\u0022\u003E\u003C\/div\u003E'), barHtml: "", createBar: function () { this.barHtml = ""; if (this.getCookie("donate_bar_showed")) { return; } let donateSettings = '\u007B\u0022id\u0022\u003A221,\u0022name\u0022\u003A\u0022Ideasoft\u0020\\u00d6rnek\u0020\\u015eablonu\u0022,\u0022redirect_url\u0022\u003A\u0022https\u003A\/\/ahbap.org\u0022,\u0022content\u0022\u003A\u0022\u003Cspan\u0020style\u003D\\\u0022font\u002Dsize\u003A\u002014px\u003B\\\u0022\u003EYard\\u0131mla\\u015fma\u0020seferberli\\u011fine\u0020kat\\u0131larak\u0020deprem\u0020b\u0026ouml\u003Blgesindeki\u0020vatanda\\u015flar\\u0131m\\u0131za\u0020destek\u0020olabilirsiniz.\u003C\/span\u003E\u0022,\u0022html\u0022\u003A\u0022\u003Cdiv\u0020id\u003D\\\u0022donateBar\\\u0022\u0020style\u003D\\\u0022background\u002Dcolor\u003A\u0023000000\u003Bheight\u003A50px\u003Bdisplay\u003Aflex\u003Bjustify\u002Dcontent\u003Acenter\u003Balign\u002Ditems\u003Acenter\\\u0022\u003E\u003Cdiv\u0020style\u003D\\\u0022flex\u003A1\u003Bpadding\u002Dleft\u003A20px\\\u0022\u003E\u003Cspan\u0020style\u003D\\\u0022color\u003A\u0023ffffff\\\u0022\u003E\u007Bicerik\u007D\u003C\/span\u003E\u003C\/div\u003E\u003Cdiv\u0020style\u003D\\\u0022flex\u003A0\u00200\u0020auto\u003Bpadding\u002Dright\u003A20px\\\u0022\u003E\u003Cdiv\u0020style\u003D\\\u0022color\u003A\u0023ecf0f1\u003Bpadding\u003A5px\u002010px\u003Bborder\u003A1px\u0020solid\u0020\u0023ecf0f1\u003Bborder\u002Dradius\u003A10px\\\u0022\u003EBa\\u011f\\u0131\\u015f\u0020Yap\u003Ci\u0020style\u003D\\\u0022font\u002Dsize\u003A10px\u003Bvertical\u002Dalign\u003Amiddle\u003Bmargin\u002Dleft\u003A5px\u003B\\\u0022\u0020class\u003D\\\u0022fas\u0020fa\u002Darrow\u002Dright\\\u0022\u003E\u003C\/i\u003E\u003C\/div\u003E\u003C\/div\u003E\u003C\/div\u003E\u0022,\u0022position\u0022\u003A\u0022top\u0022,\u0022status\u0022\u003Atrue,\u0022created_at\u0022\u003A\u00222023\u002D03\u002D16T15\u003A57\u003A55\u002B03\u003A00\u0022,\u0022updated_at\u0022\u003A\u00222023\u002D03\u002D16T15\u003A58\u003A19\u002B03\u003A00\u0022\u007D'; donateSettings = JSON.parse(donateSettings); this.barHtml = DonateApp.changeHtml(donateSettings.redirectUrl ?? donateSettings.redirect_url, donateSettings.html, donateSettings.content); this.appendBar(); }, changeHtml: function (redirectUrl, donateHtml, donateContent) { var barHtml = '' + donateHtml + ''; barHtml = barHtml.replace('{icerik}', donateContent) return barHtml; }, appendBar: function () { if (this.barHtml === ""){ return; } let barHtmlObject = $(this.barHtml)[0]; document.getElementById('donate-app').append(barHtmlObject); }, closeBar: function () { let barElements = jQuery('#donateBar'); if (barElements.length > 0) { this.setCookie('donate_bar_showed', true, 30); } barElements.remove(); document.body.style.paddingTop = 0; }, setCookie: function (name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; }, getCookie: function (name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; }, evenListener: function () { $("#donate-bar-close").on('click', function () { DonateApp.closeBar(); }); let postPersist = IdeaCart.listeners.postPersist; IdeaCart.listeners.postPersist = function () { let bar = document.getElementById("donateBar"); if (bar !== null){ bar.remove(); } DonateApp.createBar(); return postPersist.apply(postPersist, arguments); } let postFlush = IdeaCart.listeners.postFlush; IdeaCart.listeners.postFlush = function () { let bar = document.getElementById("donateBar"); if (bar !== null){ bar.remove(); } DonateApp.createBar(); return postFlush.apply(postFlush, arguments); } let postRemove = IdeaCart.listeners.postRemove; IdeaCart.listeners.postRemove = function () { let bar = document.getElementById("donateBar"); if (bar !== null){ bar.remove(); } DonateApp.createBar(); return postRemove.apply(postRemove, arguments); } let postUpdate = IdeaCart.listeners.postUpdate; IdeaCart.listeners.postUpdate = function () { let bar = document.getElementById("donateBar"); if (bar !== null){ bar.remove(); } DonateApp.createBar(); return postUpdate.apply(postUpdate, arguments); } } }; DonateApp.init();