2.2.3: Fixed error when "Force Noscript Captcha" is enabled.

This commit is contained in:
Tuxedo Takodachi 2023-11-08 17:30:57 +01:00
parent 45a3a49da8
commit ebe35f2972
10 changed files with 38 additions and 49 deletions

View File

@ -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.3 (2023-11-08)
- Fixed error when "Force Noscript Captcha" is enabled.
### XT v2.2.2 (2023-10-29)
- Fixed trying to get thread JSON from unsupported archives.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan XT
// @version XT 2.2.2
// @version XT 2.2.3
// @minGMVer 1.14
// @minFFVer 74
// @namespace 4chan-XT

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan XT
// @version XT 2.2.2
// @version XT 2.2.3
// @minGMVer 1.14
// @minFFVer 74
// @namespace 4chan-XT

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan XT
// @version XT 2.2.2
// @version XT 2.2.3
// @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.2",NAMESPACE:e.name,sites:Object.create(null),boards:Object.create(null)},n=function(){const e={"&":"&amp;","'":"&#039;",'"':"&quot;","<":"&lt;",">":"&gt;"},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.3",NAMESPACE:e.name,sites:Object.create(null),boards:Object.create(null)},n=function(){const e={"&":"&amp;","'":"&#039;",'"':"&quot;","<":"&lt;",">":"&gt;"},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."],
@ -222,8 +222,8 @@ Mayhem:["iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFklE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AAAAMklEQVQI12NggAFmY2MDECaNAQZCilAzVJyg5oS4GqAxUtygjIp2KGOKJ5SxepcB3BUAcdYRqxAtgFoAAAAASUVORK5CYII=","iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAAA1/GhpCidAAAAAXRSTlMAQObYZgAAABJJREFUCB1jZGBgrMNAQEEc4gCSfAX5bRw/NQAAAABJRU5ErkJggg==","iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAAAAAAAAAA1/H///8AISUALzQAeokACAkAQEcAorYAMTcE9WFNAAAAA3RSTlMAPse+s4iwAAAAMklEQVQI12NggAFmY2MDECaNAQZCilAzVJyg5oS4GqAxUtygjIp2KGOKJ5SxepcB3BUAcdYRqxAtgFoAAAAASUVORK5CYII=","iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAABV/wErM5hwAAAAAXRSTlMAQObYZgAAABJJREFUCB1jZGBgrMNAQEEc4gCSfAX5bRw/NQAAAABJRU5ErkJggg==","iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAAAAAAAABV/wH///8NKAASOAAwkQADCgAZTABAwQATOwC5e3VGAAAAA3RSTlMAPse+s4iwAAAAMklEQVQI12NggAFmY2MDECaNAQZCilAzVJyg5oS4GqAxUtygjIp2KGOKJ5SxepcB3BUAcdYRqxAtgFoAAAAASUVORK5CYII="]
};e=Qe.getOwn(e,t.favicon);const o=h;let n=0;for(;e[n];)e[n]="data:image/png;base64,"+e[n++];return[o.unreadDead,o.unreadDeadY,o.unreadSFW,o.unreadSFWY,o.unreadNSFW,o.unreadNSFWY]=e,o.update()},update(){return this.isSFW?(this.unread=this.unreadSFW,this.unreadY=this.unreadSFWY):(this.unread=this.unreadNSFW,this.unreadY=this.unreadNSFWY)},SFW:"//s.4cdn.org/image/favicon-ws.ico",NSFW:"//s.4cdn.org/image/favicon.ico",dead:"data:image/gif;base64,R0lGODlhEAAQAKECAAAAAP8AAP///////yH5BAEKAAIALAAAAAAQABAAAAIvlI+pq+D9DAgUoFkPDlbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==",logo:"data:image/png;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw=="};const u=(e,t=a.body)=>Array.from(t.querySelectorAll(e)),p={init(){if(!("yotsuba"!==o.SITE.software||a.cookie.indexOf("pass_enabled=1")>=0)){
if(!t["Force Noscript Captcha"]||!jt.jsEnabled)return t.captchaLanguage.trim()?["boards.4chan.org","boards.4channel.org"].includes(location.hostname)?Qe.onExists(i,"#captchaFormPart",(e=>Qe.onExists(e,'iframe[src^="https://www.google.com/recaptcha/"]',$e.replace.iframe))):Qe.onExists(i,'iframe[src^="https://www.google.com/recaptcha/"]',$e.replace.iframe):void 0;Qe.ready($e.replace.noscript)}},noscript(){let e,t,o;if(!(t=Qe("#g-recaptcha"))||!(e=Qe("noscript",t.parentNode)))return;const n=Qe.el("span",{id:"captcha-forced-noscript"});Qe.replace(e,n),Qe.rm(t);const a=function(){return n.innerHTML=e.textContent,$e.replace.iframe(Qe('iframe[src^="https://www.google.com/recaptcha/"]',n))};return(o=Qe("#togglePostFormLink a, #form-link"))?Qe.on(o,"click",a):a()},iframe(e){let o;if(o=t.captchaLanguage.trim()){const t=/[?&]hl=/.test(e.src)?e.src.replace(/([?&]hl=)[^&]*/,"$1"+encodeURIComponent(o)):e.src+`&hl=${encodeURIComponent(o)}`;e.src!==t&&(e.src=t)}}},g={init(){
};e=Qe.getOwn(e,t.favicon);const o=h;let n=0;for(;e[n];)e[n]="data:image/png;base64,"+e[n++];return[o.unreadDead,o.unreadDeadY,o.unreadSFW,o.unreadSFWY,o.unreadNSFW,o.unreadNSFWY]=e,o.update()},update(){return this.isSFW?(this.unread=this.unreadSFW,this.unreadY=this.unreadSFWY):(this.unread=this.unreadNSFW,this.unreadY=this.unreadNSFWY)},SFW:"//s.4cdn.org/image/favicon-ws.ico",NSFW:"//s.4cdn.org/image/favicon.ico",dead:"data:image/gif;base64,R0lGODlhEAAQAKECAAAAAP8AAP///////yH5BAEKAAIALAAAAAAQABAAAAIvlI+pq+D9DAgUoFkPDlbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==",logo:"data:image/png;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw=="};const u=(e,t=a.body)=>Array.from(t.querySelectorAll(e)),p={init(){
"yotsuba"!==o.SITE.software||a.cookie.indexOf("pass_enabled=1")>=0||(t["Force Noscript Captcha"]&&jt.jsEnabled?Qe.ready(this.noscript):t.captchaLanguage.trim()&&(["boards.4chan.org","boards.4channel.org"].includes(location.hostname)?Qe.onExists(i,"#captchaFormPart",(e=>Qe.onExists(e,'iframe[src^="https://www.google.com/recaptcha/"]',this.iframe))):Qe.onExists(i,'iframe[src^="https://www.google.com/recaptcha/"]',this.iframe)))},noscript(){let e,t,o;if(!(t=Qe("#g-recaptcha"))||!(e=Qe("noscript",t.parentNode)))return;const n=Qe.el("span",{id:"captcha-forced-noscript"});Qe.replace(e,n),Qe.rm(t);const a=function(){n.innerHTML=e.textContent,this.iframe(Qe('iframe[src^="https://www.google.com/recaptcha/"]',n))};(o=Qe("#togglePostFormLink a, #form-link"))?Qe.on(o,"click",a):a()},iframe(e){let o;if(o=t.captchaLanguage.trim()){const t=/[?&]hl=/.test(e.src)?e.src.replace(/([?&]hl=)[^&]*/,"$1"+encodeURIComponent(o)):e.src+`&hl=${encodeURIComponent(o)}`;e.src!==t&&(e.src=t)}}},g={init(){
if(a.cookie.indexOf("pass_enabled=1")>=0)return;if(!(this.isEnabled=!!Qe("#t-root")||!Qe.id("postForm")))return;const e=Qe.el("div",{className:"captcha-root"});return this.nodes={root:e},Qe.addClass(je.nodes.el,"has-captcha","captcha-t"),Qe.after(je.nodes.com.parentNode,e)},moreNeeded(){},getThread(){let e;const t=o.BOARD.ID;return e="new"===je.posts[0].thread?"0":""+je.posts[0].thread,{boardID:t,threadID:e}},setup(e){if(this.isEnabled)return this.nodes.container||(this.nodes.container=Qe.el("div",{className:"captcha-container"}),Qe.prepend(this.nodes.root,this.nodes.container),g.currentThread=g.getThread(),Qe.global((function(){const e=document.querySelector("#qr .captcha-container");return window.TCaptcha.init(e,this.boardID,+this.threadID),window.TCaptcha.setErrorCb((e=>window.dispatchEvent(new CustomEvent("CreateNotification",{detail:{type:"warning",content:""+e}}))))}),g.currentThread)),e?Qe("#t-resp").focus():void 0},destroy(){
if(this.isEnabled&&this.nodes.container)return Qe.global((()=>window.TCaptcha.destroy())),Qe.rm(this.nodes.container),delete this.nodes.container},updateThread(){if(!this.isEnabled)return;const{boardID:e,threadID:t}=g.currentThread||{},o=g.getThread();return o.boardID!==e||o.threadID!==t?(g.destroy(),g.setup()):void 0},getOne(){let e,t={};if(this.nodes.container)for(var o of["t-response","t-challenge"])t[o]=Qe(`[name='${o}']`,this.nodes.container).value;return t["t-response"]||(e=Qe("#t-msg"))&&/Verification not required/i.test(e.textContent)||(t=null),t},setUsed(){if(this.isEnabled)return this.nodes.container?Qe.global((()=>window.TCaptcha.clearChallenge())):void 0},occupied(){return!!this.nodes.container}},f=(e,t)=>{let o=0,n=null,a=null,i=null;const r=function(){return o=Date.now(),t.apply(a,i)};return function(){return i=arguments,a=this,o<Date.now()-e?r():(clearTimeout(n),n=setTimeout(r,e))}},m=()=>Object.create(null);m.clone=function(e){if("object"!=typeof e||null===e)return e
;if(e instanceof Array){const t=[];for(let o=0,n=e.length;o<n;o++)t.push(m.clone(e[o]));return t}{const n=Object.create(null);for(var t in e){var o=e[t];n[t]=m.clone(o)}return n}},m.json=e=>m.clone(JSON.parse(e));const b=1e3,A=6e4,v=36e5,w=24*v,x=window.GM_xmlhttpRequest?"userscript":"crx";class y{static initClass(){this.keys=["hiddenThreads","hiddenPosts","lastReadPosts","yourPosts","watchedThreads","watcherLastModified","customTitles"]}constructor(e,o,n){if(this.changes=[],this.onSync=this.onSync.bind(this),this.key=e,this.initData(t[this.key]),Qe.sync(this.key,this.onSync),n||this.clean(),o){var i=()=>(Qe.off(a,"4chanXInitFinished",i),this.sync=o);Qe.on(a,"4chanXInitFinished",i)}}initData(e){let t;if(this.data=e,this.data.boards){let e;({boards:t,lastChecked:e}=this.data),this.data["4chan.org"]={boards:t,lastChecked:e},delete this.data.boards,delete this.data.lastChecked}return this.data[o.SITE.ID]||(this.data[o.SITE.ID]={boards:m()})}save(e,t){return e(),this.changes.push(e),

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan XT
// @version XT 2.2.2
// @version XT 2.2.3
// @minGMVer 1.14
// @minFFVer 74
// @namespace 4chan-XT
@ -193,8 +193,8 @@
'use strict';
var version = {
"version": "XT 2.2.2",
"date": "2023-10-29T13:00:14.753Z"
"version": "XT 2.2.3",
"date": "2023-11-08T16:25:49.335Z"
};
var meta = {
@ -1868,25 +1868,20 @@ https://*.hcaptcha.com
const $$ = (selector, root = d$1.body) => Array.from(root.querySelectorAll(selector));
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
const CaptchaReplace = {
init() {
if ((g.SITE.software !== 'yotsuba') || (d$1.cookie.indexOf('pass_enabled=1') >= 0)) { return; }
if (Conf['Force Noscript Captcha'] && Main$1.jsEnabled) {
$$1.ready(Captcha.replace.noscript);
$$1.ready(this.noscript);
return;
}
if (Conf['captchaLanguage'].trim()) {
if (['boards.4chan.org', 'boards.4channel.org'].includes(location.hostname)) {
return $$1.onExists(doc$1, '#captchaFormPart', node => $$1.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe));
$$1.onExists(doc$1, '#captchaFormPart', node => $$1.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe));
} else {
return $$1.onExists(doc$1, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe);
$$1.onExists(doc$1, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe);
}
}
},
@ -1900,12 +1895,12 @@ https://*.hcaptcha.com
$$1.rm(original);
const insert = function() {
span.innerHTML = noscript.textContent;
return Captcha.replace.iframe($$1('iframe[src^="https://www.google.com/recaptcha/"]', span));
this.iframe($$1('iframe[src^="https://www.google.com/recaptcha/"]', span));
};
if (toggle = $$1('#togglePostFormLink a, #form-link')) {
return $$1.on(toggle, 'click', insert);
$$1.on(toggle, 'click', insert);
} else {
return insert();
insert();
}
},

View File

@ -1,6 +1,6 @@
{
"name": "4chan XT",
"version": "XT 2.2.2",
"version": "XT 2.2.3",
"manifest_version": 2,
"description": "4chan XT is a script that adds various features to anonymous imageboards.",
"icons": {

View File

@ -80,8 +80,8 @@
'use strict';
var version = {
"version": "XT 2.2.2",
"date": "2023-10-29T13:00:14.753Z"
"version": "XT 2.2.3",
"date": "2023-11-08T16:25:49.335Z"
};
var meta = {
@ -1755,25 +1755,20 @@ https://*.hcaptcha.com
const $$ = (selector, root = d$1.body) => Array.from(root.querySelectorAll(selector));
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
const CaptchaReplace = {
init() {
if ((g.SITE.software !== 'yotsuba') || (d$1.cookie.indexOf('pass_enabled=1') >= 0)) { return; }
if (Conf['Force Noscript Captcha'] && Main$1.jsEnabled) {
$$1.ready(Captcha.replace.noscript);
$$1.ready(this.noscript);
return;
}
if (Conf['captchaLanguage'].trim()) {
if (['boards.4chan.org', 'boards.4channel.org'].includes(location.hostname)) {
return $$1.onExists(doc$1, '#captchaFormPart', node => $$1.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe));
$$1.onExists(doc$1, '#captchaFormPart', node => $$1.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe));
} else {
return $$1.onExists(doc$1, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe);
$$1.onExists(doc$1, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe);
}
}
},
@ -1787,12 +1782,12 @@ https://*.hcaptcha.com
$$1.rm(original);
const insert = function() {
span.innerHTML = noscript.textContent;
return Captcha.replace.iframe($$1('iframe[src^="https://www.google.com/recaptcha/"]', span));
this.iframe($$1('iframe[src^="https://www.google.com/recaptcha/"]', span));
};
if (toggle = $$1('#togglePostFormLink a, #form-link')) {
return $$1.on(toggle, 'click', insert);
$$1.on(toggle, 'click', insert);
} else {
return insert();
insert();
}
},

View File

@ -1,26 +1,21 @@
import { g, Conf, doc, d } from "../globals/globals";
import Main from "../main/Main";
import $ from "../platform/$";
import Captcha from "./Captcha";
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
const CaptchaReplace = {
init() {
if ((g.SITE.software !== 'yotsuba') || (d.cookie.indexOf('pass_enabled=1') >= 0)) { return; }
if (Conf['Force Noscript Captcha'] && Main.jsEnabled) {
$.ready(Captcha.replace.noscript);
$.ready(this.noscript);
return;
}
if (Conf['captchaLanguage'].trim()) {
if (['boards.4chan.org', 'boards.4channel.org'].includes(location.hostname)) {
return $.onExists(doc, '#captchaFormPart', node => $.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe));
$.onExists(doc, '#captchaFormPart', node => $.onExists(node, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe));
} else {
return $.onExists(doc, 'iframe[src^="https://www.google.com/recaptcha/"]', Captcha.replace.iframe);
$.onExists(doc, 'iframe[src^="https://www.google.com/recaptcha/"]', this.iframe);
}
}
},
@ -34,12 +29,12 @@ const CaptchaReplace = {
$.rm(original);
const insert = function() {
span.innerHTML = noscript.textContent;
return Captcha.replace.iframe($('iframe[src^="https://www.google.com/recaptcha/"]', span));
this.iframe($('iframe[src^="https://www.google.com/recaptcha/"]', span));
};
if (toggle = $('#togglePostFormLink a, #form-link')) {
return $.on(toggle, 'click', insert);
$.on(toggle, 'click', insert);
} else {
return insert();
insert();
}
},

View File

@ -1,4 +1,4 @@
{
"version": "XT 2.2.2",
"date": "2023-10-29T13:00:14.753Z"
"version": "XT 2.2.3",
"date": "2023-11-08T16:25:49.335Z"
}