PageSourceSearch

https://asajikan.jp/wp-content/themes/asajikan/js/app-guidance.js?ver=20260925204845

js asajikan.jp collected 2026-09-25 20:48:55 UTC 5,172 bytes, 122 lines download raw bytes

1/**
2 * アプリ誘導関連
3 */
4
5$( function() {
6	var ua = navigator.userAgent;
7	var app_link_ios = 'https://apps.apple.com/jp/app/%E6%9C%9D%E6%99%82%E9%96%93-jp-%E6%9C%9D%E3%81%94%E3%81%AF%E3%82%93%E3%83%AC%E3%82%B7%E3%83%94%E3%82%84%E6%9C%9D%E3%81%AE%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%B9%E3%82%92%E6%AF%8E%E6%97%A5%E3%81%8A%E5%B1%8A%E3%81%91/id400435286';
8	var app_link_android = 'https://play.google.com/store/apps/details?id=jp.asajikan&hl=ja';
9    var is_sp = false;
10    var is_ios = false;
11    var is_android = false;
12
13    // iOS
14    if ( ua.indexOf('iPhone') > 0 || ua.indexOf('iPad')  > 0 || ua.indexOf('iPod') > 0) {
15        $( '#ualink' ).attr( 'href', app_link_ios );
16        $( '#link_app' ).attr( 'href', app_link_ios );
17        $( '#header_link_app' ).attr( 'href', app_link_ios );
18        is_sp = true;
19        is_ios = true;
20
21        //iosの時にアプリ誘導バナーを表示する
22        $( '.bnrAppGuidance' ).find('img').css('visibility', 'visible'); //対象ファイル:top_loop.php
23        $( '.apri_a_box' ).css('visibility', 'visible'); //対象ファイル:front-page.php
24        $( '.apri_b_sp' ).css('visibility', 'visible');//対象ファイル:sidebar.php
25        $( '.appGuidanceArea' ).css('visibility', 'visible');//対象ファイル:content-single.php
26        $( '.appdl1' ).css('display', 'block');//対象ファイル:footer.php
27    // Android
28    } else if ( ua.indexOf('Android') > 0 ) {
29        $( '#ualink' ).attr( 'href', app_link_android );
30        $( '#link_app' ).attr( 'href', app_link_android );
31        $( '#header_link_app' ).attr( 'href', app_link_android );
32        is_sp = true;
33        is_android = true;
34
35        // androidの時にアプリ誘導バナーを非表示にする
36        $( '.bnrAppGuidance' ).addClass( 'is-hidden' ); //対象ファイル:top_loop.php
37        $( '.apri_a' ).addClass( 'is-hidden' ); //対象ファイル:front-page.php
38        $( '.apri_b_sp' ).addClass( 'is-hidden' ); //対象ファイル:sidebar.php
39        $( '.appGuidanceArea' ).addClass( 'is-hidden' ); //対象ファイル:content-single.php
40        // $( '.appdl1' ).addClass( 'is-hidden' ); //対象ファイル:footer.php
41        // ナビゲーションの位置を調整
42        $( '.main-navigation2' ).removeAttr( 'id' );
43    // etc
44    } else {
45        is_sp = false;
46        is_ios = false;
47        is_android = false;
48    }
49
50    // // ページ読み込みのタイミングでheader上部のバナー表示・非表示確認
51    // $( document ).ready( function(){
52    //     if ( document.cookie.indexOf( 'header-guidance-close' ) !== -1 ) {
53    //         $( '.header-app-guidance' ).css( 'display', 'none' );
54    //         if ( is_sp ) {
55    //             $( '.main-navigation2' ).removeAttr( 'id' );
56    //         }
57    //     }
58    // });
59
60    // // header上部バナー非表示制御
61    // $( '.header-guidance-close' ).on( 'click', function(){
62    //     // 有効期限を30日
63    //     document.cookie = 'header-guidance-close=true; max-age=2592000000';
64
65    //     // 非表示
66    //     $( '.header-app-guidance' ).css( 'display', 'none' );
67
68    //     // css調整
69    //     if ( is_sp ) {
70    //         $( '.main-navigation2' ).removeAttr( 'id' );
71    //     }
72    // });
73
74    // analytics click event:アプリ告知誘導系
75    $( 'a.ga-click' ).on( 'click', function(){
76        var ga_category = $( this ).data( 'ga_category' );
77        var ga_label = $( this ).data( 'ga_label' );
78        var ga_after_text_check = "";
79        if ( $( this ).data( 'after_text_check' ) !== undefined ) {
80            ga_after_text_check = $( this ).data( 'after_text_check' );
81        }
82
83        // console.log( 'ga_category:' + ga_category );
84        // console.log( 'ga_label:' + ga_label );
85        // console.log( 'ga_after_text_check:' + ga_after_text_check );
86
87        // console.log( 'is_sp:' + is_sp );
88        // console.log( 'is_ios:' + is_ios );
89        // console.log( 'is_android:' + is_android );
90
91        // 【ga_category】と【ga_label】が取得できていることが前提
92        if ( ga_category && ga_label ) {
93            // 一部カテゴリはiOSとAndroidを判定
94            if ( 
95                ga_category == "header" 
96                || ga_category == "header_single" 
97                || ga_after_text_check == "1" 
98               ) {
99                if ( is_ios ) {
100                    ga_label = ga_label + "ios";
101                } else if ( is_android ) {
102                    ga_label = ga_label + "android";
103                } else {
104                    // 取得できない場合は処理中止
105                    return;
106                }
107            } else if ( ga_category == "about" ) {
108                if ( is_ios || is_android ) {
109                    ga_label = "sp" + ga_label;
110                } else {
111                    ga_label = "pc" + ga_label;
112                }
113            }
114
115            // console.log( 'immediately before ga_category: ' + ga_category );
116            // console.log( 'immediately before ga_label: ' + ga_label );
117
118            ga('send', 'event', ga_category, 'click', ga_label);
119        }
120    });
121
122});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.