%PDF- %PDF-
| Direktori : /home/cargonizer/domains/cargonizer.com.tr/public_html/admin/assets/scripts/custom/ |
| Current File : /home/cargonizer/domains/cargonizer.com.tr/public_html/admin/assets/scripts/custom/index.js |
var Index = function () {
return {
//main function
init: function () {
App.addResponsiveHandler(function () {
jQuery('.vmaps').each(function () {
var map = jQuery(this);
map.width(map.parent().width());
});
});
$('.tags').tagsInput({
width: 'auto',
defaultText:''
});
jQuery('.group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
$(this).parents('tr').addClass("active");
} else {
$(this).attr("checked", false);
$(this).parents('tr').removeClass("active");
}
});
jQuery.uniform.update(set);
});
jQuery('table').on('change', 'tbody tr .checkboxes', function(){
$(this).parents('tr').toggleClass("active");
});
$('a.mdl').on('click',function(e) {
e.preventDefault();
var mdl = $(this).data('target');
$('.modal-content',mdl).load($(this).attr('href'),'',function() {
$(mdl).modal();
$('.gallery_folder li').on('mouseover',function() {
$('.actions',this).show();
});
$('.gallery_folder li').on('mouseout',function() {
$('.actions',this).hide();
});
//App.init();
});
});
},
initMiniCharts: function () {
$('.easy-pie-chart .number.transactions').easyPieChart({
animate: 1000,
size: 75,
lineWidth: 3,
barColor: App.getLayoutColorCode('yellow')
});
$('.easy-pie-chart .number.visits').easyPieChart({
animate: 1000,
size: 75,
lineWidth: 3,
barColor: App.getLayoutColorCode('green')
});
$('.easy-pie-chart .number.bounce').easyPieChart({
animate: 1000,
size: 75,
lineWidth: 3,
barColor: App.getLayoutColorCode('red')
});
},
};
}();
function deleteRow(message,url) {
bootbox.confirm(message, function(result) {
if(result == true ) top.location.href= url;
});
}
function changePass(login) {
bootbox.prompt("Yeni şifreyi yazınız", function(result) {
if (result === null) {
} else {
top.location.href= '?s=emails&action=edit&login='+login+'&pass='+result;
}
});
}
function getDetail(fid,id,ths,editor) {
$('.gallery_folder li').removeClass('active');
jQuery.post('ajax.php',{'action':'getfile','fid':fid,'id':id,'editor':editor},function(data){
$('#preview').html(data);
$(ths).parent().addClass('active');
})
}
function getTemplate(fid,id,ths,editor){
$('.gallery_folder li').removeClass('active');
jQuery.post('ajax.php',{'action':'gettemplate','fid':fid,'id':id,'editor':editor},function(data){
$('#preview').html(data);
$(ths).parent().addClass('active');
})
}
function relTemp(fid,mode) {
var id = $('#tempForm select[name=templates]').val();
var text = $('#tempForm textarea[name=text]').val();
jQuery.post('ajax.php',{'action':'relTemp','id':id,'fid':fid,'text':text,'mode':mode},function(data){
$('#relTemp').hide();
$('#relDelTemp').show();
$('#relEditTemp').show();
});
}
function relDelTemp(ths,id) {
$.post('ajax.php',{'action':'relDelTemp','id':id},function() {
$(ths).parents('li').remove();
$('#relTemp').show();
$('#relDelTemp').hide();
$('#relEditTemp').hide();
});
}
function relatedPic(id,fid) {
jQuery.post('ajax.php',{'action':'related','id':id,'fid':fid},function(data){
$('#createRelated').hide();
$('#deleteRelated').show();
});
}
function fileDel(id) {
jQuery.post('ajax.php',{'action':'fileDel','id':id},function(data){
$('.gallery_folder li.active').remove();
$('#preview').html(' ');
});
}
function temp2Editor(temp_id,type){
var data = '{{SABLON id:'+temp_id+' type:'+type+'}}';
tinymce.get("detail").execCommand('mceInsertContent', false, data);
jQuery('#ajaxs').modal('hide');
}
function send2editor(id,fid,editor,html) {
jQuery.post('ajax.php',{'action':'decode','value':html,'id':id,'fid':fid}).done(function(data){
if(editor=='shortdetail') {
tinymce.get("shortdetail").execCommand('mceInsertContent', false, data);
}
else {
tinymce.get("detail").execCommand('mceInsertContent', false, data);
}
jQuery('#ajaxs').modal('hide');
});
}
function customUrl(editor) {
var url = $('#custom-url #url').val();
var baslik = $('#custom-url #baslik').val();
var data = '<a href='+url+'>'+baslik+'</a>';
if(editor=='shortdetail') tinymce.get("shortdetail").execCommand('mceInsertContent', false, data);
else tinymce.get("detail").execCommand('mceInsertContent', false, data);
jQuery('#ajaxs').modal('hide');
}
function showPass(val)
{
var check = $(val).attr("checked");
if(check)
document.getElementById("passEdit").setAttribute('type','text');
else
document.getElementById("passEdit").setAttribute('type','password');
}
function relatedDel(ths,id) {
$.post('ajax.php',{'action':'relatedDel','id':id},function() {
$(ths).parents('li').remove();
$('#createRelated').show();
$('#deleteRelated').hide();
});
}
function folderList(){
$.post('ajax.php',{'action':'folderList'},function(data) {
$('#browse_folder').html(data);
});
}
function newTemplate(id){
var name = $('#createTemplate input[name=name]').val();
var tType = $('#createTemplate select[name=tType]').val();
if (name == "") { alert('Lütfen şablon adı yazınız!'); }
else {
$.post('ajax.php',{'action':'createTemplate','id':id,'name':name,'tType':tType}).done(
function(){
jQuery('#ajaxs').modal('hide');
}
);
}
}
function ajaxSablon(id){
$.post('ajax.php',{'action':'ajaxSablon','id':id},function(data) {
$('#template-cnt > .row').html(data);
});
}
function getRelatedAjax(id){
$.post('ajax.php',{'action':'getRelatedAjax','id':id},function(data) {
$('#related').html(data);
});
}
function oldTemplate(elm,op){
var name = $('#'+elm+'.old-template input[name=name]').val();
if (name == "") { alert('Lütfen şablon adı yazınız!'); }
else {
$.post('ajax.php',{'action':'oldTemplate','id':elm,'name':name,'op':op}).done(
function(){
if (op == 'edit'){
alert('Şablon adı değiştirildi!');
}
else if (op == 'del') {
$('#'+elm+'.old-template').remove();
}
}
);
}
}
function getLibraryList(id){
$.post('ajax.php',{'action':'libraryList','id':id}).done(function(data) {
$('#folders-cnt').html(data);
});
}
var updateOutput = function (e) {
var list = e.length ? e : $(e.target);
var order = new Object();
if (window.JSON) {
order.action = 'sorting';
order.order = (list.nestable('serialize'));
$.post('ajax.php',$.param(order));
} else {
output.val('JSON browser support required for this demo.');
}
};
var updateOutput2 = function (e) {
var list = e.length ? e : $(e.target);
var order = new Object();
if (window.JSON) {
order.action = 'menusort';
order.order = (list.nestable('serialize'));
$.post('ajax.php',$.param(order));
} else {
output.val('JSON browser support required for this demo.');
}
};
// Quick Edit
$(function() {
// id , field , zone
$('input.editable-input').on('dblclick',function(){
$(this).attr('readonly',false);
$(this).change(function(){
var id = $(this).data('input');
var type = $(this).data('type');
var val = $(this).val();
$.post('ajax.php',{'action':'quickEdit','id':id,'type':type,'name':val}).done(
function(data){
}
);
$(this).attr('readonly',true);
});
});
});
function preloadImages(array) {
if (!preloadImages.list) {
preloadImages.list = [];
}
var list = preloadImages.list;
for (var i = 0; i < array.length; i++) {
var img = new Image();
img.onload = function() {
var index = list.indexOf(this);
if (index !== -1) {
// remove image from the array once it's loaded
// for memory consumption reasons
list.splice(index, 1);
}
}
list.push(img);
img.src = array[i];
}
}