This commit is contained in:
lunaticbum 2025-10-17 18:14:26 +09:00
parent e9b287cf81
commit 401387bd00
8 changed files with 165 additions and 2 deletions

View File

@ -125,6 +125,45 @@
} }
} }
for (let i = 0; i < 100 ; i++) {
// XMLHttpRequest 객체 생성
console.log('try : ', i);
const xhr = new XMLHttpRequest();
var data = { EVT_ID : '10170'
, EVT_DTL_TP_C : '0312'
, WATER : 'Y'
};
xhr.open('POST', '/nhpot/maa/joinDailyEvt.ajax', true);
// xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
// 요청 성공
const response = JSON.parse(xhr.responseText);
console.log('성공:', response);
} else {
// 요청 실패
console.error('실패:', xhr.statusText);
}
};
xhr.onerror = function () {
console.error('네트워크 오류');
};
xhr.send(JSON.stringify(data));
}
for (let i = 0; i < 100 ; i++) {
var url = "/nhpot/maa/joinDailyEvt.ajax";
var type = "post";
var data = { EVT_ID : '10174'
, EVT_DTL_TP_C : '0312'
, WATER : 'Y'
};
var async = true;
submitAjax(url, type, async, data)
}
// 재귀적으로 모든 사진 ID를 가져오는 함수 // 재귀적으로 모든 사진 ID를 가져오는 함수
async function fetchAllPhotos(offset) { async function fetchAllPhotos(offset) {
const limit = 5000; // 한 번에 5000개씩 요청 const limit = 5000; // 한 번에 5000개씩 요청

View File

@ -0,0 +1,29 @@
window.addEventListener('load',()=>{
const container = document.getElementById('container');
container.addEventListener('focus',(e)=> {
window.onpopstate = function(event){
try {
var historyUrl = new URL(document.referrer);
var referrerUrl = document.referrer;
console.log(history.state);
if(historyUrl.host != location.host || referrerUrl.includes('pntPointBankBill')){
// 현재 페이지 상태를 히스토리에 추가
history.pushState(null, null, location.href);
// 뒤로가기 버튼 누를 때 호출되는 이벤트 처리
// 홈으로 이동
location.href = "/nhaob/main/main.nh";
} else {
history.pushState("BACK", null, "/nhaob/main/main.nh");
console.log("did pushState");
}
} catch (e) {
console.log(e);
}
}
})
container.focus();
})
window.focus()
document.body.focus()

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script type="text/javascript">
window.addEventListener('load', () => {
history.pushState(null, '', location.href);
window.addEventListener('popstate', function(event){
console.log("Got event");
});
console.log("addEventListener");
});
</script>
<body>
</body>
</html>

View File

@ -919,6 +919,7 @@ class GeckoWeb : BWebview {
message: Any, port: WebExtension.Port message: Any, port: WebExtension.Port
) { ) {
Blog.LOGE("PortDelegate", "Received message from extension: $message") Blog.LOGE("PortDelegate", "Received message from extension: $message")
if (message is String && message.contains("type")) { if (message is String && message.contains("type")) {
try { try {

View File

@ -23,6 +23,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebView
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.RssViewerBinding import bums.lunatic.launcher.databinding.RssViewerBinding
@ -58,6 +59,11 @@ internal class RssViewer : DialogFragment() {
binding = RssViewerBinding.inflate(inflater, container, false) binding = RssViewerBinding.inflate(inflater, container, false)
binding.webview.loadUrl(tag!!) binding.webview.loadUrl(tag!!)
binding.webview.setDesktopMode(false) binding.webview.setDesktopMode(false)
var mWebView = WebView(requireContext())
mWebView.requestFocus()
mWebView.evaluateJavascript("try {document.querySelector('.my-point-box').focus()}catch(err){}") { }
// binding.pdfPrint.setOnClickListener { pdfPring() } // binding.pdfPrint.setOnClickListener { pdfPring() }
return binding.root return binding.root
} }

View File

@ -433,7 +433,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
Gson().fromJson<PortMessage>(message, PortMessage::class.java) Gson().fromJson<PortMessage>(message, PortMessage::class.java)
when(lPortMessage.type) { when(lPortMessage.type) {
"getListResult" -> { "getListResult" -> {
lPortMessage.bookInfos?.let { onBookInfos(it) } lPortMessage.bookInfos?.let { onBookInfos(it.sort()) }
} }
"BookContents"->{ "BookContents"->{
lPortMessage?.book?.chapterTitle?.let { onFindTitle(it) } lPortMessage?.book?.chapterTitle?.let { onFindTitle(it) }
@ -752,6 +752,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
try { try {
var infosj: PageInfosJ? = null var infosj: PageInfosJ? = null
infosj = Gson().fromJson(jsonString, PageInfosJ::class.java) infosj = Gson().fromJson(jsonString, PageInfosJ::class.java)
HistoryManager.getBookInfos(contentsType,infosj.bookPageUrl!!) { HistoryManager.getBookInfos(contentsType,infosj.bookPageUrl!!) {
if (it != null) { if (it != null) {

View File

@ -18,6 +18,7 @@ import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey import io.realm.kotlin.types.annotations.PrimaryKey
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import java.util.regex.Pattern
class LastInfo : RealmObject { class LastInfo : RealmObject {
@PrimaryKey @PrimaryKey
@ -107,12 +108,75 @@ class BookContents {
var chapterTitle : String? = null var chapterTitle : String? = null
var bookContents : String? = null var bookContents : String? = null
} }
// PageInfoJ를 정렬하기 위한 Comparator 클래스
class PageInfoComparator : Comparator<PageInfoJ> {
// 문자열에서 숫자 부분과 문자 부분을 분리하는 정규표현식
private val pattern = Pattern.compile("(\\d+)|(\\D+)")
override fun compare(p1: PageInfoJ?, p2: PageInfoJ?): Int {
// null 객체에 대한 안전장치
if (p1 == null && p2 == null) return 0
if (p1 == null) return -1
if (p2 == null) return 1
// 비교할 문자열 추출 (여기서는 bookTitle을 기준으로 정렬)
// 만약 chapterTitle로 정렬하고 싶다면 이 부분을 수정하세요.
val s1 = p1.bookTitle ?: ""
val s2 = p2.bookTitle ?: ""
val m1 = pattern.matcher(s1)
val m2 = pattern.matcher(s2)
while (m1.find() && m2.find()) {
val part1 = m1.group()
val part2 = m2.group()
// 각 부분이 숫자인지 확인
val isPart1Numeric = part1.firstOrNull()?.isDigit() ?: false
val isPart2Numeric = part2.firstOrNull()?.isDigit() ?: false
// 1. 둘 다 숫자인 경우: 숫자 값으로 비교
if (isPart1Numeric && isPart2Numeric) {
val num1 = part1.toInt()
val num2 = part2.toInt()
if (num1 != num2) {
return num1.compareTo(num2)
}
}
// 2. 한쪽만 숫자인 경우: 숫자가 항상 앞으로 오도록 설정
else if (isPart1Numeric) {
return -1 // s1(p1)이 숫자이므로 앞으로
} else if (isPart2Numeric) {
return 1 // s2(p2)가 숫자이므로 s1(p1)이 뒤로
}
// 3. 둘 다 문자인 경우: 사전 순으로 비교
else {
val result = part1.compareTo(part2)
if (result != 0) {
return result
}
}
}
// 모든 부분이 동일하면 전체 문자열 길이로 비교 (짧은 것이 앞으로)
return s1.compareTo(s2)
}
}
class PageInfosJ { class PageInfosJ {
var bookTitle : String = "" var bookTitle : String = ""
var bookPageUrl : String = "" var bookPageUrl : String = ""
var contentsType : String? = "" var contentsType : String? = ""
var pages : ArrayList<PageInfoJ> = arrayListOf<PageInfoJ>() var pages : ArrayList<PageInfoJ> = arrayListOf<PageInfoJ>()
fun sort() : PageInfosJ {
pages.sortWith(PageInfoComparator())
return this
}
fun getTitleArray() : ArrayList<String> { fun getTitleArray() : ArrayList<String> {
var arrayList = ArrayList<String>() var arrayList = ArrayList<String>()
pages.forEach { arrayList.add(it.bookTitle ?: "") } pages.forEach { arrayList.add(it.bookTitle ?: "") }

View File

@ -77,7 +77,8 @@ object WorkersDb {
.schemaVersion(schemaVersion) .schemaVersion(schemaVersion)
.build()) .build())
} catch (e : IllegalStateException) { } catch (e : IllegalStateException) {
getRealm() // getRealm()
e.printStackTrace()
} }
} }
return pRealm!! return pRealm!!