سانس ورود / ثبت نام window.user = null; if(window.location.hash=='#login') $('#btn-login').click(); لیست برنامه ها تماس و پشتیبانی درباره ما آرشیو برنامه ها پیگیری خرید برنامه ها تماس و پشتیبانی درباره ما آرشیو ورود / ثبت نام window.user = null; if(window.location.hash=='#login') $('#btn-login').click(); پیگیری خرید //ga('set', {page: document.location.pathname+document.location.search+document.location.hash, title: document.title}); //ga('send', 'pageview'); gtag('config', 'G-4C30WQDGFH'); $('body').removeClass().addClass('sn-store'); ; هنرتیکت | خرید بلیت کنسرت و برنامه های هنری $.fn.followTo = function ( bottomDistance, topDistance, margin, method ) { var $this = this, $window = $(window); var _bottomFixedPos = $(document).height() - $this.height() - bottomDistance; if(topDistance==-1) topDistance = $this.offset().top; var _topFixedPos = topDistance || 0; var _margin = margin || 0; var _method = method || 'fixed'; $window.scroll(function(e){ if ($window.scrollTop() > _bottomFixedPos) { $this.css({ position: 'absolute', top: _bottomFixedPos + margin }); } else if($window.scrollTop() < _topFixedPos - margin) { $this.css({ position: 'absolute', top: _topFixedPos }); } else { $this.css({ position: _method, top: (method=='absolute'?$window.scrollTop():0) + _margin }); } }); $window.scroll(); }; function scrollToElement(q, offset, ignoreTop, callback) { offset = offset || 0; if(q instanceof jQuery) e = q; else e = $(q); if(!e.offset()) return; if(!$('#body').is('.home')) { if($(window).scrollTop() > e.offset().top) { $('body, #head, #extended-menu, .fixed').removeClass('h'); } else if($(window).scrollTop() < e.offset().top && e.offset().top > 350) { $('body:not(.sn-promotions), #head, #extended-menu, .fixed').addClass('h'); } } o = $('#head:not(.h)').height() - parseInt(e.css('border-top-width').replace('px', '')); if($('.snap').length) o += $('.snap').is('.fixed')?$('.snap').height():($('.snap').height()+parseInt($('.snap').css("margin-top"))-36); if(!ignoreTop || e.offset().top - o + offset > $(window).scrollTop()) $("html, body").animate({ scrollTop: e.offset().top - o + offset }, {duration: 500, complete: callback }); } function submitSearch() { if(light() && !ext()) { notify('بخش جستجو مدتی در دسترس نیست... از شکیبایی شما سپاسگزاریم.', null, 2000); return; } var url = '/search/' + $('input.search').val().trim(); $.pjax({url: url, container: '#_container'}); } function search(e) { if(/*true ||*/ (light() /*&& !admin()*/)) { $("#search-suggest-container").show(); $("#search-suggest").html('<span class="block center top-margined">بخش جستجو مدتی غیرفعال خواهد بود... از شکیبایی شما سپاسگزاریم</span>'); return; } else { $("#search-suggest").html('<span class="block center top-margined">برای انجام جستجو Enter یا نماد ذره بین را بزنید</span>').next('.shortcuts').hide(); return; } var searchtxt = $("#txtsearch").val().trim(); $("#search-suggest-container").show().find('.shortcuts').hide(); $.ajax({ type : 'GET', dataType: 'json', url : "/api/v2/assistant/search?count=3&criteria="+searchtxt, success:function(resp, textStatus, jqXHR) { if($("#txtsearch").val().trim().length<2) return; var pagesHtml = renderPagesList(resp.data.pages); var channelsHtml = renderChannelsList(resp.data.channels); var mediasHtml = renderMediasList(resp.data.medias); $("#search-suggest").html('<div id="pages">'+pagesHtml+'</div><div id="channels"><h2>کانال ها</h2><div class="result">'.replaceAll('<', '<')+channelsHtml+'</div></div><div id="medias"><h2>رسانه</h2><div class="result">'.replaceAll('<', '<')+mediasHtml+'</div></div>'.replaceAll('<', '<')); $("#search-suggest-container a.all").show(); }, error: function(jqXHR, textStatus, errorThrown) {} }); } function master() { return false; } function admin() { return $('#user-bar.assistant').length>0; } function plus() { return $('.plus-btn.active').length>0; } function light() { return false || $('#user-bar.light').length>0 || ($.cookie('TW_LIGHT')?true:false); } function lightMode() { return $.cookie('TW_LIGHT_MODE')?$.cookie('TW_LIGHT_MODE'):'default'; } function mda() { $('.adm').removeClass('adm'); } function ext() { return 'honarticket.com'; } function onUserReady() { if(admin()) { $('body').addClass('admin'); mda(); } renderPartials(); window.dispatchEvent(new Event('tiwall:user_ready')); processFeedbackLinks(); } function updateNotifications() { if(light() || ext()) return; renderUserBox(null, true); } function renderUserBox(zbLoginCallback, nc) { var disabled = lightMode()=='login'; if(disabled) { if(!document.userLoaded) { onUserReady(); document.userLoaded = true; } if(typeof zbLoginCallback == 'function') zbLoginCallback(); return; } if(ext() && !zbLoginCallback && $('div.forceRenderUserBox').length==0) return; $.ajax({ type : 'GET', url : "/api/v1/user/renderUserBox"+((zbLoginCallback || nc)?"?_nc=1":""), success: function(r, textStatus, jqXHR) { $('div.user-box').html(r); if(!document.userLoaded) { onUserReady(); document.userLoaded = true; } if(typeof zbLoginCallback == 'function') zbLoginCallback(); }, error: function(jqXHR, textStatus, errorThrown) {} }); } function onPartialLoadedGeneral(url) { if($('.pages-list').length) { $('.pages-list a.item-page:not(.all)').off('click').click(function(e) { $('.pages-list a.item-page').not(this).data('hover', false); if($(this).is(':active') && !$(this).data('hover')) { e.preventDefault(); $(this).data('hover', true); } }); } if($('.smart-hover').length) { $('.smart-hover').off('click').click(function(e) { $('.smart-hover').not(this).data('hover', false); if($(this).is(':active') && !$(this).data('hover')) { e.preventDefault(); $(this).data('hover', true); } }); } if($('[data-schedule]').length) manageSchedules(); setTimeout(processLoadLater, 100); document.disablePjaxLoader = false; } function renderPartials() { var onPartialLoaded = null; $('.partial:not(.rendered):not(.asleep)').each(function() { var params = {}; var url = null; var success = null; var type = $(this).data('partial-id'); var container = this; var cancel = false; if($(this).is('.nil') && light()) { $(this).remove(); cancel = true; } if(type=='ads') { params.section = $(this).data('partial-section'); var rnd = $(this).data('partial-rand'); if(rnd) params.rand = light() ? 1 : rand(1, rnd); if($(this).data('partial-subjectId')) params.subjectId = $(this).data('partial-subjectId'); if($(this).data('partial-count')) params.count = $(this).data('partial-count'); if($(this).data('partial-mode')) params.mode = $(this).data('partial-mode'); url = '/api/adver/renderAds'; onPartialLoaded = layoutScrollingBanners; } else if(type=='purchaseBox') { params._nc = 1; } else if(type=='viewCounter') { params.section = $(this).data('partial-section'); params.id = $(this).data('partial-itemid'); url = '/api/internal/general/viewCounter'; if(light()) cancel = true; } else if(type=='discountsMenu') { params.user_id = $(this).data('partial-userId'); params.user_key = $(this).data('partial-userKey'); url = '/api/system/renderDiscountsMenu'; } else if(type=='followButton') { params.type = $(this).data('partial-type'); params.item_id = $(this).data('partial-itemid'); url = '/api/user/renderFollowButton'; } else if(type=='toolsMenu') { params.type = $(this).data('partial-type'); params.item_id = $(this).data('partial-itemid'); url = '/api/v1/user/renderToolsMenu'; if(light()) cancel = true; } else { url = $(this).data('partial-url'); } if(!cancel) { if(!url) { url = document.location.pathname; params.part = type; } if(admin() && !$(container).data('partial-ignore-admin')) params.admin = 1; $.ajax({ 'type' : 'GET', 'data' : params, 'url' : url, 'success': function(r) { if($(container).data('partial-replace')) $(container).replaceWith(r); else $(container).addClass('rendered').html(r); if(onPartialLoaded) onPartialLoaded(); onPartialLoadedGeneral(url); }, 'error': function(jqXHR, textStatus, errorThrown) {} }); } }); if(!onPartialLoaded) layoutScrollingBanners(); } function renderPagesList(list) { //return ''; var result = ''; if(list.length > 0) { var current = []; var archive = []; current.push({_type:'header', title:'برگه های روز'}); $.each(list, function(index, item) { //console.log(item); if( (item.behavior=='product' && item.subject.parent_id != 1) || Date.parse(item.spec.end_date)+86400000 > new Date().getTime()) current.push(item); else archive.push(item); }); if(current.length==1) current.push({_type:'message', text:'نتیجه ای در این بخش یافت نشد'}); if(archive.length) archive = [{_type:'header', title:'برگه های گذشته'}].concat(archive); var items = current.concat(archive); $.each(items, function(index, item) { if(item._type=='header') { result += '<h2>'+item.title+'</h2>'; } else if(item._type=='message') { result += '<span class="search-empty">'+item.text+'</span>'; } else { var part02 = ''; result += '<a href="/p'+/*item.subject.urn+*/'/'+item.urn+'">'; result += '<img src="'+item.image.thumb_url+'" width="50" height="50" />'; result += '<span class="div subject-mark color-'+item.subject.urn+'"/>'+item.title; if(!item.related_channels) item.related_channels = {}; if(item.title_prefix || item.related_channels.director) result += ' <span class="normal-text"> ('; if(item.title_prefix) { if(item.title_prefix.endsWith('ی')) result += 'یک '+item.title_prefix+(item.related_channels && item.related_channels.director?' از ':''); else result += (item.title_prefix + (item.related_channels && item.related_channels.director && item.related_channels.director.text?'ی از ':'')); } if(item.related_channels.director) { result += item.related_channels.director.text; } if(item.title_prefix || item.related_channels.director) result += ')</span>'; if(item.spec.venue) { part02 += item.spec.venue.title; } if(item.behavior=='event') { part02 += ' / '+item.spec.date_duration_text; } if(isDefined(item.spec.time)) { part02 += (part02!=''?' / ':' ')+'ساعت '+item.spec.time.text; } if(part02 != '') result += '<br/><span class="normal-text dark-gray">'+part02+'</span>'; result += '<span class="div clear"/></a>'; } }); searchEmpty=false; } else { result += '<h2>برگه ها</h2><span class="search-empty">نتیجه ای در این بخش یافت نشد</span>'; searchEmpty=true; } return result; } function renderChannelsList(list) { var result = ''; if(list.length > 0) { $.each(list, function(index, item) { var part02 = item.promo_desc?item.promo_desc:(item.subtype?item.subtype.title:item.type.title); result += '<a href="/'+item.urn+'">'; result += '<img src="'+item.image.thumb_url+'" width="50" height="50" class="channel-image" />'; result += item.title; result += '<br/><span class="normal-text dark-gray">'+part02+'</span>'; result += '<span class="div clear"/></a>'; }); } else { result += '<span class="search-empty">نتیجه ای در این بخش یافت نشد</span>'; searchEmpty=true; } return result; } function renderMediasList(list) { var result = ''; if(list.length > 0) { $.each(list, function(index, item) { var part02 = item.kicker; result += '<a href="/'+item.folder+'/'+item.urn+'">'; result += '<img src="'+item.image.thumb_url+'" width="50" height="50" />'; result += '<div>'; result += (part02?'<span class="normal-text dark-gray">'+part02+'</span>':''); result += '<div>'+item.title+'</div>'.replace('<', '<'); result += '</div>'.replace('<', '<'); result += '<span class="div clear"/></a>'; }); } else { result += '<span class="search-empty">نتیجه ای در این بخش یافت نشد</span>'; searchEmpty=true; } return result; } function processUserPurchase(sale_id, options) { var selector = '#promotion-box a.btn, #header .buy.btn, #shipping-info #btnSubmit.btn'; //if(user) { $(selector).addClass('disabled').prop('disabled', 'disabled'); //console.log('tiwall:user_ready'); var params = {"sale_id": sale_id}; if(!options) options = {}; if(options.include_package_state) params.include_package_state = 1; if(options.subject_id) params.subject_id = options.subject_id; if(options.package_id) params.package_id = options.package_id; if(options.force_package) params.force_package = options.force_package; if(options.free) params.free = true; $.ajax({ cache: false, timeout: 5000, dataType : 'json', url : '/api/user/getUserReserves', data : params, success:function(response, textStatus, jqXHR) { if(response && response.status=='success') { var showPreview = showWallet = true; if(response.data) { var last_reserve = response.data.last_reserve; if(last_reserve) { var max_days = last_reserve.group_timeout / 1440; var days = (new Date().getTime() - new Date(last_reserve.insert_datetime).getTime()) / (1000 * 3600 * 24); } var title = null; //console.log(response, max_days, days, days < max_days); if(last_reserve && last_reserve.url && (days <= max_days || admin())) { //console.log(last_reserve.url); var is_acc = last_reserve.url=='{access}' /*|| last_reserve.url===null*/; title = 'دسترسی'; if(is_acc) { if(last_reserve.idata.indexOf('service=skyroom')!=-1) title = 'ورود به رویداد'; else if(last_reserve.idata.indexOf('_live')!=-1) title = 'تماشای پخش زنده'; else if(last_reserve.idata.indexOf('type=aod')!=-1) title = 'شنیدن آنلاین'; else title = 'تماشای آنلاین'; } else title = 'دانلود'; $(selector).addClass('green play').text(title).val(title).off('click').on('click', function() { window.open(is_acc ? '/api/v2/reserves/acc?id='+last_reserve.id : last_reserve.url); return false; }); showPreview = showWallet = false; } else if(response.data.purchase_data) { if(response.data.purchase_data.cssclass) $(selector).addClass(response.data.purchase_data.cssclass); $(selector).text(response.data.purchase_data.title).val(response.data.purchase_data.title).off('click').on('click', function() { if( !response.data.purchase_data.require_login || login($('.btn.preview').attr('href')) ) { if(response.data.purchase_data.preview) window.open($('.btn.preview').attr('href')); else document.location = response.data.purchase_data.url; } return false; }); showPreview = showWallet = false; } else if(response.data.package_state && (!last_reserve.url || days > max_days)) { title = 'تماشای سریع! مانده: '+formatPersianDigits(response.data.package_state.capacity - response.data.package_state.used); $('#btnUseVodPackage').text(title).show(); $('#btnSubmit').addClass('attached'); //$(selector).text(title).val(title); //$('#inputUseVodPackage').val(1); showWallet = false; } } if(showPreview && !options.package_id) { $('.btn.preview').show().siblings('#promotion-box .btn.s').addClass('with-preview'); } if(showWallet && $('#btnPayByWallet').length) { $('#btnPayByWallet').show(); $('#btnSubmit').addClass('attached'); } } else { console.log(response); } }, error: function(jqXHR, textStatus, errorThrown) { console.log(textStatus); }, complete: function() { $(selector).prop('disabled', '').removeClass('disabled'); } }); //} else $(selector).prop('disabled', '').removeClass('disabled'); $(window).off('tiwall:user_ready'); } function notify(messages, type, timeout) { if(timeout==='normal') timeout = 1500; else if(timeout==='fast') timeout = 1000; else if(timeout==='slow') timeout = 2000; $('.notify').remove(); var msg = ''; var img = ''; var desc = ''; var action = ''; var action_label = 'ببینم!'; if(messages instanceof Array) { messages.forEach(function(item, index) { if(index>0) msg += '<br />'; msg += '<span>- '+item+'</span>'; }); } else if(messages instanceof Object) { msg = messages.title; desc = messages.body; action = messages.click_action; if(messages.click_action_label) action_label = messages.click_action_label; if(messages.icon!='_ignore') { img = messages.icon; if(!img) img = 'https://static.honarticket.com/resource/images/icon/notif_icon.png'; } } else if(messages) msg = messages; $('#_container').append( '<div class="block notify'.replace('<', '<') +(type?' '+type:'') +'">' +(img?'<img src="'+img+'" />':'') +'<span class="block msg">'+msg+'</span>' +(desc?'<span class="block desc">'+desc+'</span>':'') +(action?'<span class="block clear"></span><a class="btn gray" href="'.replace('<', '<')+action+'">'+action_label+'</a>':'') +(timeout || type=='countdown'?'':'<a class="btn gray" href="javascript:;" onclick="$(this).parent().fadeOut()">بستن</a></div>'.replace('<', '<')) ); if(timeout) setTimeout(function() { $('.notify').fadeOut(); }, timeout); } function confirm2(type, msg, desc, callback_ok, callback_cancel, buttons, timeout) { $('.confirm2').remove(); if(type) { document.confirm2CallbackOk = callback_ok; document.confirm2CallbackCancel = callback_cancel; $('#_container').append( '<div style="display: none;" class="confirm2'.replace('<', '<') +(type?' confirm2-'+type:'') +'"><span class="img"></span><span class="block msg">'+msg+'</span>' +(desc?'<span class="block desc">'+desc+'</span>':'') +(buttons>1?'<a class="btn" href="javascript:;" onclick="document.confirm2CallbackOk()">بله!</a>':'') +(buttons>0?'<a class="btn gray" href="javascript:;" onclick="$(this).parent().fadeOut(); document.confirm2CallbackCancel()">بستن</a></div>'.replace('<', '<'):'') ); $('.confirm2').fadeIn('fast'); if(timeout) setTimeout(function() { $('.confirm2').fadeOut(); }, timeout); } } function displayPjaxLoader() { clearTimeout(document.pjtid); $('#pjax-loader').fadeIn(); document.pjtid = setTimeout(function() { $('#pjax-loader').fadeOut(); }, 6000); } function login(target, href, params) { if(window.user) return true; if(href) { document.afterLoginUrl = target ? $(target).attr('href') : href; if($(target).attr('target')=='_blank') document.afterLoginUrlTarget = '_blank'; } else if(typeof target == 'string' && target.startsWith('/')) document.afterLoginUrl = target; else if(target) document.afterLogin = '#'+$(target).attr('id'); if(params) $('#btn-login').data('temp_params', params); $('#btn-login').click(); return false; } function onZBLogin() { renderUserBox(function() { closePopup(); var url = null; if(document.afterLoginUrl) url = document.afterLoginUrl; else if(document.location.search.indexOf('?continue=')!=-1) url = decodeURI(document.location.search.replace('?continue=', '').replace('%2F', '/')); else url = document.location.href; if(!url.startsWith('/tools')) { if(document.afterLoginUrlTarget == '_blank') window.open(url); else { $.pjax({url: url, container: '#_container', scrollTo: false, onSuccess:function() { if(document.afterLogin && $(document.afterLogin).length>0) { setTimeout(function() { $(document.afterLogin).click(); document.afterLogin=null; }, 100); } }}); } } else document.location = url; }); } function onZBEvent(event, args) { if(event=='user:message') $('#popup-content').scrollTop(0); } // Persian digit format var persianDigits = {'0':'0', '1':'1', '2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8', '9':'9', '.':'/', ',':','}; var englishDigits = {'0':'0', '1':'1', '2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8', '9':'9'}; //var shrinkOn = 137; var shrinkOn = 40; var shadowOn = 0; var hideOn = shrinkOn+250; var desktopSmall = 950; var tablet = 767; var mobile = 480; function formatPersianDigits(input) { input = input.toString(); var result = ''; for (var i = 0; i < input.length; i++) { character = input.charAt(i); if(persianDigits[character]) result += persianDigits[input.charAt(i)]; else result += character; } return result; } function formatEnglishDigits(input, removeExtraChars, allowDot) { input = input.toString(); var result = ''; var character = null; if(input.startsWith('+')) input = '00'+input.substr(1); for (var i = 0; i < input.length; i++) { character = input.charAt(i); if(englishDigits[character]) result += englishDigits[character]; else if( !removeExtraChars || (!isNaN(Number(character)) && character!=' ') || (allowDot && character=='.') ) result += character; //console.log(typeof(character)); } return result; } function formatCurrency(n) { var rx= /(\d+)(\d{3})/; return String(n).replace(/^\d+/, function(w){ while(rx.test(w)){ w= w.replace(rx, '$1,$2'); } return w; }); } function formatTime(timeStr) { var t = new Date('1970/01/01 '+timeStr); return formatPersianDigits(t.getHours())+':'+formatPersianDigits(("0" + t.getMinutes()).slice(-2)); } function rand(min, max) { if(!min) min = 1000000; if(!max) max = 9999999; return (Math.floor(Math.random() * (max - min + 1)) + min); } function decacheLinks() { $('.menu.popup a:not(.no-rand), a.feedback-link, a.social-btn').each(function() { if($(this).attr('href') && $(this).attr('href').includes('?') && !$(this).attr('href').includes('&_nc')) $(this).attr('href', $(this).attr('href')+'&_nc=1'); }); } function isDefined(x) { return typeof x != 'undefined' && x != null && x != '00:00:00' && x != ''; } function getPaddings(selector) { return Number($(selector).css('padding-top').replace('px', '')) + Number($(selector).css('padding-bottom').replace('px', '')); } function removeFill() { if($(window).width() <= mobile) wid = '-m'; else if($(window).width() <= tablet) wid = '-t'; else wid = ''; $('.fill'+wid).height(''); } function onWindowResize() { //if(!$('#body').is('.home') || $(window).scrollTop() > shrinkOn) layoutHall(); //console.log('onWindowResize'); if($(window).width() >= tablet && $('#page').is('.sale')) layoutHall(); layoutScrollRelated(); layoutScrollingBanners(); if($(window).width() <= mobile) wid = '-m'; else if($(window).width() <= tablet) wid = '-t'; else wid = ''; if($('.fill'+wid).length>0) { var vp = getPaddings('.fill'+wid); var o = $('.fill'+wid).data('fill-offset') ? Number($('.fill'+wid).data('fill-offset')) : 0; var h = $(window).height() - $('.fill'+wid).offset().top - vp - o; if(!$('.fill'+wid).data('original-height')) $('.fill'+wid).data('original-height', $('.fill'+wid).height()); if(h > $('.fill'+wid).data('original-height')) $('.fill'+wid).height(h); } $('.city-dropdown').css('width', $('#city-dropdown-switch').outerWidth()); if($(window).width() > 1490) { $('#hol').css('left', -1*(240+($(window).width()-1470)/2)+'px'); $('#hor').css('right', -1*(230+($(window).width()-1450)/2)+'px'); } $('.admin-tools').css('max-height', Math.max(200, $(window).height()-250)+'px'); if($('#body.page:not(.channel)').length) layoutSideColumn(); $('#popup-content').each(function() { $(this).children('.c').css('max-height', ($(window).height()-$(this).position().top-( $(this).is('.window') && $(window).width()<=mobile ? 20 : 100))+'px'); }); $('.window.auto-resize').each(function() { $(this).children('.c').css('max-height', ($(window).height()-$(this).position().top-( $(window).width()<=mobile ? 80 : 150))+'px'); }); $('#search-suggest-container .c').css('max-height', Math.min(450, ($(window).height()-110+17))+'px'); var containerHeight = ($(document).height()-$('#footer').outerHeight()-$('body').offset().top-parseInt($('#footer').css('margin-top')))-20; //$('#_container').css('min-height', containerHeight); $('#_container').css('min-height', $(window).height()-$('#footer').height()-parseInt($('#footer').css('marginTop'))-78); if($('.channel .showcase-c').length) { var rowCounts = {'979':4, '768':3, '1':2}; $('.channel #pages-container').addClass('overflowed'); for(let [w, c] of Object.entries(rowCounts)) if($(window).width() > w && $('.channel .showcase-c a.item-page').length <= c) { $('.channel #pages-container').removeClass('overflowed'); break; } } if($('#page').is('.sale')) { adjustNotesBottom(); manageNonFullInstanceBar(); } // adjust full-height elements $('.full-height').css('height', $(window).height()); } function layoutScrollRelated() { if(!$('#head').is('.expanded')) { if($(window).scrollTop() > hideOn) { if(!$(window).data('lastScroll') || $(window).scrollTop()>$(window).data('lastScroll')) $('body:not(.sn-promotions), #head, #extended-menu, .fixed').addClass('h'); else if($(window).scrollTop()<$(window).data('lastScroll')-100) { $('body, #head, #extended-menu, .fixed').removeClass('h'); $(window).data('lastScroll', 0); } if(!$(window).data('lastScroll') || $(window).scrollTop() > $(window).data('lastScroll')) $(window).data('lastScroll', $(window).scrollTop()); } else { $('body, #head, #extended-menu, .fixed').removeClass('h'); $(window).data('lastScroll', 0); } //console.log($(window).scrollTop(), $(window).data('lastScroll')); if(!$('#body').is('.home')) { if(!$('.snap').is('.fixed') && ($('.cover').length>0 || $('.slider-banners:visible').length>0 || ext())) { if($(window).scrollTop() > shadowOn) $('#head').addClass('shadowed'); else $('#head').removeClass('shadowed'); if($(window).scrollTop() > shrinkOn) $('#head').addClass('colored'); else $('#head').removeClass('colored'); } } else { if($(window).scrollTop() > shrinkOn) { $('#head').addClass('shrinked'); //$('#extended-menu').addClass('fixed'); if(!document.shrinkTId) document.shrinkTId = setTimeout(function() { $('#extended-menu').addClass('transition'); }, 0.3); } else { clearTimeout(document.shrinkTId); document.shrinkTId = null; $('#extended-menu').removeClass('transition'); $('#head').removeClass('shrinked'); //$('#extended-menu').removeClass('fixed'); } if($(window).scrollTop() > 0 && !$('.snap').is('.fixed')) $('#head').addClass('shadowed'); else $('#head').removeClass('shadowed'); if($(window).scrollTop() > shrinkOn) $('#head').addClass('colored'); else $('#head:not(.expanded)').removeClass('colored'); if($(window).scrollTop() > 0) $('#head').addClass('bg'); else $('#head').removeClass('bg'); } } if($(window).scrollTop()>hideOn) { if(!$('#up-switch').data('visible')) { $('#up-switch').data('visible', true); $('#up-switch').fadeIn(); } } else { if($('#up-switch').data('visible')) { $('#up-switch').data('visible', false); $('#up-switch').fadeOut(); } } var activeAutoSnap = null; $('.auto-snap').each(function(i) { if($(window).scrollTop() > $(this).parent().offset().top) activeAutoSnap = this; }); if(activeAutoSnap && !$(activeAutoSnap).is('.snap')) { $('.snap:not(.auto-snap)').addClass('original-snap').addClass('hidden'); $('.snap').removeClass('snap').removeClass('fixed'); $(activeAutoSnap).addClass('snap'); } else if(!activeAutoSnap) { $('.auto-snap.snap').removeClass('snap').removeClass('fixed'); $('.original-snap').removeClass('original-snap').removeClass('hidden').addClass('snap'); } $('.stick-selected').removeClass('stick-selected'); $('.stick').each(function(i) { var pos = $(this).is('.stick-bottom')?'bottom':'top'; var offset = $(this).data('stick-offset')?parseInt($(this).data('stick-offset').replace('px','')) : ($('body').is('.h')?50:100)+($('body').is('.channel-c') && $(window).width()<768 ? 35:0) ; var area = $(this).data('stick-area')?$(this).closest($(this).data('stick-area')):($(this).data('stick-external-area')?$($(this).data('stick-external-area')):null); var stick = this; var condition = !$(this).data('stick-if') || $(this).is($(this).data('stick-if')); condition = condition && (typeof window['stickEnabled'] != 'function' || window['stickEnabled']()); var applies = null; var elem = $(this).is('.stick-type2') && $(this).next('.stick-active').length ? $(this).next('.stick-active').get(0) : this; applies = (pos=='top' && $(window).scrollTop() > $(elem).offset().top - offset && (!area || $(window).scrollTop() < area.offset().top + area.height() - offset - 100) ) || (pos=='bottom' && $(window).scrollTop() < $(elem).offset().top - $(window).height() + $(elem).height() + offset); if(applies && condition) { if($(this).is('.stick-type2')) { if(!$(this).is('.sticked')) { if($(this).width()) $(this).css('width', $(this).outerWidth()+'px'); var cloned = $(this).clone(); $(cloned).removeClass('stick').addClass('stick-active'); $(this).addClass('sticked').after(cloned); } } else { if(!$(this).is('.stick-active')) { $(this).next('.stick-active').removeClass('stick-active').next('.sticked').remove(); var cloned = $(this).clone().removeClass('stick stick-active').addClass('sticked'); if($(this).width()) cloned.css('width', $(this).outerWidth()+'px'); if($(this).is('a')) cloned.click(function() { $(stick).click(); }); $(this).addClass('stick-active').after(cloned); $(cloned).find('[data-alt]').each(function(i) { bindAltClick(this); }) $('body').addClass('with-sticked'); } } } else { if($(this).is('.stick-type2')) { if($(this).is('.sticked')) { $(this).css('width', ''); $(this).removeClass('sticked').next('.stick-active').remove(); } } else { if($(this).is('.stick-active')) { if($(this).is('a')) $(this).removeClass('stick-active').next('.sticked').remove(); else $(this).replaceWith($(this).next('.sticked').removeClass('sticked').addClass('stick')).next('.sticked').remove(); $('body').removeClass('with-sticked'); } } } if(applies && $(this).is(':visible')) { if($(this).data('stick-tab')) { $('.stick-selected').removeClass('stick-selected'); $($(this).data('stick-tab')).addClass('stick-selected'); } } }); $('.s').each(function(i) { if($(window).scrollTop()+$($(this).data('related')).height() > $(this).offset().top+$(this).height()) $($(this).data('related')).addClass('visible'); else $($(this).data('related')).removeClass('visible'); }); $('.rs').each(function(i) { if($(window).scrollTop()+$(window).height()-$($(this).data('related')).height() < $(this).offset().top+$(this).height()) $($(this).data('related')).addClass('visible'); else $($(this).data('related')).removeClass('visible'); }); $('.section-flag').each(function(i, flag) { var sectionLink = $('.section-links a[href="#'+$(flag).attr('id')+'"]'); if($(flag).is(':visible') && $(window).scrollTop() >= $(flag).offset().top-100 && (i == $('.section-flag').length-1 || $(window).scrollTop() < $('.section-flag').eq(i+1).offset().top-100) ) { sectionLink.addClass('active'); } else if(sectionLink.is('.active')) sectionLink.removeClass('active'); }); $('.pages-list').each(function(i, section) { var sectionLink = $('.showcase-menu a[data-alt="#'+$(section).attr('id')+' + .show-all-c a"]'); if(!$(section).parent().is('.collapsed') && $(window).scrollTop() >= $(section).offset().top-130 && (i == $('.pages-list').length-1 || $(window).scrollTop() < $('.pages-list').eq(i+1).offset().top-100) ) { sectionLink.addClass('active'); } else if(sectionLink.is('.active')) sectionLink.removeClass('active'); }); } function adjustNotesBottom() { if(!$('#showtimeMenu').length) return; //console.log($('#page.sale').css('position')); if($('#page.sale').css('position')=='absolute') { //var notesBottom = $('#page.sale.behaviour-event').offset().top + $('#page.sale.behaviour-event').outerHeight(); //var seatmapTop = $('#seatmap-c').offset().top - Number($('#seatmap-c').css('margin-top').replace('px','')); //if(seatmapTop != notesBottom) $('#seatmap-c').css('margin-top', Math.max(notesBottom-seatmapTop, 0)+'px'); //var notesHeight = Math.max($('#page.sale').outerHeight(), 480); var notesHeight = $('#page.sale').outerHeight(); var instancesHeight = $('#showtimeMenu').outerHeight(); var padding = Number($('#showtimeMenu').css('padding-bottom').replace('px','')); var height = notesHeight - (isNaN(padding)?0:padding); //console.log(notesHeight, padding, height); //console.log(notesHeight, instancesHeight, height); if($('#showtimeMenu').css('min-height') != height+'px') $('#showtimeMenu').css('min-height', height+'px'); } else $('#showtimeMenu').css('min-height', ''); } function manageNonFullInstanceBar() { // check if fist non-full instance is outside screen var firstNonFullInstance = $('#showtimeMenu .instance:not(.full)').first(); if(firstNonFullInstance.length && !$('.instance.current').length) { var firstNonFullInstanceOffset = firstNonFullInstance.offset().top - window.scrollY + firstNonFullInstance.outerHeight()/2 - window.innerHeight; if(firstNonFullInstanceOffset>0) $('.fnfib').show(); else $('.fnfib').fadeOut('fast'); } else $('.fnfib').fadeOut('fast'); } function layoutHall() { //console.log('layoutHall'); if($('#hallMap').length>0) { if($('#hallMap-c #legend').length) $('#hallMap-c #legend').appendTo('#g-legend'); if($('#hallMap-c .ui-tabs-nav').length) $('#hallMap-c .ui-tabs-nav').appendTo('#g-tabs'); if($('#hallMap-c div#plan-map').length) { //$('#hall .scene').hide(); var r = Math.min($(window).width() / $('#hallMap-c img#plan-map').width(), 1); var h = $('div#plan-map').height()*r; $('#hallMap-c div#plan-map').appendTo('#g-map').css('transform', 'scale('+r+')'); if(h>0) $('#g-map').css('height', h+'px'); //console.log($('#g-map'), $('#g-map').height()); $('#zoom-btn').css('margin-top', '0').css('top', ($('#g-map').height()+parseInt($('#seatmap-assets').css('padding-top'))+7)+'px'); } $('.seatmap-roll').css('width', '').css('margin-right', ''); if($(window).width() > $('#hallMap').width()) { var w = ($(window).width()-$('#chairsMenu').width())/2; $('.seatmap-roll').css('margin-right', (w*-1)+'px').css('width', $(window).width()+'px'); } var center = -1*($('#hall').width() - $('#hallMap').width())/2; //console.log('center', center, $('#hall').width(), $('#hallMap').width(), $('#hallMap-c').width()); if(document.pz) { document.pz.reset(); document.pz.destroy(); $('#seatmap-c').removeClass('zoomable zoomed-out zoomed-in'); } if($('#hall').width()>$('#hallMap').width()) { $('#hallMap-c').css('visibility', 'hidden'); setTimeout(function() { //$('#hallMap-c').addClass('pannable'); document.pz = Panzoom(document.getElementById('hallMap-c'), {animate: true, cursor: 'e-resize', disablePan: true, 'origin': 'top center'} ); var r = $('#hall').width()/$('#hallMap').width(); //var p = ($('#hallMap').height()-$('#hallMap').height()/r)/-2*r; $('#hallMap').get(0).style.setProperty('--zoomedout-height', ($('#hallMap-c').height()/r+10)+'px'); //document.pz.pan(0, p, {force: true}); document.pz.zoom(1 / r); //console.log($('#hallMap').height(), $('#hallMap').height()/r, r, p); $('#seatmap-c').addClass('zoomable zoomed-out'); $('#seatmap-assets #zoom-btn').off('click').on('click', function() { if($('#seatmap-c').is('.zoomed-out')) { $('#seatmap-c').removeClass('zoomed-out').addClass('zoomed-in'); document.pz.reset(); document.pz.setOptions({disablePan: false, disableYAxis: true}); setTimeout(function() { $('#hallMap').animate({scrollLeft: center}, 300); }, 300); } else { $('#seatmap-c').removeClass('zoomed-in').addClass('zoomed-out'); layoutHall(); } }); $('#hallMap').scrollLeft(center/r); $('#hallMap-c').css('visibility', 'visible'); }, 350); } else { $('#hallMap').scrollLeft(center); } } } function layoutSnap() { return; if($('.snap').length && !$('.snap').is('.fixed')) { var selector = $('.snap').attr('data-target')?$('.snap').attr('data-target'):'.snap'; var mt = $('.snap').css('margin-top')?parseInt($('.snap').css('margin-top')):0; mt += $('.snap').css('margin-bottom')?parseInt($('.snap').css('margin-bottom')):0; if($('.snap').data('absolute') && $(window).width() > 768) $('.snap').attr('data-offset', $(selector).offset().top).attr('data-height', '0').attr('data-mt', mt); else $('.snap').attr('data-offset', $(selector).offset().top).attr('data-height', $('.snap').height()+getPaddings('.snap')).attr('data-mt', mt); $('body').data('mt', parseInt($('body').css('margin-top'))); } var so = $('.snap').data('snap-offset')?$('.snap').data('snap-offset'):0; if($('.snap:visible').attr('data-offset')) { //console.log([$('.snap').attr('data-offset'), $('.snap').attr('data-offset') - $(window).scrollTop(), $('.snap').data('height'), 15, so]); if($('.snap').attr('data-offset')-$(window).scrollTop() < 50-so) { if($(window).scrollTop()==0) return; $('body').addClass('snapped').css('margin-top', $('body').data('mt') + Number($('.snap').attr('data-height')) + Number($('.snap').attr('data-mt'))); $('.snap').addClass('fixed'); $('#head').removeClass('shadowed'); } else { $('body').removeClass('snapped').css('margin-top', ''); $('.snap').removeClass('fixed'); if($('.cover').length==0 && $('.slider-banners:visible').length==0 && !$('.snap').is('.fixed')) $('#head').addClass('shadowed'); } } } function layoutScrollingBanners() { var c = 1; //var ar = 0.205; var ar = $(window).width()<767 ? 0.461538 : 0.25; var ap = true; if(!$('.slick-initialized').length) { $(".slick-center").slick({ centerMode: true, slidesToShow: c, slidesToScroll: 1, //autoplaySpeed: 2800, //speed: 300, rtl: true, infinite: true, autoplay: ap, //swipeToSlide: true, //touchThreshold: 3, arrows: true, //dots: true, centerMode: false, responsive: [ { breakpoint: 1500, settings: { slidesToShow: c, } }, { breakpoint: 767, settings: { slidesToShow: 1, centerMode: false } }, { breakpoint: 480, settings: { slidesToShow: 1, centerMode: false } } ] }); $('.slick-prev').removeClass('slick-prev').addClass('slick-next2'); $('.slick-next').removeClass('slick-next').addClass('slick-prev'); $('.slick-next2').removeClass('slick-next2').addClass('slick-next'); } calcVerticalLayout(); } function calcVerticalLayout() { //console.log('calcVerticalLayout', $('.snap').offset().top, $('.snap').outerHeight()); return true; if($('.snap').length && !$('.snap').is('.fixed')) { hideOn = Math.max(100, $('.snap').offset().top+$('.snap').outerHeight()-40); } //console.log('calcVerticalLayout', hideOn); } function layoutSideColumn() { if(!$('.snap').is('.fixed') && $('#left-column').length) { var coverTop = $('.cover').length ? $('.cover').offset().top : 0; $('#left-column').get(0).style.setProperty('--margin-top', $('.visitCount').offset().top+$('.visitCount').height()-coverTop-$('.cover').height()+50+'px') $('#left-column').get(0).style.setProperty('--offset', $('.snap').height()+'px'); $('#left-column').css('opacity', '1'); } } function processLoadLater() { $('.load-later:not(.loaded)').each(function() { if($(this).is('.nil') && light()) return; //console.log([$(window).scrollTop(), $(window).height(), $(this).offset().top]); if($(window).scrollTop()+$(window).height() >= $(this).offset().top-10) { $(this).addClass('loaded'); var targetUrl = $(this).data('url')+($(this).data('disable-cache')? ($(this).data('url').indexOf('?')==-1?'?':'&')+'__='+rand():''); document.disablePjaxLoader = true; var _this = this; $.pjax({url: targetUrl, container: '#'+$(this).attr('id'), scrollTo: false, push: false, timeout: 0, onSuccess:function() { if(document.afterLogin) { $(document.afterLogin).click(); document.afterLogin = null; } if($(_this).is('.layout')) layout({noScrollTop: true}); $('#footer').css('visibility', 'visible'); onPartialLoadedGeneral(); }}); } }); } function onAsRoleClick(_this) { //console.log('fl-menu link clicked!'); var base = $(_this).parents('.fl-menu').prev(); if($(_this).data('as') && $(_this).data('as')!=-1) base.attr('href', base.attr('href')+'&asRole='+$(_this).data('as')); base.get(0).onclick = base.data('onclick'); base.click(); hideOutsideClickHandler(); $(_this).parents('.fl-menu').fadeOut(function() { $(this).remove(); }); } function processFeedbackLinks() { if(typeof user != 'undefined' && user && user.channels) { var asRoleMenuHtml = '<div class="fl-menu pu temp"><h6>{title}</h6><div class="c custom-scrollbar"><a href="javascript:;" class="self" onclick="onAsRoleClick(this)" data-as="-1"><i class="far fa-user"></i> از سوی خود</a>'.replaceAll('<', '<'); user.channels.forEach(function(ch, i) { asRoleMenuHtml += '<a'.replaceAll('<', '<')+(i==0?' class="group-start"':'')+' href="javascript:;" onclick="onAsRoleClick(this)" data-as="'+ch.id+'"><img src="'.replaceAll('<', '<')+ch.image.thumb_url+'" /> '+ch.title+'</a>'.replaceAll('<', '<'); }); asRoleMenuHtml += '</div></div>'.replaceAll('<', '<'); $('a.fl:not(.processed)').each(function() { var oldOnClick = $(this).get(0).onclick; var flChannels = $(this).prevAll('.db:first').data('fb-ids'); $(this).addClass('processed').data('onclick', oldOnClick).get(0).onclick = function(e) { $('.fl-menu').remove(); $('.outside-click-handler').addClass('transparent').show(); $(this).after(asRoleMenuHtml.replace('{title}', $(this).text())); var _this = this; flChannels.forEach(function(chId) { $(_this).next('.fl-menu').find('a[data-as="'+chId+'"]').addClass('active'); }); $(_this).next('.fl-menu').find( $(this).is('.unfeedback') ? 'a:not(.active)' : 'a.active').addClass('disabled'); return false; }; }); } } function processSmartHzMenus() { if($(window).width() > 768) { $('.hz-scroll.smart:not(.processed) .hz-scroll-c').each(function() { $(this).children().each(function() { //console.log($(this).text(), this.offsetLeft, $(this).parent().get(0).offsetWidth/2); if(this.offsetLeft < $(this).parent().get(0).offsetWidth/2+50) $(this).addClass('to-transfer'); }); if($(this).find('.to-transfer').length) { $(this).parent().addClass('applied').append('<a class="dropdown-switch" href="javascript:;"><i class="fal fa-chevron-left"></i></a><div class="dropdown"><div><div class="c"></div></div></div>'); $(this).find('.to-transfer').removeClass('to-transfer').appendTo($(this).siblings('.dropdown').find('div.c')); } }).parent().addClass('processed'); } } function layoutHeaderColor() { if($('.cover').length>0 || $('.slider-banners:visible').length>0) { $('body').addClass('coverable'); if(!$('#body').is('.home')) $('#head').addClass('bg'); } else { if(!$('#body').is('.home') && $('.slider-banners:visible').length==0 && !ext()) { $('#head').addClass('colored').removeClass('bg'); if(!$('.snap').is('.fixed')) $('#head').addClass('shadowed') } $('body').removeClass('coverable'); } } function layout(options) { //console.log('layout');; if(!options) options = {}; $('#home-buttons a').removeClass('active'); layoutHeaderColor(); if($('#body').is('.home')) { if(!options.noScrollTop) $(window).scrollTop(0); $('body').addClass('home'); $('#nav-showcase').addClass('active'); $('#head').removeClass('colored'); } else { $('body').removeClass('home'); $('#head').addClass('shrinked'); $('#extended-menu').addClass('fixed transition'); if(!$('body').is('.coverable')) $('#head').addClass('colored'); if($('#body').is('.showcase')) $('#nav-showcase').addClass('active'); else if($('#body').is('.body-wall') && !$('.user-profile-glance').length) $('#nav-wall').addClass('active'); } $('body').removeClass('wall-c notifications-c create-c create-form media-c video-c page-c channel-c search-c plus-c'); if($('#body').data('view')) $('body').addClass($('#body').data('view')); $('body').toggleClass('wall-c', $('#body').is('.body-wall') || $('#body').is('.notifications')); $('body').toggleClass('notifications-c', $('#body').is('.notifications')); $('.grid-box:not(.processed)').each(function(i) { //if($(this).parent().next().is('.roll') || $(this).parent().is(':last-child')) $(this).addClass('no-separate'); var _this = this; if($(this).find('.partial').length) $(this).get(0).style.setProperty('--max-height', '2000px'); else { $(this).get(0).style.setProperty('--max-height', $(this).height()+'px'); $(this).addClass('processing'); setTimeout(function() { $(_this).addClass('processed'); }, 10); } }); $('#footer').css('visibility', $('.load-later:not(.loaded)').length?'hidden':'visible'); //console.log($('.cover').width(), $('.cover').width()*0.21); //if($('.cover-image').length) $('.cover-image').get(0).style.setProperty('--min-height', ($('.cover').width()*0.21)+'px'); onWindowResize(); layoutSnap(); //layoutHall(); //layoutScrollingBanners(); setTimeout(processLoadLater, 500); } function submitCurrentLocation(loc) { //console.log(loc); submitFilter('near', loc.coords.latitude+'-'+loc.coords.longitude); } function getLocation() { //console.log(navigator.geolocation); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(submitCurrentLocation, function(err) { if(err.code == err.PERMISSION_DENIED) notify('اجازه دسترسی به موقعیت مکانی در این مرورگر رد شده است'); else { notify('اشکالی در دریافت اجازه دسترسی به موقعیت مکانی در این مرورگر وجود دارد'); console.log(err); } $('.filter-group select, .filter-group input, .filter-group a, .filter-group .dd-switch').removeClass('disabled').prop('disabled', false); }); } else { alert("این مرورگر مکان یابی را پشتیبانی نمی کند"); return false; } } function tosrus(element) { var $tos = $(element).tosrus( {}, { //show:true, effect : "fade", infinite : true, wrapper : { onClick : "close", classes : "img-border" }, caption : { add : true }, pagination : { add : true, type : "thumbnails" }, keys : { prev : true, next: true, }, }, { //show:true, effect : "fade", buttons : "inline", pagination : { add : true }, caption : { add : true }, wrapper : { classes : "img-border" } } ); $tos.click(function() { $tos.trigger( "close.tos" ); }); } function uploadMessagingToken(t, oldt) { $.ajax('//api.tiwall.com/internal/general/registerDevice?zbAppId=8&userAgent='+navigator.userAgent+'&token='+t+(oldt?'&oldToken='+oldt:'')).done(function() { window.localStorage.setItem('messagingTokenUploaded', t); }); } function requestMessagingPermit() { confirm2('notifPermit', 'توی پنجره ای که باز می شه دکمه Allow رو بزنید...'); setTimeout(function() { // Retrieve permission & token const messaging = firebase.messaging(); messaging.requestPermission() .then(function() { messaging.getToken().then(function(t) { if(t) { uploadMessagingToken(t); confirm2('notifPermit', 'بسیار خوب!', 'رویدادهای مهم رو براتون روی این دستگاه می فرستیم', null, null, 1, 2000); } else console.log('No Instance ID token available. Request permission to generate one.'); }).catch(function(err) { console.log('An error occurred while retrieving token. ' + err); confirm2(false); }); }).catch(function(err) { console.log('Unable to get permission to notify: ' + err); confirm2(false); }); }, 500); } function ignoreMessagingPermit() { $.cookie(document.messagingReq.cn, document.messagingReq.v, {path: '/', expires: 30}); } function initMessagingPermit() { const messaging = firebase.messaging(); // Manage asking for web-notification permission document.messagingReq = {cn:'messagingReq', v:5}; if($.cookie(document.messagingReq.cn)!=document.messagingReq.v) { messaging.getToken().then(function(t) { if(!t) confirm2('notifPermit', 'خوش خبر باشیم؟!', 'مایلید رویدادهای مهم، مثل برنامه های جذاب و آغاز فروششون رو، روی این دستگاه به آگاهی شما برسونیم؟', requestMessagingPermit, ignoreMessagingPermit, 2); else { var storedToken = window.localStorage.getItem('messagingTokenUploaded'); if(t!==storedToken) uploadMessagingToken(t, storedToken); } }); } } function resetDiscounts() { discounts = { general:{totalDiscountedPrice:0, totalUsualPrice:0, desc:"خرید با تخفیف:", conf:null}, group:{conf:null}, bulk:{totalDiscountedPrice:0, totalUsualPrice:0, conf:null}, premium:{totalDiscountedPrice:0, totalUsualPrice:0, conf:null}, code:{totalDiscountedPrice:0, totalUsualPrice:0} }; } function alignPopup(popup, sw, global) { if(!popup.data('offset-x')) popup.data('offset-x', 0); if(!popup.data('offset-y')) popup.data('offset-y', 0); if(global) popup.css('position', 'fixed').css('left', sw.offset().left + 'px').css('top', sw.offset().top + sw.outerHeight() - $(window).scrollTop() + 7 + 'px'); else popup.css('position', 'fixed').css('left', Math.max(sw.offset().left - 48 + popup.data('offset-x'), 10) + 'px').css('top', sw.offset().top - $(window).scrollTop() + 30 + + popup.data('offset-y') + 'px'); } function setRollOffsets() { $('.grid-box .pages-list').each(function() { $(this).data('offset', $(this).offset().top+($(window).scrollTop()>shrinkOn?30:0) ); }); } function initCroppie(image, vptype, settings) { var width = $(image).parents('.d-image').width(); var height = width; if(settings && settings.maxWidth && settings.maxHeight) { var ratio = settings.maxHeight/settings.maxWidth; if(ratio<0.33) { $(image).parents('.d-field').addClass('fullwidth'); width = $(image).parents('.d-field').width(); } height = ratio*width; } var cr = $(image).croppie({ // viewport options viewport: { width: width, height: height, type: vptype // 'square' or 'circle' }, // boundary options boundary: { width: width, height: height } }); $(image).parents('.croppie-container').on('update.croppie', function(ev, cropData) { //console.log('yes'); var _this = this; var imageSelector = $(this).siblings('input[type="file"].image-selector'); //console.log( imageSelector.data('max-width'), imageSelector.data('max-height')); cr.croppie('result', {type:'base64', size:{width: imageSelector.data('max-width'), height: imageSelector.data('max-height')}, format:'jpeg', quality: 0.8, circle:false}).then(function(src) { $(_this).siblings('input[type="hidden"].d-image-src').val(src); //$(_this).siblings('img.test').attr('src', src); }); $(this).siblings('input[type="hidden"].d-image-meta').val('updated'); }); $(image).data('cr', cr); } function validateComment(formElement) { if(!$(formElement).find("textarea#wallCommentBody").val().trim()) { notify('لطفا متن نظر خود را بنویسید', 'center', 'normal'); return false; } if($(formElement).find("textarea#wallCommentBody").val().trim().length > 8192) { notify('نظر نمی تواند بیش از 8192 کاراکتر باشد', 'center', 'normal'); return false; } return true; } function validateUpload(file, settings) { if(!settings) settings = {}; if(!settings.type) settings.type = 'image'; var errors = []; var ext = file.name.split('.').pop().toLowerCase(); if(settings.type=='image') { var extensions = ['gif','png','jpg','jpeg']; if($.inArray(ext, extensions)==-1) errors.push('نوع فایل باید یکی از انواع png/gif/jpeg/jpg باشد'); if(settings.validateSize && file.size > 1024000) errors.push('حجم فایل نباید بیشتر از 1024 کیلوبایت باشد'); } else if(settings.type=='video') { var extensions = ['mp4','mv','mov','qt','ts','3gp','3gpp','3g2','3gp2','mpg','mpeg','mp1','mp2','m1v','m1a','m2a','mpa','mpv','mpv2','mpe','m4a','m4p','m4b','m4r','m4v','avi','flv','f4v','f4p','f4a','f4b','vob','lsf','lsx','asf','asr','asx','webm','mkv','wmv']; if($.inArray(ext, extensions)==-1) errors.push('نوع فایل مجاز نیست'); if(settings.validateSize && file.size > 20480000) errors.push('حجم فایل نباید بیشتر از 20 مگابایت باشد'); } if(errors.length>0) { notify(errors.join('<br/>')); return false; } else return true; } function validateBase64Image(data) { var errors = []; if(data.indexOf(',')!=-1) { var sections = data.split(','); data = sections[1]; } var binarySize = data.length*3/4; var maxBinarySize = 1024000; //console.log([binarySize, maxBinarySize]); if(binarySize > maxBinarySize) errors.push('حجم فایل نباید بیشتر از 1 مگابایت باشد'); if(errors.length>0) { notify(errors.join('<br/>')); return false; } else return true; } function bindAltClick(alt) { $(alt).off('click').on('click', function() { var target = $($(this).attr('data-alt')); target.data('origin', $(this)); if($(this).parents('#main-filters').length && !target.parents('.grid-box').length) { notify('این بخش همینک خالی است', 'docked', 'normal'); return; } if(!$(this).is('.tab') || !$(this).is('.active') /*|| $(this).is('.current')*/) target.click(); if($(this).is('.tab')) { $(this).siblings('.tab.current').trigger('blur'); $(this).addClass('current').siblings('.tab').removeClass('current'); $($(this).data('tab-target')).removeClass('invisible').siblings().addClass('invisible'); } return false; }); } function initFlex() { $('.toflex:not(.flexdatalist):not(.flexdatalist-alias)').flexdatalist().on('shown:flexdatalist.results', function(e, result) { var id = '#'+$(e.currentTarget).attr('id')+'-flexdatalist'; var wd = $(id).outerWidth() - $(id+'-results').outerWidth(); if(wd<10 && wd>-10) $(id+'-results').css('width', $(id+'-results').width()+wd+($(window).width()<mobile?2:2)); if($(id).parents('.window').length) { var top = $(id).offset().top+$(id).outerHeight()-$(window).scrollTop(); $(id+'-results').css('top', top); } }); } function hideOutsideClickHandler() { if($.cookie("_WT") && $.cookie("_WT")>1) return; $('.outside-click-handler').fadeOut(function() { $(this).removeClass('dark transparent'); }); } function closePopup(popup) { if(popup) $(popup).fadeOut('fast', function() { $(popup).removeClass().children('.c').html(''); }); else $('#popup-content').fadeOut('fast', function() { $('#popup-content').removeClass().children('.c').html(''); }); hideOutsideClickHandler(); } function openCommentBox(itemId, link) { if(user) { $('#bottom-comment-link-'+itemId).hide(); $('#reply-base-'+itemId+' a.close-box').click(); $('#wallCommentItemFormContainer'+itemId).show().find('textarea').focus(); scrollToElement('#wallCommentItemFormContainer'+itemId, -200); } return login(link); } function replyComment(wallpost_id, comment_id, comment_title) { $('a#comment-'+wallpost_id).click(); $('#reply-base-'+wallpost_id).slideDown('fast').children('input').val(comment_id).siblings('span.title').html(comment_title); } function confirmRemoveComment() { return confirm('آیا به زدودن این نظر اطمینان دارید؟'); } function validateWait() { var waitTime = $.cookie("_WT"); if(waitTime>1) { //console.log('validateWait'); //notify('لطفا تا پایان زمان انتظار، یعنی '+formatPersianDigits(waitTime)+' ثانیه دیگر صبر نمایید.', 'autohide', 2000); $('#chairsMenu, a.instance').css('pointer-events', '').css('opacity', ''); $('#pjax-loader').fadeOut(); onMaxCuncurrentUsersExceed(); return false; } else return true; } function onMaxCuncurrentUsersExceed(errorTextStatus) { //console.log('onMaxCuncurrentUsersExceed'); $('body').removeClass('s2'); $('.outside-click-handler').show(); $('a.instance.current').removeClass('current'); if(!$.cookie("_WT") || $.cookie("_WT")=='0') { $.cookie('_WT', 30, {path: "/"}); sessionStorage.removeItem('_WT_TS'); sessionStorage.removeItem('_WT'); } var now = Math.floor(Date.now() / 1000); if(!sessionStorage.getItem('_WT_TS')) sessionStorage.setItem('_WT_TS', now); if(!sessionStorage.getItem('_WT')) sessionStorage.setItem('_WT', $.cookie('_WT')); $.cookie('_WT', Math.max(0, sessionStorage.getItem('_WT')-(now-sessionStorage.getItem('_WT_TS')) ), {path: '/'}); var i = parseInt($.cookie("_WT")); var url = window.location.hash; if(url && !url.startsWith('#/api/')) url = url.substring(1); var message = 'در حال حاضر، ظرفیت نفرات در حال خرید برای این برنامه به اتمام رسیده.<br/>شما در صف ورود به اولین ظرفیت آزاد شده هستید.<br/>لطفا تا اتمام زمان زیر صبر کنید تا مجدد وضعیت شما بررسی شود.<br/>زمان انتظار: '+formatPersianDigits(i)+' ثانیه.' var msg = { 'title': (admin() && errorTextStatus ?'['+errorTextStatus+'] ':'')+message, 'icon': '_ignore', } notify(msg, 'countdown'); clearTimeout(document.mcueIID); clearInterval(document.hsiId); document.mcueIID = setTimeout(function() { //i--; $.cookie('_WT', i, {path: '/'}); if(i>1) { onMaxCuncurrentUsersExceed(); } else { $.removeCookie('_WT', { path: '/' }); $.removeCookie('_WT_U', { path: '/' }); sessionStorage.removeItem('_WT_TS'); sessionStorage.removeItem('_WT'); $('.outside-click-handler').fadeOut(); notify({'title':'همینک دوباره تلاش کنید...', 'icon': '_ignore', 'click_action': url, 'click_action_label': 'تلاش دوباره'}, 'countdown', url?null:1000); } }, 1000); } function submitFilter(key, value) { if(key=='city_venue') { var idSections = value.split(':'); key = (idSections[0]=='city_id') ? 'city' : 'venue'; value = idSections[1]; } $('.filter-group select, .filter-group input, .filter-group .dd-switch, .filter-group a.btn').not($(this)).prop('disabled', true).addClass('disabled'); $('.store.navmenu a').attr('disabled', true); if(value=='currentLocation') { getLocation(); return; } urls = { 'today': '/showcase?filters=available:true,today:true'+'&w=when', 'today_remove': '/showcase?filters=today:true'+'&w=when', 'day': '/showcase?filters=available:true,day:%value%'.replace('%value%', value)+'&w=when', 'day_remove': '/showcase?filters=day:%value%'.replace('%value%', value)+'&w=when', 'from': '/showcase?filters=from:%value%'.replace('%value%', value)+'&w=when', 'to': '/showcase?filters=to:%value%'.replace('%value%', value)+'&w=when', 'after': '/showcase?filters=after:%value%'.replace('%value%', value)+'&w=when', 'before': '/showcase?filters=before:%value%'.replace('%value%', value)+'&w=when', 'available': '/showcase?filters=available:true'+'&w=when', 'city': '/showcase?filters=city:%value%'.replace('%value%', value)+'&w=where', 'near': '/showcase?filters=near:%value%'.replace('%value%', value)+'&w=where', 'venue': '/showcase?filters=venue:%value%'.replace('%value%', value)+'&w=where', 'kids': '/showcase?filters=kids:true'+'&w=how', 'comedy': '/showcase?filters=comedy:true'+'&w=how', 'online': '/showcase?filters=online:true'+'&w=how', 'order': '/showcase?order=%value%'.replace('%value%', value)+'&w=how', }; if(!value && urls[key+'_remove']) urls[key] = urls[key+'_remove']; while((match = /[=,]([^,&]+:,)/.exec(urls[key])) !== null) urls[key] = urls[key].replace(match[1], ''); while((match = /(,[^,&]+:)&/.exec(urls[key])) !== null) urls[key] = urls[key].replace(match[1], ''); while((match = /=([^,&]+:)&/.exec(urls[key])) !== null) urls[key] = urls[key].replace(match[1], ''); if(urls[key]) urls[key] = urls[key].replace('?&', '?'); $.pjax({url: urls[key], container: '#_container', scrollTo: false}); } function onFilterChange() { if($(this).is('[type="checkbox"]')) { var _this = this; setTimeout(function() { submitFilter($(_this).attr('name'), $(_this).is(':checked')?'true':''); }, 300); } else if(!$(this).is('.toflex') || $(this).val()) submitFilter($(this).attr('name'), $(this).val()); } function checkSchedule(e) { //console.log('checkSchedule'); //console.log(e); var serverTime = Math.floor($.now() / 1000) + parseInt(sessionStorage.getItem('serverTimeDef')); var schcd = Math.max($(e).data('schedule')-serverTime, 0); var tmpLabel = $(e).find('span.tmp-label'); var actionLabel = tmpLabel.data('action-label') ? tmpLabel.data('action-label') : 'خرید'; if(schcd==0) { $(e).removeAttr('data-schedule').removeClass('soon scheduled'); $(e).find('.counter').remove(); $(e).addClass('sch-started').find('.btn').removeClass('disabled').html('<i class="i i-buy"></i>خرید بلیت آغاز شد!'); if($(e).data('schedule-callback') && typeof $(e).data('schedule-callback') == 'function') $(e).data('schedule-callback')(); } else if(schcd < 60*60*3) { if($(e).find('span.schcd').length==0) tmpLabel.html(actionLabel+' در <span class="schcd"></span>'); var h = Math.floor((schcd %(60*60*24)) / 3600); var m = Math.floor((schcd % (60*60)) / 60); var s = Math.floor(schcd % 60); $(e).find('span.schcd').html((h>0 ? formatPersianDigits(h)+' ساعت':'')+(m>0 ? (h>0?' و \′':'')+formatPersianDigits(m)+(h==0?' دقیقه':''):'') + (h==0 ? (m>0?' و ″':'')+formatPersianDigits(s)+(m==0?' ثانیه':''):'')); } //console.log(schcd); if($(e).find('.counter').length) setCounterData(schcd, $(e).find('.counter'), {'ignoreDays': true, 'classic': ext()}); } function manageSchedules(tryIndex) { //console.log('manageSchedules'); if($('[data-schedule]').length==0) return; if(!tryIndex) tryIndex = 0; var msi = 1; var serverTimeDef = parseInt(sessionStorage.getItem('serverTimeDef')); if(serverTimeDef) { var serverTime = Math.floor($.now() / 1000) + serverTimeDef; $('[data-schedule]').each(function() { checkSchedule(this); }); clearInterval(document.msiId); document.msiId = setInterval(function() { $('[data-schedule]').each(function() { checkSchedule(this); }); }, msi*1000); } else if(!document.getServerTimeInProgress) { document.getServerTimeInProgress = $.ajax({ cache: false, dataType: 'json', timeout: 5000, url: '/api/v1/internal/general/getServerTime', success: function(resp) { if(resp && resp.status=='success') { var msr = rand(3, 33); var serverTime = resp.data - msr; var serverTimeDef = serverTime - Math.floor($.now() / 1000); sessionStorage.setItem('serverTimeDef', serverTimeDef); $('[data-schedule]').each(function() { checkSchedule(this); }); clearInterval(document.msiId); document.msiId = setInterval(function() { $('[data-schedule]').each(function() { checkSchedule(this); }); }, msi*1000); }}, error: function() { if(tryIndex<4) manageSchedules(tryIndex+1); else console.log('tiwall: tried getServerTime, more than 4 times with error'); }, complete: function() { document.getServerTimeInProgress = false; } }); } } function loadTelegramMiniAppScript(callback) { var ts = document.createElement('script'); //ts.setAttribute('src','https://cdn.zirbana.com/js/telegram/telegram-web-app.js'); ts.setAttribute('src','https://telegram.org/js/telegram-web-app.js'); ts.addEventListener('load', callback); document.head.appendChild(ts); } globalOnReadyCalled = false; function globalOnReady() { if(typeof xajax != undefined) xajaxLoaded = true; $("div").off("click", "a.showFullText").on("click", "a.showFullText", function() { $(this).prev('.to-hide').hide(); $(this).nextAll(".hidden-section").fadeIn().find('.partial.asleep').removeClass('asleep'); var element = $(this).parents('.wall-post, .topic'); var scrollTop = $(document).scrollTop(); if(element.length && element.offset().top > scrollTop && element.offset().top+element.height() > scrollTop+$(window).height()) scrollToElement(element, -6); $(this).remove(); if($(this).is('.awaken-counter')) renderPartials(); }); // section-links $('.section-links a[href*=#]').off('click').on('click', function(e){ e.preventDefault(); if($(this.hash).length) { if($(this.hash).parents('.col').length) { $('.col').addClass('narrow-hidden'); $(this.hash).parents('.col').removeClass('narrow-hidden'); } scrollToElement(this.hash, $(this).data('offset')); } }); $('.social-btn:nth-child('+$('.social-btn').length+')').addClass('l'); $('.hz-scroll').each(function(i) { if($(this).children().length==1 && !$(this).is('.hz-scroll-normal')) $(this).children(':first-child').addClass('hz-scroll-c'); if($(this).find('.selected').length>0) $(this).scrollLeft($(this).find('.selected').offset().left); }); applyStarRating(); setTimeout(processFeedbackLinks, 500); $(document).on("mouseenter", "div.ddl li", function() { $(this).addClass("hover"); }).on("mouseleave", "div.ddl li", function() { $(this).removeClass("hover"); }).on("mouseleave", "div.ddl", function() { $(this).find('ul.menu').fadeOut("fast"); }); $("div.ddl").on("click", "li", function() { $(this).parent().siblings("input.val").val($(this).attr("val")); $(this).parent().siblings("div.val").html($(this).html()); $(this).parent().fadeOut("fast"); }); $('div').off('click', '.video-launcher').on('click', '.video-launcher', function() { $('.outside-click-handler').addClass('dark').fadeIn('fast'); $('#popup-content').addClass('video'); $('#popup-content .c').html("<object class='loader' data='https://static.honarticket.com/resource/images/loading.svg'></object>"); $('#popup-content .c').load('/api/v1/video/renderVideoPlayer?autoplay=1&url='+encodeURI($(this).data('video-url'))); $('#popup-content').fadeIn('fast'); }); $("div.with-more:not(.inited)").each(function() { $(this).addClass('inited'); var _this = this; setTimeout(function() { var maxHeight = $(_this).data('max-height')?$(_this).data('max-height'):90; _this.style.setProperty('--collapsed-height', maxHeight+'px'); _this.style.setProperty('--height', $(_this).height()+'px'); if($(_this).height() > maxHeight) $(_this).filter(':not(.processed)').addClass('apply').append('<span class="handle"></span>'); $(_this).addClass('processed'); setTimeout(function() { $(_this).addClass('done'); processLoadLater(); $('.display-later').removeClass('display-later'); processSmartHzMenus(); }, 200); }, 300); }); if(admin()) mda(); function onTooltipOpen(e, ui) { setTimeout(function() { //console.log([ui.tooltip.offset().left, ui.tooltip.outerWidth(),$(window).width() ]); var padding = ui.tooltip.outerWidth() - ui.tooltip.width(); if(ui.tooltip.outerWidth() > $(window).width()-10) ui.tooltip.css('width', ($(window).width()-padding-10)+'px'); if(ui.tooltip.offset().left < 5) ui.tooltip.css('left', '5px'); else if(ui.tooltip.offset().left + ui.tooltip.outerWidth() > $(window).width()-10) ui.tooltip.css('left', ($(window).width()-ui.tooltip.outerWidth()-10)+'px'); }, ui.tooltip.is(':visible')?0:500); } var tooltipO = { position: { my: "left bottom-5", at: "left top" }, open: onTooltipOpen, content: function(tip) { return $(this).attr('title'); } }; $('.tooltip.no-delay').tooltip(tooltipO); tooltipO.show = { delay: 500 }; $('.tooltip:not(.no-delay)').tooltip(tooltipO); $(document).on('click', '.tooltip:not(.clickable)', function(e) { return false; }) $('[data-alt]').each(function(i) { var _this = this; var target = $($(_this).attr('data-alt')); if($(this).parents('#main-filters').length && !$($(this).attr('data-alt')).parents('.grid-box').length) $(this).addClass('disabled'); else if(target.is('input[type="checkbox"]')) $($(_this).attr('data-alt')).off('click').on('click', function() { if(!$(_this).is('.disabled a') && !$(_this).is('.disabled')) $(_this).toggleClass('active', $(this).is(':checked')); }); bindAltClick(_this); }); $('div').off('click', '.popup-content-switch').on('click', '.popup-content-switch', function() { if($(this).is('#btn-login') && lightMode()=='login' && !window._dev) { notify('بخش ورود و عضویت مدتی در دسترس نیست... از شکیبایی شما سپاسگزاریم.', null, 2000); return false; } $('.outside-click-handler').fadeIn('fast'); $('#popup-content .c').html("<object class='loader' data='https://static.honarticket.com/resource/images/loading.svg'></object>"); if($(this).data('class')) $('#popup-content').addClass($(this).data('class')); var _this = this; $('#popup-content').fadeIn('fast', function() { $(this).find('.loader').css('visibility', 'visible'); var url = $(_this).data('url') ? $(_this).data('url'): $(_this).attr('href'); $(this).children('.c').load(url+(url.includes('?')?'&':'?')+($(_this).data('temp_params')?$(_this).data('temp_params')+'&':'')+'embedded=1&_='+rand(), null, function() { onWindowResize(); }); $(_this).data('temp_params', ''); }); return false; }); $('.wall-post').off('click', 'a.showHiddenComments').on('click', 'a.showHiddenComments', function() { $(this).parent().hide().nextAll("div.hidden").fadeIn(); }); $('.wall-post').off('click', '.wallCommentItem a.reply').on('click', '.wallCommentItem a.reply', function() { replyComment($(this).parents('.wall-post').data('id'), $(this).parents('.wallCommentItem').data('id'), $(this).parents('.wallCommentItem').find('.commenter a.user').text()); }); $('.wall-post').off('click', '.reply-base a.close-box').on('click', '.reply-base a.close-box', function() { $(this).siblings('input').val('').parent().slideUp('fast'); }); $('.wall-post').off('click', '.reply-to').on('click', '.reply-to', function() { var target = $('#wallComment'+$(this).data('reply-to')); if(target.length) { if(target.is('.hidden')) target.siblings('.hiddenComments').find('.showHiddenComments').click(); target.addClass('hilighted'); setTimeout(function() { target.removeClass('hilighted'); }, 2000); scrollToElement(target, -80); } }); if(globalOnReadyCalled) return; globalOnReadyCalled = true; // init document.pendingReserveExists = false; document.seatmapUpdateInProgress = false; /* to close menu after click, & clear body margin-top for snapped header */ $('#head, #extended-menu').removeClass('expanded').css('height', ''); $('#head.tmp.colored').removeClass('tmp colored'); layout(); decacheLinks(); setTimeout(layoutScrollRelated, 500); onPartialLoadedGeneral(); //layoutScrollRelated(); $('body').css('margin-top', ''); $('.ui-tooltip').fadeOut(); calcVerticalLayout(); if($('.cover img').length>0) $('.cover img').load(calcVerticalLayout); window.hash = {}; if(window.location.hash) { var hashSections = window.location.hash.substring(1).split('&'); if(hashSections) hashSections.forEach(function(v, i, arr) { var hashSectionsParts = v.split('='); window.hash[hashSectionsParts[0]] = hashSectionsParts[1]?hashSectionsParts[1]:true; }); } //console.log('load', hash, localStorage, sessionStorage); var viewModes = ['embedded', 'telegram']; window.view_mode = viewModes.includes(hash._mode) ? hash._mode : (sessionStorage.getItem('view_mode') && viewModes.includes(sessionStorage.getItem('view_mode')) ? sessionStorage.getItem('view_mode') : null); if(window.view_mode) { sessionStorage.setItem('view_mode', window.view_mode); $('body').addClass('embedded'); $('#footer').remove(); } if(window.view_mode=='telegram') { loadTelegramMiniAppScript(function() { Telegram.WebApp.ready(); Telegram.WebApp.expand(); }); } $('.dropdown').removeClass('show').siblings('.dropdown-switch').data('clicked', false); //if($('.print-icon').length && typeof a2a != "undefined") a2a_init(); if(document.userLoaded) onUserReady(); clearInterval(document.hsiId); hideOutsideClickHandler(); if(typeof globalOnReadyInited == 'undefined') { // on website initialize (only once till next non-pjax/non-ajax request) //onWindowResize(); if($.cookie('TW_USERNAME') && !ext()) document.notifIID = setInterval(updateNotifications, 5*60*1000); searchEmpty=true; $(document).on("keyup", '#txtsearch', function() { clearTimeout(document.searchIntervalId); if($("#txtsearch").val().trim().length < 2) { $("#search-suggest-container .shortcuts").show(); $("#search-suggest-container a.all").hide(); $("#search-suggest").html(''); searchEmpty=true; } else { if(isDefined(searchEmpty) && searchEmpty) { //console.log($('#search-suggest .loader').length); if($('#search-suggest .loader').length==0) $('#search-suggest').html("<object class='loader' data='https://static.honarticket.com/resource/images/loading.svg'></object>"); $("#search-suggest-container a.all").hide(); $("#search-suggest-container").show().find('.shortcuts').hide(); } if(light() || true) { search(); return; } else document.searchIntervalId = setTimeout(search, 600); } if($("#txtsearch").val()) $('a.clear-search').removeClass('hidden'); else $('a.clear-search').addClass('hidden'); }); $(document).on('click', '#search-suggest-container', function() { $('input.search').focus(); }); $('input.search').focusout(function() { clearTimeout(document.searchIntervalId); document.sshid = setTimeout(function() { $('#search-suggest-container').hide(); }, 400); }).focus(function(e) { clearTimeout(document.sshid); if($(this).val().trim().length < 2) { $("#search-suggest-container a.all").hide(); $("#search-suggest-container").show().find('shortcuts').show(); } else { //$("#search-suggest-container a.all").show(); $("#search-suggest-container").show().find('shortcuts').hide(); //search(e); } }).off('keyup').keyup(function(e) { if(e.which==13 && $('input.search').val().trim()) submitSearch(); }); $('a.search').off('click').click(function() { if($('input.search').is(':visible')) { if($('input.search').val().trim()) submitSearch(); else $('input.search').focus(); } else { $('input.search').fadeIn().focus(); } }); $('a.clear-search').click(function() { $("#txtsearch").val(''); $('#txtsearch').keyup(); $(this).addClass('hidden'); }); $(document).on('mouseup', 'a.ad', function() { if(light()) return; $.ajax({url: "/api/internal/general/viewCounter", data: {section: 'banner', id: $(this).attr('adid'), noOutput: 1}}); }); $('#popup-content button.close').click(function() { closePopup($(this).parents('#popup-content').get(0)); }); $(document).on('click', 'a.login:not(.popup-content-switch)', function() { //if(window.location.pathname.indexOf('/login')==-1) window.location='/login?return_url='+window.location.pathname+window.location.search; //else window.location=window.location.pathname; //return false; return login(); }); $(document).on("click", ".item-feedback-container .addOption", function() { if($(this).parent("li").siblings().length < 50) $(this).parent("li").before("<li><input type='text' name='feedback-option[]' value='' autocomplete='off' /><a class='removeOption' href='javascript:;'>×</a></li>").prev().hide().show().find('input').focus(); else notify('نهایت تا پنجاه گزینه تعریف پذیر است', 'error center', 'normal'); }); $(document).on("click", ".item-feedback-container .removeOption", function() { if($(this).parent("li").siblings().length > 1) { $(this).parent("li").remove(); } else { //notify('دست کم یک گزینه برای پاسخ نیاز است', 'error center', 'normal'); $('#addItemFeedback').click(); } }); $(document).off('change', '.image-selector').on('change', '.image-selector', function() { // file(s) are selected in OS dialogue box var input = this; var settings = { maxWidth: $(input).data('max-width'), maxHeight: $(input).data('max-height'), init: window[$(input).data('init')], complete: window[$(input).data('complete')] }; if(input.files) addImage($(input).data('origin').get(0), input.files, 0, settings); }); $(document).off('click', '.d-image .rotate').on('click', '.d-image .rotate', function() { // rotate button clicked for an attached image //var img = $(this).parent('.d-image').children('img.loaded'); var img = null; if($(this).parent('.d-image').is('.edit')) img = $(this).siblings('.croppie-container').children('img.loaded'); else img = $(this).siblings('img.loaded'); rotateBase64Image(img.attr('src'), {degree:90, callback:function(data) { img.attr('src', data).siblings('input[type="hidden"].d-image-src').val(data).siblings('input[type="hidden"].d-image-meta').val('updated'); }}); }); $(document).off('click', '.d-image .remove').on('click', '.d-image .remove', function() { // remove button clicked for an attached image var img = null; if($(this).parent('.d-image').is('.edit')) img = $(this).siblings('.croppie-container').children('img'); else img = $(this).siblings('img'); img.removeClass('loaded').parents('.d-field').removeClass('fullwidth').find('.image-selector').val(''); $(this).hide().siblings('input[type="hidden"].d-image-src').val('').siblings('input[type="hidden"].d-image-meta').val('removed').siblings('.tool').hide(); var removedCallback = window[$(img.data('alt')).data('removed')]; removedCallback(img.get(0)); }); renderUserBox(); String.prototype.replaceAll = function(search, replacement) { var target = this; return target.split(search).join(replacement); }; $(document).on('blur', 'input.mobile', function() { $(this).val(formatEnglishDigits($(this).val(), true)); }); $(document).on('click', '.with-more-sections-menu a:not(.dropdown-switch):not(.exclusion)', function() { var menu = $(this).parents('.with-more-sections-menu'); if($(this).data('target-section')=='all') { if($(this).data('action')=='switch' && $(this).is('.active')) { $(menu.data('contents')+' .handle').click(); } else { /*$(menu.data('contents')).removeClass('expanded');*/ } $(menu.data('contents')+' .handle').show(); $(menu.data('sections')).show(); } else { $(menu.data('sections')).removeClass('active').hide(); $($(this).data('target-section')).addClass('active').show(); $($(this).data('target-content')).addClass('expanded'); $($(this).data('target-content')+' .handle').hide(); } $(this).parents('.with-more-sections-menu').find('a.active').removeClass('active'); $(this).addClass('active'); if($(this).data('target-section')!='all') { var scrollTop = $($(this).data('target-section')).parent().closest('div, table').data('scroll-target') ? $($($(this).data('target-section')).parent().closest('div, table').data('scroll-target')).offset().top-100 : $($(this).data('target-section')).parent().closest('div, table').offset().top-125; if($(this).parents('.with-more-sections-menu').is('.scroll') || $(window).scrollTop()<scrollTop) $("html, body").animate({ scrollTop: scrollTop}); } }); $(document).on('click', 'form.pjax button[type="submit"]', function() { $(this).parents('form.pjax').append('<input type="hidden" name="'+$(this).attr('name')+'" value="'+$(this).attr('value')+'" />'); }); $(document).on('click', '.properties h4', function() { $(this).toggleClass('collapsed'); }); $(document).on('blur', 'input[type="text"]', function() { $(this).val($(this).val().trim()); }); $(document).on("mouseenter", "div.ddl:not(.disabled) div.val, div.ddl:not(.disabled) input.val", function () { $(this).nextAll("ul.menu").fadeIn("fast"); }).on("keyup", "div.ddl div.val, div.ddl input.val", function() { $(this).siblings("ul.menu").fadeOut("fast"); }); $(document).on('click', '.instance.direct-link', function(e) { //console.log('yes'); var datalink = $(this).data("link"); window.open(datalink); //return false; }); $(document).on('blur', 'input.english-digits', function() { $(this).val(formatEnglishDigits($(this).val())); }); $(document).on('click', 'a.ajax-notify', function() { var _this = this; $(this).addClass('disabled').siblings('.ajax-notify').addClass('disabled'); var url = $(this).data('url')?$(this).data('url'):$(this).attr('href') $.ajax({ url: url, success: function(resp) { try { var r = JSON.parse(resp); if((r.ok || r.status=='success') && r.data && r.data.message) notify(url+'<br/><br/>'+r.data.message, 'ltr'); else notify(url+'<br/><br/>'+resp, 'ltr'); } catch(err) { notify(url+'<br/><br/>'+resp, 'ltr'); } }, error: function(resp) { console.log(resp); notify(url+'<br/><br/>'+'در انجام کار مشکلی پیش آمد، لطفا دوباره تلاش کنید.'); }, complete: function(resp) { mda(); $(_this).removeClass('disabled').siblings('.ajax-notify').removeClass('disabled'); } }); return false; }); } globalOnReadyInited = true; $("a[rel^='prettyPhoto']").prettyPhoto({padding:20,showTitle:false}); if($('.grid-box .pages-list').length) setTimeout(setRollOffsets, 400); var menuClearTOID = null; $(".menu-item").mouseover(function() { clearTimeout(menuClearTOID); var _thisId = $(this).attr("id"); menuClearTOID = setTimeout(function() { $("#navmenu ul.submenu:not(#_"+_thisId+")").hide(); $("#_"+_thisId).fadeIn("fast"); },100); }); $("#navmenu a.menu-item").not('.selected').mouseover(function() { $(this).animate({'opacity': '0.7', 'padding-right':'5px'},120,'swing'); }).mouseleave(function() { $(this).animate({'opacity': '1', 'padding-right':'0'},170); }); $(".inner-labeled input, .inner-labeled textarea").each(function(){ //$(this).attr("mainBg", $(this).css("background")).attr("mainBorder", $(this).css("border")); if (this.value) { $(this).prev().hide(); } }); $(document).on('focus', '.inner-labeled input, .inner-labeled textarea', function() { $(this).css({background: '#fff'}, 500).prev().hide(); }).on('blur', '.inner-labeled input, .inner-labeled textarea', function(){ if (!this.value) { $(this).css({background: $(this).attr("mainBg"), border: $(this).attr("mainBorder")}, 500).prev().show(); } }); $(document).on('click', ".inner-labeled label", function() { $(this).next().focus(); }); $(".hilighted").removeClass("hilighted").addClass("hilighted-l").after("<span class='hilighted-r'></span>"); $("#registerPassword").keyup(function() { if(this.value.length >= 6) $("#passwordConfirm").css("display", ""); }); $(document).on('focus', ".expandable-comment", function () { if(!$(this).data("collapsedHeight")) $(this).data("collapsedHeight", $(this).height()); $(this).addClass('expanded').css({"height": "170px"}).next('.hidden').show(); $(this).parent().next('.hidden').show(); //$(this).removeClass('attached'); //$('#filter-menu.attached').removeClass('attached'); $(this).parents('form').addClass('expanded'); }); $('#subjects-knob').click(function() { $('#navmenu').slideDown(200); $('#sidebar-base').fadeOut('fast'); }); $("#navmenu").mouseover(function() { clearTimeout(menuClearTOID); }); $("#navmenu").mouseleave(function() { menuClearTOID = setTimeout(function() { $("#sidebar-base").show(); $("#navmenu").fadeOut("fast"); },500); }); $(document).on('mouseenter', 'a.ad.hasPurchase', function() { //if($(this).children('a.ad-buy').length==0) $(this).append("<a href='/s/"+$(this).data('urn')+"' class='floating-btn ad-buy'>خرید"+$(this).data('entity')+"</a>").children('a.ad-buy').hide().fadeIn(200); $(this).children('a.ad-buy').addClass('show'); }).on('mouseleave', 'a.ad.hasPurchase', function() { //$(this).children('a.ad-buy').remove(); $(this).children('a.ad-buy').removeClass('show'); }); $(document).off('click', '.popup-switch').on('click', '.popup-switch', function(e) { var popup = $(this).data('target')?$($(this).data('target')):$(this).next('.popup'); popup.data('switch', this); $('.dropdown').removeClass('show'); $(this).data('clicked', !$(this).data('clicked')); if($(this).is('.click-only') && !popup.is('.click-only')) popup.addClass('click-only'); if(!$(this).data('clicked')) { if(popup.is('.with-class')) popup.removeClass('show'); else popup.fadeOut('fast'); } else { if(popup.is('.with-class')) popup.addClass('show'); else popup.fadeIn('fast'); if($(this).is('.align-target')) alignPopup(popup, $(this)); } }); $(document).off('mouseenter', '.popup-switch:not(.click-only)').on('mouseenter', '.popup-switch:not(.click-only)', function(e) { var popup = $(this).data('target')?$($(this).data('target')):$(this).next('.popup'); clearTimeout(popup.attr("tid")); popup.data('switch', this); popup.attr("tid", setTimeout(function(_this) { $('.dropdown').removeClass('show'); if(!$(_this).is('.click')) { if(popup.is('.with-class')) popup.addClass('show'); else popup.show(); if($(_this).is('.align-target')) alignPopup(popup, $(_this)); } if(!$(_this).is('#share-popup-switch, #player-bar-switch') && popup.offset().top - $(window).scrollTop() < 50) popup.css('bottom', '-170px').css('left', '19px'); }, 300, this)); e.stopPropagation(); }).off('mouseleave', '.popup-switch:not(.click-only)').on('mouseleave', '.popup-switch:not(.click-only)', function() { var popup = $(this).data('target')?$($(this).data('target')):$(this).next('.popup'); clearTimeout(popup.attr("tid")); var _this = this; popup.attr("tid", setTimeout(function(o) { $(_this).data('clicked', false); if(o.is('.with-class')) o.removeClass('show'); else o.fadeOut('fast'); }, 700, popup)); }).off('click', '.popup-switch:not(.click)').on('click', '.popup-switch:not(.click)', function(e) { e.stopPropagation(); }); $(document).off('mouseenter', '.popup').on('mouseenter', '.popup', function() { clearTimeout($(this).attr("tid")); }).off('mouseleave', '.popup:not(.click-only)').on('mouseleave', '.popup:not(.click-only)' , function() { clearTimeout($(this).attr("tid")); $(this).attr("tid", setTimeout(function(_this) { $($(_this).data('switch')).data('clicked', false); if($(_this).is('.show')) $(_this).removeClass('show'); else $(_this).fadeOut('fast'); if($(_this).is('#player-bar') && document.onmouseup) document.onmouseup(); }, 700, this)); }).off('click', '.popup').on('click', '.popup', function(e) { e.stopPropagation(); }); $(document).on('click', '.popup:not(.with-class) > a:not(.persistant)', function() { $(this).parent('.popup').fadeOut('fast'); $($(this).parent('.popup').data('switch')).data('clicked', false); }); $(document).on('click', '.popup > button.close', function() { $(this).parent('.popup').removeClass('show'); $($(this).parent('.popup').data('switch')).data('clicked', false); return false; }); $(document).on('click', '.popup + .dimmer', function() { $(this).siblings('.popup').removeClass('show'); $($(this).siblings('.popup').data('switch')).data('clicked', false); return false; }); $(document).off('click', '.outside-click-handler').on('click', '.outside-click-handler', function() { $('.window').fadeOut('fast'); $('#popup-content').fadeOut('fast', function() { if($(this).is('.popup-ad')) $(this).remove(); else $(this).removeClass().children('.c').html(''); }); $('.pu').fadeOut('fast', function() { if($(this).is('.temp')) $(this).remove(); }); $('#page.sale').find('a.sale-desc-collapse-btn').click(); hideOutsideClickHandler(); }); $(document).off('click', '.window-close').on('click', '.window-close', function() { $('.window').fadeOut('fast'); hideOutsideClickHandler(); }); $(document).off('click', '.window-switch').on('click', '.window-switch', function() { if(light() && !admin() && !ext()) { notify('بخش فیلترها مدتی در دسترس نیست... از شکیبایی شما سپاسگزاریم.', null, 2000); return; } if(!$(this).data('window')) $(this).data('window', $(this).next('.window')); $('.outside-click-handler').fadeIn('fast'); $($(this).data('window')).fadeIn('fast'); if($(this).is('.showcase-menu.bar .filters a')) $('#menu-switch').click(); onWindowResize(); }); $(document).off('click', '.stop-podcast').on('click', '.stop-podcast', function() { $('body').removeClass('podcast-playing'); $('#player-bar').removeClass('show'); }); $(document).off('click', '.receipt .customers a.edit-customers').on('click', '.receipt .customers a.edit-customers', function() { var originalValue = $(this).next('div').children('textarea').val(); $(this).next('div').children('textarea').data('original-value', originalValue); $(this).prev('div.customers-value').hide().end().hide().next('div').show(); }); $(document).off('click', '.receipt .customers a.btn.save').on('click', '.receipt .customers a.btn.save', function() { $('.receipt .customers a.btn').addClass('disabled'); var _this = this; $.ajax({ url: '/api/v1/sale/resetReserveUsers', dataType: "json", data: {'reserve_id': $(this).parents('.receipt').data('id'), 'user_mobiles': $(this).siblings('textarea').val().replaceAll('\n', ',').replaceAll('،', ',')}, success: function(resp) { if(resp.status=='success') $(_this).parent().hide().siblings('div.customers-value').html(resp.data.new_value).show().siblings('a.edit-customers').html('ویرایش').show(); else notify(resp.error.message); }, error: function(resp) { console.log(resp); notify('در انجام کار مشکلی پیش آمد، لطفا دوباره تلاش کنید.'); }, complete: function(resp) { $('.receipt .customers a.btn').removeClass('disabled'); } }); }); $(document).off('click', '.receipt .customers a.btn.cancel').on('click', '.receipt .customers a.btn.cancel', function() { $(this).siblings('textarea').val($(this).siblings('textarea').data('original-value')).parent().hide().siblings('div.customers-value, a.edit-customers').show(); }); $(document).off('keyup keypress', '.receipt .customers textarea').on('keyup keypress', '.receipt .customers textarea', function() { $(this).height(0).height(this.scrollHeight-20); }) initFlex(); $('.flexdatalist-alias.address, .flexdatalist-alias.city, .flexdatalist-alias.no-autocomplete').attr('autocomplete', 'off'); $(document).off('keyup', 'input.toflex.single:not(.normal)').on('keyup', 'input.toflex.single:not(.normal)', function(e) { if($(this).prev('input').val() && e.which != 13) $(this).prev('input').val(''); }); $(document).off('focus', 'input.toflex.single:not(.normal)').on('focus', 'input.toflex.single:not(.normal)', function() { $(this).data('currentVal', $(this).val()).val(''); if(!$(this).val()) setTimeout(function(_this) { $(_this).keyup(); }, 300, this); }); $(document).off('focusout', 'input.toflex.single:not(.normal)').on('focusout', 'input.toflex.single:not(.normal)', function() { if($(this).data('currentVal')) $(this).val($(this).data('currentVal')); }); //$('#embedded-wall-title:empty').parent('#wall').addClass('empty'); function initItemSummaryRemoval() { clearTimeout(document.stid); if(document.lastSummaryId) { document.stid = setTimeout(function() { $('.item-summary').fadeOut('fast', function() { $(this).remove(); }); document.lastSummaryId = null; }, 600); } } $(document).on('mouseenter', '.summary-link', function() { clearTimeout(document.stid); var _this = this; if(!$(this).data('item-type')) $(this).data('item-type', 'page'); document.stid = setTimeout(function() { if(document.lastSummaryId != $(_this).data('item-id')) { document.lastSummaryId = $(_this).data('item-id'); $('.item-summary').remove(); $(_this).parent().after("<div class='item-summary ".replace('<', '<')+$(_this).data('item-type')+"-summary' style='display: none'></div>".replace('<', '<')).next().load( ($(_this).data('item-type')=='channel'?'/api/v2/channels/renderChannelSummary?id=':'/api/v2/pages/renderPageSummary?id=')+$(_this).data('item-id'), function() { $(this).fadeIn('fast'); if($(this).offset().top - $(window).scrollTop() < 50) $(this).css('margin-top', '-70px'); }).on('mouseenter', function() { clearTimeout(document.stid); }).on('mouseleave', initItemSummaryRemoval); } }, 600); }).on('mouseleave', '.summary-link', initItemSummaryRemoval); // if(!document.pjaxStarted) { $.pjax.defaults.timeout = 8000; $(document).on('pjax:send', function() { document.pjaxInProgress = true; if(!document.disablePjaxLoader) displayPjaxLoader(); /*console.log('send');*/ }); $(document).on('pjax:complete', function() { document.pjaxInProgress = false; if(!document.disablePjaxLoader) { $('#pjax-loader').fadeOut(); clearTimeout(document.pjtid); } else { document.disablePjaxLoader = false; } /*console.log('complete');*/ }); $(document).on('pjax:success', function(e, data, status, xhr, options) { if($(e.target).is('.replace')) $(e.target).replaceWith($(e.target).html()); globalOnReady(); if(typeof options.onSuccess === 'function') options.onSuccess(); /*document.disablePjaxLoader = false;*/ }); $(document).on('submit', 'form.pjax', function(e) { var formId = $(this).attr('id'); if(e.originalEvent) { var submitter = e.originalEvent.submitter; if(submitter.attributes.nopjax) return true; if(submitter.name != 'submit_wall' && submitter.name != 'submit') $(this).append('<input type="hidden" name="'+submitter.name+'" value="'+submitter.value+'" />'); } $(this).append('<input type="hidden" name="'+(formId=='wallItemForm'?'submit_wall':'submit')+'" value="'+(formId?formId:'1')+'" />'); var pjaxOptions = {scrollTo: false}; if($(this).is('.pjax-nopush')) pjaxOptions.push = false; $.pjax.submit(e, '#_container', pjaxOptions); $(this).find('input[type="submit"]').click(function () { $(this).attr('disabled', 'disabled'); return false; }); }); document.pjaxStarted = true; } $('div').pjax('a[target!="_blank"]:not(.no-pjax, .play-podcast, .start-podcast, .stop-podcast, a.pjax-nopush, .pjax-noscroll, .pjax-custom, .page.tabmenu a, #page-wall-c .paging a, a.fl)', '#_container'); $('div').pjax('a.pjax-noscroll[target!="_blank"]:not(.no-pjax, .play-podcast, .start-podcast, a.pjax-nopush, .stop-podcast), .page.tabmenu a, #page-wall-c .paging a', '#_container', {scrollTo: false}); $('div').pjax('a.play-podcast, a.start-podcast, a.stop-podcast', '#player-container', {scrollTo: false, push: false}); $('div').pjax('a.pjax-nopush[target!="_blank"]', '#_container', {scrollTo: false, push: false}); $('div').on('click', 'a.play-podcast, a.start-podcast, a.stop-podcast', function() { if($('audio').length) { var audio = $('audio').get(0); audio.pause(); audio.currentTime = 0; audio.src = ''; } }); // $(document).on('mouseenter', 'a.podcast:not(.play-podcast, .items-all)', function() { if($(this).children('a.play-podcast').length==0) $(this).append('<a href="'+$(this).attr('href')+'?play=1" class="play-podcast icon med"> </a>'); }).on('mouseleave', 'a.podcast', function() { $(this).children('a.play-podcast').remove(); }); clearInterval(document.msiId); if($('[data-schedule]').length>0) manageSchedules(); /*$('.grid-item-hover').contenthover({ overlay_background:'#000', overlay_opacity:0.85, height: 160, fade_speed: 180, });*/ $(window).off('scroll').on('scroll', function() { $('.loader').css('visibility', 'visible'); layoutScrollRelated(); layoutSnap(); processLoadLater(); $('#player-bar').mouseleave(); $('.browsable.faded').removeClass('faded'); window.dispatchEvent(new Event("scroll2")); if($('#page').is('.sale')) { manageNonFullInstanceBar(); } }); $(document).off('click', '.dropdown-switch').on('click', '.dropdown-switch', function() { var dropdown = $(this).data('target')?$($(this).data('target')):$(this).nextAll('.dropdown'); dropdown.toggleClass('show', !$(this).data('clicked')); $(this).data('clicked', !$(this).data('clicked')); if($(this).is('.click-only') && !dropdown.is('.click-only')) dropdown.addClass('click-only'); $('#player-bar').removeClass('show'); if($(this).data('clicked')) { if($(this).is('.align-target')) alignPopup(dropdown, $(this)); else if($(this).parents('.hz-scroll').length && !$(this).data('target')) alignPopup(dropdown, $(this), true); } dropdown.parents('.sticked').toggleClass('no-overflow', $(this).data('clicked')); }); $(document).off('mouseenter', '.dropdown-switch:not(.click-only)').on('mouseenter', '.dropdown-switch:not(.click-only)', function() { var dropdown = $(this).data('target')?$($(this).data('target')):$(this).nextAll('.dropdown'); if(!$(this).is('.click')) { $('.dropdown').not(dropdown).removeClass('show'); $('#player-bar').removeClass('show'); } clearTimeout($(document).data('toid-'+$(this).attr('id'))); if(!$(this).is('.click')) $(document).data('toid-'+$(this).data('ddid'), setTimeout(function(_this) { dropdown.addClass('show'); dropdown.data('ddid', $(_this).attr('id')); if($(_this).is('.align-target')) alignPopup(dropdown, $(_this)); else if($(_this).parents('.hz-scroll').length && !$(_this).data('target')) alignPopup(dropdown, $(_this), true); dropdown.parents('.sticked').addClass('no-overflow'); }, 250, this)); }).off('mouseleave', '.dropdown-switch:not(.click-only)').on('mouseleave', '.dropdown-switch:not(.click-only)', function() { var _this = this; var dropdown = $(this).data('target')?$($(this).data('target')):$(this).siblings('.dropdown'); clearTimeout($(document).data('toid-'+$(this).data('ddid'))); $(document).data('toid-'+$(this).attr('id'), setTimeout(function() { $(_this).data('clicked', false); dropdown.removeClass('show'); dropdown.parents('.sticked').removeClass('no-overflow'); }, dropdown.is('.hide-fast')?10:1000)); }); $(document).off('mouseenter', '.dropdown').on('mouseenter', '.dropdown', function() { clearTimeout($(document).data('toid-'+$(this).data('ddid'))); }).off('mouseleave', '.dropdown:not(.click-only)').on('mouseleave', '.dropdown:not(.click-only)', function() { //console.log('mouseleave!'); var _this = this; $(document).data('toid-'+$(this).data('ddid'), setTimeout(function() { $(_this).removeClass('show'); $(_this).parents('.sticked').removeClass('no-overflow'); $(_this).siblings('.dropdown-switch').data('clicked', false); }, 1000)); }); $(document).off('click', '.dropdown > .close').on('click', '.dropdown > .close', function() { $(this).parent('.dropdown').removeClass('show').siblings('.dropdown-switch').data('clicked', false); }); $(document).off('click', '.dropdown + .dimmer').on('click', '.dropdown + .dimmer', function() { $(this).siblings('.dropdown').removeClass('show').siblings('.dropdown-switch').data('clicked', false); }); $(document).off('click', 'div#showtimeMenu + .dimmer').on('click', 'div#showtimeMenu + .dimmer', function() { $('body').removeClass('instance-change'); }); $(document).off('click', 'a.pjax-custom').on('click', 'a.pjax-custom', function(e) { e.preventDefault(); document.disablePjaxLoader = true; if( !$(this).data('confirm') || ($(this).data('confirm') && confirm($(this).data('confirm'))) ) { var _this = this; $.pjax({url: $(this).data('url'), container: $(this).data('reload')?'#popup-content':$(this).data('container'), scrollTo: false, push: false, onSuccess:function() { document.disablePjaxLoader = false; if($(_this).data('reload')) $.pjax({url: document.URL, container: '#_container', scrollTo: false, push: false}); }}); } }); $(document).off('click', '.item-page .btn').on('click', '.item-page .btn', function(e) { e.preventDefault(); document.disablePjaxLoader=true; $.pjax({url: $(this).data('saleurn'), container: '#_container'}); }) $('.play-podcast').click(function(e) { $('body').addClass('podcast-playing'); }); $('.item-page .play-podcast').click(function(e) { e.preventDefault(); $.pjax({url: "/podcast/"+$(this).data('podcasturn')+"?play=1", container: '#player-container', scrollTo: false}); }) $('.cal').each(function() { var _this = this; Calendar.setup({ inputField: $(this).attr('id'), button: $(this).attr('id'), ifFormat: '%Y-%m-%d', dateType: 'jalali', weekNumbers: false, onUpdate: function() { document.activeCal = this.inputField; $(_this).next('.dd-switch').children('span').html(formatPersianDigits($(this.inputField).val())); }, onClose: function() { $(this.element).css('opacity', ''); this.hide(); if(document.activeCal) $(document.activeCal).change(); }, }); }); //console.log($('textarea.rich'), tinymce); $(document).off('click', '.with-more .handle').on('click', '.with-more .handle', function() { var box = $(this).parent('.with-more'); if(box.is('.expanded')) { box.removeClass('expanded'); //$(this).html('... دیدن ادامه ››'); } else { box.addClass('expanded'); //$(this).html('›› بستن'); } if(!$(this).parents('.with-more').is('.no-scroll')) { var scrollTop = $(this).parent().data('scroll-target') ? $($(this).parent().data('scroll-target')).offset().top-85 : $(this).parent().offset().top-110; if(box.is('.expanded') && $(window).scrollTop()<scrollTop || !box.is('.expanded') && $(window).scrollTop()>scrollTop) $("html, body").animate({ scrollTop: scrollTop}); } }); $('.filter-group #from, .filter-group #to, .filter-group #today, .filter-group #day').off('mouseup').on('mouseup', function() { var _this = this; setTimeout(function(_this) { $(_this).focus(); $('.calendar').css('top', $(_this).is('#day')?($(window).width()>mobile?'229px':'184px'): $(window).width()>mobile?'291px':'246px').css('opacity', '1'); $('.calendar').css('left', $(_this).offset().left-($(_this).is('#from') ? $('.calendar').width()-$(_this).width()-($(window).width()==$('.window').outerWidth()+30?2:3)-($(_this).is('#day')?1:0) : 0)); $('.calendar').toggleClass('right-aligned', $(_this).is('#from')); }, 100, this); }); $(document).off('change', '.filter-group select, .filter-group input').on('change', '.filter-group select, .filter-group input', onFilterChange); $(document).off('click', '.grid-box .show-all').on('click', '.grid-box .show-all', function() { var gridBox = $(this).parents('.grid-box'); var expandedSiblings = gridBox.parents('.showcase-c').find('.grid-box:not(.collapsed)'); var expandedSiblingExists = expandedSiblings.length > 0; if(gridBox.is('.collapsed')) { gridBox.removeClass('collapsed'); expandedSiblings.addClass('collapsed'); gridBox.parents('.home-showcase').addClass('contains-expanded'); } else gridBox.addClass('collapsed').parents('.home-showcase').removeClass('contains-expanded'); layoutScrollRelated(); setTimeout(function() { var shrinkOffset = 0; if($('body').is('.home')) shrinkOffset = 10; var targetScroll = gridBox.children('.pages-list').data('offset'); $("html, body").animate({ scrollTop: (targetScroll>300?(targetScroll>$(window).scrollTop()&&targetScroll>hideOn?targetScroll:targetScroll-50):targetScroll-45)-37-shrinkOffset}, {duration: 500 }); }, 100); }); $('.admin-tools').mouseleave(function() { document.attoid = setTimeout(function() { $('.admin-tools').fadeOut(); }, 500); }).mouseenter(function() { clearTimeout(document.attoid); $('.admin-tools').fadeIn('fast'); }); $('.floating-switch.tools-switch').mouseenter(function() { clearTimeout(document.attoid); $('.admin-tools').fadeIn('fast'); }).mouseleave(function() { document.attoid = setTimeout(function() { $('.admin-tools').fadeOut(); }, 500); }).click(function(e) { e.stopPropagation(); if($('.admin-tools').is(':visible') && $('.admin-tools').css('opacity')==1) $('.admin-tools').fadeOut(); else $('.admin-tools').fadeIn('fast'); }); $(window).resize(onWindowResize); } // end of globalOnReady() $(document).ready(globalOnReady); $(document).ready(onPjaxLoaded); شهر خود را انتخاب کنید همه شهرها تهران رشت اصفهان اردبیل کرج بندرعباس رامسر سلماس محمودآباد کیش ساری تبریز همه برنامه ها به زودی کنسرت های تهران کنسرت سایر شهرها جزیره کیش کنسرت-نمایش ها جنگ ها Previous Next کنسرت های تهران کنسرت محسن ابراهیم زاده تهران، سالن میلاد نمایشگاه بین المللی سه شنبه 16 دی بلیت ها به اتمام رسید کنسرت مجید رضوی تهران، سالن میلاد نمایشگاه بین المللی پنجشنبه 18 دی خرید بلیت کنسرت پرنده آتشین (ارکستر سمفونیک تهران) تهران، تالار وحدت جمعه 19 تا 20 دی خرید بلیت کنسرت حمید عسکری تهران، سالن میلاد نمایشگاه بین المللی دوشنبه 22 دی خرید بلیت کنسرت پالس تهران، بلک باکس ایران مال پنجشنبه 25 دی خرید بلیت کنسرت گروه نوشه (ویژه بانوان) تهران، تالار وحدت جمعه 26 دی خرید بلیت کنسرت مصطفی راغب تهران، سالن میلاد نمایشگاه بین المللی دوشنبه 29 دی خرید بلیت کنسرت گروه نوشه (ویژه بانوان) تهران، فرهنگسرای نیاوران - سالن خلیج فارس دوشنبه 29 دی بلیت ها به اتمام رسید کنسرت گروه ماکان تهران، سالن میلاد نمایشگاه بین المللی دوشنبه 29 دی خرید بلیت کنسرت سایر شهرها رشت کنسرت اشوان رشت، تالار مرکزی رشت - سالن وی آی پی موسیقی سه شنبه 16 دی بلیت ها به اتمام رسید اصفهان کنسرت رضا صادقی اصفهان، سالن سیتی سنتر (اصفهان) سه شنبه 16 دی خرید بلیت اردبیل کنسرت مجید عصری اردبیل، سالن آمفی تئاتر فدک - اردبیل چهارشنبه 17 دی خرید بلیت رشت کنسرت علی قمصری رشت، تالار مرکزی رشت - سالن وی آی پی موسیقی پنجشنبه 18 دی خرید بلیت کرج جنگ کودک خاله پروانه کرج، سالن اکومال - کرج جمعه 19 دی خرید بلیت رشت کنسرت علی شیرازی (گروه هگمتانه) رشت، تالار مرکزی رشت - سالن وی آی پی نمایش شنبه 20 دی بلیت ها به اتمام رسید بندرعباس کنسرت د دان (دانیال و پیمان) بندرعباس، تالار شهید آوینی - بندرعباس یکشنبه 21 تا 22 دی خرید بلیت رامسر کنسرت علی شیرازی (گروه هگمتانه) رامسر، هتل پارسیان - رامسر یکشنبه 21 دی بلیت ها به اتمام رسید کرج کنسرت مهدی جلیلی کرج، سالن اکومال - کرج دوشنبه 22 دی خرید بلیت اصفهان کنسرت آصف آریا اصفهان، سالن سیتی سنتر (اصفهان) پنجشنبه 25 دی خرید بلیت اردبیل کنسرت استاد وحید اسد اللهی اردبیل، سالن آمفی تئاتر فدک - اردبیل جمعه 26 دی خرید بلیت بندرعباس کنسرت رضا صادقی بندرعباس، تالار شهید آوینی - بندرعباس جمعه 26 تا 27 دی خرید بلیت سلماس کنسرت افشین آذری سلماس، سالن اداره ارشاد (سلماس) جمعه 26 دی خرید بلیت محمودآباد کنسرت مجید رضوی محمودآباد، سالن امیرمهر اکسین - محمود آباد جمعه 26 دی خرید بلیت جزیره کیش کیش کنسرت مسعود صادقلو کیش، کنسرت هال VIP مریم - کیش پنجشنبه 18 دی خرید بلیت کیش کنسرت کاکوبند کیش، آبنمای موزیکال آوای خلیج فارس جمعه 26 دی خرید بلیت کنسرت-نمایش ها نمایش ستاره سربی تهران، پردیس تئاتر موسیقی شهرزاد - سالن 1 شنبه 26 مهر و 15 آذر و 25 بهمن خرید بلیت نمایش رابین هود تهران، تالار وحدت 20 آبان تا 18 دی خرید بلیت نمایش در همسایگی تزارها تهران، ایرانشهر - سالن استاد ناظرزاده کرمانی 07 تا 30 دی خرید بلیت ساری نمایش بار هستی | ساری ساری، تالار مرکزی - ساری چهارشنبه 17 تا 19 دی خرید بلیت تبریز نمایش آن برد تبریز، مجتمع فرهنگی هنری 29 بهمن تبریز - سالن استاد مقبلی شنبه 20 تا 26 دی خرید بلیت نمایش شاه لیر تهران، اریکه ایرانیان جمعه 03 بهمن خرید بلیت جنگ ها کرج جنگ کودک خاله پروانه کرج، سالن اکومال - کرج جمعه 19 دی خرید بلیت برنامه ها تماس و پشتیبانی درباره ما آرشیو برنامه ها دسته بندی ها همه برنامه ها به زودی کنسرت های تهران کنسرت سایر شهرها کنسرت-نمایش ها راهنما پیگیری خرید ثبت مشکل یا طرح پرسش نشانی تهران، ولنجک، خیآبان سیزدهم، خیآبان ساسان، پلاک 33، طبقه 5، واحد 53 تلفن تماس 021 - 28424343 ما را در شبکه های اجتماعی دنبال کنید تمام شد