From bd9ae51dcf554c382165e8c6574d77833c821d74 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:46:18 +0900 Subject: [PATCH] ci: update userscripts (#243) Co-authored-by: Robot-Inventor <50550561+Robot-Inventor@users.noreply.github.com> --- index.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.user.js b/index.user.js index 9d94993..13c20a2 100644 --- a/index.user.js +++ b/index.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Hide View Count // @namespace https://github.com/Robot-Inventor/hide-view-count -// @version 2.2.1 +// @version 2.2.2 // @description This extension hides the number of impressions on Twitter and prevents the creation of an approval desire monster. It won't allow the View Count to be displayed for even a second! // @author Robot-Inventor (ろぼいん / @keita_roboin) // @match https://twitter.com/* @@ -15,5 +15,5 @@ // @updateURL https://raw.githubusercontent.com/Robot-Inventor/hide-view-count/main/index.user.js // @grant none // ==/UserScript== -(()=>{"use strict";let e;var t={16:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function p(e){try{s(n.next(e))}catch(e){i(e)}}function l(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(p,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.asyncQuerySelectorAll=t.asyncQuerySelector=void 0;let n=(e,t)=>new Promise(r=>{let n=e();if(n instanceof Element||n instanceof NodeList&&n.length){r(n);return}let o=null,i=new MutationObserver(()=>{let t=e();(t instanceof Element||t instanceof NodeList&&t.length)&&(i.disconnect(),o&&clearTimeout(o),r(t))});o=setTimeout(()=>{i.disconnect(),r(null)},t),i.observe(document.body,{attributes:!0,childList:!0,subtree:!0})});t.asyncQuerySelector=(e,...t)=>r(void 0,[e,...t],void 0,function*(e,t=document,r=500){return yield n(()=>t.querySelector(e),r)});t.asyncQuerySelectorAll=(e,...t)=>r(void 0,[e,...t],void 0,function*(e,t=document,r=500){var o;return null!==(o=yield n(()=>t.querySelectorAll(e),r))&&void 0!==o?o:document.createDocumentFragment().childNodes})}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e].call(i.exports,i,i.exports,n),i.exports}n.rv=function(){return"1.1.0"},n.ruid="bundler=rspack@1.1.0";let o=e=>{let t=Object.getOwnPropertyNames(e).filter(e=>e.startsWith("__reactProps$"));return t.length?e[t[0]]:null};class i{profileElement;constructor(e){this.profileElement=e}get props(){var e;let t=o(this.profileElement);if(!((null!==(e=t)&&"object"==typeof e||"function"==typeof e)&&Array.isArray(e.children)&&(null!==e.children[0]&&"object"==typeof e.children[0]||"function"==typeof e.children[0])&&(null!==e.children[0].props&&"object"==typeof e.children[0].props||"function"==typeof e.children[0].props)&&Array.isArray(e.children[0].props.children)&&(null!==e.children[0].props.children[1]&&"object"==typeof e.children[0].props.children[1]||"function"==typeof e.children[0].props.children[1])&&(null!==e.children[0].props.children[1].props&&"object"==typeof e.children[0].props.children[1].props||"function"==typeof e.children[0].props.children[1].props)&&(null!==e.children[0].props.children[1].props.user&&"object"==typeof e.children[0].props.children[1].props.user||"function"==typeof e.children[0].props.children[1].props.user)&&(void 0===e.children[0].props.children[1].props.user.possibly_sensitive||null===e.children[0].props.children[1].props.user.possibly_sensitive||!1===e.children[0].props.children[1].props.user.possibly_sensitive||!0===e.children[0].props.children[1].props.user.possibly_sensitive)&&"string"==typeof e.children[0].props.children[1].props.user.screen_name&&(""===e.children[0].props.children[1].props.user.profile_interstitial_type||"sensitive_media"===e.children[0].props.children[1].props.user.profile_interstitial_type||"fake_account"===e.children[0].props.children[1].props.user.profile_interstitial_type||"offensive_profile_content"===e.children[0].props.children[1].props.user.profile_interstitial_type||"timeout"===e.children[0].props.children[1].props.user.profile_interstitial_type)&&Array.isArray(e.children[0].props.children[1].props.user.withheld_in_countries)&&e.children[0].props.children[1].props.user.withheld_in_countries.every(e=>"string"==typeof e)))throw Error("Failed to get React props of profile");return t.children[0].props.children[1].props.user}}let p=["pro.twitter.com","pro.x.com"];var l=n("16");let s=e=>"TEXTAREA"===e.tagName,c=e=>s(e)?e:e.parentElement,d=async(e,t)=>{let r=p.includes(location.hostname),n=await (0,l.asyncQuerySelectorAll)(r?"[role='dialog'] [data-text='true'], [role='dialog'] textarea[data-testid='tweetTextarea_0']":"[role='dialog'] [data-text='true'], textarea[data-testid='tweetTextarea_0']",document,t);if(!n.length)throw Error("[twi-ext] Failed to get text box marker of tweet");for(let e=0;e{open(`https://x.com/intent/tweet?text=${encodeURIComponent(e)}`,"_blank")};class a{tweetElement;constructor(e){this.tweetElement=e}getMenuBar(){let e=this.tweetElement.querySelector("div[role='group'][id]");if(!e)throw Error("[twi-ext] Failed to get menu bar of tweet");return e}get element(){return this.tweetElement}get props(){var e;let t=o(this.getMenuBar());if(!((null!==(e=t)&&"object"==typeof e||"function"==typeof e)&&Array.isArray(e.children)&&(null!==e.children[1]&&"object"==typeof e.children[1]||"function"==typeof e.children[1])&&(null!==e.children[1].props&&"object"==typeof e.children[1].props||"function"==typeof e.children[1].props)&&(null!==e.children[1].props.retweetWithCommentLink&&"object"==typeof e.children[1].props.retweetWithCommentLink||"function"==typeof e.children[1].props.retweetWithCommentLink)&&(null!==e.children[1].props.retweetWithCommentLink.state&&"object"==typeof e.children[1].props.retweetWithCommentLink.state||"function"==typeof e.children[1].props.retweetWithCommentLink.state)&&(null!==e.children[1].props.retweetWithCommentLink.state.quotedStatus&&"object"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus||"function"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus)&&(void 0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||null===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||!1===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||!0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive)&&(void 0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||null===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||!1===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||!0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable)&&"string"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus.permalink&&(null!==e.children[1].props.retweetWithCommentLink.state.quotedStatus.user&&"object"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus.user||"function"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus.user)&&(void 0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||null===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||!1===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||!0===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive)&&"string"==typeof e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.screen_name&&(""===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"sensitive_media"===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"fake_account"===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"offensive_profile_content"===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"timeout"===e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type)&&Array.isArray(e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.withheld_in_countries)&&e.children[1].props.retweetWithCommentLink.state.quotedStatus.user.withheld_in_countries.every(e=>"string"==typeof e)))throw Error("[twi-ext] Failed to get React props of tweet");return t.children[1].props.retweetWithCommentLink.state.quotedStatus}get metadata(){var e,t;let r=this.props.user.screen_name,n=o(this.element);if(!n)throw Error("[twi-ext] Failed to get React props of tweet");let i=null;let p=(null!==(e=n)&&"object"==typeof e||"function"==typeof e)&&Array.isArray(e.children)&&Array.isArray(e.children[0])&&(null!==e.children[0][1]&&"object"==typeof e.children[0][1]||"function"==typeof e.children[0][1])&&(null!==e.children[0][1].props&&"object"==typeof e.children[0][1].props||"function"==typeof e.children[0][1].props)&&Array.isArray(e.children[0][1].props.children)&&(null!==e.children[0][1].props.children[0]&&"object"==typeof e.children[0][1].props.children[0]||"function"==typeof e.children[0][1].props.children[0])&&(null!==e.children[0][1].props.children[0].props&&"object"==typeof e.children[0][1].props.children[0].props||"function"==typeof e.children[0][1].props.children[0].props)&&Array.isArray(e.children[0][1].props.children[0].props.children)&&(null!==e.children[0][1].props.children[0].props.children[2]&&"object"==typeof e.children[0][1].props.children[0].props.children[2]||"function"==typeof e.children[0][1].props.children[0].props.children[2])&&(null!==e.children[0][1].props.children[0].props.children[2].props&&"object"==typeof e.children[0][1].props.children[0].props.children[2].props||"function"==typeof e.children[0][1].props.children[0].props.children[2].props)&&Array.isArray(e.children[0][1].props.children[0].props.children[2].props.children)&&(null!==e.children[0][1].props.children[0].props.children[2].props.children[7]&&"object"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7]||"function"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7])&&(null!==e.children[0][1].props.children[0].props.children[2].props.children[7].props&&"object"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7].props||"function"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7].props)&&(null!==e.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser&&"object"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser||"function"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser)&&"string"==typeof e.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser.screen_name;if((null!==(t=n)&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.children)&&Array.isArray(t.children[0])&&(null!==t.children[0][1]&&"object"==typeof t.children[0][1]||"function"==typeof t.children[0][1])&&(null!==t.children[0][1].props&&"object"==typeof t.children[0][1].props||"function"==typeof t.children[0][1].props)&&Array.isArray(t.children[0][1].props.children)&&(null!==t.children[0][1].props.children[0]&&"object"==typeof t.children[0][1].props.children[0]||"function"==typeof t.children[0][1].props.children[0])&&(null!==t.children[0][1].props.children[0].props&&"object"==typeof t.children[0][1].props.children[0].props||"function"==typeof t.children[0][1].props.children[0].props)&&Array.isArray(t.children[0][1].props.children[0].props.children)&&(null!==t.children[0][1].props.children[0].props.children[1]&&"object"==typeof t.children[0][1].props.children[0].props.children[1]||"function"==typeof t.children[0][1].props.children[0].props.children[1])&&(null!==t.children[0][1].props.children[0].props.children[1].props&&"object"==typeof t.children[0][1].props.children[0].props.children[1].props||"function"==typeof t.children[0][1].props.children[0].props.children[1].props)&&Array.isArray(t.children[0][1].props.children[0].props.children[1].props.children)&&Array.isArray(t.children[0][1].props.children[0].props.children[1].props.children[1])&&(null!==t.children[0][1].props.children[0].props.children[1].props.children[1][2]&&"object"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2]||"function"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2])&&(null!==t.children[0][1].props.children[0].props.children[1].props.children[1][2].props&&"object"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2].props||"function"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2].props)&&(null!==t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser&&"object"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser||"function"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser)&&"string"==typeof t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser.screen_name)i=n.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser.screen_name;return p&&(i=n.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser.screen_name),{isFocalMode:p,isPostedByCurrentUser:r===i}}async clickRetweetButton(e){let t=await (0,l.asyncQuerySelector)("[data-testid='unretweet'], [data-testid='retweet']",this.tweetElement,e);if(!t)throw Error("[twi-ext] Failed to get retweet button of tweet");t.click()}static async clickQuoteButton(e){let t=await (0,l.asyncQuerySelector)("[data-testid='Dropdown'] [href='/compose/post'],[data-testid='sheetDialog'] [href='/compose/post']",document,e);if(!t)throw Error("[twi-ext] Failed to get quote button of tweet");t.click()}async quoteTweet(e,t=1e3,r=!1){let n=this.props.permalink,o=`${e} -https://x.com${n}`;if(r){h(o);return}try{await this.clickRetweetButton(t),await a.clickQuoteButton(t),await d(e,t)}catch{h(o)}}}let u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},f=new Uint8Array(16),y=[];for(let e=0;e<256;++e)y.push((e+256).toString(16).slice(1));function m(e,t=0){return(y[e[t+0]]+y[e[t+1]]+y[e[t+2]]+y[e[t+3]]+"-"+y[e[t+4]]+y[e[t+5]]+"-"+y[e[t+6]]+y[e[t+7]]+"-"+y[e[t+8]]+y[e[t+9]]+"-"+y[e[t+10]]+y[e[t+11]]+y[e[t+12]]+y[e[t+13]]+y[e[t+14]]+y[e[t+15]]).toLowerCase()}let w=function(t,r,n){if(u.randomUUID&&!r&&!t)return u.randomUUID();let o=(t=t||{}).random||(t.rng||function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(f)})();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,r){n=n||0;for(let e=0;e<16;++e)r[n+e]=o[e];return r}return m(o)};var b=function(){var e=document.querySelectorAll("[role='group'] a[href$='analytics']"),t=!0,r=!1,n=void 0;try{for(var o,i,p,l=e[Symbol.iterator]();!(t=(p=l.next()).done);t=!0){var s=p.value;s.parentElement&&(s.href="",s.parentElement.style.display="none")}}catch(e){r=!0,n=e}finally{try{!t&&null!=l.return&&l.return()}finally{if(r)throw n}}var c=document.querySelector("a[aria-describedby] time");if(null==c?void 0:null===(i=c.parentElement)||void 0===i?void 0:null===(o=i.parentElement)||void 0===o?void 0:o.parentElement){var d=c.parentElement.parentElement.parentElement.querySelectorAll("div ~ *"),h=!0,a=!1,u=void 0;try{for(var f,y=d[Symbol.iterator]();!(h=(f=y.next()).done);h=!0)f.value.style.display="none"}catch(e){a=!0,u=e}finally{try{!h&&null!=y.return&&y.return()}finally{if(a)throw u}}}};new class e{OBSERVER_OPTIONS={childList:!0,subtree:!0};onNewTweetCallback=null;onNewProfileCallback=null;constructor(e){let t=`data-twi-ext-checked-${w()}`,r={timeoutMs:1e4,...e},n=new MutationObserver(()=>{if(this.onNewTweetCallback)for(let e of document.querySelectorAll(`[data-testid="tweet"]:not([${t}])`))e.setAttribute(t,""),this.onNewTweetCallback(new a(e));if(this.onNewProfileCallback){let e=document.querySelector(`:not([data-testid="tweet"]) [data-testid="UserName"]:not([${t}])`);e&&(e.setAttribute(t,""),this.onNewProfileCallback(new i(e)))}});(0,l.asyncQuerySelector)("main",document,r.timeoutMs).then(e=>{if(!e)throw Error("[twi-ext] Failed to get main element");n.observe(e,this.OBSERVER_OPTIONS)}),(0,l.asyncQuerySelector)("#layers",document,r.timeoutMs).then(e=>{if(!e)throw Error("[twi-ext] Failed to get #layers element");n.observe(e,this.OBSERVER_OPTIONS)})}onNewTweet(e){this.onNewTweetCallback=e}onNewProfile(e){this.onNewProfileCallback=e}}().onNewTweet(function(){b()})})(); \ No newline at end of file +(()=>{"use strict";var e={16:function(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(l,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?l(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(i,s)}c((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.asyncQuerySelectorAll=t.asyncQuerySelector=void 0;let n=(e,t)=>new Promise(r=>{let n=e();if(n instanceof Element||n instanceof NodeList&&n.length){r(n);return}let l=null,o=new MutationObserver(()=>{let t=e();(t instanceof Element||t instanceof NodeList&&t.length)&&(o.disconnect(),l&&clearTimeout(l),r(t))});l=setTimeout(()=>{o.disconnect(),r(null)},t),o.observe(document.body,{attributes:!0,childList:!0,subtree:!0})});t.asyncQuerySelector=(e,...t)=>r(void 0,[e,...t],void 0,function*(e,t=document,r=500){return yield n(()=>t.querySelector(e),r)});t.asyncQuerySelectorAll=(e,...t)=>r(void 0,[e,...t],void 0,function*(e,t=document,r=500){var l;return null!==(l=yield n(()=>t.querySelectorAll(e),r))&&void 0!==l?l:document.createDocumentFragment().childNodes})}},t={};function r(n){var l=t[n];if(void 0!==l)return l.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.rv=function(){return"1.1.8"},r.ruid="bundler=rspack@1.1.8";let n=(()=>{let e=e=>Array.isArray(e.children)&&2===e.children.length&&"object"==typeof e.children[1]&&null!==e.children[1]&&t(e.children[1]),t=e=>"object"==typeof e.props&&null!==e.props&&r(e.props),r=e=>"object"==typeof e.retweetWithCommentLink&&null!==e.retweetWithCommentLink&&n(e.retweetWithCommentLink),n=e=>"object"==typeof e.state&&null!==e.state&&l(e.state),l=e=>"object"==typeof e.quotedStatus&&null!==e.quotedStatus&&o(e.quotedStatus),o=e=>(null===e.possibly_sensitive||void 0===e.possibly_sensitive||"boolean"==typeof e.possibly_sensitive)&&(null===e.possibly_sensitive_editable||void 0===e.possibly_sensitive_editable||"boolean"==typeof e.possibly_sensitive_editable)&&"string"==typeof e.permalink&&"object"==typeof e.user&&null!==e.user&&i(e.user),i=e=>(null===e.possibly_sensitive||void 0===e.possibly_sensitive||"boolean"==typeof e.possibly_sensitive)&&"string"==typeof e.screen_name&&(""===e.profile_interstitial_type||"sensitive_media"===e.profile_interstitial_type||"fake_account"===e.profile_interstitial_type||"offensive_profile_content"===e.profile_interstitial_type||"timeout"===e.profile_interstitial_type)&&Array.isArray(e.withheld_in_countries)&&e.withheld_in_countries.every(e=>"string"==typeof e);return t=>"object"==typeof t&&null!==t&&e(t)})(),l=(()=>{let e=e=>Array.isArray(e.children)&&1===e.children.length&&Array.isArray(e.children[0])&&2===e.children[0].length&&"object"==typeof e.children[0][1]&&null!==e.children[0][1]&&t(e.children[0][1]),t=e=>"object"==typeof e.props&&null!==e.props&&r(e.props),r=e=>Array.isArray(e.children)&&1===e.children.length&&"object"==typeof e.children[0]&&null!==e.children[0]&&n(e.children[0]),n=e=>"object"==typeof e.props&&null!==e.props&&l(e.props),l=e=>Array.isArray(e.children)&&2===e.children.length&&"object"==typeof e.children[1]&&null!==e.children[1]&&o(e.children[1]),o=e=>"object"==typeof e.props&&null!==e.props&&i(e.props),i=e=>Array.isArray(e.children)&&2===e.children.length&&Array.isArray(e.children[1])&&3===e.children[1].length&&"object"==typeof e.children[1][2]&&null!==e.children[1][2]&&s(e.children[1][2]),s=e=>"object"==typeof e.props&&null!==e.props&&c(e.props),c=e=>"object"==typeof e.loggedInUser&&null!==e.loggedInUser&&a(e.loggedInUser),a=e=>"string"==typeof e.screen_name;return t=>"object"==typeof t&&null!==t&&e(t)})(),o=(()=>{let e=e=>Array.isArray(e.children)&&1===e.children.length&&Array.isArray(e.children[0])&&2===e.children[0].length&&"object"==typeof e.children[0][1]&&null!==e.children[0][1]&&t(e.children[0][1]),t=e=>"object"==typeof e.props&&null!==e.props&&r(e.props),r=e=>Array.isArray(e.children)&&1===e.children.length&&"object"==typeof e.children[0]&&null!==e.children[0]&&n(e.children[0]),n=e=>"object"==typeof e.props&&null!==e.props&&l(e.props),l=e=>Array.isArray(e.children)&&3===e.children.length&&"object"==typeof e.children[2]&&null!==e.children[2]&&o(e.children[2]),o=e=>"object"==typeof e.props&&null!==e.props&&i(e.props),i=e=>Array.isArray(e.children)&&8===e.children.length&&"object"==typeof e.children[7]&&null!==e.children[7]&&s(e.children[7]),s=e=>"object"==typeof e.props&&null!==e.props&&c(e.props),c=e=>"object"==typeof e.loggedInUser&&null!==e.loggedInUser&&a(e.loggedInUser),a=e=>"string"==typeof e.screen_name;return t=>"object"==typeof t&&null!==t&&e(t)})(),i=(()=>{let e=e=>Array.isArray(e.children)&&2===e.children.length&&"object"==typeof e.children[0]&&null!==e.children[0]&&t(e.children[0])&&!0,t=e=>"object"==typeof e.props&&null!==e.props&&r(e.props),r=e=>Array.isArray(e.children)&&2===e.children.length&&"object"==typeof e.children[1]&&null!==e.children[1]&&n(e.children[1]),n=e=>"object"==typeof e.props&&null!==e.props&&l(e.props),l=e=>"object"==typeof e.user&&null!==e.user&&o(e.user),o=e=>(null===e.possibly_sensitive||void 0===e.possibly_sensitive||"boolean"==typeof e.possibly_sensitive)&&"string"==typeof e.screen_name&&(""===e.profile_interstitial_type||"sensitive_media"===e.profile_interstitial_type||"fake_account"===e.profile_interstitial_type||"offensive_profile_content"===e.profile_interstitial_type||"timeout"===e.profile_interstitial_type)&&Array.isArray(e.withheld_in_countries)&&e.withheld_in_countries.every(e=>"string"==typeof e);return t=>"object"==typeof t&&null!==t&&e(t)})(),s=e=>Array.isArray(e)&&e.length>0,c=e=>{let t=Object.getOwnPropertyNames(e).filter(e=>e.startsWith("__reactProps$"));return s(t)?e[t[0]]:null};class a{profileElement;constructor(e){this.profileElement=e}get props(){let e=c(this.profileElement);if(!i(e))throw Error("Failed to get React props of profile");return e.children[0].props.children[1].props.user}}let p=["pro.twitter.com","pro.x.com"];var d=r("16");let u=e=>"TEXTAREA"===e.tagName,y=e=>u(e)?e:e.parentElement,h=async(e,t)=>{let r=p.includes(location.hostname),n=[...await (0,d.asyncQuerySelectorAll)(r?"[role='dialog'] [data-text='true'], [role='dialog'] textarea[data-testid='tweetTextarea_0']":"[role='dialog'] [data-text='true'], textarea[data-testid='tweetTextarea_0']",document,t)];if(!s(n))throw Error("[twi-ext] Failed to get text box marker of tweet");for(let e=0;e{open(`https://x.com/intent/tweet?text=${encodeURIComponent(e)}`,"_blank")};class w{tweetElement;constructor(e){this.tweetElement=e}getMenuBar(){let e=this.tweetElement.querySelector("div[role='group'][id]");if(!e)throw Error("[twi-ext] Failed to get menu bar of tweet");return e}get element(){return this.tweetElement}get props(){let e=c(this.getMenuBar());if(!n(e))throw Error("[twi-ext] Failed to get React props of tweet");return e.children[1].props.retweetWithCommentLink.state.quotedStatus}get metadata(){let e=this.props.user.screen_name,t=c(this.element);if(!t)throw Error("[twi-ext] Failed to get React props of tweet");let r=null,n=o(t);return l(t)&&(r=t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser.screen_name),n&&(r=t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser.screen_name),{isFocalMode:n,isPostedByCurrentUser:e===r}}async clickRetweetButton(e){let t=await (0,d.asyncQuerySelector)("[data-testid='unretweet'], [data-testid='retweet']",this.tweetElement,e);if(!t)throw Error("[twi-ext] Failed to get retweet button of tweet");t.click()}static async clickQuoteButton(e){let t=await (0,d.asyncQuerySelector)("[data-testid='Dropdown'] [href='/compose/post'],[data-testid='sheetDialog'] [href='/compose/post']",document,e);if(!t)throw Error("[twi-ext] Failed to get quote button of tweet");t.click()}async quoteTweet(e,t=1e3,r=!1){let n=this.props.permalink,l=`${e} +https://x.com${n}`;if(r){f(l);return}try{await this.clickRetweetButton(t),await w.clickQuoteButton(t),await h(e,t)}catch{f(l)}}}var b=function(){var e=document.querySelectorAll("[role='group'] a[href$='analytics']"),t=!0,r=!1,n=void 0;try{for(var l,o,i,s=e[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var c=i.value;c.parentElement&&(c.href="",c.parentElement.style.display="none")}}catch(e){r=!0,n=e}finally{try{!t&&null!=s.return&&s.return()}finally{if(r)throw n}}var a=document.querySelector("a[aria-describedby] time");if(null==a?void 0:null===(o=a.parentElement)||void 0===o?void 0:null===(l=o.parentElement)||void 0===l?void 0:l.parentElement){var p=a.parentElement.parentElement.parentElement.querySelectorAll("div ~ *"),d=!0,u=!1,y=void 0;try{for(var h,f=p[Symbol.iterator]();!(d=(h=f.next()).done);d=!0)h.value.style.display="none"}catch(e){u=!0,y=e}finally{try{!d&&null!=f.return&&f.return()}finally{if(u)throw y}}}};new class e{OBSERVER_OPTIONS={childList:!0,subtree:!0};onNewTweetCallback=null;onNewProfileCallback=null;constructor(e){let t=`data-twi-ext-checked-${crypto.randomUUID()}`,r={timeoutMs:1e4,...e},n=new MutationObserver(()=>{if(this.onNewTweetCallback)for(let e of document.querySelectorAll(`[data-testid="tweet"]:not([${t}])`))e.setAttribute(t,""),this.onNewTweetCallback(new w(e));if(this.onNewProfileCallback){let e=document.querySelector(`:not([data-testid="tweet"]) [data-testid="UserName"]:not([${t}])`);e&&(e.setAttribute(t,""),this.onNewProfileCallback(new a(e)))}});(0,d.asyncQuerySelector)("main",document,r.timeoutMs).then(e=>{if(!e)throw Error("[twi-ext] Failed to get main element");n.observe(e,this.OBSERVER_OPTIONS)}),(0,d.asyncQuerySelector)("#layers",document,r.timeoutMs).then(e=>{if(!e)throw Error("[twi-ext] Failed to get #layers element");n.observe(e,this.OBSERVER_OPTIONS)})}onNewTweet(e){this.onNewTweetCallback=e}onNewProfile(e){this.onNewProfileCallback=e}}().onNewTweet(function(){b()})})(); \ No newline at end of file