PageSourceSearch

https://www.cocotoon.co.kr/js/web/webtoon/main.js?v=1790899915

js cocotoon.co.kr collected 2026-10-02 00:12:02 UTC 5,766 bytes, 194 lines download raw bytes

1$( document ).ready(function () {
2    const main_swiper = new Swiper('.mainSwiper', {
3        slidesPerView: 3,
4        spaceBetween: 31,
5        loop: true,
6        autoplay: true,
7        navigation: {
8            nextEl: ".swiper-button-next",
9            prevEl: ".swiper-button-prev",
10        },
11        breakpoints: {
12            // 모바일 세로모드
13            320: {
14                slidesPerView: "auto",
15                spaceBetween: 12,
16            },
17            // 테블릿 세로모드
18            490: {
19                slidesPerView: 3
20            },
21            // 테블릿 가로모드
22            1024: {
23                slidesPerView: 3
24            }
25        }
26    });
27
28    const lank_swiper = new Swiper('.rankSwiper', {
29        slidesPerView: 3,
30        spaceBetween: 16,
31        loop: true,
32        //autoplay: true,
33        navigation: {
34            nextEl: ".swiper-button-next",
35            prevEl: ".swiper-button-prev",
36        },
37        breakpoints: {
38            // 모바일 세로모드
39            320: {
40                slidesPerView: "auto",
41                spaceBetween: 12,
42            },
43            // 테블릿 세로모드
44            490: {
45                slidesPerView: 2
46            },
47            // 테블릿 가로모드
48            1024: {
49                slidesPerView: 3
50            }
51        }
52    });
53
54    $(".subMenu li").click(function(){
55        $(".subMenu li").removeClass("active");
56        $(this).addClass("active");
57        var clickedText = $(this).text();
58        if(clickedText == "인기순"){
59            displayWeekList(weekListByPop);        
60        }else if(clickedText == "업데이트순"){
61            displayWeekList(weekListByUpdate);
62        }else if(clickedText == "조회순"){
63            displayWeekList(weekListByViews);
64        }
65            
66    });
67    displayWeekList(weekListByPop);
68    displayNewList(newList);
69    displayAllCategories(rankList);
70    displayTotalRanking(totalList);
71    displayEventList(eventList);
72    displayRecommendList(recommendList);
73
74    $("#banner").on("click", function () {
75      const os = getMobileOperatingSystem();
76      if (os === "Android") {
77        // Play Store 링크로 이동
78        window.location.href = "market://details?id=com.cocoreelshort";
79      } else if (os === "iOS") {
80        // App Store 링크로 이동
81        //window.location.href = "https://apps.apple.com/app/id1672471445";
82      } else {
83        // alert("지원되지 않는 플랫폼입니다.");
84      }
85    });
86});
87
88
89function displayRecommendList(toonList){
90    var source = $("#webtoonlist_type1_template").html();
91
92    Handlebars.registerHelper('decrementAdStart', function(ad_start) {
93        return parseInt(ad_start) - 1;
94    });
95
96    var template = Handlebars.compile(source);
97
98    var html = template({ toons: toonList });
99
100    $("#recommendList").html(html);
101}
102
103function displayEventList(toonList){
104    var source = $("#webtoonlist_type1_template").html();
105
106    Handlebars.registerHelper('decrementAdStart', function(ad_start) {
107        return parseInt(ad_start) - 1;
108    });
109
110    var template = Handlebars.compile(source);
111
112    var html = template({ toons: toonList });
113    $("#eventList").html(html);
114}
115
116// 웹툰 리스트를 화면에 표시하는 함수
117function displayTotalRanking(toonList) {
118     toonList.forEach((toon, index) => {
119        toon.rank = index + 1; // 순위 설정
120    });
121    // Handlebars 템플릿 소스 가져오기
122    var source = $("#webtoonlist_type2_template").html();
123    // 템플릿 컴파일
124    var template = Handlebars.compile(source);
125    // 컴파일된 HTML 생성
126    var html = template({ toons: toonList });
127    // 카테고리 ID에 해당하는 요소에 HTML 뿌리기
128    $("#totalList").html(html);
129}
130
131// 모든 카테고리에 대해 웹툰 리스트를 화면에 표시
132function displayAllCategories(webtoonData) {
133    const categoryIds = [
134        "rankFantasy", "rankAction", "rankRomance", 
135        "rankThriller", "rankFiction", "rankSports", "rankEveryday", "rankBl", 
136        "rankBoy", "rankDrama"
137    ];
138
139    categoryIds.forEach((id, index) => {
140        const toonList = webtoonData[(index + 1).toString()];
141        if (toonList && toonList.length > 0) {
142            displayRankList(toonList, id);
143        }
144    });
145}
146
147function displayWeekList(toonList){
148    var source = $("#webtoonlist_type1_template").html();
149
150    var template = Handlebars.compile(source);
151
152    var html = template({ toons: toonList });
153
154    $("#weekList").html(html);
155}
156
157function displayNewList(toonList){
158    var source = $("#webtoonlist_type1_template").html();
159
160    var template = Handlebars.compile(source);
161
162    var html = template({ toons: toonList });
163
164    $("#newList").html(html);
165}
166
167
168// 웹툰 리스트를 화면에 표시하는 함수
169function displayRankList(toonList, categoryId) {
170     toonList.forEach((toon, index) => {
171        toon.rank = index + 1; // 순위 설정
172    });
173    // Handlebars 템플릿 소스 가져오기
174    var source = $("#webtoonlist_type2_template").html();
175    // 템플릿 컴파일
176    var template = Handlebars.compile(source);
177    // 컴파일된 HTML 생성
178    var html = template({ toons: toonList });
179    // 카테고리 ID에 해당하는 요소에 HTML 뿌리기
180    $(`#${categoryId}`).html(html);
181}
182
183// 사용자 정의 헬퍼 등록
184Handlebars.registerHelper('isEqual', function(a, b, options) {
185    if (a == b) { // == 사용: 문자열과 숫자 비교를 모두 처리할 수 있음
186        return options.fn(this); // 조건이 참일 때의 블록
187    } else {
188        return options.inverse(this); // 조건이 거짓일 때의 블록
189    }
190});
191
192Handlebars.registerHelper('decrementAdStart', function(ad_start) {
193    return parseInt(ad_start) - 1;
194});

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.