diff --git a/index.user.js b/index.user.js index 1b90bb1..f75f57e 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.0.0 +// @version 2.0.1 // @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/* @@ -13,4 +13,4 @@ // @grant none // ==/UserScript== /*! For license information please see index.user.js.LICENSE.txt */ -(()=>{"use strict";var t={531:function(t,e){var n=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function s(t){try{l(o.next(t))}catch(t){i(t)}}function a(t){try{l(o.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.asyncQuerySelectorAll=e.asyncQuerySelector=void 0;const o=(t,e)=>new Promise((n=>{const o=t();if(o instanceof Element&&o||o instanceof NodeList&&o.length)return void n(o);let r=null;const i=new MutationObserver((()=>{const e=t();e&&(i.disconnect(),r&&clearTimeout(r),n(e))}));r=setTimeout((()=>{i.disconnect(),n(null)}),e),i.observe(document.body,{attributes:!0,childList:!0,subtree:!0})}));e.asyncQuerySelector=(t,...e)=>n(void 0,[t,...e],void 0,(function*(t,e=document,n=500){return yield o((()=>e.querySelector(t)),n)})),e.asyncQuerySelectorAll=(t,...e)=>n(void 0,[t,...e],void 0,(function*(t,e=document,n=500){var r;return null!==(r=yield o((()=>e.querySelectorAll(t)),n))&&void 0!==r?r:document.createDocumentFragment().childNodes}))},272:(t,e,n)=>{n.r(e),n.d(e,{Timeline:()=>p,Tweet:()=>r});var o=n(531);class r{tweetElement;constructor(t){this.tweetElement=t}getMenuBar(){const t=this.tweetElement.querySelector("div[role='group'][id]");if(!t)throw new Error("Failed to get menu bar of tweet");return t}get element(){return this.tweetElement}get props(){const t=(t=>{const e=Object.getOwnPropertyNames(t).filter((t=>t.startsWith("__reactProps$")));return e.length?t[e[0]]:null})(this.getMenuBar());if(!function(t){const e=t;return(null!==e&&"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((t=>"string"==typeof t))}(t))throw new Error("Failed to get React props of tweet");return t.children[1].props.retweetWithCommentLink.state.quotedStatus}async clickRetweetButton(t){const e=await(0,o.asyncQuerySelector)("[data-testid='unretweet'], [data-testid='retweet']",this.tweetElement,t);if(!e)throw new Error("Failed to get retweet button of tweet");e.click()}static async clickQuoteButton(t){const e=await(0,o.asyncQuerySelector)(["[data-testid='Dropdown'] [href='/compose/post']","[data-testid='sheetDialog'] [href='/compose/post']"].join(","),document,t);if(!e)throw new Error("Failed to get quote button of tweet");e.click()}static async getTweetTextBox(t){const e="pro.twitter.com"===location.hostname?"[role='dialog'] [data-text='true'], [role='dialog'] textarea[data-testid='tweetTextarea_0']":"[role='dialog'] [data-text='true'], textarea[data-testid='tweetTextarea_0']",n=await(0,o.asyncQuerySelector)(e,document,t);if(!n)throw new Error("Failed to get text box marker of tweet");const r="TEXTAREA"===n.tagName?n:n.parentElement;if(!r)throw new Error("Failed to get text box of tweet");return r}async quoteTweet(t,e=1e3){try{await this.clickRetweetButton(e),await r.clickQuoteButton(e);const n=await r.getTweetTextBox(e);n.innerHTML=t,n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(e){const n=this.props.permalink;open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(`${t}\nhttps://twitter.com${n}`)}`,"_blank")}}}const i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let s;const a=new Uint8Array(16);function l(){if(!s&&(s="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!s))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(a)}const c=[];for(let t=0;t<256;++t)c.push((t+256).toString(16).slice(1));const u=function(t,e,n){if(i.randomUUID&&!e&&!t)return i.randomUUID();const o=(t=t||{}).random||(t.rng||l)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=o[t];return e}return function(t,e=0){return c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]}(o)};class p{OBSERVER_OPTIONS={childList:!0,subtree:!0};onNewTweetCallback=null;constructor(t){const e=`twi-ext-checked-${u()}`,n={timeoutMs:1e4,...t},i=new MutationObserver((()=>{if(!this.onNewTweetCallback)return;const t=document.querySelectorAll(`[data-testid="tweet"]:not([${e}])`);if(t.length)for(const n of t)n.setAttribute(e,""),this.onNewTweetCallback(new r(n))}));(0,o.asyncQuerySelector)("main",document,n.timeoutMs).then((t=>{if(!t)throw new Error("twi-ext: Failed to get main element");i.observe(t,this.OBSERVER_OPTIONS)}))}onNewTweet(t){this.onNewTweetCallback=t}}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o].call(i.exports,i,i.exports,n),i.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(new(n(272).Timeline)).onNewTweet((t=>{(t=>{const e=t.element.querySelector("[role='group'] a[href$='analytics']");e&&e.parentElement&&(e.href="",e.parentElement.style.display="none");const n=document.querySelector("a[aria-describedby] time");if(n&&n.parentElement&&n.parentElement.parentElement&&n.parentElement.parentElement.parentElement){const t=n.parentElement.parentElement.parentElement.querySelectorAll("div ~ *");for(const e of t)e.style.display="none"}})(t)}))})(); \ No newline at end of file +(()=>{"use strict";var e={531: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{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(p,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.asyncQuerySelectorAll=t.asyncQuerySelector=void 0;const n=(e,t)=>new Promise((r=>{const n=e();if(n instanceof Element&&n||n instanceof NodeList&&n.length)return void r(n);let o=null;const i=new MutationObserver((()=>{const t=e();t&&(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}))},272:(e,t,r)=>{r.r(t),r.d(t,{Timeline:()=>a,Tweet:()=>i});var n=r(531);const o=e=>{const t=Object.getOwnPropertyNames(e).filter((e=>e.startsWith("__reactProps$")));return t.length?e[t[0]]:null};class i{tweetElement;constructor(e){this.tweetElement=e}getMenuBar(){const e=this.tweetElement.querySelector("div[role='group'][id]");if(!e)throw new Error("Failed to get menu bar of tweet");return e}get element(){return this.tweetElement}get props(){const e=o(this.getMenuBar());if(!function(e){const t=e;return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.children)&&(null!==t.children[1]&&"object"==typeof t.children[1]||"function"==typeof t.children[1])&&(null!==t.children[1].props&&"object"==typeof t.children[1].props||"function"==typeof t.children[1].props)&&(null!==t.children[1].props.retweetWithCommentLink&&"object"==typeof t.children[1].props.retweetWithCommentLink||"function"==typeof t.children[1].props.retweetWithCommentLink)&&(null!==t.children[1].props.retweetWithCommentLink.state&&"object"==typeof t.children[1].props.retweetWithCommentLink.state||"function"==typeof t.children[1].props.retweetWithCommentLink.state)&&(null!==t.children[1].props.retweetWithCommentLink.state.quotedStatus&&"object"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus||"function"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus)&&(void 0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||null===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||!1===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive||!0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive)&&(void 0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||null===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||!1===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable||!0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.possibly_sensitive_editable)&&"string"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus.permalink&&(null!==t.children[1].props.retweetWithCommentLink.state.quotedStatus.user&&"object"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus.user||"function"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus.user)&&(void 0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||null===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||!1===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive||!0===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.possibly_sensitive)&&"string"==typeof t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.screen_name&&(""===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"sensitive_media"===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"fake_account"===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"offensive_profile_content"===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type||"timeout"===t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.profile_interstitial_type)&&Array.isArray(t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.withheld_in_countries)&&t.children[1].props.retweetWithCommentLink.state.quotedStatus.user.withheld_in_countries.every((e=>"string"==typeof e))}(e))throw new Error("Failed to get React props of tweet");return e.children[1].props.retweetWithCommentLink.state.quotedStatus}get metadata(){const e=this.props.user.screen_name,t=o(this.element);if(!t)throw new Error("Failed to get React props of tweet");let r=null;return function(e){const t=e;return(null!==t&&"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}(t)&&(r=t.children[0][1].props.children[0].props.children[1].props.children[1][2].props.loggedInUser.screen_name),function(e){const t=e;return(null!==t&&"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[2]&&"object"==typeof t.children[0][1].props.children[0].props.children[2]||"function"==typeof t.children[0][1].props.children[0].props.children[2])&&(null!==t.children[0][1].props.children[0].props.children[2].props&&"object"==typeof t.children[0][1].props.children[0].props.children[2].props||"function"==typeof t.children[0][1].props.children[0].props.children[2].props)&&Array.isArray(t.children[0][1].props.children[0].props.children[2].props.children)&&(null!==t.children[0][1].props.children[0].props.children[2].props.children[7]&&"object"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7]||"function"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7])&&(null!==t.children[0][1].props.children[0].props.children[2].props.children[7].props&&"object"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7].props||"function"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7].props)&&(null!==t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser&&"object"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser||"function"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser)&&"string"==typeof t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser.screen_name}(t)&&(r=t.children[0][1].props.children[0].props.children[2].props.children[7].props.loggedInUser.screen_name),{isPostedByCurrentUser:e===r}}async clickRetweetButton(e){const t=await(0,n.asyncQuerySelector)("[data-testid='unretweet'], [data-testid='retweet']",this.tweetElement,e);if(!t)throw new Error("Failed to get retweet button of tweet");t.click()}static async clickQuoteButton(e){const t=await(0,n.asyncQuerySelector)(["[data-testid='Dropdown'] [href='/compose/post']","[data-testid='sheetDialog'] [href='/compose/post']"].join(","),document,e);if(!t)throw new Error("Failed to get quote button of tweet");t.click()}static async getTweetTextBox(e){const t="pro.twitter.com"===location.hostname?"[role='dialog'] [data-text='true'], [role='dialog'] textarea[data-testid='tweetTextarea_0']":"[role='dialog'] [data-text='true'], textarea[data-testid='tweetTextarea_0']",r=await(0,n.asyncQuerySelector)(t,document,e);if(!r)throw new Error("Failed to get text box marker of tweet");const o="TEXTAREA"===r.tagName?r:r.parentElement;if(!o)throw new Error("Failed to get text box of tweet");return o}async quoteTweet(e,t=1e3){try{await this.clickRetweetButton(t),await i.clickQuoteButton(t);const r=await i.getTweetTextBox(t);r.innerHTML=e,r.dispatchEvent(new Event("input",{bubbles:!0}))}catch(t){const r=this.props.permalink;open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(`${e}\nhttps://twitter.com${r}`)}`,"_blank")}}}const p={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let s;const l=new Uint8Array(16);function c(){if(!s&&(s="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!s))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(l)}const d=[];for(let e=0;e<256;++e)d.push((e+256).toString(16).slice(1));const h=function(e,t,r){if(p.randomUUID&&!t&&!e)return p.randomUUID();const n=(e=e||{}).random||(e.rng||c)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return d[e[t+0]]+d[e[t+1]]+d[e[t+2]]+d[e[t+3]]+"-"+d[e[t+4]]+d[e[t+5]]+"-"+d[e[t+6]]+d[e[t+7]]+"-"+d[e[t+8]]+d[e[t+9]]+"-"+d[e[t+10]]+d[e[t+11]]+d[e[t+12]]+d[e[t+13]]+d[e[t+14]]+d[e[t+15]]}(n)};class a{OBSERVER_OPTIONS={childList:!0,subtree:!0};onNewTweetCallback=null;constructor(e){const t=`twi-ext-checked-${h()}`,r={timeoutMs:1e4,...e},o=new MutationObserver((()=>{if(!this.onNewTweetCallback)return;const e=document.querySelectorAll(`[data-testid="tweet"]:not([${t}])`);if(e.length)for(const r of e)r.setAttribute(t,""),this.onNewTweetCallback(new i(r))}));(0,n.asyncQuerySelector)("main",document,r.timeoutMs).then((e=>{if(!e)throw new Error("twi-ext: Failed to get main element");o.observe(e,this.OBSERVER_OPTIONS)}))}onNewTweet(e){this.onNewTweetCallback=e}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(new(r(272).Timeline)).onNewTweet((e=>{(e=>{const t=e.element.querySelector("[role='group'] a[href$='analytics']");t&&t.parentElement&&(t.href="",t.parentElement.style.display="none");const r=document.querySelector("a[aria-describedby] time");if(r&&r.parentElement&&r.parentElement.parentElement&&r.parentElement.parentElement.parentElement){const e=r.parentElement.parentElement.parentElement.querySelectorAll("div ~ *");for(const t of e)t.style.display="none"}})(e)}))})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9c3d124..1d00a68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hide-impression", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hide-impression", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "dependencies": { "@robot-inventor/eslint-config": "^0.1.1", diff --git a/package.json b/package.json index 10a6e05..6e6d213 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hide-impression", - "version": "2.0.0", + "version": "2.0.1", "description": "Browser extension to hide the number of Twitter impressions", "main": "index.js", "scripts": {