xchina

good

As of 2024-03-29. See the latest version.

// ==UserScript==
// @name        xchina
// @version      2024.3.29
// @author       You
// @description  good
// @include     https://xchina.co/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_download
// @grant        GM_xmlhttpRequest
// @connect       *
// @require     https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js
// @require		https://code.jquery.com/jquery-3.6.0.min.js
// @require     https://update.greasyfork.org/scripts/480132/1349340/Get_all_img_Library.js
// @namespace https://greasyfork.org/users/1210231
// ==/UserScript==
$(function(){

	get_list(get_big_img)

	//changePB()
})

function get_list(callback){
	if(window.location.href.match(/xchina\.co\/photo\/id-\w+\.html/g)){}else{return}

	let key = "xchina"
	let atag = $('a.next[href]:first')
	let nums = (()=>{
					if(atag.length>0&&atag.prev().length>0){
						return Number(atag.prev().text())
					}else{
						return 1
					}
				})()
	atag = $('a[current="true"]:first')
	if(atag.length==0){callback($('.photos').children());return}

	let geturl = function(i){return atag[0].href.replace(/\d+(?=\.)/,(i+1))}
	let getimg = function(data){return $(data).find('.photos').children().attr('ccc','yes')}
	let putimg = function(img,i){
		$('.photos').append(img)
		$('.mass_top').css('font-size','10vw')

		$('.photos').children('*:not([ccc])').remove()
		$('*:not(.download_bu,.mass_top)').filter(function(){return $(this).css('position')=="fixed"}).remove()
		callback(img)
	}
	window.GAIL.get_img_obo_ajax_href(key,nums,geturl,getimg,putimg)
}
function get_big_img(img){
	let iimg = img.find('img')
	iimg.each(function(){
        $(this).parent().before($(this))
        $(this).next().remove()
		this.src = this.src.replace(/_[^\.]+/g,"").replace(/\w+$/g,"jpg")
		$(this).parents('a:first[href]').removeAttr('href')
		$(this).click(function(){
			let name = document.title + ".jpg"
			let src = this.src
			GM_download({
				url:src,
				name:name,
			})
		})
	})

	$(".push-bottom").remove()
	return

}