Skip to content

Commit 1b2ed9d

Browse files
committed
Update pvcep_rules.js
1 parent ff412ab commit 1b2ed9d

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

Picviewer CE+/pvcep_rules.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,10 +1558,32 @@ var siteInfo = [
15581558
{
15591559
name: "Sankaku Complex",
15601560
url:/sankakucomplex\.com/,
1561-
src:/\/data\/preview\//,
15621561
xhr:{
1563-
url: "a",
1564-
query: "img#image"
1562+
url: function(a, p) {
1563+
const re = /^https?:\/\/(?:www\.)?((?:idol|chan)\.)?(sankaku)complex(\.com\/)(?:\w{2}\/)?(post)s?\/(?:show\/)?([a-zA-Z0-9]+).*/;
1564+
const $ = a && a.href.match(re);
1565+
if ($) {
1566+
return !$[1] ? `https://${$[2]}api${$[3]+$[4]}s/${$[5]}/fu` : $[0];
1567+
}
1568+
},
1569+
query: function(html, doc, url) {
1570+
const re = /^https?:\/\/((?:idol|chan|www)\.)?(sankaku)complex(\.com\/)(?:\w{2}\/)?(post)s?\/(?:show\/)?([a-zA-Z0-9]+).*/;
1571+
const $ = url.match(re);
1572+
if(html[0]!=='{') return;
1573+
let meta = document.querySelector('head > meta[name="referrer"]');
1574+
if (!meta) {
1575+
meta = document.createElement('meta');
1576+
meta.name = 'referrer';
1577+
meta.content = 'same-origin';
1578+
document.getElementsByTagName('head')[0].appendChild(meta);
1579+
} else if (meta.attributes.content.value !== 'same-origin') {
1580+
meta.attributes.content.value = 'same-origin';
1581+
}
1582+
let lowres_url, highres_url;
1583+
lowres_url = html.match(/(?:(?:Resized: <a|<a id="lowres"[^>]+?) href=|sample_url": ?)"([^"]+)/)?.[1];
1584+
highres_url = html.match(/(?:(?:Original: <a|<a id="highres"[^>]+?) href="|file_url":"?)([^(,")]+)/)?.[1];
1585+
return highres_url;
1586+
}
15651587
}
15661588
},
15671589
{

0 commit comments

Comments
 (0)