tampermonkey

tampermonkey 编写B站视频截图脚本

点点圈 提交于 2020-02-26 17:06:38
B站看视频的时候想截一些表情包, 但是没找到比较方便的方式, 用截图软件的话, 不暂停考验手速和软件反应速度, 暂停会有暂停标记 (╯‵□′)╯︵┻━┻ 实现效果如下, 同样的页面, 暂停后使用 ctrl + shift + s 截图保存会过滤字幕和暂停标签 安装地址 B站截图工具 实现思路为 将video中的数据画到canvas中, 然后下载 需要对不同的清晰度, 设置不同的画布大小 (function() { "use strict"; // 得到当前播放的video标签 function getVideo() { return document.getElementsByTagName("video")[0]; } // 根据清晰度, 获取画布大小 function getSize() { let text = ( document.getElementsByClassName( "bui-select-item bui-select-item-active" )[0] || {} ).innerText || "default"; let sizeMap = { "360P": { width: 460, height: 360 }, "480P": { width: 640, height: 480 }, "720P": { width: 1080, height:

Select element in a frame

天涯浪子 提交于 2020-02-07 12:45:52
问题 My goal is to change a value from a to d inside the array options in menu.html using Greasemonkey extension in Firefox but my problem is that the element I am trying to select/access is loaded as a frame . I have been trying to solve this issue for some time now and I would be very happy if somone could help me out. I have got two files main.html and menu.html whose contents are: main.html (is the main page) <html> <head> <meta http-equiv="Pragma" content="no-cache"> <script language=

Select element in a frame

我的未来我决定 提交于 2020-02-07 12:45:08
问题 My goal is to change a value from a to d inside the array options in menu.html using Greasemonkey extension in Firefox but my problem is that the element I am trying to select/access is loaded as a frame . I have been trying to solve this issue for some time now and I would be very happy if somone could help me out. I have got two files main.html and menu.html whose contents are: main.html (is the main page) <html> <head> <meta http-equiv="Pragma" content="no-cache"> <script language=

Sharing variables between 2 separate scripts [duplicate]

浪子不回头ぞ 提交于 2020-01-25 00:22:22
问题 This question already has an answer here : Get 2 userscripts to interact with each other? (1 answer) Closed 2 years ago . I'm trying to share variable between 2 different Tampermonkey scripts running in 2 separate tabs. I tried using GM_setValue in one script then retrieving it with GM_getValue in the other one but without any success, so I assume there's separate storage for each script. Is there any easy way to do this? Am I just missing something simple? Can I somehow make both scripts

GM_openInTab (or any other GM_ function) is not defined?

吃可爱长大的小学妹 提交于 2020-01-21 12:22:06
问题 When my GM script does this: var curTab = GM_openInTab(url); it results in a 'GM_openInTab is not defined' JavaScript error in the Browser Console. I also tried using var curWin = window.open(url); instead of GM_openInTab but it had no affect. What I'm trying to do with this GM script is: for a given website (domain name), go through a list (array) of URLs on this domain and look for items of interest. What's wrong with my code or approach? I'm using Greasemonkey 2.3 with Firefox 33.1.1 and

window.close and self.close do not close the window in Chrome

孤街醉人 提交于 2020-01-17 05:32:17
问题 The issue is that when I invoke window.close() or self.close() it doesn't close the window. Now there seems to be a belief that in Chrome you can't close by script any window that is not script created. That is patently false but regardless it is supposed to still do it, even if it requires to pop up an alert to confirm. These are not happening. So does anyone have real, functional and proven method of closing a window using something like javascript:window.close() or javascript:self.close()

How to load a table, from another webpage, into an array?

纵然是瞬间 提交于 2020-01-15 07:10:07
问题 I am creating a Greasemonkey/Tampermonkey script that puts some stats into an array. Using JavaScript, how would I make it so a page loads a URL (football.fantasysports.yahoo.com/f1/326198/pointsagainst?pos=QB) in the background and creates an array with the first two columns ( Rank and Team )? The problem I am having is doing all of this in the background, I presume I would be using AJAX. Any help would be appreciated. 回答1: For a static page (like the one you linked), use GM_xmlhttpRequest()

Add class in jQuery in Greasemonkey script

南笙酒味 提交于 2020-01-14 03:24:13
问题 I Asked a question earlier and was given a Working solution. One thing I want to do is incorporate jQuery to remove a class F-link-secondary and replace it with F-rank-good/bad/neutral depending on the value of deltaText. On most pages this is what I see: But on a certain page, the F-rank-XXX class is not there and instead there is just a single F-link-secondary which has no style. Here is what I want to do but I am not sure how to incorporate it with the Greasemonkey script. function getRank

How to change a link's text based on different phrasing of the link's title attribute?

时光毁灭记忆、已成空白 提交于 2020-01-14 03:23:26
问题 In my Fantasy football page, it gives stats about the opposing team and when you mouseover it tells you how many points they give up (See picture). Here is the relevant code pertaining to this: <a class="Inline F-rank-good" title="WAS gives up the 3rd most fantasy points to the QB position." target="_blank" href="/f1/777400/pointsagainst?pos=QB&ntid=28">Was</a> How do I create a Greasemonkey script that will add the # to the end of the team name (i.e. "Was" becomes "Was - 3" One problem there

Adding a custom keyboard shortcut using userscript to Chrome with Tampermonkey

旧城冷巷雨未停 提交于 2020-01-12 20:19:17
问题 I would like to add some custom keyboard shortcuts to a certain web page. Using the accepted answer from this question as a guide: How can I add a JavaScript keyboard shortcut to an existing JavaScript Function? I made my own little function and added a listener: // ==UserScript== // @name ChartGame // @namespace http://www.chartgame.com/ // @version 0.1 // @description enter something useful // @match http://www.chartgame.com/play* // @copyright 2012+, You // ==/UserScript== function doc