tampermonkey

Way to Open Clicked Link in New Tab via Tampermonkey?

梦想的初衷 提交于 2021-02-08 13:45:26
问题 So I have what seems to be a simple problem. I'm trying to automatically open a specific link on a page using the following code: // ==UserScript== // @name AutoClicker // @include https://example.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== var TargetLink = $("a:contains('cars')") if (TargetLink.length) window.location.href = TargetLink[0].href //--- but open it in a new tab Which works splendidly. The only problem

What's a simple way in Google Chrome to insert Javascript into sites?

不打扰是莪最后的温柔 提交于 2021-02-05 18:57:27
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

What's a simple way in Google Chrome to insert Javascript into sites?

早过忘川 提交于 2021-02-05 18:52:48
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

What's a simple way in Google Chrome to insert Javascript into sites?

孤街浪徒 提交于 2021-02-05 18:50:21
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

js querySelectorAll not a valid selector despite it being like the docs example [duplicate]

天涯浪子 提交于 2021-02-05 09:15:06
问题 This question already has answers here : Error while query selector on numeric value (2 answers) Closed 2 years ago . https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll Here, an attribute selector is used to return a list of the list items contained within a list whose ID is "userlist" which have a "data-active" attribute whose value is "1" var container = document.querySelector("#userlist"); var matches = container.querySelectorAll("li[data-active=1]"); but when i try

Can Tampermonkey Userscript access Chrome API?

大憨熊 提交于 2021-01-29 14:13:44
问题 I am developing a userscript that requiers chrome object, but I can't access it. How to access to chrome object inside tampermonkey's userscript? Maybe, some permissions in manifest or what... 回答1: Refer to Chrome extension code vs Content scripts vs Injected scripts. Chrome extensions can access Chrome APIs and Tampermonkey is an extension. However, Tampermonkey must make a given API's functionality to a userscript via GM_ functions. If there is not a GM_ function for what you want, then you

Unable to fill out the text field and submit automatically

好久不见. 提交于 2021-01-29 05:15:20
问题 What I am trying to accomplish is to populate the text box for "Reason for Access" with the word "TEST" using Tampermonkey. (I'm very new to using Tampermonkey & UserScript so please be patient with me.) I am having an issue where the "Reason for Access" is still blank and isn't submitting automatically. Would you be able to provide assistance? Let me know if you need anything. This is my userscript: function ClickURL2() { var FillF2 = document.getElementsByName("reason"); FillF2[0].value =

How do I take text contained in web page and make it part of the page title?

♀尐吖头ヾ 提交于 2021-01-28 12:23:16
问题 I desperately need help with writing a Tampermonkey/Greasemonkey script that takes part of the information within the web page and makes it part of the page (and window) title. A client's name is part of the target (internal) web page, and clearly labeled within the HTML: <div id="patient-info" class="ehr-patients-info"> <div id="patient-identification"> <span title="" id="patient-name"> Johnnyfirst Smithylast </span> </div> ... I want to add the text "Johnnyfirst Smithylast" to the window

How can I access built-in methods of an Object that is overridden?

吃可爱长大的小学妹 提交于 2021-01-04 02:49:23
问题 A webpage is setting a built-in javascript method to null , and I'm trying to find a way to call the overridden methods in a userscript. Consider the following code: // Overriding the native method to something else document.querySelectorAll = null; Now, if I try to execute document.querySelectorAll('#an-example') , I will get the exception Uncaught TypeError: null is not a function . The reason being the method has been changed to null and is no longer accessible. I'm looking for a way to

How can I access built-in methods of an Object that is overridden?

不羁岁月 提交于 2021-01-04 02:48:09
问题 A webpage is setting a built-in javascript method to null , and I'm trying to find a way to call the overridden methods in a userscript. Consider the following code: // Overriding the native method to something else document.querySelectorAll = null; Now, if I try to execute document.querySelectorAll('#an-example') , I will get the exception Uncaught TypeError: null is not a function . The reason being the method has been changed to null and is no longer accessible. I'm looking for a way to