Poll of the Day > Is there a way to configure my browser so that whenever I visit a certain page,

Topic List
Page List: 1
EclairReturns
04/10/23 9:55:08 PM
#1:


certain elements get added? I'm using Brave Browser, by the by. For example, let's say I have this website here.

https://en.m.wiktionary.org/wiki/Wiktionary:Main_Page#/search

Is there some sort of Javascript code would I have to input in order to activate this element on line 122 of the page source?

The element on line 122, corresponding to the search-bar
<input class="search mw-ui-background-icon-search skin-minerva-search-trigger" type="search" name="search" id="searchInput"


I apologize for my laziness; I've never seen a reason to use Javascript (assuming that is what is warranted here) in my browser up until this very moment.

I must have these answers.

---
Number VI: Larxene.
The Organization's Not-That-Geezer's-Heart-Tank.
... Copied to Clipboard!
badjay
04/10/23 10:04:51 PM
#2:


Let's ask chat gpt.

Yes, you can use browser extensions such as Tampermonkey or Greasemonkey to inject custom JavaScript code into specific web pages. These extensions allow you to create scripts that run when you visit a particular website and can manipulate the page in various ways.
Here's an example Tampermonkey script that adds a red border to the search bar on the Wiktionary main page:
javascript

// ==UserScript==
// @name Add border to Wiktionary search bar
// @namespace https://example.com/
// @version 1.0
// @description Adds a red border to the search bar on the Wiktionary main page
// @author Your Name
// @match https://en.m.wiktionary.org/wiki/Wiktionary:Main_Page
// @grant none
// ==/UserScript==

(function() {
'use strict';

var searchInput = document.getElementById('searchInput');
searchInput.style.border = '1px solid red';
})();

To use this script, you would need to install Tampermonkey (or a similar extension), create a new script, and paste the code into the editor. Then save the script and visit the Wiktionary main page to see the border around the search bar.
Note that you may need to adjust the script if the page source changes in the future (e.g., if the search bar's ID or class name changes).

Looks like you can.

---
[05:45:34] I bought an American L and it was like a tent
... Copied to Clipboard!
Yellow
04/10/23 10:10:59 PM
#3:


Depends on what you need

https://en.m.wiktionary.org/w/index.php?search=you+can+just+edit+the+url&title=Special%3ASearch&ns0=1

Edits the URL

And

https://chrome.google.com/webstore/detail/run-javascript/lmilalhkkdhfieeienjbiicclobibjao?hl=en

Can do as you say. What Javascript to write? Something along the lines of

document.getElementById("searchInput").focus();

Should work. Edit: Use Tampermonkey instead. It's more commonly used.
... Copied to Clipboard!
EclairReturns
04/10/23 11:05:13 PM
#4:


badjay posted...
// @description Adds a red border to the search bar on the Wiktionary main page


(function() {
'use strict';

var searchInput = document.getElementById('searchInput');
searchInput.style.border = '1px solid red';
})();


I am very glad that technology has failed me.

Yellow posted...
document.getElementById("searchInput").focus();

Tampermonkey


Thanks. It really helped a lot. That being said, it still seems to deactivate the search bar right after the script has focused on it.

---
Number VI: Larxene.
The Organization's Not-That-Geezer's-Heart-Tank.
... Copied to Clipboard!
Count_Drachma
04/10/23 11:18:57 PM
#5:


What's the appeal of Brave?

---
Everybody's got a price / Everybody's got to pay / Because the Million Drachma Man / Always gets his way. AhahahahMMH
... Copied to Clipboard!
Yellow
04/11/23 4:36:13 AM
#6:


EclairReturns posted...
I am very glad that technology has failed me.

Thanks. It really helped a lot. That being said, it still seems to deactivate the search bar right after the script has focused on it.
I poked around and here's a Tampermonkey script that works. It only affects the main page, not the others, so if you want to change that you would probably change the parameters at the top.

setTimeout is JS's "wait" function. I pass a function as well as the value 800 to it, telling it to wait 800 milliseconds before executing the function. I've had it work as low as 500, so you could try that and see how it works out for you.

There's likely a better solution that looks into signs the page is fully loaded, but the issue was that something about the web page wasn't expecting the user to click on that box until the page had fully loaded.

// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://en.m.wiktionary.org/wiki/Wiktionary:Main_Page
// @icon https://www.google.com/s2/favicons?sz=64&domain=wiktionary.org
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Your code here...
setTimeout(() => {
document.getElementById("searchInput").click();
}, 800);
})();

Count_Drachma posted...
What's the appeal of Brave?
Blocks advertisers and tracking that doesn't benefit the end user mostly. You could call it just a straight upgrade from chrome, even if you don't notice any difference.

badjay posted...
Let's ask chat gpt.
I'm sorry, but I really hate shat gpt. That language model is nothing more to me than advanced plagiarism. And bad plagiarism at that.
... Copied to Clipboard!
EclairReturns
04/11/23 9:16:35 PM
#7:


Yellow posted...
// Your code here...
setTimeout(() => {
document.getElementById("searchInput").click();
}, 800);
})();


That pretty much does what I wanted. Thanks.

---
Number VI: Larxene.
The Organization's Not-That-Geezer's-Heart-Tank.
... Copied to Clipboard!
chelsea___wtf
04/11/23 9:43:06 PM
#8:


badjay posted...
Let's ask chat gpt.

https://gamefaqs.gamespot.com/a/user_image/6/3/9/AAfW0CAAEX8P.png

---
creature-based
... Copied to Clipboard!
sveksii
04/12/23 1:24:14 AM
#9:


Count_Drachma posted...
What's the appeal of Brave?
You help fund right wing causes and conspiracy theories that its founder espouses all while enjoying false promises of security it offers while it mishandles your data.
... Copied to Clipboard!
Topic List
Page List: 1