var app = angular.module("LyncPix.ShoppingCartModule", [ 'ngAnimate', 'ngAria', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngAria', 'ui.bootstrap', 'ui.router', 'ui.select', 'toastr', 'monospaced.elastic', 'flow', 'anim-in-out', 'uiRouterStyles', '19degrees.ngSweetAlert2' ]); app.config(['$logProvider', '$locationProvider', 'toastrConfig', 'flowFactoryProvider', 'Config', '$stateProvider', '$urlRouterProvider', function ($logProvider, $locationProvider, toastrConfig, flowFactoryProvider, Config, $stateProvider, $urlRouterProvider) { // Enable log $logProvider.debugEnabled(true); // $locationProvider.hashPrefix(''); // $locationProvider.html5Mode({ // enabled: true, // requireBase: true // }); var sapak = '71047864-3FBD-40E0-A512-BA539E2C86BA' || 'F8619244-5275-4BF9-BFDC-7867E78F5FE3'; // Set options third-party lib toastrConfig.allowHtml = true; toastrConfig.timeOut = 3000; toastrConfig.positionClass = 'toast-top-right'; toastrConfig.preventDuplicates = false; toastrConfig.progressBar = true; toastrConfig.closeButton = true; flowFactoryProvider.defaults = { target: Config.UPLOAD_URL, permanentErrors: [404, 500, 501], chunkSize: 80 * 1024 * 1024, queueSize: 2, region: 'eu-west-1', bucket: 'lyncpixgraphics5', folder: 'guest/' + Config.randomStr(12), acl: 'public-read', poolId: 'eu-west-1:39a33a1d-2435-4d01-9128-45aa23d71c10', provider: 'aws' }; $stateProvider .state('app', { abstract: true, url: '?frame', views: { root: { templateUrl: 'main.php' + '?sapak=' + sapak, controller: 'MainController', controllerAs: 'vm' } }, data: { css: 'direction.css.php?sapak=' + sapak }, params: { sapakguid: sapak } }) .state('quick', { abstract: true, url: '?frame', views: { root: { templateUrl: 'main-quick-checkout.php' + '?sapak=' + sapak, controller: 'MainController', controllerAs: 'vm' } }, data: { css: 'direction.css.php?sapak=' + sapak }, params: { sapakguid: sapak, hideHeaderLinks: 1 } }) .state('quick.quickcart', { url: '/quickcart/:clientguid', views: { 'content@quick': { templateUrl: 'quickcart.php' + '?sapak=' + sapak, controller: 'QuickcartController', controllerAs: 'vm' } } }) .state('quick.quickpayment', { url: '/quickpayment/:clientguid', views: { 'content@quick': { templateUrl: 'quickpayment.php' + '?sapak=' + sapak, controller: 'QuickpaymentController', controllerAs: 'vm' } } }) .state('quick.thankyou', { url: '/thankyou/:clientguid', views: { 'content@quick': { templateUrl: 'thankyou.php' + '?sapak=' + sapak, controller: 'QuickpaymentController', controllerAs: 'vm' } } }) .state('app.home', { url: '/home', views: { 'content@app': { templateUrl: 'home.php' + '?sapak=' + sapak, controller: 'ProductCategoriesController', controllerAs: 'vm' } } }) .state('app.account', { url: '/account', views: { 'content@app': { templateUrl: 'account.php' + '?sapak=' + sapak, controller: 'AccountController', controllerAs: 'vm' } } }) .state('app.login', { url: '/login', views: { 'content@app': { templateUrl: 'login.php' + '?sapak=' + sapak, controller: 'LoginController', controllerAs: 'vm' } } }) .state('app.forcelogin', { url: '/forcelogin/:uguid', views: { 'content@app': { templateUrl: 'forcelogin.php' + '?sapak=' + sapak, controller: 'ForceloginController', controllerAs: 'vm' } } }) .state('app.order-history', { url: '/order-history', views: { 'content@app': { templateUrl: 'order_history.php' + '?sapak=' + sapak, controller: 'OrderHistoryController', controllerAs: 'vm' } } }) .state('app.cart', { url: '/cart', views: { 'content@app': { templateUrl: 'cart.php' + '?sapak=' + sapak, controller: 'CartController', controllerAs: 'vm' } } }) .state('app.category', { url: '/category/:categoryID?', views: { 'content@app': { templateUrl: 'mid.php' + '?sapak=' + sapak, controller: 'ProductsController', controllerAs: 'vm' } } }) .state('app.product', { parent: 'app.category', url: '/product/{productID:int}', views: { 'content@app': { templateUrl: 'product.php' + '?sapak=' + sapak+'&k=1', controller: 'ProductPropertiesController', controllerAs: 'vm' } } }) .state('app.product.edit', { parent: 'app.product', url: '/edit/{cartID:int}', views: { 'content@app': { templateUrl: 'product.php' + '?sapak=' + sapak+'&k=1', controller: 'ProductPropertiesController', controllerAs: 'vm' } } }) .state('app.layout', { parent: 'app.product', abstract: true, url: '/layout/{cartID:int}', views: { 'content@app': { templateUrl: 'layout.php' + '?sapak=' + sapak, controller: 'LayoutController', controllerAs: 'vm' } } }) .state('app.layout.options', { url: '/options', views: { 'layout@app.layout': { templateUrl: 'layout-options.php' + '?sapak=' + sapak, //controller: 'ProductPropertiesController', //controllerAs: 'vm' } } }) .state('app.layout.payment', { url: '/payment', views: { 'layout@app.layout': { templateUrl: 'payment.php' + '?sapak=' + sapak, controller: 'PaymentController', controllerAs: 'vm' } } }) .state('app.generate', { url: '/generate/:hashKey', views: { 'content@app': { templateUrl: 'generate.php' + '?sapak=' + sapak, controller: 'MainController', controllerAs: 'vm' } } }) .state('app.404', { url: '/404', views: { 'content@app': { templateUrl: '404.php' + '?sapak=' + sapak, //controller: 'ProductCategoriesController', //controllerAs: 'vm' } } }); $urlRouterProvider.otherwise(function () { return "/home"; }); }]); app.run(['$q', '$http', '$rootScope', '$location', '$window', '$timeout', function ($q, $http, $rootScope, $location, $window, $timeout) { $rootScope.$on("$locationChangeStart", function (event, next, current) { $rootScope.error = null; /*console.log($location.path());*/ $.getScript("js/jquery.bxslider.js"); var path = $location.path(); if (path == "/product") { $('footer').css('display', 'none'); } else { $('footer').css('display', 'block'); } setTimeout(function () { /* Min Height */ $('.bg').css('min-height', $(window).height()); /* scroll function */ //$('.content .left_cont').height($(window).height()); $(".left_cont").mCustomScrollbar({}); $('.pro_left .left_cont').mCustomScrollbar('destroy'); $('.pro_left .detail').mCustomScrollbar({}); /* Checkbox/Radio */ $('.login input[type="checkbox"]').change(function () { if (this.checked) { $(this).parent().addClass('active') } else { $(this).parent().removeClass('active') } }); $('#add input[type="radio"]').change(function () { if (this.checked) { $('#add input[type="radio"]').parent().removeClass('active') $(this).parent().addClass('active') } }); $('#delivery input[type="radio"]').change(function () { if (this.checked) { $('#delivery input[type="radio"]').parent().removeClass('active') $(this).parent().addClass('active') } }); $('#p_detail input[type="radio"]').change(function () { if (this.checked) { $('#p_detail input[type="radio"]').parent().removeClass('active') $(this).parent().addClass('active') } }); /* Product Page */ if ($(window).width() > 959) { $('.ord_list:even ,.wish_list:even').addClass('even'); // $('.product .right_side').height($(window).height()-85) var winheight = $(window).height() - 83; $.lockfixed(".content.scroll_pro .left_cont", {offset: {top: -85, bottom: 0}}); $.lockfixed(".content .left_cont", {offset: {top: -85, bottom: 260}}); $('.album_list .col').removeClass('last'); $('.album_list .col:nth-child(3n)').addClass('last'); $('.ord_history ul').each(function () { var max = -1; var h; $(this).children("li").each(function () { h = $(this).outerHeight(); if (h > max) { max = h; } }); $(this).children("li").height(max) }); } else { $('.album_list .col:nth-child(2n)').addClass('last'); $('.ord_head').each(function () { $(this).children('li:even').addClass('even') }) $('.wish_list').each(function () { $(this).children('li:even').addClass('even') }) $('.ord_list').each(function () { $(this).children('li:even').addClass('even') }) try{ //window.slider.destroySlider(); //window.slider = $('.bxslider').bxSlider(); } catch(error) {} } $(window).resize(function () { if ($(window).width() > 959) { $('.album_list .col').removeClass('last'); $('.album_list .col:nth-child(3n)').addClass('last'); $('.ord_list:even ,.wish_list:even').addClass('even'); // $('.product .right_side').height($(window).height()-85) var winheight = $(window).height() - 83; $('.content .bxslider .item .inner_item').height(winheight) if ($('.pro_left').children().hasClass('lf-ghost')) { return false; } else { $.lockfixed(".content .left_cont", {offset: {top: -85, bottom: 260}}); $.lockfixed(".content.test .left_cont", {offset: {top: -85, bottom: 0}}); } $('.ord_history ul').each(function () { var max = -1; var h; $(this).children("li").each(function () { h = $(this).outerHeight(); if (h > max) { max = h; } }); $(this).children("li").height(max) }); if ($(window).width() > 959 && $(window).width() < 1025) { $('.album_list .col').removeClass('last'); $('. .col:nth-child(3n)').addClass('last'); } } else { $('.content .bxslider .item .inner_item').height('auto') $('.album_list .col').removeClass('last'); $('.album_list .col:nth-child(2n)').addClass('last'); //$('.product .right_side').height('auto') $('.ord_history ul li').height('auto') //window.slider.destroySlider(); //window.slider = $('.bxslider').bxSlider(); } }) if ($(window).width() > 1024) { var winheight = $(window).height() - 83; $('.content .bxslider .item .inner_item').height(winheight) /* Slider */ window.sliderSettings = { mode: 'vertical', slideMargin: 5, controls: true, displaySlideQty: 3, moveSlideQty: 1, pager: false, touchEnabled: false, infiniteLoop: false, onSliderLoad: function () { $(document).on('click', '.content .left_cont.show .detail .pro_detail .detail_list', function () { $('.bxslider').addClass('noslide'); i = $(this).index(); /*console.log(i) console.log(slider)*/ window.slider.goToSlide(i); setTimeout(function () { $('.bxslider').removeClass('noslide'); }, 100) }) }, }; window.slider = $('.bxslider').bxSlider(window.sliderSettings).on("mousewheel", function (event, delta, deltaX, deltaY) { //console.log(event, delta, deltaX, deltaY); if (delta > 0) { /*if(delta>-150) $('.content .left_cont .detail .pro_detail .detail_list.active').removeClass('active').prev().addClass('active');*/ window.slider.goToPrevSlide() var current = window.slider.getCurrentSlide(); $('.content .left_cont .detail .pro_detail .detail_list').removeClass('active'); $('.content .left_cont .detail .pro_detail .detail_list').eq(current).addClass('active'); $rootScope.$emit('bxSliderPageChanged', 'prev'); } if (deltaY < 0) { window.slider.goToNextSlide() var current = window.slider.getCurrentSlide(); $('.content .left_cont .detail .pro_detail .detail_list').removeClass('active'); $('.content .left_cont .detail .pro_detail .detail_list').eq(current).addClass('active'); $rootScope.$emit('bxSliderPageChanged', 'next'); } event.stopPropagation(); event.preventDefault(); }); } else { window.sliderSettings = { slideMargin: 1, controls: true, displaySlideQty: 1, moveSlideQty: 1, pager: false, touchEnabled: false, infiniteLoop: false , minSlides: 1, maxSlides: 1, moveSlides: 1, mode: 'vertical', startSlide: 0, captions: false }; window.slider = $('.bxslider').bxSlider(window.sliderSettings); } $(document).on('click', '.product .inner_item label', function () { $(this).children('input[type="radio"]').prop('checked', true); setTimeout(function() { console.log("aaaaaaa"); window.slider.goToNextSlide(); var current = window.slider.getCurrentSlide(); $('.content .left_cont .detail .pro_detail .detail_list').removeClass('active'); $('.content .left_cont .detail .pro_detail .detail_list').eq(current).addClass('active'); $rootScope.$emit('bxSliderPageChanged', 'next'); } , 50 ); }) $(document).on('click', '.slide_check label', function () { if ($(this).children('input[type="checkbox"]').prop('checked') == true) { $(this).children('input[type="checkbox"]').prop('checked', false); $(this).removeClass('active') } else { $(this).children('input[type="checkbox"]').prop('checked', true); $(this).addClass('active') } }) /* Shadow-box */ Shadowbox.init({ language: 'en', players: ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv'] }); /* Mobslider */ function owl() { if ($(window).width() <= 767) { // $('.bottom_section .about_slider .wrapper').addClass('owl-carousel'); /* about Slider */ var _height_ = $('.populer .list_cont .right_txt').height(); if ($("#owl-demo").hasClass("owl-carousel")) { return false; } else { $("#owl-demo").owlCarousel({ singleItem: true, loop: false, margin: 0, items: 1, nav: false, dots: true }); } } else { if ($("#owl-demo").children().hasClass('owl-stage-outer')) { $("#owl-demo").trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded'); $("#owl-demo").find('.owl-stage-outer').children().unwrap(); } else { return false; } } } $(window).resize(owl); $(window).ready(owl); if ($(window).width() > 767) { /*$.lockfixed(".content.payment .left_cont",{offset: {top:-85, bottom: 260}});*/ } else { owl(); } }, 1400) }); $rootScope.$on('$stateChangeSuccess', function() { document.body.scrollTop = document.documentElement.scrollTop = 0; }); } ]); /* Jquery */ $(window).load(function () { setTimeout(function () { $('.loading-contner').fadeOut(); }, 1000) }) $(document).ready(function () { /*$(document).on('click','.a_ratio .col_6',function(e){ $('.a_ratio .col_6').removeClass('active') $(this).addClass('active') })*/ $(document).on('click', '.a_format .col_3', function (e) { $('.a_format .col_3').removeClass('active') $(this).addClass('active') }) $(document).on('click', '.a_material .col_3', function () { $('.a_material .col_3').removeClass('active') $(this).addClass('active') }) $(document).on('click', '.file', function () { $('#file').trigger('click'); }) $(document).on('click', '.a_cover .col_6', function () { $('.a_cover .col_6').removeClass('active') $(this).addClass('active') }) $(document).on('click', '.f_albums', function () { $('.filter_data').addClass('active'); $('.overlay').addClass('active') }) $(document).on('click', '.close', function () { $('.filter_data').removeClass('active'); $('.overlay').removeClass('active'); }) $(document).on('click', '.overlay', function () { $('.filter_data').removeClass('active'); $('.overlay').removeClass('active'); }) $(document).on('click', '.list_2', function () { $('.list_3').removeClass('active') $(this).addClass('active') $('.album_list').addClass('ab_l_2'); $('.album_list .col').removeClass('last') $('.album_list .col:nth-child(2n)').addClass('last') }) $(document).on('click', '.list_3', function () { $('.list_2').removeClass('active') $(this).addClass('active') $('.album_list').removeClass('ab_l_2'); $('.album_list .col').removeClass('last') $('.album_list .col:nth-child(3n)').addClass('last') }) /*$(document).on('click','.color p',function(){ $(this).parent().children('p').removeClass('active'); $(this).addClass('active'); var i = $(this).index(); $(this).parents('.col').children('.img_list').children('img').removeClass('active') $(this).parents('.col').children('.img_list').children('img').eq(i).addClass('active') })*/ /*$(document).on('click','.cover_color a',function(){ $('.cover_color a').removeClass('active') $(this).addClass('active') })*/ /* Slide ON/OFF */ $(document).on('click', '.slid_btn', function () { $(this).removeClass('active'); setTimeout(function () { $('.product .side_btn').fadeIn() }, 500) $('.product').removeClass('active'); $('.left_cont').removeClass('show'); }); $(document).on('click', '.side_btn', function () { $('.slid_btn').addClass('active'); setTimeout(function () { $('.product .side_btn').fadeOut() }, 500) $('.product').addClass('active'); $('.left_cont').addClass('show'); }); var stateIs = 1; /* Mob Menu */ $(document).on('click', '.mob_btn', function () { $(this).toggleClass('active'); $('.mob_menu').slideToggle(); stateIs = 2; }); $(document).on('click', '.mob_menu', function(){ if(stateIs==2){ $('.mob_btn').removeClass('active'); $('.mob_menu').css('display','none'); stateIs= 1; } }); $(window).scroll(function () { var wintop = $(window).scrollTop(); if (wintop > 50) { $('header').addClass('sticky') } else { $('header').removeClass('sticky') } }); $(document).on('click', '.pro_detail_list a', function () { $(this).parent().next().slideToggle(); }) $(document).on('click', '.content .left_cont.show .detail .pro_detail .detail_list', function () { $('.content .left_cont .detail .pro_detail .detail_list').removeClass('active') $(this).addClass('active') }) }) function generateDeviceDetectionString () { var screenWidth = parseInt(screen.width)/100; var screenHeight = parseInt(screen.height)/7; var screenAvailableWidth = parseInt(screen.availWidth)/5; var screenAvailableHeight = parseInt(screen.availHeight)/5; var pixRatio = 1; if('deviceXDPI' in screen) { pixRatio = screen.deviceXDPI / screen.logicalXDPI; } else if (window.hasOwnProperty('devicePixelRatio')) { pixRatio = window.devicePixelRatio; } if(isNaN(pixRatio)) { pixRatio = 1; } pixRatio = pixRatio *3; var deviceDetectionString = "v1s"+ screenWidth +"o"+ screenHeight + "o" + screenAvailableWidth +"o"+ screenAvailableHeight +"o"+ pixRatio +"d"; //Is it a touch var touchType = 0; //Is it a mobile var mobileType = 0; //What is the device var deviceType = 0; if ("ontouchstart" in window || navigator.msMaxTouchPoints) { touchType = 1; } if(navigator.userAgent.match(/Mobile| mobile/i)) { mobileType = 1; } //Apple if(navigator.userAgent.match(/Intel Mac/i)) { // iPadOS reports it's an Intel Mac so test for touch support. mobileType = touchType; deviceType = 1; } if(navigator.userAgent.match(/iPad/i)) { mobileType = 1; deviceType = 2; } if(navigator.userAgent.match(/iPhone/i)) { mobileType = 1; deviceType = 3; } if(navigator.userAgent.match(/iPod/i)) { mobileType = 1; deviceType = 4; } //Android if(navigator.userAgent.match(/Android/i) && navigator.userAgent.match(/Mobile| mobile/i)) { mobileType = 1; deviceType = 5; } if(navigator.userAgent.match(/Android/i) && !navigator.userAgent.match(/Mobile| mobile/i)) { mobileType = 0; deviceType = 6; } //Windows if(navigator.userAgent.match(/(Windows)/i)) { mobileType = 0; deviceType = 7; } if(navigator.userAgent.match(/(Windows Phone OS|Windows CE|Windows Mobile|IEMobile)/i)) { mobileType = 1; deviceType = 8; } //Blackberry if(navigator.userAgent.match(/BlackBerry/i)) { mobileType = 1; deviceType = 9; } //Palm if(navigator.userAgent.match(/(palm)/i)) { mobileType = 1; deviceType = 10; } //Linux if(navigator.userAgent.match(/(Linux|X11)/i)) { mobileType = 1; deviceType = 11; } //WebOS if(navigator.userAgent.match(/webOS/i)) { mobileType = 1; deviceType = 12; } //Opera Mini if(navigator.userAgent.match(/Opera Mini/i)) { mobileType = 1; deviceType = 13; } let sumCheck = screenWidth + screenHeight + screenAvailableWidth + screenAvailableHeight + pixRatio + touchType + mobileType + deviceType; deviceDetectionString = deviceDetectionString + touchType + "o" + mobileType+ "o" + deviceType + "o" + sumCheck; return deviceDetectionString; }