var modalOpener = ilterData.modalOpener, uploadWidth = ilterData.uploadWidth, uploadHeight = ilterData.uploadHeight, previewWidthHeight = ilterData.previewWidthHeight, buttonId = 0, topModal = false, screenLock = false, iFileCheck = false, activeEditor = null, realTimeMap = null, realTimeCheck = null, editorType = 'general', listData = { page: '1', list_count: '20' }; listData[CSRFTokenKey] = CSRFToken; $(window).on('load', function(event) { event.preventDefault(); $('#eq-loader').hide(); $('[data-onload]').each(function(){ eval($(this).data('onload')); }); }); function explodeSeconds(value){ var minutes; var seconds; minutes = Math.floor(value / 60); seconds = value % 60; if (minutes < 10) { minutes = '0' + minutes; } if (seconds < 10) { seconds = '0' + seconds; } return { 'minutes': minutes, 'seconds': seconds }; } // İçerik Seo Link Fonksiyonu function contentSeo(input, contentType, action, lang) { var text = $(input).val(); var contentId = ($('#id').val() ? $('#id').val() : '000'); var group = $('[data-group]').val(); var data = { text: text, content_type: contentType, contentId: contentId, group: group, lang: lang }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/content_seo', type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (action == 'all') { $('#seo_title-' + lang).val(response.title); $('#slug-' + lang).val(response.slug); $('#slug_link-' + lang).html(response.link); } else if (action == 'slug') { $('#slug-' + lang).val(response.slug); $('#slug_link-' + lang).html(response.link); } if (action == 'link') { $('#slug_link-' + lang).html(response.link); } } }); } //SEO Kontrol Fonksiyonu function contentSeoButton(action, contentType, lang) { if (action == 'edit') { $('#slug-' + lang).prop('readonly', false).focus(); $('#contentSeoButton-' + lang).html(''); } else if (action == 'finish') { contentSeo('#slug-' + lang, contentType, 'slug', lang); $('#slug-' + lang).prop('readonly', true); $('#contentSeoButton-' + lang).html(''); } } // İçerik Vitrin Kontrol Fonksiyonu function contentPriority() { if ($('#priority').val() == '2') { $('#datetime_priority_start').removeClass('d-none').addClass('d-block'); $('#control_priority').removeClass('d-none').addClass('d-block'); } else { $('#datetime_priority_start').removeClass('d-block').addClass('d-none'); $('#control_priority').removeClass('d-block').addClass('d-none'); $('#control_priority_time').prop('checked', false); $('#datetime_priority_end').removeClass('d-block').addClass('d-none'); } }; // Select ile seçim Fonksiyonu function select(data, selected, shown) { var select = $('#' + selected).val(); var show = shown.split(','); var i = 0; for (i = 0; i < show.length; i++) { if (select == data) { $('#' + show[i]).removeClass('d-none').addClass('d-block'); } else { $('#' + show[i]).removeClass('d-block').addClass('d-none'); } } }; function percent(value, percent) { return ((parseInt(value) * parseInt(percent)) / 100); } // Checkbox ile seçim Fonksiyonu function show(action, secilen, gosterilenler) { var gosterilen = gosterilenler.split(','); if (action == '0') { var i = 0; for (i = 0; i < gosterilen.length; i++) { if ($('#' + secilen).is(':checked')) { $('#' + gosterilen[i]).removeClass('d-block').addClass('d-none'); } else { $('#' + gosterilen[i]).removeClass('d-none').addClass('d-block'); } } } else if (action == '1') { var i = 0; for (i = 0; i < gosterilen.length; i++) { if ($('#' + secilen).is(':checked')) { $('#' + gosterilen[i]).removeClass('d-none').addClass('d-block'); } else { $('#' + gosterilen[i]).removeClass('d-block').addClass('d-none'); } } } }; // base64 To Blob function base64_to_blob(base64_url) { var block = base64_url.split(';'); var b64Data = block[1].split(',')[1]; var contentType = block[0].split(':')[1] || ''; var sliceSize = 1024; var byteCharacters = atob(b64Data); var byteArrays = []; for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { var slice = byteCharacters.slice(offset, offset + sliceSize); var byteNumbers = new Array(slice.length); for (var i = 0; i < slice.length; i++) { byteNumbers[i] = slice.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); byteArrays.push(byteArray); } var blob = new Blob(byteArrays, { type: contentType }); return blob; } // jQuery Yuvarlama Fonksiyonu function yuvarla(sayi, hane) { return Number(Math.round(sayi + 'e' + hane) + 'e-' + hane); } // Modal function modal(btn, modal_id, address, tModal = false, data = null, method = 'GET') { topModal = tModal; $('#' + modal_id).find('.modal-content').find('[data-plugin-popover][popover-opened="true"]').popover('hide'); $('#' + modal_id).find('.modal-content').empty(); $('#' + modal_id).removeData('bs.modal'); $('#' + modal_id).modal({ show: true, backdrop: 'static', keyboard: false }); var json, status; $.ajax({ url: ADDRESS_PANEL + address, type: method, data: data, beforeSend: function() { console.log(this.url, this.data); $('body .tooltip').tooltip('hide'); $('#' + modal_id).find('.modal-content').html('
'); }, error: function(xhr, errorString, exception) { var message = ''; $('#' + modal_id).find('.modal-content').html(message); }, success: function(response) { try { json = $.parseJSON(response); status = json.status; } catch (err) { status = 'success'; } if (status == 'error') { var message = ''; $('#' + modal_id).find('.modal-content').html(message); } else { $('#' + modal_id).find('.modal-content').html(response); modal_scroll(modal_id); $.fn.modal.Constructor.prototype._enforceFocus = function() {}; } }, complete: function(response) { (function($) { 'use strict'; if ($('#' + modal_id).find('[data-plugin-tooltip]').length > 0) { if ($.isFunction($.fn['tooltip'])) { $(function() { $('#' + modal_id).find('[data-plugin-tooltip]').each(function() { var _this = $(this); _this.tooltip(); _this.click(function(){ $(this).tooltip('hide'); }); }); }); } } }).apply(this, [jQuery]); (function($) { 'use strict'; if ($('#' + modal_id).find('[data-plugin-clipboard]').length > 0) { if (typeof ClipboardJS !== undefined) { $(function() { $('#' + modal_id).find('[data-plugin-clipboard]').each(function() { var _this = this; var copy = new ClipboardJS(_this, { container: $('#' + modal_id).get(0) }); copy.on('error', function(e) { notification('error', 'HATA!', 'Kopyalanamadı.
Lütfen yazılım danışmanınıza başvurun.'); }); }); }); } } }).apply(this, [jQuery]); } }); if (topModal == true) { setTimeout(function(){ $('#' + modal_id).css('z-index', '1101'); $('.modal-backdrop:last').css('z-index', '1100'); }, 100); } if (topModal == false && $('.modal-backdrop').length > 1) { $('.modal-backdrop:last').remove(); } if ($(btn).data('command')) { var command = new Function($(btn).data('command')); return command(); } } function modal_scroll(modal_id, modalFileCheck = true) { var _this = $('#' + modal_id); setTimeout(function(){ if(modal_id == 'modal_file' && modalFileCheck == true) { return false; } else { if(_this.find('.modal-body').hasClass('mCustomScrollbar')){ _this.find('.modal-body').mCustomScrollbar('destroy'); } _this.find('.modal-body').mCustomScrollbar({ advanced: { updateOnContentResize: true }, mouseWheelPixels: 100, scrollInertia: 250, theme: 'minimal' }); } }, 500); } // Modal Açınca Mobilde Tam Ekran Yap // $('body').on('shown.bs.modal', '.modal', function(e) { // if($(window).innerWidth()<480){ // document.documentElement.webkitRequestFullscreen(); // } // }); // // Modal Kapatınca Tam Ekran'dan Çık // $('body').on('hidden.bs.modal', '.modal', function(e) { // document.webkitExitFullscreen(); // }); // Modal İçeriği Temizleme $('body').on('hidden.bs.modal', '.modal', function(e) { var modal_id = e.target.id; if (topModal == true && $('.modal.fade.show').length>0) { $('body').addClass('modal-open'); topModal = false; } else { $('#' + modal_id).find('.modal-content').html(''); $(this).removeData('bs.modal'); } if (this.f_listModal && (modal_id == 'modal_content' || modal_id == 'modal_file')) { listData = { page: '1', list_count: '20' }; listData[CSRFTokenKey] = CSRFToken; } }); // Modal İçeriği Temizleme $('body').on('shown.bs.modal', '.modal', function(e) { var modal_id = e.target.id; }); $('.iaccordion .collapse').on('shown.bs.collapse', function(){ $(this).parent().find(".fa-chevron-right").removeClass("fa-chevron-right").addClass("fa-chevron-down"); }).on('hidden.bs.collapse', function(){ $(this).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-right"); }); $(document).on('keypress keyup blur', '.onlyNumber',function (event) { $(this).val($(this).val().replace(/[^\d\.].+/, '0')); let keyCode = (event.keyCode ? event.keyCode : event.which); if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { event.preventDefault(); } }); function onlyNumber(event){ let keyCode = (event.keyCode ? event.keyCode : event.which); if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { // 46 is dot event.preventDefault(); } } // Fatura Hesaplama Fonksiyonu function invoiceCalculate(btn, form) { var button = $(btn), ajaxResult, formId = '#' + form, formData = new FormData($(formId)[0]); formData.append(CSRFTokenKey, CSRFToken); formData.append('isLogin', IP); $(formId).find('.option-data').each(function(){ formData.delete($(this).attr('name')); }); $.ajax({ url: ADDRESS_PANEL + 'system/help/action/invoiceCalculate', type: 'POST', data: formData, dataType: 'JSON', beforeSend: function() { }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } $('#subtotal_div').html(response.calculate.subtotal); $('#discount_div').html(response.calculate.discount); $('#virtual_pos_comission_rate_div').html('Kredi Kartı İle Ödeme Komisyonu'); $('#virtual_pos_comission_rate').val('0'); if(response.calculate.virtual_pos_custom_comission=='yesUpdate'){ $('#virtual_pos_comission_rate_div').html('Kredi Kartı İle Ödeme Komisyonu (%' + response.calculate.virtual_pos_comission_rate + ')'); $('#virtual_pos_comission_rate').val(response.calculate.virtual_pos_comission_rate); $('#virtual_pos_comission').val(response.calculate.virtual_pos_comission_value); } $('#taxation_rate_div').html('KDV (%' + response.calculate.taxation_rate + ')'); $('#taxation_value_div').html(response.calculate.taxation_value); $('#total_div').html(response.calculate.total); if (response.command) { eval(response.command); } } }, complete: function() { }, cache: false, contentType: false, processData: false }); return false; } // Kod Yenileme Fonksiyonu function codeRefresh(btn, input_id) { var button = $(btn); var input = '#' + input_id; var codeRefresh = null; var data = { input: input }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/code', type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { button.prop('disabled', true); }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } $('').insertAfter(input); codeRefresh = $('#' + response.randomId).text(); $(input).val(codeRefresh); $(input + '_' + 'again').val(codeRefresh); $('#' + response.randomId).remove(); if (response.command) { eval(response.command); } } }, complete: function() { codeRefresh = null; button.prop('disabled', false); } }); } // Şifre Yenileme Fonksiyonu function passRefresh(btn, input_id) { var button = $(btn); var input = '#' + input_id; var passRefresh = null; var data = { input: input }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/password', type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { button.prop('disabled', true); }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } $('').insertAfter(input); passRefresh = $('#' + response.randomId).text(); $(input).val(passRefresh); $(input + '_' + 'again').val(passRefresh); $('#' + response.randomId).remove(); if (response.command) { eval(response.command); } } }, complete: function() { passRefresh = null; button.prop('disabled', false); } }); } // Şifre Göster/Gizle Fonksiyonu function passSH(btn, input_id) { var button = $(btn); button.prop('disabled', true); if (button.find('i').hasClass('fa-eye')) { $('#' + input_id).attr('type', 'text'); button.find('i').removeClass('fa-eye').addClass('fa-eye-slash'); } else { $('#' + input_id).attr('type', 'password'); button.find('i').removeClass('fa-eye-slash').addClass('fa-eye'); } button.prop('disabled', false); } // this function will take current images on the map and create HTML elements for them function updateCustomMarkers(event) { // get map object var map = event.chart; // go through all of the images for (var x in map.dataProvider.images) { // get MapImage object var image = map.dataProvider.images[x]; // check if it has corresponding HTML element if ('undefined' == typeof image.externalElement) image.externalElement = createCustomMarker(image); // reposition the element accoridng to coordinates var xy = map.coordinatesToStageXY(image.longitude, image.latitude); image.externalElement.style.top = xy.y + 'px'; image.externalElement.style.left = xy.x + 'px'; } } // this function creates and returns a new marker element function createCustomMarker(image) { // create holder var holder = document.createElement('div'); holder.className = 'map-marker'; holder.title = image.title; holder.style.position = 'absolute'; // maybe add a link to it? if (undefined != image.url) { holder.onclick = function() { window.location.href = image.url; }; holder.className += ' map-clickable'; } // create dot var dot = document.createElement('div'); dot.className = 'dot'; holder.appendChild(dot); // create pulse var pulse = document.createElement('div'); pulse.className = 'locator'; holder.appendChild(pulse); // append the marker to the map container image.chart.chartDiv.appendChild(holder); return holder; } // Google Analytics Real-Time Fonksiyonu function googleRealTimeAnalytics() { var data = {}; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/statics/real_time', type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { if (!realTimeCheck) { $('#realTimeMap').prev('.loading-ga').fadeOut('fast'); realTimeMap = AmCharts.makeChart('realTimeMap', { type: 'map', theme: 'light', projection: 'miller', areasSettings: { autoZoom: true, selectedColor: '#CC0000' }, smallMap: {}, dataProvider: { map: 'worldLow', zoomLevel: 15, zoomLongitude: 36.2988188, zoomLatitude: 39.0571333, images: [] } }); realTimeMap.addListener('positionChanged', updateCustomMarkers); } }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { toastr.clear(); $('#realTimeCount').html(response.count); realTimeMap.dataProvider = { map: 'worldLow', images: response.locations }; realTimeMap.dataProvider.zoomLevel = realTimeMap.zoomLevel(); realTimeMap.dataProvider.zoomLatitude = realTimeMap.dataProvider.zoomLatitudeC = realTimeMap.zoomLatitude(); realTimeMap.dataProvider.zoomLongitude = realTimeMap.dataProvider.zoomLongitudeC = realTimeMap.zoomLongitude(); realTimeMap.validateData(); if (!realTimeCheck) { $('#realTimeAddresses').prev('.loading-ga').fadeOut('fast'); $('#realTimeAddresses').find('tbody .mCustomScrollBox .mCSB_container').html(response.addresses); $('#realTimeAddresses').fadeIn(2000); } else { $('#realTimeAddresses').find('tbody .mCustomScrollBox .mCSB_container').html(response.addresses); } }, complete: function() { realTimeCheck = true; setTimeout(function(){ googleRealTimeAnalytics(); }, 15000); } }); } // Google Analytics Gösterim Fonksiyonu var googleAnalyticsCheck = false, sessionUsers, pageViews, newAndReturns; function googleAnalytics(medhod) { notification('warning', 'UYARI!', 'Verilerin yüklenmesi biraz zaman alabilir. Lütfen bekleyin.'); var monthShort = new Array('Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'); var monthLong = new Array('Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'); var data = {}; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/statics/' + medhod, type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { googleRealTimeAnalytics(); if (!googleAnalyticsCheck) { sessionUsers = Morris.Line({ resize: true, element: 'sessionUsers', xkey: 'x', xLabelFormat: function(x) { var year = x.getFullYear(); var month = x.getMonth(); var day = x.getDate(); return day + ' ' + monthShort[month]; }, xLabels: 'day', ykeys: ['a', 'b'], labels: ['Oturum', 'Kullanıcı'], hideHover: true, lineColors: ['#1a73e9', '#00b1f4'], dateFormat: function(x) { d = new Date(x); var year = d.getFullYear(); var month = d.getMonth(); var day = d.getDate(); return day + ' ' + monthLong[month] + ' ' + year; } }); pageViews = Morris.Line({ resize: true, element: 'pageViews', xkey: 'x', xLabelFormat: function(x) { var year = x.getFullYear(); var month = x.getMonth(); var day = x.getDate(); return day + ' ' + monthShort[month]; }, xLabels: 'day', ykeys: ['a', 'b'], labels: ['Toplam Sayfa Görüntüleme', 'Benzersiz page Görüntüleme'], hideHover: true, lineColors: ['#1a73e9', '#00b1f4'], dateFormat: function(x) { d = new Date(x); var year = d.getFullYear(); var month = d.getMonth(); var day = d.getDate(); return day + ' ' + monthLong[month] + ' ' + year; } }); newAndReturns = AmCharts.makeChart('newAndReturns', { type: 'pie', theme: 'light', colors: ['#1a73e9', '#00b1f4'], valueField: 'count', titleField: 'type', outlineAlpha: 0.4, depth3D: 15, dataProvider: [], balloon: { fixedPosition: true }, angle: 30, responsive: { enabled: true } }); } }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { googleAnalyticsCheck = true; toastr.clear(); switch (medhod) { case 'home': break; case 'all': if (response.data.sessionUsers !== 'ERROR') { $('#sessionUsers').prev('.loading-ga').fadeOut('fast'); $('#sessionUsers').fadeIn(2000); $('#sessionUsersCount').html(response.data.sessionUsers.count.session + ' / ' + response.data.sessionUsers.count.users); sessionUsers.setData(response.data.sessionUsers.data); var sessionUsersWidth = $('#sessionUsers').parent().width(); $('#sessionUsers svg').width(sessionUsersWidth); sessionUsers.redraw(); } else { $('#sessionUsers').prev('.loading-ga').fadeOut('fast'); $('#sessionUsers').html('
Veri Alınamadı!
').fadeIn(2000); } if (response.data.pageViews !== 'ERROR') { $('#pageViews').prev('.loading-ga').fadeOut('fast'); $('#pageViews').fadeIn(2000); $('#pageViewsCount').html(response.data.pageViews.count.total + ' / ' + response.data.pageViews.count.unique); pageViews.setData(response.data.pageViews.data); var pageViewsWidth = $('#pageViews').parent().width(); $('#pageViews svg').width(pageViewsWidth); pageViews.redraw(); } else { $('#pageViews').prev('.loading-ga').fadeOut('fast'); $('#pageViews').html('
Veri Alınamadı!
').fadeIn(2000); } if (response.data.newAndReturns !== 'ERROR') { $('#newAndReturns').prev('.loading-ga').fadeOut('fast'); $('#newAndReturns').fadeIn(2000); newAndReturns.dataProvider = response.data.newAndReturns; newAndReturns.validateData(); } else { $('#newAndReturns').prev('.loading-ga').fadeOut('fast'); $('#newAndReturns').html('
Veri Alınamadı!
').fadeIn(2000); } $('#trafficChannels').prev('.loading-ga').fadeOut('fast'); $('#trafficChannels').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.trafficChannels); $('#trafficChannels').fadeIn(2000); $('#pageUsers').prev('.loading-ga').fadeOut('fast'); $('#pageUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.pageUsers); $('#pageUsers').fadeIn(2000); $('#countryUsers').prev('.loading-ga').fadeOut('fast'); $('#countryUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.countryUsers); $('#countryUsers').fadeIn(2000); $('#cityUsers').prev('.loading-ga').fadeOut('fast'); $('#cityUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.cityUsers); $('#cityUsers').fadeIn(2000); $('#deviceUsers').prev('.loading-ga').fadeOut('fast'); $('#deviceUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.deviceUsers); $('#deviceUsers').fadeIn(2000); $('#osUsers').prev('.loading-ga').fadeOut('fast'); $('#osUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.osUsers); $('#osUsers').fadeIn(2000); $('#browserUsers').prev('.loading-ga').fadeOut('fast'); $('#browserUsers').find('tbody .mCustomScrollBox .mCSB_container').html(response.data.browserUsers); $('#browserUsers').fadeIn(2000); break; } } }); } // Panel Bildirim function notifications(){ var kaynak = new EventSource(ADDRESS_PANEL + 'system/help/action/notification'); kaynak.onmessage = function(event) { // document.getElementById("result").innerHTML += event.data + "
"; }; } //notifications(); // Toastr Bildirim function notification(type, title, message, isStatic = false) { toastr.clear(); toastr.options = { 'closeButton': true, 'debug': false, 'newestOnTop': false, 'progressBar': true, 'rtl': false, 'positionClass': 'toast-top-center', 'preventDuplicates': false, 'onclick': false, 'tapToDismiss': false, 'showDuration': 300, 'hideDuration': 1000, 'timeOut': (isStatic==true ? 0 : 5000), 'extendedTimeOut': (isStatic==true ? 0 : 5000), 'showEasing': 'swing', 'hideEasing': 'linear', 'showMethod': 'fadeIn', 'hideMethod': 'fadeOut' }; var notification = toastr[type](message, '
' + title + '
'); } // Ajax İşlemleri Bildirim Şablonu function ajaxErrorNotification(xhr, errorString, exception) { var title = 'İŞLEM HATASI!'; var message = 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
xhr.status = ' + xhr.status + '
xhr.responseText = ' + xhr.responseText + '
error = ' + errorString + '
exception = |' + exception + '|'; notification('error', title, message); } function ajaxNullNotification(response) { var title = 'İŞLEM HATASI!'; var message = (response ? (response.message ? response.message : 'Aradığınız sayfa bulunamadı!') + (response.url ? '
Adres: ' + response.url : '') : 'Bilinmeyen bir nedenle işlem tamamlanamadı.'); notification('error', title, message); if (response.command) { eval(response.command); } } // Veri Güncelleme/Temizleme Fonksiyonu function veri_guncelle(btn, durum, action, id) { if (durum == '1') { var button = $(btn); var buttonText = button.html(); var buttonWidth = (button.outerWidth() < 120 ? 120 : button.outerWidth()); var buttonHeight = button.outerHeight(); var loadingg = buttonWidth - (button.outerWidth() - button.width()); $.ajax({ url: ADDRESS_PANEL + 'action/content.php?action=' + action, type: 'POST', data: {}, dataType: 'JSON', beforeSend: function() { button.prop('disabled', true).css('width', buttonWidth + 'px').css('height', buttonHeight + 'px').html('
'); }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (response.command) { eval(response.command); } } }, complete: function() { if (ajaxResult == false || (ajaxResult.notification !== null && ajaxResult.notification.type && ajaxResult.notification.type !== 'success')) { setTimeout(function(){ button.html(buttonText).removeAttr('style').prop('disabled', false); }, 1000); } }, cache: false, contentType: false, processData: false }); return false; } else { $.ajax({ url: ADDRESS_PANEL + 'action/content.php?action=' + action, type: 'POST', data: {}, dataType: 'JSON', success: function(response) {}, cache: false, contentType: false, processData: false }); return false; } } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = 'expires=' + d.toUTCString(); document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; } function strip_tags(html) { var tmp = document.createElement('DIV'); tmp.innerHTML = html; return tmp.textContent || tmp.innerText || ''; } function unset_GET(parameter, url) { url = url == null ? window.location.href : url; var urlparts = url.split('?'); if (urlparts.length >= 2) { var prefix = encodeURIComponent(parameter) + '='; var pars = urlparts[1].split(/[&;]/g); //reverse iteration as may be destructive for (var i = pars.length; i-- > 0;) { //idiom for string.startsWith if (pars[i].lastIndexOf(prefix, 0) !== -1) { pars.splice(i, 1); } } url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ''); return url; } else { return url; } } function _GET(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } function set_GET(key, value, url) { if (!url) url = window.location.href; var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i'); var separator = url.indexOf('?') !== -1 ? '&' : '?'; if (url.match(re)) { return url.replace(re, '$1' + key + '=' + value + '$2'); } else { return url + separator + key + '=' + value; } } function setURL(url) { var title = $('title').html(); window.history.pushState('object or string', title, url); } function getJson(str) { var parse; try { parse = JSON.parse(str); } catch (e) { return false; } return parse; } function json_decode(str) { return getJson(str); } function json_encode(obj) { return JSON.stringify(obj); } function in_array(needle, haystack) { var length = haystack.length; for (var i = 0; i < length; i++) { if (haystack[i] == needle) return true; } return false; } function html_entity_decode(str) { var txt = document.createElement('textarea'); txt.innerHTML = str; return txt.value; } function html_entities(str) { return String(str).replace(/&/g, '&').replace(//g, '>').replace(/'/g, '"'); } // Uyarı Fonksiyonları function uyar() { $('#uyar').val('1'); } function uyarma() { $('#uyar').val('0'); } window.onbeforeunload = function() { if ($('#hesap_durum').val() == '1' && $('#content_durum').val() == '1') { var event = 'event'; if (content_action == 'file') { content_durum(this, 'devret', 'file', $('.modal #id').val(), 0); } else { content_durum(this, 'devret', pageData['controller'], _GET('id'), 0); } } if ($('#uyar').val() == '1') { return false; } else if ($('#uyar').val() == '0') { return null; } }; // $('[data-plugin-multiselect]').on('show.bs.select', function (e, clickedIndex, isSelected, previousValue) { // var jDropdown = $('#' + $(clickedIndex.relatedTarget).attr('aria-owns')); // setTimeout(function(){ // jDropdown.css({ // 'max-height': (parseInt(jDropdown.css('max-height') - 30) + 'px'), // 'overflow': 'hidden' // }).mCustomScrollbar({ // theme: 'minimal', // mouseWheelPixels: 100, // scrollInertia: 250, // autoDraggerLength:false, // dropupAuto: false, // advanced: { // updateOnBrowserResize: true, // updateOnContentResize: false, // autoScrollOnFocus: false // } // }); // }, 50); // }); // $('[data-plugin-multiselect]').on('hide.bs.select', function (e, clickedIndex, isSelected, previousValue) { // var jDropdown = $('#' + $(clickedIndex.relatedTarget).attr('aria-owns')); // // jDropdown.mCustomScrollbar('destroy'); // }); // btn.dropdown-toggle.bs-placeholder.btn-light // $(document).on('click', '.dropdown.bootstrap-select .dropdown-toggle', function(){ // var jDropdown = $('#' + $(this).attr('aria-owns')); // console.log(jDropdown); // setTimeout(function(){ // if(jDropdown.hasClass('mCustomScrollbar')) { // jDropdown.mCustomScrollbar('destroy'); // console.log(jDropdown); // return; // } // jDropdown.css('max-height', (parseInt(jDropdown.css('max-height')) - 30) + 'px').mCustomScrollbar({ // advanced: { // updateOnContentResize: true // }, // theme: 'minimal', // mouseWheelPixels: 100, // scrollInertia: 250, // }); // }, 50); // }); $(document).on('change keyup keydown keypress', '.text-uppercase', function(){ $(this).val($(this).val().toUpperCase()); }); var ilter = function() { var s991 = 991, tc = '.topbar-container', tn = '.topbar-nav', t = function() { $('.menu-categories li > .collapse').on('shown.bs.collapse', function(e) { e.preventDefault(), e.stopPropagation(); var o = $(this).parent().offset(), n = $('#topbar').offset(), s = o.top - n.top; o.left, n.left; $('#topbar').mCustomScrollbar('scrollTo', '-=' + s) }) }, k = function() { if ($(tc).hasClass('topbar-opened')) { $(tn).slideDown(300); } else if ($(tc).hasClass('topbar-closed')) { $(tn).slideUp(300); } }, a = function() { $('.sidebarCollapse').on('click', function(e) { e.preventDefault(), $(tc).toggleClass('topbar-closed'), $(tc).toggleClass('topbar-opened'), $('.overlay').toggleClass('show'), $('footer .footer-section-1').toggleClass('f-close'), k() }) }, i = function() { $('.toggle-control-sidebar').click(function(e) { e.preventDefault(), $('.control-sidebar').toggleClass('control-sidebar-open'), $('.cs-overlay').toggleClass('show'), $('html,body').toggleClass('cs-noneoverflow') }) }, r = function() { $('.overlay, cs-overlay').on('click', function() { $(tc).addClass('topbar-closed'), $(tc).removeClass('topbar-opened'), $('.overlay').removeClass('show'), k() }) }, c = function() { $('.cs-overlay').on('click', function() { $(this).removeClass('show'), $('html,body').removeClass('cs-noneoverflow'), $('.control-sidebar').removeClass('control-sidebar-open') }) }, u = function() { $('#topbar').mCustomScrollbar('destroy') }, f = function() { $('#topbar').mCustomScrollbar({ theme: 'minimal', mouseWheel: { preventDefault: true }, scrollInertia: 1e3 }) }, d = function() { // $('.menu-categories li.menu .submenu').mCustomScrollbar({ // theme: 'minimal', // mouseWheel:{ // preventDefault: true // }, // scrollInertia: 1e3 // }) }, p = function() { $(document).on('click', function(e) { $('.menu-categories li.menu > .submenu').is(e.target) || $('.menu-categories li.menu > .submenu').has(e.target).length || $('.menu-categories li.menu > .submenu').collapse('hide') }) }, mp = function(e) { var width = $(e).innerWidth(), margin = parseInt($(e).css('margin-left')), position = $(e).position(), ust_width = $(e).parent().outerWidth(), sub_menu = $(e).find('.submenu'), sub_menu_width = sub_menu.outerWidth(); if ((ust_width - (position.left)) < ((sub_menu_width / 2) + 17)) { sub_menu.css({ 'left': 'auto', 'right': '10px' }) } else if (position.left > (sub_menu_width / 2)) { sub_menu.css({ 'left': (position.left + (width / 2) - (sub_menu_width / 2)) + (margin), 'right': 'auto' }) } else { sub_menu.css({ 'left': '10px', 'right': 'auto' }) } }, ttm = function() { $('.topbar-nav.header nav#topbar ul.menu-categories li.menu').on('click', function(e) { mp(e.currentTarget); }) }, h = function() { $('.chb').change(function() { $('.chb').prop('checked', !1), $(this).prop('checked', true) }) }, g = function() { window.innerWidth <= s991 && ($('.menu-categories li > .collapse').removeClass('eq-animated eq-fadeInUp'), t(), f()) }, b = function() { $(window).on('resize', function(event) { event.preventDefault(), window.innerWidth <= s991 && ($('.menu-categories li > .collapse').removeClass('eq-animated eq-fadeInUp'), f()) }) }, v = function() { window.innerWidth > s991 && (u(), p(), $('.menu-categories li > .collapse').addClass('eq-animated eq-fadeInUp')) }, C = function() { $(window).on('resize', function(event) { $('.topbar-nav.header nav#topbar ul.menu-categories li.menu .submenu.collapse').each(function() { mp($(this).parent('.menu')); }); event.preventDefault(), window.innerWidth > s991 && ($('footer .footer-section-1').removeClass('f-close'), $('.menu-categories li > .collapse').addClass('eq-animated eq-fadeInUp'), u()); }) }, cs = function() { $('.control-sidebar .sidebar-scroll').mCustomScrollbar({ advanced: { updateOnContentResize: true }, mouseWheelPixels: 100, scrollInertia: 250, theme: 'minimal' }) }, mm = function() { $('.message-dropdown .message-scroll').mCustomScrollbar({ advanced: { updateOnContentResize: true }, theme: 'minimal' }); }; return { init: function() { $(window).scroll(function() { if ($(this).scrollTop() > 100) { $('.scrollTop').fadeIn(); } else { $('.scrollTop').fadeOut(); } }); h(), a(), i(), r(), c(), v(), C(), g(), b(), cs(), ttm(), mm() }, f_listType: null, f_contentType: null, f_listModal: null, // Formsuz İşlem Fonksiyonu actionNF: function(btn, content, action, data, callback = null) { if(btn!==null){ var button = $(btn), buttonText = button.html(), buttonWidth = (button.outerWidth() < 120 ? 120 : button.outerWidth()), buttonHeight = button.outerHeight(), loadingg = buttonWidth - (button.outerWidth() - button.width()); } var ajaxResult, formData = new FormData(); formData.append(CSRFTokenKey, CSRFToken); $.each(data, function(key, value){ formData.append(key, value); }); formData.append(CSRFTokenKey, CSRFToken); $.ajax({ url: ADDRESS_PANEL + content + '/' + action, type: 'POST', data: formData, dataType: 'JSON', beforeSend: function() { if(button){ button.prop('disabled', true).css('width', buttonWidth + 'px').css('height', buttonHeight + 'px').html('
'); } }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (response.command) { eval(response.command); } } }, complete: function() { if(button){ if (ajaxResult == false || (ajaxResult.notification !== null && ajaxResult.notification.type !== 'success')) { setTimeout(function(){ button.html(buttonText).removeAttr('style').prop('disabled', false); }, 250); } } if(ajaxResult !== false && callback){ callback(ajaxResult); } }, cache: false, contentType: false, processData: false }); return false; }, // İşlem Fonksiyonu action: function(btn, content, action, form) { var button = $(btn), buttonText = button.html(), buttonWidth = (button.outerWidth() < 120 ? 120 : button.outerWidth()), buttonHeight = button.outerHeight(), loadingg = buttonWidth - (button.outerWidth() - button.width()), ajaxResult, formId = '#' + form, formData = new FormData($(formId)[0]); $('[data-plugin-codemirror]').each(function() { var name = $(this).attr('name'); CodeEditor[name].codemirror.save(); var value = CodeEditor[name].codemirror.getValue(); formData.append(name, value); }); formData.append(CSRFTokenKey, CSRFToken); formData.append('button', button); $(formId).find('.option-data').each(function(){ formData.delete($(this).attr('name')); }); $.ajax({ url: ADDRESS_PANEL + content + '/' + action, type: 'POST', data: formData, dataType: 'JSON', beforeSend: function() { if (action == 'database' || action == 'update' || action == 'backup') { notification('warning', 'UYARI!', 'İşlem devam ediyor. Lütfen pageyı yenilemeyin veya kapatmayın.'); } button.prop('disabled', true).css('width', buttonWidth + 'px').css('height', buttonHeight + 'px').html('
'); }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (action == 'database') { $('#tables').html(response.tables); $('#result').html(response.result).fadeIn('fast'); setTimeout(function(){ button.html(buttonText).removeAttr('style').prop('disabled', false); }, 1000); } else if (action == 'update') { $('#action_result').html(response.result); } if (response.command) { eval(response.command); } } }, complete: function() { if (ajaxResult == false || (ajaxResult.notification !== null && ajaxResult.notification.type && ajaxResult.notification.type !== 'success')) { setTimeout(function(){ button.html(buttonText).removeAttr('style').prop('disabled', false); }, 1000); } }, cache: false, contentType: false, processData: false }); return false; }, // Checkbox İşlem Fonksiyonu actionCB: function(btn, content, action, data) { var button = $(btn), formData = new FormData(); $.each(data, function(key, value){ formData.append(key, value); }); formData.append('check', (button.is(':checked') ? '1' : '0')); formData.append(CSRFTokenKey, CSRFToken); $.ajax({ url: ADDRESS_PANEL + content + '/' + action, type: 'POST', data: formData, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (response.command) { eval(response.command); } } }, complete: function() { if (ajaxResult == false || (ajaxResult.notification !== null && ajaxResult.notification.type && ajaxResult.notification.type !== 'success')) { setTimeout(function(){ button.prop('checked', !button.is(':checked')); }, 250); } }, cache: false, contentType: false, processData: false }); return false; }, // Dosya İşlem Fonksiyonu formatBytes: function (bytes, decimals = 2) { bytes = parseInt(bytes); if (bytes === 0) { return '0 Byte'; } if(bytes>0) { const k = 1024; const dm = decimals < 0 ? 0 : decimals; const sizes = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } else { return '0 Byte'; } }, fileAction: function(btn, content, action, data) { var _this = this; var button = $(btn); var buttonText = button.html(); var buttonWidth = (button.outerWidth() < 120 ? 120 : button.outerWidth()); var buttonHeight = button.outerHeight(); var loadingg = buttonWidth - (button.outerWidth() - button.width()); var xhr = new window.XMLHttpRequest(); data.append(CSRFTokenKey, CSRFToken); $.ajax({ url: ADDRESS_PANEL + 'tools/file-manager/' + action + '/' + content, type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { button.prop('disabled', true).css('width', buttonWidth + 'px').css('height', buttonHeight + 'px').html('
'); }, xhr: function() { xhr.upload.addEventListener('progress', function(evt) { if (evt.lengthComputable) { var percentComplete = evt.loaded / evt.total; var progress = (percentComplete * 100).toFixed(2); $('#progress').html(_this.formatBytes(evt.loaded) + ' / ' + _this.formatBytes(evt.total)); if(progress==100){ $('#progress').html('İşleniyor..'); } $('#progress_bar').width(progress + '%').html('%' + progress); } }, false); return xhr; }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); $('#progress').html(''); $('#progress_bar').width('0%').html('%0'); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (response.command) { eval(response.command); } } }, complete: function() { if (ajaxResult == false || (ajaxResult.notification !== null && ajaxResult.notification.type && ajaxResult.notification.type !== 'success')) { setTimeout(function(){ button.html(buttonText).removeAttr('style').prop('disabled', false); $('#progress').html(''); $('#progress_bar').width('0%').html('%0'); }, 1500); } if (ajaxResult !== false && (ajaxResult.notification !== null && ajaxResult.notification.type && ajaxResult.notification.type == 'success')) { $('#progress').html('Tamamlandı'); $('#progress_bar').width('100%').html('%100'); } }, cache: false, contentType: false, processData: false }); return false; }, // Liste Tipine Göre button listButton: function(btn, listType) { var button = $(btn); this.f_listType = listType; if (button.hasClass('active')) { return false; } listData = { page: '1', list_count: '20' }; $('#refresh-button').attr('onclick', 'ilter.getList(\'' + this.f_contentType + '\', \'' + listType + '\');'); if($('[data-plugin-popover][popover-opened="true"]').length>0){ $(function(){ $('[data-plugin-popover][popover-opened="true"]').each(function(){ var _this = $(this); _this.popover('hide'); }); }); } switch (this.f_contentType) { default: var btn_list = button.parent().parent('ul').find('li button'); btn_list.removeClass('btn-primary btn-warning active').addClass('btn-default'); if (listType == 'actives') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/actives'); button.removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'trash') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/trash'); button.removeClass('btn-default').addClass('btn-warning active'); } break; case 'tools/templates': var btn_list = button.parent().parent('ul').find('li button'); btn_list.removeClass('btn-primary btn-info btn-warning active').addClass('btn-default'); if (listType == 'replies') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/replies'); button.removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'trash,') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/trash'); button.removeClass('btn-default').addClass('btn-warning active'); } break; case 'tools/file-manager': var btn_list = $('#contents > .card-header > #folders'); btn_list.find('button').removeClass('btn-primary btn-warning active').addClass('btn-default'); if (listType == 'recent') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/recent'); btn_list.find('[data-list-type="' + listType + '"]').removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'image') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/image'); btn_list.find('[data-list-type="' + listType + '"]').removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'video') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/video'); btn_list.find('[data-list-type="' + listType + '"]').removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'document') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/document'); btn_list.find('[data-list-type="' + listType + '"]').removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'archive') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/archive'); btn_list.find('[data-list-type="' + listType + '"]').removeClass('btn-default').addClass('btn-primary active'); } else if (listType == 'trash') { setURL(ADDRESS_PANEL + this.f_contentType + '/list/trash'); button.removeClass('btn-default').addClass('btn-warning active'); } listData['openType'] = 'page'; break; } $.ajax({ url: ADDRESS_PANEL + 'system/help/new_csrf', type: 'POST', data: { url: location.href }, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.command) { eval(response.command); } } }); listData[CSRFTokenKey] = CSRFToken; this.getList(this.f_contentType, this.f_listType); }, // İçerik Filtreleri listFilter: function(btn, key, value) { var button = $(btn); if (key == 'token') { notification('error', 'İŞLEM HATASI', 'CSRF Token bilgisi geçersiz.'); return false; } if (key == 'search' && value == '') { notification('error', 'İŞLEM HATASI', 'Arama yapmak için bir şeyler yazmadınız.'); return false; } if (key == 'page' && parseInt(value) < 1) { notification('error', 'İŞLEM HATASI', 'Geçersiz sayfa sayısı girildi.'); return false; } if (key == 'list_count' && (parseInt(value) < 1 || parseInt(value) > 100)) { notification('error', 'İŞLEM HATASI', 'Geçersiz öğe sayısı girildi.'); return false; } if(key!=='page'){ listData['page'] = '1'; } if (key in listData) { delete listData[key]; } if(value==null){ delete listData[key]; }else{ listData[key] = value; } this.getList(this.f_contentType, this.f_listType); }, // İçerik Listeleme Fonksiyonu getList: function(contentType, listType, modal = null) { var _this = this; _this.f_contentType = contentType; _this.f_listType = listType; if (modal && _this.f_listModal !== modal) { _this.f_listModal = modal; } var htmlId = '#' + (_this.f_listModal ? _this.f_listModal + ' #list-' : 'contents #list-'); var data = listData; $.ajax({ url: ADDRESS_PANEL + contentType + '/list/' + listType, type: 'POST', data: data, dataType: 'JSON', beforeSend: function() { if (_this.f_listModal) { $('#' + _this.f_listModal).find('.modal-body').mCustomScrollbar('destroy'); } $('body .tooltip').tooltip('hide'); $(htmlId + 'body').html('
').fadeIn(2000); }, error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { if (response.notification == null) { $(htmlId + 'body .card-loading').fadeOut('fast'); if(response.html.header) { $(htmlId + 'header').html(response.html.header).fadeIn('fast'); } $(htmlId + 'body').html(response.html.body); if(response.html.footer) { $(htmlId + 'footer').html(response.html.footer).fadeIn('fast'); } } else if (response.notification.type == 'error') { $(htmlId + 'body .card-loading').fadeOut('fast'); $(htmlId + 'header').html(response.html.header).fadeIn('fast'); $(htmlId + 'body').html(response.html.body); $(htmlId + 'footer').html(response.html.footer).fadeIn('fast'); if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } } if (!_this.f_listModal && contentType == 'tools/file-manager') { fileManager(response.count, listType); } if (response.command) { eval(response.command); } } }, complete: function(response) { if (_this.f_listModal) { modal_scroll(_this.f_listModal, false); } (function($) { 'use strict'; if ($(htmlId + 'body').find('[data-plugin-tooltip]').length > 0) { if ($.isFunction($.fn['tooltip'])) { $(function() { $(htmlId + 'body').find('[data-plugin-tooltip]').each(function() { var _this = $(this); _this.tooltip(); }); }); } } }).apply(this, [jQuery]); (function($) { 'use strict'; if ($(htmlId + 'body').find('[data-plugin-clipboard]').length > 0) { if (typeof ClipboardJS !== undefined) { $(function() { $(htmlId + 'body').find('[data-plugin-clipboard]').each(function() { var _this = $(this).get(0); var copy = new ClipboardJS(_this, { container: $(htmlId + 'body').get(0) }); copy.on('error', function(e) { notification('error', 'HATA!', 'Kopyalanamadı.
Lütfen yazılım danışmanınıza başvurun.'); }); }); }); } } }).apply(this, [jQuery]); (function($) { 'use strict'; $('.scroll-dropdown').each(function () { $(this).css('max-height', '300px').mCustomScrollbar({ advanced: { updateOnContentResize: true }, theme: 'minimal' }) }) }).apply(this, [jQuery]); } }); }, fileAddToEditor: function(id, type) { var data = { fileType: type, fileId: id, editorType: editorType }, ajaxResult; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/add_file', type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); ajaxResult = false; }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if(response.html !== null){ if(editorType=='sms'){ activeEditor.insertText(response.html); }else{ activeEditor.insertContent(response.html); } } if (response.command) { eval(response.command); } } } }); return false; }, contentAddToEditor: function(id, type) { var data = { contentType: type, contentId: id, editorType: editorType }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/add_content', type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.notification == null) { if(editorType=='push'){ if(response.html.title){ activeEditor.find('#content_title').val(response.html.title); if(response.html.content!==null){ activeEditor.find('#content_content').val(response.html.content); } if(response.html.slug!==null){ activeEditor.find('#content_slug').val(response.html.slug); } if(response.html.image!==null){ activeEditor.find('#content_image').val(response.html.image.id); activeEditor.find('#file-preview-content_image > .preview').attr('src', response.html.image.slug); } }else{ notification('error', 'İŞLEM HATASI!', 'İşlem tamamlanamadı.'); } }else if(editorType=='sms'){ activeEditor.insertText(response.html); }else{ activeEditor.insertContent(response.html); } } else if (response.notification.type == 'error') { if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } } if (response.command) { eval(response.command); } } }); return false; }, productAddToEditor: function(id, type) { var data = { productType: type, productId: id, editorType: editorType }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/add_product', type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.notification == null) { if(editorType=='push'){ if(response.html.title){ activeEditor.find('#content_title').val(response.html.title); if(response.html.product!==null){ activeEditor.find('#content_content').val(response.html.content); } if(response.html.slug!==null){ activeEditor.find('#content_slug').val(response.html.slug); } if(response.html.image!==null){ activeEditor.find('#content_image').val(response.html.image.id); activeEditor.find('#file-preview-content_image > .preview').attr('src', response.html.image.slug); } }else{ notification('error', 'İŞLEM HATASI!', 'İşlem tamamlanamadı.'); } }else if(editorType=='sms'){ activeEditor.insertText(response.html); }else{ activeEditor.insertContent(response.html); } } else if (response.notification.type == 'error') { if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } } if (response.command) { eval(response.command); } } }); return false; }, codeAddToEditor: function(code){ if(editorType=='push'){ if(activeEditor.find('#content_content').length>0){ activeEditor.find('#content_content').insertText(code); }else{ activeEditor.insertText(code); } activeEditor.focusToEnd(); }else if(editorType=='sms'){ activeEditor.insertText(code); activeEditor.focusToEnd(); }else{ activeEditor.insertContent(code); } }, templateAddToEditor: function(id) { var data = { template: id, editorType: editorType }; data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + 'system/help/action/add_template', type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.notification == null) { activeEditor.setContent(response.html); } else if (response.notification.type == 'error') { if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } } if (response.command) { eval(response.command); } } }); return false; }, selectFile: function(id, type, ctype, dir = 'content', sizes = null) { $('#modal_file [data-dismiss="modal"]').click(); var content = $('body #file-data-' + id).val(); if (modalOpener == 'editor') { if (typeof this.fileAddToEditor == 'function') { this.fileAddToEditor(id, type); } else { notification('error', 'İŞLEM HATASI!', 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
Editör bulunamadı!'); } } else { $('[name="' + modalOpener + '"]').val(id); var fileSelectEl = $('[id="file-select-' + modalOpener + '"]'), filePreviewEl = $('[id="file-preview-' + modalOpener + '"]'), fileDetailEl = $('[id="file-detail-' + modalOpener + '"]'); if (type == 'image') { filePreviewEl.find('img').attr('src', content); if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-image').addClass('fa-exchange-alt'); } else { fileSelectEl.html(' Resim Düzenle'); } } else if (type == 'video') { if (!$(filePreviewEl).hasClass('embed-responsive')) { $(filePreviewEl).addClass('embed-responsive').addClass('embed-responsive-16by9'); $(filePreviewEl).css('max-width', (parseInt(ilterData.previewWidth) + 10) + 'px').css('max-height', (parseInt(ilterData.previewHeight) + 10) + 'px'); } if (ctype == 'file' || ctype == 'url') { var template = ''; } else if (ctype == 'embed') { var template = ''; } $(filePreviewEl).html(template); if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-video').addClass('fa-exchange-alt'); } else { fileSelectEl.html(' Video Düzenle'); } } else if (type == 'document') { $(filePreviewEl).val(content); if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-file-alt').addClass('fa-exchange-alt'); } else { fileSelectEl.html(' Belge Düzenle'); } fileDetailEl.attr('onclick', 'modal(this, \'modal_file\', \'tools/file-manager/detail/' + id + '\', false, {openType: \'modal\', dir: \'' + dir + '\', modalOpener: \'' + modalOpener + '\'});').removeClass('d-none').addClass('d-block'); } else if (type == 'archive') { $(filePreviewEl).val(content); if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-file-archive').addClass('fa-exchange-alt'); } else { fileSelectEl.html(' Arşiv Düzenle'); } fileDetailEl.attr('onclick', 'modal(this, \'modal_file\', \'tools/file-manager/detail/' + id + '\', false, {openType: \'modal\', dir: \'' + dir + '\', modalOpener: \'' + modalOpener + '\'});').removeClass('d-none').addClass('d-block'); } if (dir !== 'content') { fileSelectEl.attr('onclick', 'modal(this, \'modal_file\', \'tools/file-manager/edit/' + id + '\', false, {openType: \'modal\', dir: \'' + dir + '\', modalOpener: \'' + modalOpener + '\', uploadWidth: \'' + sizes.uploadWidth + '\', uploadHeight: \'' + sizes.uploadHeight + '\', previewWidthHeight: \'' + sizes.previewWidthHeight + '\'});'); } $('[id="file-remove-' + modalOpener + '"]').removeClass('d-none').addClass('d-block'); } // $.ajax({ // url: ADDRESS_PANEL + 'system/help/action/hit/file', // type: 'POST', // data: { // id: id // }, // success: function(response) {} // }); if (dir !== 'content') { $('body #file-data-' + id).remove(); } }, selectContent: function(id, type) { $('#modal_content [data-dismiss="modal"]').click(); if (typeof this.contentAddToEditor == 'function') { this.contentAddToEditor(id, type); } else { notification('error', 'İŞLEM HATASI!', 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
Editör bulunamadı!'); } // $.ajax({ // url: ADDRESS_PANEL + 'system/help/action/hit/content', // type: 'POST', // data: { // id: id // }, // success: function(response) {} // }); }, selectProduct: function(id, type) { $('#modal_product [data-dismiss="modal"]').click(); if (typeof this.productAddToEditor == 'function') { this.productAddToEditor(id, type); } else { notification('error', 'İŞLEM HATASI!', 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
Editör bulunamadı!'); } // $.ajax({ // url: ADDRESS_PANEL + 'system/help/action/hit/product', // type: 'POST', // data: { // id: id // }, // success: function(response) {} // }); }, selectCode: function(code) { $('#modal_system [data-dismiss="modal"]').click(); if (code && typeof this.codeAddToEditor == 'function') { this.codeAddToEditor(code); } else { notification('error', 'İŞLEM HATASI!', 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
Editör bulunamadı!'); } }, selectTemplate: function(id, lang = null) { $('#modal_content [data-dismiss="modal"]').click(); if (typeof this.templateAddToEditor == 'function') { this.templateAddToEditor(id, lang); } else { notification('error', 'İŞLEM HATASI!', 'Bilinmeyen bir nedenle işlem tamamlanamadı. Hata Detayı:
Editör bulunamadı!'); } // $.ajax({ // url: ADDRESS_PANEL + 'system/help/action/hit/template', // type: 'POST', // data: { // id: id // }, // success: function(response) {} // }); }, fileRemove: function(id, type, dir) { var fileSelectEl = $('[id="file-select-' + id + '"]'), filePreviewEl = $('[id="file-preview-' + id + '"]'); switch (type) { case 'image': filePreviewEl.html(''); if (fileSelectEl.find('i').hasClass('fa-pencil-alt') || fileSelectEl.find('i').hasClass('fa-exchange-alt')) { fileSelectEl.find('i').removeClass('fa-pencil-alt').removeClass('fa-exchange-alt').addClass('fa-image'); } if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-exchange-alt').addClass('fa-image'); } else { fileSelectEl.html(' Resim Oluştur'); } break; case 'video': filePreviewEl.html(''); if (fileSelectEl.find('i').hasClass('fa-pencil-alt') || fileSelectEl.find('i').hasClass('fa-exchange-alt')) { fileSelectEl.find('i').removeClass('fa-pencil-alt').removeClass('fa-exchange-alt').addClass('fa-video'); } if (filePreviewEl.hasClass('embed-responsive')) { filePreviewEl.removeClass('embed-responsive').removeClass('embed-responsive-16by9'); } if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-exchange-alt').addClass('fa-video'); } else { fileSelectEl.html(' Video Oluştur'); } break; case 'document': filePreviewEl.val(''); if (fileSelectEl.find('i').hasClass('fa-pencil-alt') || fileSelectEl.find('i').hasClass('fa-exchange-alt')) { fileSelectEl.find('i').removeClass('fa-pencil-alt').removeClass('fa-exchange-alt').addClass('fa-file-alt'); } if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-exchange-alt').addClass('fa-file-alt'); } else { fileSelectEl.html(' Belge Oluştur'); } break; case 'archive': filePreviewEl.val(''); if (fileSelectEl.find('i').hasClass('fa-pencil-alt') || fileSelectEl.find('i').hasClass('fa-exchange-alt')) { fileSelectEl.find('i').removeClass('fa-pencil-alt').removeClass('fa-exchange-alt').addClass('fa-file-archive'); } if (dir == 'content') { fileSelectEl.find('i').removeClass('fa-exchange-alt').addClass('fa-file-archive'); } else { fileSelectEl.html(' Arşiv Oluştur'); } break; } $('[name="' + id + '"]').val('0'); if (dir !== 'content') { fileSelectEl.attr('onclick', 'modal(this, \'modal_file\', \'tools/file-manager/create/' + (type == 'image' ? 'editor' : type) + '\', false, {openType: \'modal\', dir: \'' + dir + '\'});'); } $('[id="file-remove-' + id + '"]').removeClass('d-block').addClass('d-none'); $('[id="file-detail-' + id + '"]').removeClass('d-block').addClass('d-none'); }, selectCountry: function(btn, cityId){ return this.getOptions(btn, 'system/help/action/select_country', cityId); }, selectCity: function(btn, districtId){ return this.getOptions(btn, 'system/help/action/select_city', districtId); }, selectGroup: function(btn, categoryId, extraType){ return this.getOptions(btn, 'system/help/action/select_group', categoryId, extraType); }, // İl İlçe seçimi getOptions: function(btn, uri, input_id, customData = null) { var input = $('#' + input_id); var inputId = input.attr('id'), inputName = input.attr('id'); var data = { id: inputId, name: inputName, selected: $(btn).val() }; if(customData!==null){ for(var i in customData){ data[i] = customData[i]; } } data[CSRFTokenKey] = CSRFToken; $.ajax({ url: ADDRESS_PANEL + uri, type: 'POST', data: data, dataType: 'JSON', error: function(xhr, errorString, exception) { ajaxErrorNotification(xhr, errorString, exception); }, success: function(response) { if (response.status == 'error') { ajaxNullNotification(response); ajaxResult = false; return false; } else { ajaxResult = response; if(response.notification !== null) { if (response.notification.type && response.notification.type !== null) { notification(response.notification.type, response.notification.title, response.notification.message); } } if (response.command) { eval(response.command); } } } }); return false; } } }(); $('#content').on('shown.bs.dropdown', function() { $(this).find('.dropdown-menu').css('max-height', '350px').mCustomScrollbar({ advanced: { updateOnContentResize: true }, mouseWheelPixels: 100, scrollInertia: 250, theme: 'minimal' }) }); var windowWidth; function windowSizes() { var e = window, a = 'inner'; if (!('innerWidth' in window)) { a = 'client'; e = document.documentElement || document.body; } return { width: e[a + 'Width'], height: e[a + 'Height'] }; } $('.scrollTop').click(function() { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); var hRe = $('.tasks').height(), aRe = $('aside.control-sidebar').height(), winHei = $(window).height(); function checkall(o, e) { var n = $('#' + o), r = $('.' + e); n.click(function() { r.prop('checked', $(this).prop('checked')) }) } function collapse(o) { 'panel' === o ? $('.js-collapse').on('click', function(o) { o.preventDefault(), $(this).parent().parent().parent().parent().find('.panel-collapse').slideToggle('slow') }) : 'card' === o } function reload(o) { 'panel' === o ? $('.js-refresh').on('click', function() { var o = $('.panel-collapse'); $(o).block({ message: '', timeout: 2e3, overlayCSS: { backgroundColor: '#000', opacity: .8, cursor: 'wait' }, css: { border: 0, color: '#fff', padding: 0, backgroundColor: 'transparent' } }) }) : 'card' === o && $('.js-refresh').on('click', function() { var o = $('.reload-widget-area'); $(o).block({ message: '', timeout: 2e3, overlayCSS: { backgroundColor: '#000', opacity: .8, cursor: 'wait' }, css: { border: 0, color: '#fff', padding: 0, backgroundColor: 'transparent' } }) }) } function multiCheck(o) { o.on('change', '.chk-parent', function() { var o = $(this).closest('table').find('td:first-child .child-chk'), e = $(this).is(':checked'); $(o).each(function() { e ? ($(this).prop('checked', true), $(this).closest('tr').addClass('active')) : ($(this).prop('checked', !1), $(this).closest('tr').removeClass('active')) }) }), o.on('change', 'tbody tr .new-control', function() { $(this).parents('tr').toggleClass('active') }) } function checkall(o, e) { var n = $('#' + o), r = $('.' + e); n.click(function() { r.prop('checked', $(this).prop('checked')) }) } function topbarSlide() { var n = '.topbar-container', j = '.topbar-nav'; if ($(n).hasClass('topbar-opened')) { $(j).slideDown(300); } else if ($(n).hasClass('topbar-closed')) { $(j).slideUp(300); } } function sidebarCloser() { var expanded = false; $('.menu-categories > li.menu > a').each(function() { var ariaExpanded = $(this).attr('aria-expanded'); if (ariaExpanded == 'true') { expanded = true; } }); if (windowWidth <= 991) { if (expanded == false) { $('.topbar-container').addClass('topbar-closed'); $('.topbar-container').removeClass('topbar-opened'); $('.overlay').removeClass('show'); } else { $('.topbar-container').removeClass('topbar-closed'); $('.topbar-container').addClass('topbar-opened'); $('.overlay').addClass('show'); topbarSlide(); } } else if (windowWidth > 991) { $('.navbar').removeClass('expand-header'); $('.topbar-container').removeClass('topbar-closed'); $('.topbar-container').removeClass('topbar-opened'); $('.overlay').removeClass('show'); topbarSlide(); $('.topbar-nav').removeAttr('style'); } } function sidebarMobCheck() { windowWidth = windowSizes().width; if (windowWidth <= 991) { if ($('.topbar-container').hasClass('topbar-opened')) return; sidebarCloser() } else if (windowWidth > 991) { sidebarCloser() } } function GetIEVersion() { var o = window.navigator.userAgent, e = o.indexOf('MSIE'); return e > 0 ? parseInt(o.substring(e + 5, o.indexOf('.', e))) : navigator.userAgent.match(/Trident\/7\./) ? 11 : 0 } function hideDropdown(o, e, n) { var r = o, i = e, t = n; '' != r && '' != i && '' != t ? $(document).on('click touchend', function() { $(r).removeClass(t), $(i).removeClass(t) }) : console.error('Fn hideDropdown requires three parameters') } $('.nav.nav-codemirror .nav-item').click(function() { var tab_href = $(this).find('.nav-link').attr('href'); setTimeout(function(){ $(tab_href).find('[data-plugin-codemirror]').each(function() { var name = $(this).attr('name'); CodeEditor[name].codemirror.refresh(); }); }, 200); }), $('.nav.nav-url .nav-item').click(function() { var tab_href = $(this).find('.nav-link').attr('href'); var link = set_GET('tab', tab_href.replace('#tab-', '')); var title = $('title').html(); window.history.pushState('object or string', title, link); }), $(function() { $('.js-cancel').on('click', function(o) { $(this).parents('#cancel-row').fadeOut('slow', function(o) {}) }) }), sidebarCloser(), $(window).resize(function(o) { sidebarMobCheck() }), hideDropdown('.app-dropdown, .message-dropdown, .notification-dropdown', '.app-dropdown .dropdown-menu, .message-dropdown .dropdown-menu, .notification-dropdown .dropdown-menu', 'show');