123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- var ac_filename = window.location.pathname;
- ac_filename = ac_filename.split('/').pop();
- ac_filename = ac_filename && ac_filename!='index' ? '_'+ac_filename : '';
- var ac_val = parseInt($.fn.cookie('ac_val')) || 0;
- var camp_ac_val = parseInt($.fn.cookie('camp_ac_val')) || 0;
- var sub_pop_num = parseInt($.fn.cookie('sub_pop_num')) || 0;
- $(function () {
- //返回
- $('.head_return_page_but').click(function () {
- window.history.go(-1);
- });
- //菜单
- $('.pop_up_menu_box > i, .head_menu_but').click(function () {
- $('.head_menu_but').toggleClass('head_menu_but_open');
- $('.pop_up_menu_box').toggleClass('pop_up_menu_show');
- });
- //关闭弹框
- $('.christmas_body .christmas_close_2,.christmas_body .christmas_main_but').click(function(){
- ac_val += 1;
- $('.christmas_popup_box').remove();
- $.fn.cookie('ac_val',ac_val,{expires: 0.33, path: '/'});
- });
- $(".camp_close_btn").click(function () {
- camp_ac_val += 1;
- $('.camp_popup_box').show();
- $.fn.cookie('camp_ac_val',camp_ac_val,{expires: 0.33, path: '/'});
- });
- //活动弹框次数
- var ac_type = $('.christmas_popup_box').data('type');
- if(ac_val >= 4 || ac_type != 1){
- $('.christmas_popup_box').remove();
- }else{
- ac_val += 1;
- $('.christmas_popup_box').show();
- $.fn.cookie('ac_val',ac_val,{expires: 0.33, path: '/'});
- }
- $(".read_popup_box a").click(function () {
- cpslog([702, {map:{pop_url:$('.read_popup_box .rpb_img a').attr('href')}}, 'read_click'])
- //写cookie 有效期1小时
- $.fn.cookie('close_continue_tips',1,{expires: 0.33, path: '/'});
- $('.read_popup_box').remove();
- if (!$(this).hasClass("rpbm_close_but")) {
- window.location.href=$(this).attr('href');
- }
- });
- $(".custom_popup_box a").click(function () {
- cpslog([702, {map:{pop_url:$('.custom_popup_box .rpb_img a').attr('href')}}, 'custom_click'])
- //写cookie 有效Ø期2.5天
- var sourceId = $(".custom_popup_box").data('resouce_id');
- $.fn.cookie('close_custom_tips_'+sourceId,1,{expires: 2.5, path: '/'});
- //关闭
- $('.custom_popup_box').remove();
- if (!$(this).hasClass("rpbm_close_but")) {
- window.location.href=$(this).attr('href');
- }
- });
- if ($('.custom_popup_box').length) {
- cpslog([701, {map:{pop_url:$('.custom_popup_box .rpb_img a').attr('href')}}])
- }
- if ($('.read_popup_box').length) {
- cpslog([701, {map:{pop_url:$('.read_popup_box .rpb_img a').attr('href')}}])
- }
- //消耗活动
- if ($('.camp_popup_box').length) {
- var camp_ac_type = $('.camp_popup_box').data('type');
- if(camp_ac_val >= 4 || camp_ac_type != 1){
- $('.camp_popup_box').remove();
- }else{
- camp_ac_val += 1;
- $('.camp_popup_box').show();
- $.fn.cookie('camp_ac_val',camp_ac_val,{expires: 0.33, path: '/'});
- }
- $(".camp_popup_box a").click(function () {
- camp_ac_val += 1;
- cpslog([702, {map:{pop_url:$('.camp_popup_box .christmas_main_but').attr('href')}}, 'camp_click'])
- //写cookie 有效Ø期0.33天
- $.fn.cookie('camp_ac_val',camp_ac_val,{expires: 0.33, path: '/'});
- //关闭
- $('.camp_popup_box').remove();
- if (!$(this).hasClass("christmas_close_2")) {
- window.location.href=$(this).attr('href');
- }
- });
- cpslog([701, {map:{pop_url:$('.camp_popup_box .christmas_main_but').attr('href')}}]);
- }
- //消耗活动首页banner
- if( $('#banner_campaign').length){
- $('#banner_campaign').click(function(){
- cpslog([702, {map:{banner_url:$('#banner_campaign a').attr('href')}}, 'banner_camp_click']);
- })
- cpslog([701, {map:{banner_url:$('#banner_campaign a').attr('href')}}]);
- }
- //卡片活动banner
- if( $('#card_banner').length){
- console.log(111);
- $('#card_banner').click(function(){
- cpslog([702, {map:{banner_url:$('#card_banner a').attr('href')}}, 'banner_card_flip_click']);
- })
- cpslog([701, {map:{banner_url:$('#card_banner a').attr('href')}}]);
- }
- //读书订阅活动
- if ($('.sub_pop').length){
- $('.sub_close_btn').click(function () {
- sub_pop_num++;
- $('.sub_pop').hide();
- $.fn.cookie('sub_pop_num',sub_pop_num,{expires: 0.33, path: '/'});
- })
- cpslog([701, {map:{pop_url:$('.sub_pop .christmas_main_but').attr('href')}}]);
- }
- });
- var commont = {
- /**
- * 切割参数
- * @param sname string 要获取的参数
- * @param str string 被切割的字符
- * @param smark string 用于切割字符
- * @returns {string}
- */
- getQueryString: function (sname, str, smark) {
- str = str ? str : window.location.search;
- smark = smark ? smark : '&';
- if (sname) {
- var c_start = str.indexOf(sname + "=");
- if (c_start != -1) {
- c_start = c_start + sname.length + 1;
- var c_end = str.indexOf(smark, c_start);
- if (c_end == -1) c_end = str.length;
- return decodeURIComponent(str.substring(c_start, c_end));
- }
- }
- return "";
- }
- };
|