userscripts

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

Can't find page variables when used GM_ functions

為{幸葍}努か 提交于 2021-01-29 15:21:02
问题 Using tampermonkey and greasymonkey. When I use userscript with // @grant none it gets current page variables window[variable].id . But when used any Gm_ function (GM.info not affect) it wont work. Because now userscript running in sandbox. How can I get current page <script type="text/javascript"></script> variables or I should use regexp? Example: // @version 0.1 // @description try to take over the world! // @author You // @match https://*/* // @grant GM_xmlhttpRequest // @noframes // ==

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 =

Exchange Quire authorization code for access token with GM_xmlhttpRequest

元气小坏坏 提交于 2021-01-29 04:00:35
问题 This may be a stupid question and I have tried to follow the instructions given from the quire-api-blog but I still have trouble obtaining a token from a Tampermonkey javascript userscript. FYI syntax for GM_xmlhttpRequest is available on https://www.tampermonkey.net/documentation.php?ext=dhdg#GM_xmlhttpRequest I am using the following code: GM_xmlhttpRequest({ method: "POST", url: "https://quire.io/oauth/token", data: JSON.stringify({ grant_type: "authorization_code", code: "xxx", client_id:

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

Create an iframe then append data to it with jQuery

痴心易碎 提交于 2021-01-28 08:50:18
问题 I am trying do some modification to an greasemonkey userscript to implement a feature I need. The code is like showAddress:function(addrString,type) { this.addrBox=$('<div id="batchPublish"></div>') .append('<div id="batchHeader"></div>') .append('<div id="batchContent" style="float:left;clear:both"></div>'); ......... var batchContent=this.addrBox.find('#batchContent') .append('<pre width="300" style="text-align:left" id="batchedlink"></pre>'); this.addrBox.find('#batchedlink').css({'width':

How do I make my userscript execute code in isolated sandbox and unsafeWindow too?

怎甘沉沦 提交于 2021-01-28 04:09:19
问题 For most of my code in my userscript, I'm need to use unsafeWindow for the websites my script executes on. I do this by using // @grant unsafeWindow . However, some of my code cannot be executed with unsafeWindow and needs to run in Tampermonkey's isolated sandbox. How would I be able to do this? Something like this could work: function disableUnsafeWindow() { // Disable UnsafeWindow } function enableUnsafeWindow() { // Enable unsafeWindow } function withUnsafeWindow() { enableUnsafeWindow()