Creating An AutoScroll Extension For Chrome.

1

 

Excerpt from a conversation:

- One of my sisters asked me (as always) what are you doing?

+ Me: I make an extension that I need for the Chrome browser.

- Look for it on the internet.

+ I already did it and I can't find it.

- If you can't find something on the internet, it's because you didn't search properly. Have you finished it yet?

+ Yup

- Does it work? What does it do? (I explain with reluctance), Are you going to publish it?

+ Probably.

- You can start the article by saying: "...In the vast ocean of digital information, a brave sailor wants to find a way to surf the waves..."

+ No, it's too cheesy for my taste.

- Come on, please me, so you can mention me, please.

+ The most I can do for you is transcribe this conversation and in the next few days dedicate an article to you about the satisfaction of learning.

- Ok (luckily for me he smiled casually and left, but only I know why I say it 😀).

 

For a certain reason that is not relevant (although the most "savvy" will realize that the "key to the reason" is in the image 😎), I was looking for an extension for the Chrome browser that when I opened any address it would automatically scroll to the end of the page, regardless of whether the page had focus or not. And although I found many of this type in the Chrome Web Store, unfortunately in all of them, the user had to interact for them to work.

 

The extension that she "creates" (it's not exactly that she invented "warm water"), although it is very simple, works relatively well and the steps to install it are very simple:

 

1º - Create a folder where you will place the extension files. For this example "C:\scroll".

 

2º - Create three files that you will rename as: content.js, manifest.json and background.js. Remember that you must have "View file name extensions" enabled in your explorer.

 

7f300bf24a09c487bd6fe14f818f8fbcda92a8817e03029b53b57d522d50186c.png

 

3º - Copy the content of the scripts into the corresponding files.

 

👉 content.js

// content.js

window.addEventListener('load', function() {

window.scrollTo(0, document.body.scrollHeight);

});

 

👉 manifest.json

// manifest.json

{

"manifest_version": 2,

"name": "Scroll",

"version": "1.0",

"permissions": ["activeTab", "declarativeContent", ""],

"background": {

"scripts": ["background.js"],

"persistent": false

},

"content_scripts": [

{

"matches": [""],

"js": ["content.js"]

}

]

}

 

👉 background.js

// background.js

chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {

chrome.declarativeContent.onPageChanged.addRules([

{

conditions: [new chrome.declarativeContent.PageStateMatcher({})],

actions: [new chrome.declarativeContent.ShowPageAction()]

}

]);

});

 

4º - Then open in the Chrome browser: Manage Extensions (chrome://extensions/).

 

5º - Activate Developer Mode.

 

6º - Go to the tab: "Load Unzipped" and open the folder where you have the extension files, in my case "C:\scroll".

 

7º - Ready, the extension is now installed.

 

8º - You can also deactivate or activate it at your convenience.

 

120064e45b435802bcb9c709d53016ee3d6e2fab47797901548a16b867152a24.png

 

However, you should keep in mind that if the page is loaded dynamically (that is, if more content is added to the page after the load event is fired), the extension might not scroll to the end of the newly loaded content. This is because the load event is fired once the initial page content has loaded, but not necessarily after all dynamic content has loaded.

I hope it is useful to you, I read them in the comments.

 

TOOLS, PLATFORMS & APPLICATIONS

 

💲 StormGain - They can start operating without investment, the capital is acquired for free with the Bitcoin Cloud Miner of the platform itself. 

 

💲 QuantFury - Join using my Invite Code: JRRU2593 & We will both receive up to $ 250 in cryptocurrencies (BTC, ETH, etc) or an action (Uber, AAPL, etc). It is traded and invest without commissions or loan rates at spot prices in real time.

 

💲 Bitrefill - Living with crypto, a philosophy of financial freedom. Travel, play, eat & live with Cryptocurrencies. 

 

💲 AddmeFast - Promote and increase the sources of traffic, visibility, reach and reputation of your social networks.

 

💲 Crypto Airline GameRich Animals - Monetized Games On Telegram.

 

💲 Gleev - Connect your YouTube channel and get paid. Earn up to $100 for each referral.

 

💲 Bulb, Publish0x - Earn cryptocurrencies, NFTs or money without investment.

 

💲 Solcial - Social network on the Solana blockchain that allows users to share content without censorship or fear of prohibition and also earn money for their work. Users can also own their own content and tokens.

 

💲 Tangled - 🎁 Pay me Internet 🎁. Generate passive income with a decentralized peer-to-peer ecosystem for consumers, advertisers, search, and social networks.

 

✍ Originally Posted: Publish0x


Enjoyed this article? Stay informed by joining our newsletter!

Comments

You must be logged in to post a comment.

About Author