..
This commit is contained in:
parent
f56c43d82b
commit
668d33543c
@ -1,4 +1,3 @@
|
||||
const list = ["?page=2","?page=3","?page=4","?page=5","?page=6"];
|
||||
const port = browser.runtime.connectNative("browser");
|
||||
port.onMessage.addListener(response => {
|
||||
var type= response["type"];
|
||||
@ -237,9 +236,9 @@ function sendMessage(msg) {
|
||||
function toast(msg) {
|
||||
port.postMessage(JSON.stringify({type:"MSG",msg:msg}));
|
||||
}
|
||||
|
||||
var time1 = null
|
||||
if (port) {
|
||||
setTimeout(
|
||||
time1 = setTimeout(
|
||||
function(){
|
||||
if (location.hostname.search("clien") > -1 && document.querySelectorAll('[class^="view_top"]')) {
|
||||
document.querySelectorAll('[class^="view_top"]').forEach(e => e.remove())
|
||||
@ -342,7 +341,11 @@ if (port) {
|
||||
|
||||
var title = "";
|
||||
try {
|
||||
title = e.querySelector(".name").querySelector("a").querySelector("span").textContent.trim();
|
||||
e.querySelector(".name").querySelector("a").querySelectorAll("span").forEach(function (e) {
|
||||
if (e.hasAttribute("class") == false) {
|
||||
title = e.textContent.trim();
|
||||
}
|
||||
})
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
@ -367,10 +370,10 @@ if (port) {
|
||||
"title" : title,
|
||||
"description" : desc,
|
||||
"originPage" : originPage,
|
||||
"magnet" : magnet,
|
||||
"magnet_link" : magnet,
|
||||
"thumbnail" : thumb,
|
||||
"pubDate" : date,
|
||||
"screenshots" : screenshots,
|
||||
"screenshotsUrl" : screenshots,
|
||||
"chosung" : "",
|
||||
"category" : "PRIVATE"
|
||||
});
|
||||
@ -387,24 +390,48 @@ if (port) {
|
||||
|
||||
},1500)
|
||||
}
|
||||
|
||||
function gotoNext() {
|
||||
if (location.href.search("page") < 0) {
|
||||
targetUrl = location.protocol + "//" + location.hostname + "/" + list[0]
|
||||
}else {
|
||||
var targetUrl = ""
|
||||
for (i = 0; i < list.length - 1; i++) {
|
||||
var time2 = null
|
||||
function gotoNext() {
|
||||
clearTimeout(time1)
|
||||
try{
|
||||
if (location.href.search(list[i]) > -1) {
|
||||
targetUrl = location.protocol + "//" + location.hostname + list[i + 1]
|
||||
|
||||
var url = new URL(location.href);
|
||||
var params = url.searchParams;
|
||||
var keys = Array.from(params.keys());
|
||||
console.log("targetUrl :: " + params);
|
||||
console.log("targetUrl :: " + keys.length);
|
||||
if (keys.length === 0 && location.href.search("page") < 0) {
|
||||
targetUrl = location.protocol + "//" + location.hostname + "/?page=2"
|
||||
} else {
|
||||
try {
|
||||
var lastValue = params.get("page");
|
||||
console.log("targetUrl :: " + lastValue);
|
||||
var numValue = Number(lastValue);
|
||||
console.log("targetUrl :: " + numValue);
|
||||
if (numValue < Number("5")) {
|
||||
params.set("page", (numValue + 1).toString());
|
||||
console.log("targetUrl :: " + params);
|
||||
url.search = params.toString();
|
||||
console.log("targetUrl :: " + url.search);
|
||||
targetUrl = url.toString();
|
||||
} else {
|
||||
console.log("targetUrl :: ");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
console.log("targetUrl :: " + targetUrl);
|
||||
time2 = setTimeout(function () {
|
||||
clearTimeout(time2)
|
||||
if (targetUrl.length > 5) {
|
||||
console.log("targetUrl :: " + targetUrl);
|
||||
location.href = targetUrl
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
if (targetUrl.length > 5) {
|
||||
setTimeout(function () {location.href = targetUrl},3000)
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,9 @@ import bums.lunatic.launcher.tokiz.view.JxEvent
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.afterDay
|
||||
import bums.lunatic.launcher.workers.WorkersDb
|
||||
import bums.lunatic.launcher.workers.WorkersDb.getRealm
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.Jsoup
|
||||
@ -472,9 +474,14 @@ class GeckoWeb : BWebview {
|
||||
}
|
||||
"PRIVATES"->{
|
||||
lPortMessage.privates?.forEach {
|
||||
Blog.LOGE("Item screenshots >>> ${it.screenshots}")
|
||||
Blog.LOGE("Item screenshots >>> ${it.getScreen()}")
|
||||
it.pubDate = afterDay(it.pubDate)
|
||||
WorkersDb.insertData(it)
|
||||
// WorkersDb.insertData(it)
|
||||
getRealm().apply {
|
||||
this.writeBlocking {
|
||||
copyToRealm(it, UpdatePolicy.ALL)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"PagerContents" -> {
|
||||
|
||||
@ -59,8 +59,11 @@ import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||
import bums.lunatic.launcher.utils.beforeDay
|
||||
import bums.lunatic.launcher.utils.beforeOneDay
|
||||
import bums.lunatic.launcher.workers.WorkersDb
|
||||
import bums.lunatic.launcher.workers.WorkersDb.prvClear
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.notifications.InitialResults
|
||||
@ -268,13 +271,34 @@ internal class RssHome : Fragment() {
|
||||
} else {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
if (lasted.size > 0) {
|
||||
lasted?.removeFirst()?.let {
|
||||
Blog.LOGE("removeFirst >>> ${Gson().toJson(it)}")
|
||||
binding.layoutRssSummary.root.visibility = View.VISIBLE
|
||||
binding.layoutRssSummary.title.text = it.title()
|
||||
binding.layoutRssSummary.desc.text = it.description()
|
||||
binding.layoutRssSummary.link.text = it.originPage()
|
||||
loadImage(binding.layoutRssSummary.cover,it.thumbnailUrl())
|
||||
loadImage(binding.layoutRssSummary.screen,it.getScreen())
|
||||
it.title()?.let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.title.text = it
|
||||
}
|
||||
|
||||
it.description()?.let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.desc.text = it
|
||||
}
|
||||
it.getMagnet().let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.link.text = it
|
||||
}
|
||||
it.thumbnailUrl().let {
|
||||
Blog.LOGE(it)
|
||||
loadImage(binding.layoutRssSummary.cover, it)
|
||||
}
|
||||
it.getScreen().let {
|
||||
Blog.LOGE(it)
|
||||
loadImage(binding.layoutRssSummary.screen, it)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.home.performClick()
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,6 +384,10 @@ internal class RssHome : Fragment() {
|
||||
binding.prv.setOnClickListener {
|
||||
queryPrevate()
|
||||
}
|
||||
binding.layoutRssSummary.close.setOnClickListener {
|
||||
binding.home.performClick()
|
||||
}
|
||||
|
||||
queryInfos()
|
||||
binding.geckoWeb.progress = binding.progressBar
|
||||
binding.geckoWeb.jxInteface = { jxEvent ->
|
||||
@ -598,14 +626,15 @@ fun loadImage(imageView: ImageView, url: String?) {
|
||||
Blog.LOGE("loadImage >>> $it")
|
||||
Glide.with(imageView.context)
|
||||
.load(url)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.fitCenter()
|
||||
.into(imageView)
|
||||
imageView.visibility = View.VISIBLE
|
||||
} else {
|
||||
imageView.visibility = View.GONE
|
||||
imageView.visibility = View.INVISIBLE
|
||||
}
|
||||
} ?: {
|
||||
imageView.visibility = View.GONE
|
||||
imageView.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,14 @@ class Clien : DcInside() {
|
||||
|
||||
}
|
||||
class Arca : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
var link : String? = null
|
||||
var title : String? = null
|
||||
var thumbnail : String? = null
|
||||
@ -160,6 +168,14 @@ open class DcInside : RssDataInterface {
|
||||
return desc ?: ""
|
||||
}
|
||||
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun pubDate(): Long {
|
||||
if (dateTiemL < 1L) {
|
||||
if (dateTiem?.length ?: 0 < 1) return 0L
|
||||
@ -219,11 +235,15 @@ class RssData : RealmObject, RssDataInterface {
|
||||
var thumbnail : String? = null
|
||||
var pubDate : Long = 0L
|
||||
var category : String? = null
|
||||
var magnet : String? = null
|
||||
var screenshots : String? = null
|
||||
fun getScreen() : String {
|
||||
Blog.LOGE("getScreen $screenshots")
|
||||
return screenshots ?: ""
|
||||
var magnet_link : String? = null
|
||||
var screenshotsUrl : String? = null
|
||||
|
||||
override fun getScreen() : String {
|
||||
return screenshotsUrl ?: ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return magnet_link ?: ""
|
||||
}
|
||||
|
||||
var chosung : String? = null
|
||||
@ -239,18 +259,15 @@ class RssData : RealmObject, RssDataInterface {
|
||||
}
|
||||
else -> title ?: ""
|
||||
}.apply {
|
||||
Blog.LOGE("title $this")
|
||||
chosung = JamoUtils.split(title).joinToString("")
|
||||
}
|
||||
}
|
||||
|
||||
override fun thumbnailUrl(): String {
|
||||
Blog.LOGE("thumbnail $thumbnail")
|
||||
return thumbnail ?: ""
|
||||
}
|
||||
|
||||
override fun originPage(): String {
|
||||
Blog.LOGE("originPage $originPage")
|
||||
return originPage ?: ""
|
||||
}
|
||||
|
||||
@ -288,6 +305,13 @@ open class Dotax(var pageLink : String,
|
||||
var dateTime : String,
|
||||
var title : String,
|
||||
var thumbnail : String) : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var updateDateTime = 0L
|
||||
override fun title(): String {
|
||||
return title
|
||||
|
||||
@ -3,7 +3,13 @@ package bums.lunatic.launcher.model
|
||||
import bums.lunatic.launcher.utils.JamoUtils
|
||||
|
||||
class NewsData : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var title : String? = ""
|
||||
var link : String? = ""
|
||||
var guid : String? = ""
|
||||
|
||||
@ -69,4 +69,6 @@ interface RssDataInterface {
|
||||
fun pubDate() : Long
|
||||
fun category() : RssDataType
|
||||
fun getCho() : String?
|
||||
fun getScreen() : String
|
||||
fun getMagnet() : String
|
||||
}
|
||||
@ -124,6 +124,13 @@ class CrosspostParentList {
|
||||
}
|
||||
|
||||
class Data : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var after: String? = null
|
||||
var dist: Int = 0
|
||||
var modhash: String? = null
|
||||
|
||||
@ -506,6 +506,13 @@ class GridChannelRenderer {
|
||||
}
|
||||
|
||||
class GridVideoRenderer : VideoRenderer() {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
// var videoId: String? = null
|
||||
// var thumbnail: Thumbnail? = null
|
||||
// var title: Title? = null
|
||||
@ -1567,6 +1574,13 @@ class VideoCountText {
|
||||
}
|
||||
|
||||
open class VideoRenderer : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var videoId: String? = null
|
||||
var thumbnail: Thumbnail? = null
|
||||
var title: Title? = null
|
||||
|
||||
@ -59,7 +59,8 @@ class CustMigration : AutomaticSchemaMigration {
|
||||
object WorkersDb {
|
||||
|
||||
|
||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(
|
||||
RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
||||
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
||||
LocationLog::class,
|
||||
@ -88,21 +89,11 @@ object WorkersDb {
|
||||
getRealm().apply {
|
||||
this.writeBlocking {
|
||||
try {
|
||||
if (rssData.category().equals(RssDataType.PRIVATE)) {
|
||||
this.copyToRealm(rssData, UpdatePolicy.ALL)
|
||||
Blog.LOGE("rssData >> $rssData ${rssData.getScreen()}")
|
||||
} else {
|
||||
if (query<RssData>("originPage == $0", rssData.originPage).find()
|
||||
.isEmpty()
|
||||
) {
|
||||
this.copyToRealm(rssData, UpdatePolicy.ERROR)
|
||||
}
|
||||
}
|
||||
try {
|
||||
query<RssData>("originPage == $0",rssData.originPage).find()?.first()?.let {
|
||||
Blog.LOGE("SAVED CHECK ${Gson().toJson(this.copyFromRealm(it))}")
|
||||
}
|
||||
}catch (e: Exception) {e.printStackTrace()}
|
||||
} catch (e : Exception) {
|
||||
|
||||
}
|
||||
@ -225,7 +216,13 @@ object WorkersDb {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun prvClear() {
|
||||
getRealm().writeBlocking {
|
||||
var results = query<RssData>().query("category == $0 ",
|
||||
RssDataType.PRIVATE.name).find()
|
||||
delete(results)
|
||||
}
|
||||
}
|
||||
fun getPrivate() = getRealm().query<RssData>().query("category == $0 ",
|
||||
RssDataType.PRIVATE.name).distinct("originPage", "title").sort("pubDate", Sort.DESCENDING)
|
||||
|
||||
|
||||
@ -8,61 +8,77 @@
|
||||
name="rss"
|
||||
type="bums.lunatic.launcher.model.RssData" />
|
||||
</data>
|
||||
<FrameLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:background="#000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
tools:ignore="UselessParent">
|
||||
<LinearLayout
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:divider="@color/white"
|
||||
android:showDividers="middle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/title"
|
||||
android:singleLine="false"
|
||||
android:lines="0"
|
||||
android:background="#000"
|
||||
android:textSize="@dimen/_20sp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:alpha="0.05"
|
||||
android:id="@+id/cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
android:alpha="0.6"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:scaleType="fitCenter"
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/cover"
|
||||
android:id="@+id/desc"
|
||||
android:singleLine="false"
|
||||
android:lines="0"
|
||||
android:background="#000"
|
||||
android:textSize="@dimen/_20sp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
app:layout_constraintTop_toBottomOf="@id/desc"
|
||||
android:id="@+id/screen"
|
||||
android:alpha="0.05"
|
||||
android:alpha="0.6"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/screen"
|
||||
android:id="@+id/link"
|
||||
android:singleLine="false"
|
||||
android:lines="0"
|
||||
android:background="#000"
|
||||
android:textSize="@dimen/_20sp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"/>
|
||||
</LinearLayout>
|
||||
android:layout_height="wrap_content"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
<ImageButton
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:tint="@color/white"
|
||||
android:background="@null"
|
||||
android:id="@+id/close"
|
||||
android:foregroundTint="@color/white"
|
||||
android:src="@drawable/close_vector"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
Loading…
x
Reference in New Issue
Block a user