PageSourceSearch

https://www.princejks.com/wm_engine_SW/_engine/common/jquery-wingNextPage.js

js princejks.com collected 2026-10-02 17:36:06 UTC 3,225 bytes, 112 lines download raw bytes

1$.fn.wingNextPage = function(option) {
2	if (!option) option = [];
3
4	let $this = this;
5	this.placeholder = $(this); // 붙여넣기 본문 위치
6	this.file_name = option.file_name; // 스킨 파일 명
7	this.module_name = option.module_name; // 스킨 모듈 명
8	this.page = option.page || 1; // 현재 페이지
9	this.mode = option.mode || 'append'; // 붙여넣기 모드 append/replace/replace_all
10	this.handle = option.handle || null; // 더보기 버튼 (마지막 페이지에서 hidden)
11	this.complete = option.complete || null; // 붙여넣기 완료 후 콜백 함수
12
13	if (typeof window.wing_morepages == 'undefined') {
14		window.wing_morepages = {};
15	}
16	window.wing_morepages['module_'+this.module_name] = this;
17
18	$this.load = function(event_type) {
19		let param = {
20			'exec_file': 'skin_module/moduleloader.php', 
21			'file_name': $this.file_name, 
22			'module_name': $this.module_name,
23			'page': $this.page,
24			'uri': location.href,
25			'add_mode': $this.mode,
26			'event_type': event_type
27		}
28		$.get(root_url+'/main/exec.php', param, function(ret) {
29			if (ret.status == 'success') {
30				if ($this.handle) {
31					if (ret.html == '' || ret.end_page == $this.page) {
32						if ($this.handle && $this.handle.length > 0) {
33							$this.handle.hide();
34						}
35					} else {
36						$this.handle.show();
37					}
38				}
39
40				$this.placeholder.html(ret.html);
41				if (typeof $this.complete == 'function') {
42					$this.complete();
43				}
44
45				if ($this.mode == 'replace' || $this.mode == 'replace_all') {
46					document.scrollingElement.scrollTop = $this.placeholder.offset().top-100; // 모바일
47					$(document.body).scrollTop($this.placeholder.offset().top-100);
48				}
49			} else {
50				console.log(this.message);
51			}
52		});
53	}
54
55	$this.next = function() {
56		let url = location.href.split('#');
57
58		// 현재 모듈을 제외한 기존 파라메터 유지
59		let param = '';
60		for([key, val] of new URLSearchParams(url[1]).entries()) {
61			if (key == 'module_'+$this.module_name) continue;
62			if (param) param += '&';
63			param += key+'='+val;
64		};
65
66		// 현재모듈의 링크 추가
67		$this.page = parseInt($this.page)+1;
68		if (param) param += '&';
69		param += 'module_'+$this.module_name+'='+$this.page;
70
71		location.href = '#'+param;
72	}
73
74	$this.param = function(p) {
75		let url = location.href.split('#');
76
77		// 페이지 초기화
78		$this.page = 0;
79
80		// 현재 모듈을 제외한 기존 파라메터 유지
81		let param = '';
82		loop1:for([key, val] of new URLSearchParams(url[1]).entries()) {
83			for (k in p) {
84				if (key == k) continue loop1;
85			}
86			if (key == 'module_'+$this.module_name) val = 1;
87			if (param) param += '&';
88			param += key+'='+val;
89		};
90
91		for (k in p) {
92			if (param) param += '&';
93			param += k+'='+p[k]; 
94		}
95		location.href = '#'+param;
96	}
97
98	return this;
99}
100
101$(window).on('hashchange load', function(event) {
102	let url = location.href.split('#');
103	let entries = new URLSearchParams(url[1]);
104
105	for (let key in window.wing_morepages) {
106		let module = window.wing_morepages[key];
107		let page = entries.get(key);
108		if (page == null) page = 1;
109		module.page = page;
110		module.load(event.type);
111	}
112});

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.