XT2.2.2
- Fixed trying to get thread JSON from unsupported archives. - Fixed type in Redirect.ts
This commit is contained in:
parent
d19d34e91a
commit
45a3a49da8
@ -3,6 +3,10 @@
|
||||
4chan XT uses a different user script namespace, so to migrate you need to export settings from 4chan X, and import them
|
||||
in XT.
|
||||
|
||||
### XT v2.2.2 (2023-10-29)
|
||||
|
||||
- Fixed trying to get thread JSON from unsupported archives.
|
||||
|
||||
### XT v2.2.1 (2023-10-28)
|
||||
|
||||
- Fixed thread not scrolling to last read post.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan XT
|
||||
// @version XT 2.2.1
|
||||
// @version XT 2.2.2
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 74
|
||||
// @namespace 4chan-XT
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan XT
|
||||
// @version XT 2.2.1
|
||||
// @version XT 2.2.2
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 74
|
||||
// @namespace 4chan-XT
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan XT
|
||||
// @version XT 2.2.1
|
||||
// @version XT 2.2.2
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 74
|
||||
// @namespace 4chan-XT
|
||||
@ -190,7 +190,7 @@
|
||||
!function(){"use strict";var e={name:"4chan XT",path:"4chan-XT",fork:"TuxedoTako",page:"https://github.com/TuxedoTako/4chan-xt",downloads:"https://github.com/TuxedoTako/4chan-xt/releases",oldVersions:"https://raw.githubusercontent.com/ccd0/4chan-x/",faq:"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions",captchaFAQ:"https://github.com/ccd0/4chan-x/wiki/Captcha-FAQ",cssGuide:"https://github.com/ccd0/4chan-x/wiki/Styling-Guide",license:"https://github.com/TuxedoTako/4chan-xt/blob/project-XT/LICENSE",changelog:"https://github.com/TuxedoTako/4chan-xt/blob/project-XT/CHANGELOG.md",issues:"https://github.com/TuxedoTako/4chan-xt/issues",newIssue:"https://github.com/TuxedoTako/4chan-xt/issues",newIssueMaxLength:8181,alternatives:"https://www.4chan-x.net/4chan_alternatives.html",appid:"lacclbnghgdicfifcamcmcnilckjamag",appidGecko:"4chan-x@4chan-x.net",chromeStoreID:"ohnjgmpcibpbafdlkimncjhflgedgpam",recaptchaKey:"6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc",distBranch:"gh-pages",
|
||||
includes_only:["*://boards.4chan.org/*","*://sys.4chan.org/*","*://www.4chan.org/*","*://boards.4channel.org/*","*://sys.4channel.org/*","*://www.4channel.org/*","*://i.4cdn.org/*","*://is.4chan.org/*","*://is2.4chan.org/*","*://is.4channel.org/*","*://is2.4channel.org/*"],matches_only:["*://*.4chan.org/*","*://*.4channel.org/*","*://*.4cdn.org/*"],
|
||||
matches:["https://erischan.org/*","https://www.erischan.org/*","https://fufufu.moe/*","https://gnfos.com/*","https://himasugi.blog/*","https://www.himasugi.blog/*","https://kakashinenpo.com/*","https://www.kakashinenpo.com/*","https://kissu.moe/*","https://www.kissu.moe/*","https://lainchan.org/*","https://www.lainchan.org/*","https://merorin.com/*","https://ota-ch.com/*","https://www.ota-ch.com/*","https://ponyville.us/*","https://www.ponyville.us/*","https://smuglo.li/*","https://notso.smuglo.li/*","https://smugloli.net/*","https://smug.nepu.moe/*","https://sportschan.org/*","https://www.sportschan.org/*","https://sushigirl.us/*","https://www.sushigirl.us/*","https://tvch.moe/*"],matches_extra:[],exclude_matches:["*://www.4chan.org/advertise","*://www.4chan.org/advertise?*","*://www.4chan.org/donate","*://www.4chan.org/donate?*","*://www.4channel.org/advertise","*://www.4channel.org/advertise?*","*://www.4channel.org/donate","*://www.4channel.org/donate?*"],
|
||||
grants:["GM_getValue","GM_setValue","GM_deleteValue","GM_listValues","GM_addValueChangeListener","GM_openInTab","GM_xmlhttpRequest","GM.getValue","GM.setValue","GM.deleteValue","GM.listValues","GM.openInTab","GM.xmlHttpRequest"],min:{chrome:"80",firefox:"74",greasemonkey:"1.14"}};const t=Object.create(null),o={VERSION:"XT 2.2.1",NAMESPACE:e.name,sites:Object.create(null),boards:Object.create(null)},n=function(){const e={"&":"&","'":"'",'"':""","<":"<",">":">"},t=/[&"'<>]/g,o=function(t){return e[t]},n=function(e){return e.toString().replace(t,o)};return n.cat=function(e){let t="";for(let o=0;o<e.length;o++)t+=e[o].innerHTML;return t},n}(),a=document,i=a.documentElement,r=console,s=function(){return i};class l{static initClass(){this.Post=new l("Post"),this.Thread=new l("Thread"),this.CatalogThread=new l("Catalog Thread"),this.CatalogThreadNative=new l("Catalog Thread")}constructor(e){this.type=e,this.keys=[]}push({name:e,cb:t}){return this[e]||this.keys.push(e),
|
||||
grants:["GM_getValue","GM_setValue","GM_deleteValue","GM_listValues","GM_addValueChangeListener","GM_openInTab","GM_xmlhttpRequest","GM.getValue","GM.setValue","GM.deleteValue","GM.listValues","GM.openInTab","GM.xmlHttpRequest"],min:{chrome:"80",firefox:"74",greasemonkey:"1.14"}};const t=Object.create(null),o={VERSION:"XT 2.2.2",NAMESPACE:e.name,sites:Object.create(null),boards:Object.create(null)},n=function(){const e={"&":"&","'":"'",'"':""","<":"<",">":">"},t=/[&"'<>]/g,o=function(t){return e[t]},n=function(e){return e.toString().replace(t,o)};return n.cat=function(e){let t="";for(let o=0;o<e.length;o++)t+=e[o].innerHTML;return t},n}(),a=document,i=a.documentElement,r=console,s=function(){return i};class l{static initClass(){this.Post=new l("Post"),this.Thread=new l("Thread"),this.CatalogThread=new l("Catalog Thread"),this.CatalogThreadNative=new l("Catalog Thread")}constructor(e){this.type=e,this.keys=[]}push({name:e,cb:t}){return this[e]||this.keys.push(e),
|
||||
this[e]=t}execute(e,t=this.keys,o=!1){let n;if(!e.callbacksExecuted||o){for(var a of(e.callbacksExecuted=!0,t))try{this[a]?.call(e)}catch(t){n||(n=[]),n.push({message:['"',a,'" crashed on node ',this.type," No.",e.ID," (",e.board,")."].join(""),error:t,html:e.nodes?.root?.outerHTML})}return n?jt.handleErrors(n):void 0}}}l.initClass();const c={main:{Miscellaneous:{"Redirect to HTTPS":[!0,"Redirect to the HTTPS version of 4chan."],"JSON Index":[!0,"Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode."],[`Use ${e.name} Catalog`]:[!0,`Link to ${e.name}'s catalog instead of the native 4chan one.`,1],"Index Refresh Notifications":[!1,"Show a notice at the top of the page when the index is refreshed.",1],"Follow Cursor":[!0,"Image Hover and Quote Preview move with the mouse cursor."],"Open Threads in New Tab":[!1,`Make links to threads in the index / ${e.name} catalog open in a new tab.`],
|
||||
"External Catalog":[!1,"Link to external catalog instead of the internal one."],"Catalog Links":[!1,"Add toggle link in header menu to turn Navigation links into links to each board's catalog."],"Announcement Hiding":[!0,"Add button to hide 4chan announcements."],"Desktop Notifications":[!0,`Enables desktop notifications across various ${e.name} features.`],"404 Redirect":[!0,"Redirect dead threads and images to the archives."],"Archive Report":[!0,"Enable reporting posts to supported archives."],"Exempt Archives from Encryption":[!1,"Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages."],Keybinds:[!0,"Bind actions to keyboard shortcuts."],"Time Formatting":[!0,"Localize and format timestamps."],"Relative Post Dates":[!0,'Display dates like "3 minutes ago". Tooltip shows the timestamp.'],"Relative Date Title":[!0,"Show Relative Post Date only when hovering over dates.",1],
|
||||
"Comment Expansion":[!0,"Expand comments that are too long to display on the index. Not applicable with JSON Index."],"File Info Formatting":[!0,"Reformat the file information."],"Thread Expansion":[!0,"Add buttons to expand threads."],"Index Navigation":[!1,"Add buttons to navigate between threads."],"Reply Navigation":[!1,"Add buttons to navigate to top / bottom of thread."],"Unique ID and Capcode Navigation":[!1,"Add buttons to navigate to posts having the same unique ID or capcode."],"Custom Board Titles":[!0,"Allow editing of the board title and subtitle by ctrl/⌘+clicking them."],"Persistent Custom Board Titles":[!1,"Force custom board titles to be persistent, even if the board titles are updated.",1],"Show Updated Notifications":[!0,`Show notifications when ${e.name} is successfully updated.`],"Color User IDs":[!0,"Assign unique colors to user IDs on boards that use them"],"Count Posts by ID":[!0,"Display number of posts in the thread when hovering over an ID."],
|
||||
@ -596,9 +596,9 @@ Qe.on(i,"click",(function(){return Qe.set("Desktop Notifications",!1),o.close()}
|
||||
domain:"archive.4plebs.org",http:!0,https:!0,software:"foolfuuka",boards:["adv","f","hr","mlpol","mo","o","pol","s4s","sp","tg","trv","tv","x"],files:["adv","f","hr","mlpol","mo","o","pol","s4s","sp","tg","trv","tv","x"],reports:!0},{uid:10,name:"warosu",domain:"warosu.org",http:!1,https:!0,software:"fuuka",boards:["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","vr","vt"],files:["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","vr","vt"],search:["biz","cgl","ck","diy","fa","ic","jp","lit","sci","vr","vt"]},{uid:23,name:"Desuarchive",domain:"desuarchive.org",http:!0,https:!0,software:"foolfuuka",boards:["a","aco","an","c","cgl","co","d","fit","g","his","int","k","m","mlp","mu","q","qa","r9k","tg","trash","vr","wsg"],files:["a","aco","an","c","cgl","co","d","fit","g","his","int","k","m","mlp","mu","q","qa","r9k","tg","trash","vr"],reports:!0},{uid:24,name:"fireden.net",domain:"boards.fireden.net",http:!1,https:!0,software:"foolfuuka",boards:["cm","co","ic","sci","vip","y"],
|
||||
files:["cm","co","ic","sci","vip","y"],search:["cm","co","ic","sci","y"]},{uid:25,name:"arch.b4k.co",domain:"arch.b4k.co",http:!0,https:!0,software:"foolfuuka",boards:["g","mlp","qb","v","vg","vm","vmg","vp","vrpg","vst"],files:["qb","v","vg","vm","vmg","vp","vrpg","vst"],search:["qb","v","vg","vm","vmg","vp","vrpg","vst"]},{uid:29,name:"Archived.Moe",domain:"archived.moe",http:!0,https:!0,software:"foolfuuka",boards:["3","a","aco","adv","an","asp","b","bant","biz","c","can","cgl","ck","cm","co","cock","con","d","diy","e","f","fa","fap","fit","fitlit","g","gd","gif","h","hc","his","hm","hr","i","ic","int","jp","k","lgbt","lit","m","mlp","mlpol","mo","mtv","mu","n","news","o","out","outsoc","p","po","pol","pw","q","qa","qb","qst","r","r9k","s","s4s","sci","soc","sp","spa","t","tg","toy","trash","trv","tv","u","v","vg","vint","vip","vm","vmg","vp","vr","vrpg","vst","vt","w","wg","wsg","wsr","x","xs","y"],
|
||||
files:["can","cock","con","fap","fitlit","gd","mlpol","mo","mtv","outsoc","po","q","qb","qst","spa","vint","vip"],search:["aco","adv","an","asp","b","bant","biz","c","can","cgl","ck","cm","cock","con","d","diy","e","f","fap","fitlit","gd","gif","h","hc","his","hm","hr","i","ic","lgbt","lit","mlpol","mo","mtv","n","news","o","out","outsoc","p","po","pw","q","qa","qst","r","s","soc","spa","trv","u","vint","vip","vrpg","w","wg","wsg","wsr","x","y"],reports:!0},{uid:30,name:"TheBArchive.com",domain:"thebarchive.com",http:!0,https:!0,software:"foolfuuka",boards:["b","bant"],files:["b","bant"],reports:!0},{uid:31,name:"Archive Of Sins",domain:"archiveofsins.com",http:!0,https:!0,software:"foolfuuka",boards:["h","hc","hm","i","lgbt","r","s","soc","t","u"],files:["h","hc","hm","i","lgbt","r","s","soc","t","u"],reports:!0},{uid:34,name:"TokyoChronos",domain:"www.tokyochronos.net",http:!1,https:!0,software:"foolfuuka",boards:["c","g","jp","mu","vp","vrpg","vt"],files:[],reports:!0},{uid:36,
|
||||
name:"palanq.win",domain:"archive.palanq.win",http:!1,https:!0,software:"foolfuuka",boards:["bant","c","con","e","i","n","news","out","p","pw","qst","toy","vip","vp","vt","w","wg","wsr"],files:["bant","c","e","i","n","news","out","p","pw","qst","toy","vip","vp","vt","w","wg","wsr"],reports:!0},{uid:37,name:"Eientei",domain:"eientei.xyz",http:!1,https:!0,software:"Eientei",boards:["3","i","sci","xs"],files:["3","i","sci","xs"],reports:!0}],data:null,init(){if(this.selectArchives(),t.archiveAutoUpdate){const e=Date.now();if(e-2*w>=t.lastarchivecheck||t.lastarchivecheck>e)return this.update()}},selectArchives(){let e,o,n,a;const i={thread:m(),post:m(),file:m()},r=m();for(n of t.archives){var s,l,d;for(var c of["boards","files"])n[c]instanceof Array||(n[c]=[]);if(({uid:d,name:s,boards:o,files:a,software:l}=n),["fuuka","foolfuuka"].includes(l))for(e of(r[JSON.stringify(d??s)]=n,o))e in i.thread||(i.thread[e]=n),e in i.post||"foolfuuka"!==l||(i.post[e]=n),
|
||||
!(e in i.file)&&a.includes(e)&&(i.file[e]=n)}for(e in t.selectedArchives){var h=t.selectedArchives[e];for(var u in h){var p,g=h[u];(p=r[JSON.stringify(g)])&&Qe.hasOwn(i,u)&&(o="file"===u?p.files:p.boards,o.includes(e)&&(i[u][e]=p))}}return Ze.data=i},update(e){let o;const n=[],a=[];let i=0;for(o of t.archiveLists.split("\n"))"#"!==o[0]&&(o=o.trim(),o&&n.push(o));const r=(e,t,o)=>new _e("warning",`Error ${t} archive data from\n${e}\n${o}`,20),s=t=>function(){if(200!==this.status)return r(n[t],"fetching",this.status?`Error ${this.statusText} (${this.status})`:"Connection Error");let{response:o}=this;return o instanceof Array||(o=[o]),a[t]=o,i++,i===n.length?Ze.parse(a,e):void 0};if(n.length)for(let e=0;e<n.length;e++)if(o=n[e],["[","{"].includes(o[0])){var l;try{l=JSON.parse(o)}catch(e){r(o,"parsing",e.message);continue}s(e).call({status:200,response:l})}else He.ajax(o,{onloadend:s(e)});else Ze.parse([],e)},parse(e,o){const n=[],a=m();for(var i of e)for(var r of i){
|
||||
var s=JSON.stringify(r.uid??r.name);s in a?Qe.extend(a[s],r):(a[s]=m.clone(r),n.push(r))}const l={archives:n,lastarchivecheck:Date.now()};return Qe.set(l),Qe.extend(t,l),Ze.selectArchives(),o?.()},to(e,t){const o=(["search","board","threadJSON"].includes(e)?Ze.data.thread:Ze.data[e])[t.boardID];return o?Ze[e](o,t):""},protocol(e){let{protocol:t}=location;return Qe.getOwn(e,t.slice(0,-1))||(t="https:"===t?"http:":"https:"),`${t}//`},thread(e,{boardID:t,threadID:o,postID:n}){let a=o?`${t}/thread/${o}`:`${t}/post/${n}`;return"foolfuuka"===e.software&&(a+="/"),o&&n&&(a+="foolfuuka"===e.software?`#${n}`:`#p${n}`),`${Ze.protocol(e)}${e.domain}/${a}`},threadJSON:(e,{boardID:t,threadID:o})=>`${Ze.protocol(e)}${e.domain}/_/api/chan/thread/?board=${t}&num=${o}`,post(e,{boardID:t,postID:o}){const n=`${Ze.protocol(e)}${e.domain}/_/api/chan/post/?board=${t}&num=${o}`;return Ze.securityCheck(n)?n:""},file(e,{boardID:t,filename:o}){if(!o)return""
|
||||
name:"palanq.win",domain:"archive.palanq.win",http:!1,https:!0,software:"foolfuuka",boards:["bant","c","con","e","i","n","news","out","p","pw","qst","toy","vip","vp","vt","w","wg","wsr"],files:["bant","c","e","i","n","news","out","p","pw","qst","toy","vip","vp","vt","w","wg","wsr"],reports:!0},{uid:37,name:"Eientei",domain:"eientei.xyz",http:!1,https:!0,software:"Eientei",boards:["3","i","sci","xs"],files:["3","i","sci","xs"],reports:!0}],data:null,init(){if(this.selectArchives(),t.archiveAutoUpdate){const e=Date.now();(e-2*w>=t.lastarchivecheck||t.lastarchivecheck>e)&&this.update()}},selectArchives(){const e={thread:new Map,threadJSON:new Map,post:new Map,file:new Map},o=m();for(const a of t.archives){for(var n of["boards","files"])a[n]instanceof Array||(a[n]=[]);const{uid:t,name:i,boards:r,files:s,software:l}=a;if(["fuuka","foolfuuka"].includes(l)){o[JSON.stringify(t??i)]=a;for(const t of r)e.thread.has(t)||e.thread.set(t,a),!e.file.has(t)&&s.includes(t)&&e.file.set(t,a),
|
||||
"foolfuuka"===l&&(e.threadJSON.has(t)||e.threadJSON.set(t,a),e.post.has(t)||e.post.set(t,a))}}for(const n in t.selectedArchives){var a=t.selectedArchives[n];for(const[t,r]of Object.entries(a)){var i;if((i=o[JSON.stringify(r)])&&Qe.hasOwn(e,t)){("file"===t?i.files:i.boards).includes(n)&&e[t].set(n,i)}}}Ze.data=e},update(e){let o;const n=[],a=[];let i=0;for(o of t.archiveLists.split("\n"))"#"!==o[0]&&(o=o.trim(),o&&n.push(o));const r=(e,t,o)=>new _e("warning",`Error ${t} archive data from\n${e}\n${o}`,20),s=t=>function(){if(200!==this.status)return r(n[t],"fetching",this.status?`Error ${this.statusText} (${this.status})`:"Connection Error");let{response:o}=this;return o instanceof Array||(o=[o]),a[t]=o,i++,i===n.length?Ze.parse(a,e):void 0};if(n.length)for(let e=0;e<n.length;e++)if(o=n[e],["[","{"].includes(o[0])){var l;try{l=JSON.parse(o)}catch(e){r(o,"parsing",e.message);continue}s(e).call({status:200,response:l})}else He.ajax(o,{onloadend:s(e)});else Ze.parse([],e)},parse(e,o){
|
||||
const n=[],a=m();for(var i of e)for(var r of i){var s=JSON.stringify(r.uid??r.name);s in a?Qe.extend(a[s],r):(a[s]=m.clone(r),n.push(r))}const l={archives:n,lastarchivecheck:Date.now()};return Qe.set(l),Qe.extend(t,l),Ze.selectArchives(),o?.()},to(e,t){const o=(["search","board"].includes(e)?Ze.data.thread:Ze.data[e]).get(t.boardID);return o?Ze[e](o,t):""},protocol(e){let{protocol:t}=location;return Qe.getOwn(e,t.slice(0,-1))||(t="https:"===t?"http:":"https:"),`${t}//`},thread(e,{boardID:t,threadID:o,postID:n}){let a=o?`${t}/thread/${o}`:`${t}/post/${n}`;return"foolfuuka"===e.software&&(a+="/"),o&&n&&(a+="foolfuuka"===e.software?`#${n}`:`#p${n}`),`${Ze.protocol(e)}${e.domain}/${a}`},threadJSON:(e,{boardID:t,threadID:o})=>`${Ze.protocol(e)}${e.domain}/_/api/chan/thread/?board=${t}&num=${o}`,post(e,{boardID:t,postID:o}){const n=`${Ze.protocol(e)}${e.domain}/_/api/chan/post/?board=${t}&num=${o}`;return Ze.securityCheck(n)?n:""},file(e,{boardID:t,filename:o}){if(!o)return""
|
||||
;if("f"===t)o=encodeURIComponent(Qe.unescape(decodeURIComponent(o)));else if(/[sm]\.jpg$/.test(o))return"";return`${Ze.protocol(e)}${e.domain}/${t}/full_image/${o}`},board:(e,{boardID:t})=>`${Ze.protocol(e)}${e.domain}/${t}/`,search(e,{boardID:t,type:o,value:n}){"capcode"===(o="name"===o?"username":"MD5"===o?"image":o)?n=Qe.getOwn({Developer:"dev",Verified:"ver"},n)||n.toLowerCase():"image"===o&&(n=n.replace(/[+/=]/g,(e=>({"+":"-","/":"_","=":""}[e])))),n=encodeURIComponent(n);const a="foolfuuka"===e.software?`${t}/search/${o}/${n}/`:"image"===o?`${t}/image/${n}`:`${t}/?task=search2&search_${o}=${n}`;return`${Ze.protocol(e)}${e.domain}/${a}`},report(e){const o=[];for(var n of t.archives){var{software:a,https:i,reports:r,boards:s,name:l,domain:d}=n;"foolfuuka"===a&&i&&r&&s instanceof Array&&s.includes(e)&&o.push([l,`https://${d}/_/api/chan/offsite_report/`])}return o},securityCheck:e=>/^https:\/\//.test(e)||"http:"===location.protocol||t["Exempt Archives from Encryption"],
|
||||
navigate(e,t,o){Ze.data||Ze.init();const n=Ze.to(e,t);return n&&(Ze.securityCheck(n)||confirm(`Redirect to ${n}?\n\nYour connection will not be encrypted.`))?location.replace(n):o?location.replace(o):void 0}},et=Ze;class tt{toString(){return this.ID}constructor(e){this.nodes={root:e,thumb:Qe(o.SITE.selectors.catalog.thumb,e)},this.siteID=o.SITE.ID,this.boardID=this.nodes.thumb.parentNode.pathname.split(/\/+/)[1],this.board=o.boards[this.boardID]||new J(this.boardID),this.ID=this.threadID=+(e.dataset.id||e.id).match(/\d*$/)[0],this.thread=this.board.threads.get(this.ID)||new I(this.ID,this.board)}}const ot={init(){if(t.Anonymize)return Qe.addClass(i,"anonymize")}};var nt={init(){if(["index","thread"].includes(o.VIEW))return t["Image Hover"]&&l.Post.push({name:"Image Hover",cb:this.node}),t["Image Hover in Catalog"]?l.CatalogThread.push({name:"Image Hover",cb:this.catalogNode}):void 0},node(){
|
||||
return this.files.filter((e=>(e.isImage||e.isVideo)&&e.thumb)).map((e=>Qe.on(e.thumb,"mouseover",nt.mouseover(this,e))))},catalogNode(){const e=this.thread.OP.files[0];if(e&&(e.isImage||e.isVideo))return Qe.on(this.nodes.thumb,"mouseover",nt.mouseover(this.thread.OP,e))},mouseover:(e,n)=>function(a){let r,s,l;if(!i.contains(this))return;const{isVideo:d}=n;if(n.isExpanding||n.isExpanded||o.SITE.isThumbExpanded?.(n))return;const c=nt.error(e,n);if(j.cache?.dataset.fileID===`${e.fullID}.${n.index}`?(r=j.popCache(),Qe.on(r,"error",c)):(r=Qe.el(d?"video":"img"),r.dataset.fileID=`${e.fullID}.${n.index}`,Qe.on(r,"error",c),r.src=n.url),t["Restart when Opened"]&&(j.rewind(r),j.rewind(this)),r.id="ihover",Qe.add(Xe.hover,r),d&&(r.loop=!0,r.controls=!1,$.setup(r),t.Autoplay&&(r.play(),"VIDEO"===this.nodeName&&(this.currentTime=r.currentTime))),n.dimensions){[l,s]=n.dimensions.split("x").map((e=>+e));const e=i.clientWidth,t=i.clientHeight-L.hover.padding,o=Math.min(1,e/l,t/s);l*=o,s*=o,
|
||||
|
||||
File diff suppressed because one or more lines are too long
41844
builds/4chan-XT.user.js
41844
builds/4chan-XT.user.js
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan XT",
|
||||
"version": "XT 2.2.1",
|
||||
"version": "XT 2.2.2",
|
||||
"manifest_version": 2,
|
||||
"description": "4chan XT is a script that adds various features to anonymous imageboards.",
|
||||
"icons": {
|
||||
|
||||
@ -80,8 +80,8 @@
|
||||
'use strict';
|
||||
|
||||
var version = {
|
||||
"version": "XT 2.2.1",
|
||||
"date": "2023-10-28T17:56:24.449Z"
|
||||
"version": "XT 2.2.2",
|
||||
"date": "2023-10-29T13:00:14.753Z"
|
||||
};
|
||||
|
||||
var meta = {
|
||||
@ -23585,69 +23585,63 @@ vp-replace
|
||||
}]
|
||||
;
|
||||
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||
*/
|
||||
var Redirect = {
|
||||
archives,
|
||||
/** List of archives by compatible functions. */
|
||||
data: null,
|
||||
init() {
|
||||
this.selectArchives();
|
||||
if (Conf['archiveAutoUpdate']) {
|
||||
const now = Date.now();
|
||||
if (now - (2 * DAY) >= Conf['lastarchivecheck'] || Conf['lastarchivecheck'] > now) {
|
||||
return this.update();
|
||||
}
|
||||
if (now - (2 * DAY) >= Conf['lastarchivecheck'] || Conf['lastarchivecheck'] > now)
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
selectArchives() {
|
||||
let boardID, boards, data, files;
|
||||
const o = {
|
||||
thread: dict(),
|
||||
post: dict(),
|
||||
file: dict()
|
||||
thread: new Map(),
|
||||
threadJSON: new Map(),
|
||||
post: new Map(),
|
||||
file: new Map(),
|
||||
};
|
||||
const archives = dict();
|
||||
for (data of Conf['archives']) {
|
||||
var name, software, uid;
|
||||
for (const data of Conf['archives']) {
|
||||
for (var key of ['boards', 'files']) {
|
||||
if (!(data[key] instanceof Array)) {
|
||||
data[key] = [];
|
||||
}
|
||||
}
|
||||
({ uid, name, boards, files, software } = data);
|
||||
const { uid, name, boards, files, software } = data;
|
||||
if (!['fuuka', 'foolfuuka'].includes(software)) {
|
||||
continue;
|
||||
}
|
||||
archives[JSON.stringify(uid ?? name)] = data;
|
||||
for (boardID of boards) {
|
||||
if (!(boardID in o.thread)) {
|
||||
o.thread[boardID] = data;
|
||||
}
|
||||
if (!(boardID in o.post) && (software === 'foolfuuka')) {
|
||||
o.post[boardID] = data;
|
||||
}
|
||||
if (!(boardID in o.file) && files.includes(boardID)) {
|
||||
o.file[boardID] = data;
|
||||
for (const boardID of boards) {
|
||||
if (!o.thread.has(boardID))
|
||||
o.thread.set(boardID, data);
|
||||
if (!o.file.has(boardID) && files.includes(boardID))
|
||||
o.file.set(boardID, data);
|
||||
if (software === 'foolfuuka') {
|
||||
if (!o.threadJSON.has(boardID))
|
||||
o.threadJSON.set(boardID, data);
|
||||
if (!o.post.has(boardID))
|
||||
o.post.set(boardID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (boardID in Conf['selectedArchives']) {
|
||||
for (const boardID in Conf['selectedArchives']) {
|
||||
var record = Conf['selectedArchives'][boardID];
|
||||
for (var type in record) {
|
||||
for (const [type, id] of Object.entries(record)) {
|
||||
var archive;
|
||||
var id = record[type];
|
||||
if ((archive = archives[JSON.stringify(id)]) && $$1.hasOwn(o, type)) {
|
||||
boards = type === 'file' ? archive.files : archive.boards;
|
||||
const boards = type === 'file' ? archive.files : archive.boards;
|
||||
if (boards.includes(boardID)) {
|
||||
o[type][boardID] = archive;
|
||||
o[type].set(boardID, archive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Redirect.data = o;
|
||||
Redirect.data = o;
|
||||
},
|
||||
update(cb) {
|
||||
let url;
|
||||
@ -23722,7 +23716,7 @@ vp-replace
|
||||
return cb?.();
|
||||
},
|
||||
to(dest, data) {
|
||||
const archive = (['search', 'board', 'threadJSON'].includes(dest) ? Redirect.data.thread : Redirect.data[dest])[data.boardID];
|
||||
const archive = (['search', 'board'].includes(dest) ? Redirect.data.thread : Redirect.data[dest]).get(data.boardID);
|
||||
if (!archive) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -1,70 +1,68 @@
|
||||
import Notice from '../classes/Notice.js';
|
||||
import type { default as Post, File } from '../classes/Post.js';
|
||||
import type Thread from '../classes/Thread.js';
|
||||
import { Conf } from '../globals/globals.js';
|
||||
import $ from '../platform/$.js';
|
||||
import CrossOrigin from '../platform/CrossOrigin.js';
|
||||
import { DAY, dict } from '../platform/helpers.js';
|
||||
import archives from './archives.json';
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||
*/
|
||||
|
||||
type Archive = (typeof archives)[number];
|
||||
|
||||
var Redirect = {
|
||||
archives,
|
||||
/** List of archives by compatible functions. */
|
||||
data: null as {
|
||||
thread: Record<any, Thread>,
|
||||
post: Record<any, Post>,
|
||||
file: Record<any, File>,
|
||||
thread: Map<string, Archive>,
|
||||
threadJSON: Map<string, Archive>,
|
||||
post: Map<string, Archive>,
|
||||
file: Map<string, Archive>,
|
||||
},
|
||||
|
||||
init() {
|
||||
this.selectArchives();
|
||||
if (Conf['archiveAutoUpdate']) {
|
||||
const now = Date.now();
|
||||
if (now - (2 * DAY) >= Conf['lastarchivecheck'] || Conf['lastarchivecheck'] > now) { return this.update(); }
|
||||
if (now - (2 * DAY) >= Conf['lastarchivecheck'] || Conf['lastarchivecheck'] > now) this.update();
|
||||
}
|
||||
},
|
||||
|
||||
selectArchives() {
|
||||
let boardID, boards, data, files;
|
||||
const o = {
|
||||
thread: dict(),
|
||||
post: dict(),
|
||||
file: dict()
|
||||
thread: new Map<string, Archive>(),
|
||||
threadJSON: new Map<string, Archive>(),
|
||||
post: new Map<string, Archive>(),
|
||||
file: new Map<string, Archive>(),
|
||||
};
|
||||
|
||||
const archives = dict();
|
||||
for (data of Conf['archives']) {
|
||||
var name, software, uid;
|
||||
for (const data of Conf['archives']) {
|
||||
for (var key of ['boards', 'files']) {
|
||||
if (!(data[key] instanceof Array)) { data[key] = []; }
|
||||
}
|
||||
({uid, name, boards, files, software} = data);
|
||||
const { uid, name, boards, files, software } = data;
|
||||
if (!['fuuka', 'foolfuuka'].includes(software)) { continue; }
|
||||
archives[JSON.stringify(uid ?? name)] = data;
|
||||
for (boardID of boards) {
|
||||
if (!(boardID in o.thread)) { o.thread[boardID] = data; }
|
||||
if (!(boardID in o.post) && (software === 'foolfuuka')) { o.post[boardID] = data; }
|
||||
if (!(boardID in o.file) && files.includes(boardID)) { o.file[boardID] = data; }
|
||||
}
|
||||
}
|
||||
|
||||
for (boardID in Conf['selectedArchives']) {
|
||||
var record = Conf['selectedArchives'][boardID];
|
||||
for (var type in record) {
|
||||
var archive;
|
||||
var id = record[type];
|
||||
if ((archive = archives[JSON.stringify(id)]) && $.hasOwn(o, type)) {
|
||||
boards = type === 'file' ? archive.files : archive.boards;
|
||||
if (boards.includes(boardID)) { o[type][boardID] = archive; }
|
||||
for (const boardID of boards) {
|
||||
if (!o.thread.has(boardID)) o.thread.set(boardID, data);
|
||||
if (!o.file.has(boardID) && files.includes(boardID)) o.file.set(boardID, data);
|
||||
if (software === 'foolfuuka') {
|
||||
if (!o.threadJSON.has(boardID)) o.threadJSON.set(boardID, data);
|
||||
if (!o.post.has(boardID)) o.post.set(boardID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Redirect.data = o;
|
||||
for (const boardID in Conf['selectedArchives']) {
|
||||
var record = Conf['selectedArchives'][boardID];
|
||||
for (const [type, id] of Object.entries(record)) {
|
||||
var archive;
|
||||
if ((archive = archives[JSON.stringify(id)]) && $.hasOwn(o, type)) {
|
||||
const boards = type === 'file' ? archive.files : archive.boards;
|
||||
if (boards.includes(boardID)) { o[type].set(boardID, archive); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Redirect.data = o;
|
||||
},
|
||||
|
||||
update(cb) {
|
||||
@ -139,8 +137,7 @@ var Redirect = {
|
||||
dest: 'post' | 'thread' | 'threadJSON' | 'file' | 'board' | 'search',
|
||||
data: { boardID: string, threadID?: string | number, postID?: string | number }
|
||||
): string {
|
||||
const archive =
|
||||
(['search', 'board', 'threadJSON'].includes(dest) ? Redirect.data.thread : Redirect.data[dest])[data.boardID];
|
||||
const archive = (['search', 'board'].includes(dest) ? Redirect.data.thread : Redirect.data[dest]).get(data.boardID);
|
||||
if (!archive) { return ''; }
|
||||
return Redirect[dest](archive, data);
|
||||
},
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "XT 2.2.1",
|
||||
"date": "2023-10-28T17:56:24.449Z"
|
||||
"version": "XT 2.2.2",
|
||||
"date": "2023-10-29T13:00:14.753Z"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user