PageSourceSearch

https://booklog.jp/js/main/premium_dialog.js?1789445319

js booklog.jp collected 2026-09-24 08:38:36 UTC 1,990 bytes, 75 lines download raw bytes

1/**
2 * プレミアムダイアログの汎用機能
3 * どのページからでも呼び出せるようにする
4 */
5(function() {
6  'use strict';
7
8  var PremiumDialog = {
9    /**
10     * ダイアログを表示する
11     */
12    show: function() {
13      var $dialog = $('#premium-dialog');
14      if (!$dialog.length) {
15        return;
16      }
17
18      // bodyに移動(まだ移動していない場合)
19      var parent = $dialog.parent()[0];
20      if (parent !== document.body) {
21        $dialog.appendTo('body');
22      }
23
24      // display: flex を明示的に設定してからフェードイン
25      $dialog.css({
26        'display': 'flex',
27        'opacity': 0,
28        'visibility': 'visible'
29      });
30      
31      // 次のフレームでアニメーション開始(display: flexが確実に適用されるように)
32      setTimeout(function() {
33        $dialog.animate({opacity: 1}, 300);
34      }, 10);
35    },
36
37    /**
38     * ダイアログを非表示にする
39     */
40    hide: function() {
41      $('#premium-dialog').fadeOut();
42    },
43
44    /**
45     * 初期化処理
46     * イベントハンドラを設定する
47     */
48    init: function() {
49      // ダイアログをbodyの直接の子要素として移動(スタッキングコンテキストの影響を避けるため)
50      var $dialog = $('#premium-dialog');
51      if ($dialog.length && $dialog.parent()[0] !== document.body) {
52        $dialog.appendTo('body');
53      }
54
55      // 閉じるボタンと背景クリックでダイアログを閉じる
56      $(document).on('click', '.premium-dialog-close, .premium-dialog-background', function(evt) {
57        evt.preventDefault();
58        PremiumDialog.hide();
59      });
60    }
61  };
62
63  // グローバルに公開
64  if (typeof window.Booklog === 'undefined') {
65    window.Booklog = {};
66  }
67  window.Booklog.PremiumDialog = PremiumDialog;
68
69  // DOM読み込み後に初期化
70  jQuery(document).ready(function($) {
71    PremiumDialog.init();
72  });
73
74})();
75

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.