mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-21 18:02:42 +01:00
parent
fa3e73e2ae
commit
2830a0a1a9
@ -2,7 +2,7 @@ plugins {
|
|||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 36
|
baseVersionCode = 37
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":lib:cryptoaes"))
|
api(project(":lib:cryptoaes"))
|
||||||
|
@ -767,12 +767,21 @@ abstract class Madara(
|
|||||||
return when {
|
return when {
|
||||||
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
||||||
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
||||||
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ")
|
element.hasAttr("srcset") -> element.attr("abs:srcset").getSrcSetImage()
|
||||||
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
||||||
else -> element.attr("abs:src")
|
else -> element.attr("abs:src")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the best image quality available from srcset
|
||||||
|
*/
|
||||||
|
private fun String.getSrcSetImage(): String? {
|
||||||
|
return this.split(" ")
|
||||||
|
.filter(URL_REGEX::matches)
|
||||||
|
.maxOfOrNull(String::toString)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set it to true if the source uses the new AJAX endpoint to
|
* Set it to true if the source uses the new AJAX endpoint to
|
||||||
* fetch the manga chapters instead of the old admin-ajax.php one.
|
* fetch the manga chapters instead of the old admin-ajax.php one.
|
||||||
@ -1106,6 +1115,7 @@ abstract class Madara(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val URL_SEARCH_PREFIX = "slug:"
|
const val URL_SEARCH_PREFIX = "slug:"
|
||||||
|
val URL_REGEX = """^(https?://[^\s/$.?#].[^\s]*)${'$'}""".toRegex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user