「MediaWiki:Common.js」の版間の差分

編集の要約なし
test
70行目: 70行目:
/* beta2 ここまで */
/* beta2 ここまで */


/* GTags */
/* お知らせよう */
// Google Tag Manager の読み込み
$(function() {
const tagmng = document.createElement('script');
    var $notice = $('#wiki-origin-notice');
tagmng.async = true;
    if (!$notice.length) return;
tagmng.src = 'https://www.googletagmanager.com/gtag/js?id=G-SW7DS4R3FJ';
document.head.appendChild(tagmng);


    var contentId = $notice.data('content-id');
    var cookieName = 'originnotice-' + contentId;
    // Cookieがあるか確認
    if (document.cookie.indexOf(cookieName + '=true') > -1) {
        $notice.hide();
    }
    $('#close-notice-btn').on('click', function() {
        $notice.fadeOut();
        var date = new Date();
        date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toUTCString();
        document.cookie = cookieName + "=true" + expires + "; path=/";
    });
});


console.log("OK Common.js")
console.log("OK Common.js")