fluid-mac-app-engine

On-the-fly modifications of the links according to a set of rules (Greasekit / Javascript)

人盡茶涼 提交于 2019-12-30 13:01:52
问题 I have an HTML page with loads of entries like this: <a href="https://www.example.co.uk/gp/wine/product?ie=UTF8&asin=123456789&tab=UK_Default" class="PrmryBtnMed" I want to replace all this links so they instead are: https://www.example.co.uk/gp/wine/order?ie=UTF8&asin=1233456789 So, it's quite a complicated search and replace. These are the instructions for a human: Look at the URL. Only make a note of the number after 'asin='. (Forget everything before that and everything after that) Then,

How can I refine this Javascript code so it IGNORES links from images

那年仲夏 提交于 2019-12-12 06:17:06
问题 This is a variation of an existing question {Please note - this question is the opposite/inverse of an existing StackOverflow question that is too complex to answer there} From the very beginning I want to make some refinement to some code from this challenge: // the new base url var base = ' https://www.example.co.uk/gp/wine/order?ie=UTF8&asin='; var links = document.getElementsByTagName('a'); for(var i = 0;i < links.length;i++){ // check each link for the 'asin' value var result = /asin=([

Using Javascript to click on a given button AND have it open in a new window

≯℡__Kan透↙ 提交于 2019-12-11 11:51:32
问题 When this page loads, I want to simulate automatically clicking the send me this thing button whilst having it open in a new window (or new tab) There will only ever be one send me this thing button on any page like that What for? This is for Greasekit on Fluid.app, which is similar to Greasemonkey. 回答1: That Button is a link and that page uses jQuery. So you can get the button like: var buyItBtn = $("a:contains('Send me this thing')"); Then modify the link to open in a new tab/window. Then

How can I refine this Javascript code to refine it so it only work on links from images (and NOT links from text)

耗尽温柔 提交于 2019-12-11 05:46:41
问题 I want to make some refinement to some code from a previous question: // the new base url var base = ' https://www.example.co.uk/gp/wine/order?ie=UTF8&asin='; var links = document.getElementsByTagName('a'); for(var i = 0;i < links.length;i++){ // check each link for the 'asin' value var result = /asin=([\d\w]+)/.exec(links[i].getAttribute('href')); if(result){ // make a new url using the 'base' and the 'asin' value links[i].setAttribute('href', base+result[1]); } } Now, instead of it acting

How can I craft a GreaseMonkey-like script to show a different page in the lower-third?

牧云@^-^@ 提交于 2019-11-29 23:20:23
问题 If you take a look at this page, there's a lot of white space in the bottom. I wish to use Greasemonkey-like script on that page, that utilises some of that white space and loads another page there (using something like an iFrame). The URL that I want to be loaded in that iFrame-type-thing (in the lower third) is always whatever View Amazon Product Page is pointing to. So, I want the code to look at the page, and find where that link points to. (As this is the bit that varies) I want the