PageSourceSearch

https://www.ghitfund.org/assets/js/sw_over/common.js?v=1780538500

js ghitfund.org collected 2026-10-02 02:33:34 UTC 10,277 bytes, 295 lines download raw bytes

1$(function () {
2    var spflag;
3
4    // 端末判定( for tablet )
5    var ua = navigator.userAgent;
6    if (
7        (ua.indexOf("Android") > 0 && ua.indexOf("Mobile") == -1) ||
8        ua.indexOf("iPad") > 0 ||
9        ua.indexOf("Kindle") > 0 ||
10        ua.indexOf("Silk") > 0
11    ) {
12        $("body").removeClass("body-sp").addClass("body-pc");
13        $("meta[name='viewport']").attr("content", "width=1180");
14    }
15
16    $(document).ready(function () {
17        spflag = $(window).width() > 1200 ? false : true;
18    });
19
20    // 画面サイズで動的にclassを付与
21    var mq = window.matchMedia("(min-width: 1200px)");
22    if (mq.matches) {
23        $("body").removeClass("body-sp").addClass("body-pc");
24    } else {
25        $("body").removeClass("body-pc").addClass("body-sp");
26    }
27
28    var timer = false;
29    var prewidth = $(window).width();
30    $(window).resize(function () {
31        if (timer !== false) {
32            clearTimeout(timer);
33        }
34        timer = setTimeout(function () {
35            var nowWidth = $(window).width();
36            if (prewidth !== nowWidth) {
37                // location.reload();
38            }
39            prewidth = nowWidth;
40        }, 200);
41    });
42
43    /* sp panel */
44    $(".panel").on("click", function () {
45        $(".menu-trigger,header .nav-area").toggleClass("active");
46        $("nav,.sp-side-menu").slideToggle();
47        $(".body-sp .overlay").fadeToggle("slow");
48    });
49    $(".overlay").on("click", function () {
50        $(".body-sp .overlay,nav,.sp-side-menu").fadeToggle("slow");
51        $(".menu-trigger,header .nav-area").removeClass("active");
52    });
53
54    /* menu accordion */
55    // PC
56    var dropMenuNav = $("header nav > ul > li > a"); /*ナビ*/
57    dropMenuNav.each(function () {
58        var self = $(this);
59        /*    $(this).on('mouseover',function(){ マウスオーバー*/
60        $(this).on("mouseenter", function () {
61            /*マウスエンター*/ if ($(window).width() <= 1200) return;
62            /*	$('.drop-menu').fadeOut('slow'); 遅いフェードアウト*/
63            /*      $('.drop-menu').fadeOut('fast');早いフェードアウト*/
64            /*      $('.drop-menu').hide();非表示*/
65            $(".body-pc header nav > ul > li > a")
66                .not(self)
67                .next(".drop-menu")
68                .delay(250)
69                .fadeOut("fast"); /*自分以外をフェードアウト*/
70            /*	$('.body-pc header nav > ul > li > a').not(self).next('.drop-menu').hide();自分以外を非表示*/
71            $(this)
72                .next(".drop-menu")
73                .delay(50)
74                .fadeIn("fast"); /*早いフェードイン+ディレイ*/
75            /*      $(this).next('.drop-menu').slideDown('fast');早いスライドダウン*/
76            /*      $(this).next('.drop-menu').slideDown('slow');遅いスライドダウン*/
77            $(".body-pc header").addClass("drop-menu-active");
78        });
79
80        /*drop-menuからのマウスアウト、リーブ*/
81        /*    $('.drop-menu').on('mouseout',function(){マウスアウト*/
82        $(".drop-menu")
83            .delay(350)
84            .on("mouseleave", function () {
85                /*マウスリーブ*/ if ($(window).width() <= 1200) return;
86                /*      $(this).slideUp('slow');遅いスライドアップ*/
87                /*      $(this).slideUp('fast');早いスライドアップ*/
88                $(this).fadeOut("fast"); /*早いフェードアウト*/
89                /*      $('.drop-menu').hide();一気に消す*/
90                $(".body-pc header").removeClass("drop-menu-active");
91            });
92    });
93
94    // SP
95    dropMenuNav.on("click", function (e) {
96        if ($(window).width() > 1200) return;
97
98        $(this).next(".drop-menu").slideToggle();
99        $("i", this).toggleClass("icon-plus icon-minus");
100        /*    e.preventDefault();*/
101    });
102
103    $(".search-site").on("click", function () {
104        $(".header-search-site").fadeToggle("fast");
105    });
106
107    /* JS match height */
108    $(
109        '.page-council .gs-col-6,.member-list .gs-col-6,.top-news-area [class^="gs-col"],.body-pc .top-counter .title,.body-s
109p .top-counter .gs-col-3,.talker-profile .title,.staff-profile .gs-col-6 , .body-sp .global-health-03 .gs-col-4 .col , .body-sp .global-health-04 .affecting .gs-col-3'
110    ).matchHeight();
111
112    /* JS biggerlink */
113    $(
114        ".top-huge-navigation .gs-col-4,.top-about-ghit .title-block,.report-banner,.footer-guide .gs-col-4"
115    ).biggerlink();
116
117    /* JS inview */
118    $(".inview-fade-in-up").on(
119        "inview",
120        function (event, isInView, visiblePartX, visiblePartY) {
121            if (isInView) {
122                $(this).stop().addClass("fade-in-up");
123            } else {
124                $(this).stop().removeClass("fade-in-up");
125            }
126        }
127    );
128
129    /* language select button */
130    /*
131  $('.language-changer a').on('click',function(e){
132    var target = $(e.target);
133    if(target.hasClass('btn-fill--sub')){
134      target.attr('class','btn btn-s btn-fill--main').siblings().attr('class','btn btn-s btn-fill--sub');
135    }
136    e.preventDefault();
137  });
138*/
139
140    // category drop menu
141    $(".target-drop-menu").on("click", function () {
142        $(".category-list").show();
143        $("li span", this).on("click", function (e) {
144            var categoryName = $(e.target).text();
145            $(".category-list").fadeOut("fast");
146            console.log(categoryName);
147            $(".category-name").text(categoryName);
148        });
149    });
150
151    // FAQ accordion
152    $(".faq-list dt").on("click", function () {
153        $(this).next("dd").slideToggle();
154        $("i", this).toggleClass("icon-plus icon-minus");
155    });
156
157    // FAQ accordionAllOpen
158    $(".btn-allopen").on("click", function () {
159        // 表示されているdtのddだけを展開/閉じる
160        var $visibleDts = $(".faq-list dt:visible");
161        if ($visibleDts.length === 0) {
162            return; // 表示されているdtがない場合は何もしない
163        }
164        // 現在の展開状態を確認(表示されているddの数)
165        var visibleDdCount = 0;
166        $visibleDts.each(function() {
167            var $dd = $(this).next("dd");
168            if ($dd.length > 0 && $dd.is(":visible")) {
169                visibleDdCount++;
170            }
171        });
172        // 全て展開されている場合は閉じる、そうでなければ開く
173        var shouldExpand = visibleDdCount < $visibleDts.length;
174        $visibleDts.each(function() {
175            var $dt = $(this);
176            var $dd = $dt.next("dd");
177            var $icon = $dt.find("i");
178            if ($dd.length > 0) {
179                if (shouldExpand) {
180                    // 閉じているものだけ開く
181                    if (!$dd.is(":visible")) {
182                        $dd.slideDown();
183                        $icon.removeClass("icon-plus").addClass("icon-minus");
184                    }
185                } else {
186                    // 全て閉じる
187                    $dd.slideUp();
188                    $icon.removeClass("icon-minus").addClass("icon-plus");
189                }
190            }
191        });
192        // ボタンのアイコンを更新(ボタン自体にアイコンがある場合)
193        var $btnIcon = $("i", this);
194        if ($btnIcon.length > 0) {
195            if (shouldExpand) {
196                $btnIcon.removeClass("icon-plus").addClass("icon-minus");
197            } else {
198                $btnIcon.removeClass("icon-minus").addClass("icon-plus");
199            }
200        }
201    });
202
203    // WEBINAR accordion
204    $(".readcont-block dt").on("click", function () {
205        $(this).prev("dd").slideToggle();
206        $("span", this).toggleClass("btn-plus btn-minus");
207    });
208
209    // RFP accordion
210    $("#opportunities dt").on("click", function () {
211        $(this).next("dd").slideToggle();
212        $("i", this).toggleClass("icon-plus icon-minus");
213    });
214
215    // case .head-image-area exist
216    var ImageOnMenu = $("main").hasClass("head-image-area");
217    if (ImageOnMenu == true) {
218        $("body").addClass("nav-on-image");
219    }
220
221    // main -> bodyclass replace
222    var bodyClass = $("main").attr("class");
223    $("body").addClass(bodyClass);
224    $("main").removeClass();
225    /*  $('.nav-ghit .main-menu > li > a[href^="#"').on('click',function(e){
226    e.preventDefault();
227  });
228*/
229
230    // PC-SP image changer
231    var $elem = $(".switch");
232    var sp = "_sp.";
233    var pc = "_pc.";
234    var replaceWidth = 768;
235
236    function img_switch() {
237        var windowWidth = parseInt($(window).width());
238
239        $elem.each(function () {
240            var $this = $(this);
241            if (windowWidth >= replaceWidth) {
242                $this.attr("src", $this.attr("src").replace(sp, pc));
243            } else {
244                $this.attr("src", $this.attr("src").replace(pc, sp));
245            }
246        });
247    }
248    img_switch();
249
250    var resizeTimer;
251    $(window).on("load resize", function () {
252        if ($(window).width() > 1200) {
253            if (spflag) {
254                spflag = false;
255
256                dropMenuNav.each(function () {
257                    $(this).next(".drop-menu").removeAttr("style");
258                    $("i", this).removeClass();
259                    $("i", this).addClass("icon-plus");
260                });
261
262                $(".body-sp .overlay, nav, .sp-side-menu").removeAttr("style");
263                $(".menu-trigger, header .nav-area").removeClass("active");
264
265                $("body").removeClass("body-sp").addClass("body-pc");
266            }
267        } else {
268            if (!spflag) {
269                spflag = true;
270                $("body").removeClass("body-pc").addClass("body-sp");
271            }
272        }
273
274        clearTimeout(resizeTimer);
275        resizeTimer = setTimeout(function () {
276            img_switch();
277        }, 200);
278    });
279
280  //contact
281  $('input#consent').prop('checked', false);
282  $('input#consent').on('change', function (e) {
283    if ($(this).prop('checked')) {
284      $(".openblock").slideDown(600);
285    } else {
286      $(".openblock").slideUp(600);
287    }
288  });
289});
290
291$(window).scroll(function () {
292    if ($(this).scrollTop() > 1) {
293        $(".body-pc .drop-menu,.body-pc .header-search-site").fadeOut("slow");
294    }
295});

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.