$(document).ready(function () { type = 'POST', root = $('#root').data('root'); //При промяна на размера на прозореца $(window).resize(function () { //Отместване на първото меню $('#main_menu').css({ 'margin-left': $(window).width() - 300 }); //Позициониране на прозореца $('#body').css({ 'margin-left': $('#menu').offset().left }); $('.djam1 img').css({ 'height': $(window).height() - 50 }); }); //"Боядисване" на текущата страница // $('#menu a').eq(page - 1).css({ // 'color': '#000' // }); //Анимиране на първото меню $('#main_menu').animate({ 'margin-left': $(window).width() - 300 }, 600); //При клик върху първото меню $('#main_menu a').click(function (c) { c.preventDefault(); var th = $(this); $('#main_menu').animate({ 'margin-left': -300 }, 600, function () { window.location.href = th.attr('href'); }); }); //При клик върху второто меню $('#menu a').click(function (c) { c.preventDefault(); var th = $(this); $('#body').animate({ 'margin-left': -1000 }, 600, function () { window.location.href = th.attr('href'); }); }); if (document.referrer != root) {//Ако идва от второто меню //Позиция на второто меню $('#menu').css({ 'margin-top': 40 }); //Аминира съдържанието на страниците $('#body').ready(function () { $('#body').animate({ 'margin-left': $('#menu').offset().left }, 600); }); } else {//Ако идва от първото меню //Анимира второто меню $('#body').ready(function () { $('#menu').animate({ 'margin-top': 40 }, 600, function () { //Аминира съдържанието на страниците, след анимацията на второто меню $('#body').animate({ 'margin-left': $('#menu').offset().left }, 600); }); }); } //Преглед на галерия $('div.galeriq').click(function () { $.ajax({ type: type, url: root + 'galeriq/getGaleriq', data: { get_galeriq: 1, galeriq: $(this).children('img').attr('alt') } }).done(function (data) { djam1(data, '#000'); }); }); //Преглед на изображение от галерията $(document).on('click', '.galeriqta', function () { open($(this).children('img').attr('alt'), 'ViewPic'); }); //Затваряне на джама и рефреш при нужда $(document).on('click', '.hiks,.djam', function () { close_djam(); // if (page == 3 && $('#exit').length > 0 && $('img.hiks').length == 0) { // window.location.href = window.location.href; // } }); //Лог $(document).on('click', '#null_log', function () { $.ajax({ type: type, url: url, data: { null_log: 1 } }).done(function () { close_djam(); window.location.href = window.location.href; }); }); $(document).on('keyup input click', 'table#login_forma input', function (key) { var name = $('table#login_forma input[name=name]').val().length, pass = $('table#login_forma input[name=password]').val().length; if (name > 4 && pass > 4) { $('table#login_forma button').attr('disabled', false); if (key.keyCode == 13) { login(type, url); } } else { $('table#login_forma button').attr('disabled', true); } }); $(document).on('click', 'table#login_forma button', function () { login(type, url); });//Лог $('#cp').click(function () { window.location = 'c_panel/'; }); $(document).on('click', '#exit', function () { $.ajax({ type: type, url: url, data: { exit: 1 } }).done(function () { window.location.href = window.location.href; }); }); $(document).on('click', '#edit', function () { $.ajax({ type: type, url: url, data: { edit: 1 } }).done(function (data) { djam1(data, '#000'); }); }); $(document).on('click', '#edit_0 button', function () { close_djam(); $.ajax({ type: type, url: url, data: { submit: 1, title: $('input[name=title]').val(), keywords: $('textarea[name=keywords]').val(), description: $('textarea[name=description]').val(), menu: $('textarea[name=menu]').val() } }).done(function (data) { alert(data); window.location.href = window.location.href; }); }); }); /* * Модел за имейл */ function model() { var model = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; return model; } function a() { ; } function login(type, url) { $.ajax({ type: type, url: url, data: { login: 1, name: $('table#login_forma input[name=name]').val(), pass: $('table#login_forma input[name=password]').val() } }).done(function (data) { if (data == 1) { window.location.href = window.location.href; } else { close_djam(); } }); } function djam(text, color) { var w = parseFloat($(window).width()), h = parseFloat($(window).height()); $('body').append('
' + text + '
'); $('.djam1').css({ 'top': (h / 2) - (parseFloat($('.djam1').height()) / 2), 'left': (w / 2) - (parseFloat($('.djam1').width()) / 2), 'border-color': color, 'color': color }); $('.djam').animate({ 'opacity': .6 }, function () { $('.djam1').show(); }); } function djam1(text, color) { var w = parseFloat($(window).width()), h = parseFloat($(window).height()); $('body').append('
' + text + '
'); $('.djam1').css({ 'top': 0, 'left': 0, 'max-height': h - 30, 'border-color': color, 'color': color }); $('.djam').animate({ 'opacity': .6 }, function () { $('.djam1').show(); }); } function djam2(text, color) { var h = parseFloat($(window).height()), v = parseFloat($(window).width()); $('body').append('
' + text + '
'); $('.djam1').css({ 'top': 0, 'left': 0, 'border-color': color, 'color': color }); $('.djam').animate({ 'opacity': .6 }, function () { $('.djam1').show(); $('.djam1 img').css({ 'height': h - 50 }); }); } function close_djam() { $('.djam1').hide(); $('.djam').animate({ 'opacity': 0 }, function () { $('.djam,.djam1').remove(); }); }