|
Lumpy posted:I'm tired and too lazy to see if the first approach is valid, but I would either: Thanks for the ideas. I ended up using settimeout to delay the function and it's working for me. A little fragile, but it'll work for this project.
|
# ? Dec 11, 2019 22:23 |
|
|
# ? May 16, 2024 18:57 |
|
The Fool posted:Thanks for the ideas. I ended up using settimeout to delay the function and it's working for me. This really isn't a good way to solve this problem
|
# ? Dec 12, 2019 04:19 |
|
HappyHippo posted:This really isn't a good way to solve this problem Have you done any custom development for Dynamics 365?
|
# ? Dec 12, 2019 05:54 |
|
You can hook into the iframes onload event to run your codecode:
|
# ? Dec 12, 2019 07:00 |
|
ddiddles posted:You can hook into the iframes onload event to run your code there's some complexity with this - pretty sure if it's a cross domain iframe it isn't going to work. iframes suck rear end.
|
# ? Dec 12, 2019 13:54 |
|
Bruegels Fuckbooks posted:there's some complexity with this - pretty sure if it's a cross domain iframe it isn't going to work. iframes suck rear end. If they're modifying the elements within the iframe, then it isn't cross domain, no?
|
# ? Dec 12, 2019 14:32 |
|
HappyHippo posted:If they're modifying the elements within the iframe, then it isn't cross domain, no? Yeah.
|
# ? Dec 12, 2019 15:21 |
The Fool posted:Have you done any custom development for Dynamics 365? I have. We use postMessage() to communicate between the D365 window and the cross-domain frame inside of it. https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage HappyHippo posted:If they're modifying the elements within the iframe, then it isn't cross domain, no? In D365 you can configure iFrames on the page to have a src that is a different domain so it's possible it's cross-domain to start with.
|
|
# ? Dec 12, 2019 15:45 |
|
That all sounds terrible and I'm just going to stop thinking about it so I don't get sad. God speed.
|
# ? Dec 13, 2019 11:24 |
|
Hey dudes. Not sure if this is the best place, but do Youtube, news sites etc employ anti-blocking scripts? I'm learning how to build browser extensions, and am trying to block comments sections by class name. Appears to work on initial load of the extension, then stops working. Works fully using the same logic, but different class names on diff sites. Could Youtube be employing a script that checks for changes, and undoes them?
|
# ? Jan 4, 2020 16:22 |
|
Dominoes posted:Hey dudes. Not sure if this is the best place, but do Youtube, news sites etc employ anti-blocking scripts? I'm learning how to build browser extensions, and am trying to block comments sections by class name. Appears to work on initial load of the extension, then stops working. Works fully using the same logic, but different class names on diff sites. Could Youtube be employing a script that checks for changes, and undoes them? (If a page itself also uses a MutationObserver to redeploy disappeared things then you could cause the page to crash.)
|
# ? Jan 4, 2020 18:20 |
|
This script works in Chrome, but not in Edge:code:
code:
Also, is there a better way of writing this so it doesn't rely on a bunch of if statements? code:
|
# ? Jan 4, 2020 18:57 |
|
roomforthetuna posted:Youtube does a lot of dynamic things. If your extension just changes things on page-load then anything it updates after page-load will be missed. You'd have to use something like a MutationObserver and re-run your function to destroy the unwanted things that appear after page load.
|
# ? Jan 5, 2020 04:25 |
|
Dominoes posted:Thank you. Those docs are clear and concise. It looks like something's even stopping that code from running after the initial extension load as well. Your explanation makes sense, and I'm sure there's a way around this. Perhaps the best bet is to study existing extensions that do something similar. I notice the same problem with some news sites.
|
# ? Jan 5, 2020 07:00 |
|
Yeah, ShadowDOM doesn't appear in the root mutations. You basically have to wrap the attachShadow method on HTMLElement prototype to know when a new shadow root is created and observe that as well, the appearance of the new root doesn't trigger an attribute mutation. edit: Looking at the YouTube DOM they do not appear to be using Shadow DOM at all, though. necrotic fucked around with this message at 16:42 on Jan 5, 2020 |
# ? Jan 5, 2020 15:43 |
|
YouTube was rewritten for Polymer v1 a while ago, that includes shadow DOM. They should be moving onto LitHtml for webcomponents. It’s definitely not an extensive deployment of the tech though.
|
# ? Jan 5, 2020 17:07 |
|
Web components/polymer v1 don't necessarily use shadow DOM. Maybe they're not using the shadow in firefox, which is where I looked, but while they are using custom elements I didn't see any shadow usage. edit: just checked chrome and its the same, custom elements but no shadow dom. edit2: also possible they've fully switched to LitHTML already and I'm mistaken about polymer v1. either way, there's no shadow dom at play for YT. necrotic fucked around with this message at 18:29 on Jan 5, 2020 |
# ? Jan 5, 2020 18:07 |
|
I think Polymer v1 uses Shady DOM to simulate a Shadow DOM, so basically expect things to get more inconvenient. https://www.polymer-project.org/blog/shadydom
|
# ? Jan 5, 2020 19:24 |
|
Ah, I forgot about that "shim".
|
# ? Jan 5, 2020 19:46 |
|
LifeLynx posted:This script works in Chrome, but not in Edge: Are you transpiling? If not, it could be that Edge doesn't support [..linkTo] yet? What does the console tell you?
|
# ? Jan 5, 2020 20:25 |
|
LifeLynx posted:This script works in Chrome, but not in Edge: Maybe I'm misunderstanding something, but what are you using the spread syntax for here? linkTo is a NodeList and should contain the forEach method directly.
|
# ? Jan 6, 2020 02:13 |
|
a hot gujju bhabhi posted:Maybe I'm misunderstanding something, but what are you using the spread syntax for here? linkTo is a NodeList and should contain the forEach method directly. That's a good point I noticed earlier while rereading my post. I think it was a leftover from when I was trying to figure something else out.
|
# ? Jan 6, 2020 02:48 |
|
a hot gujju bhabhi posted:Maybe I'm misunderstanding something, but what are you using the spread syntax for here? linkTo is a NodeList and should contain the forEach method directly. If you modify a child of the list, it invalidates the list, IIRC.
|
# ? Jan 6, 2020 15:35 |
|
a hot gujju bhabhi posted:Maybe I'm misunderstanding something, but what are you using the spread syntax for here? linkTo is a NodeList and should contain the forEach method directly. old browser bug. NodeList didn't have forEach for a few years, it's pretty recent https://esdiscuss.org/topic/why-does-legacy-content-break-when-making-array-likes-real-arrays
|
# ? Jan 6, 2020 22:23 |
|
I have a REST API written in Python as AWS lambda functions and I'd like to convert this into JavaScript as a learning experience. I have a lot of questions. With Python based projects the first thing they tell you to do is set up a virtual environment so that you are using only the packages you explicitly specify. What is the JavaScript (node.js? it's my understanding AWS uses this but I don't know how it fits in with JavaScript to be honest) equivalent of creating a new environment with conda/venv/poetry/whatever and then installing packages specified in a requirements.txt file? There is a python package/cli tool called "black" that is an "uncompromising code formatter." It takes your code and spits out what it should look like including swapping single quotes for double quotes, putting trailing commas on multi line lists, and so on. There are basically no configuration options so all the code looks the same and I like that a lot. What is the JavaScript version of this? What is the typical directory structure of a project? In python if your project was called myproject you'd typically have a project directory like code:
I’d like to learn/do this the right way so thanks in advance.
|
# ? Jan 25, 2020 10:38 |
|
Boris Galerkin posted:I have a REST API written in Python as AWS lambda functions and I'd like to convert this into JavaScript as a learning experience. I have a lot of questions. so, yes. you want to use node. i don't want to get into the nitty gritty, basically javascript is the language, v8 is the javascript engine and node (which uses v8) is the environment that provides extra apis like networking, encryption, etc. conda/venv/poetry equivalent is nvm, package manager is npm which is in every node install. running "npm init" in a folder will create a package.json that holds which libraries/packages to install. "npm -i <package>" to install i don't know if there is a node/javascript equivalent of "black", i use prettier which is a formatter at the text editor level. the closest equivalent i can think of for black is "standardjs": 2 spaces, no semicolons, single quotes. unfortunately because of where javascript is now you can go down a whole rabbithole of additional things. there is babel, there is typescript. those are not needed to deploy to lambda but just know that they exist. there is no defined structure for a project other that node_modules folder that is created by npm that stores packages. i'm about to head off to bed so i'm sure other people can chime in further but one thing i will say is you will probably want something that combines your code into one file so you can just deploy that single file into lambda otherwise you will also have to upload an accompanying node_modules folder which can get large and bloated. what you'd want to use is something like rollup, webpack, or parcel. additionally you'll want to learn about how to include libraries/packages via "require('package name')" or using import via babel. keep in mind i think almost everything is up to date except the last paragraph. unfortunately given the javascript scene there is a new "hotness" that comes out every so often. for example, the original tool people used to combine all files into one was browserify, which gave way to webpack, then rollup, then parcel (all the latter 3 are still popular). there is a lot of poo poo unfortunately which makes it hard for beginners (in the node/javascript space) to get a handle on all the stuff. hell even experienced people have a hard time so they just stay with what they know. i think this is a basic outline and i think amazon has some sample lambda you can copy to test out stuff. Strong Sauce fucked around with this message at 12:05 on Jan 25, 2020 |
# ? Jan 25, 2020 12:03 |
|
Pile-on to Strong Sauce's post: - I agree on using Prettier as a Black equivalent. - You can consider a project directory that has a node_modules directory (ie make `package.json` and run `npm install`) equivalent to a venv - I highly recommend using Typescript; it combines modern JS, combined with a static type system. - Use Webpack to allow use of Python-like import statements. It used to be a mess, but is now straightfwd to use. Config can be a pain; let me know if you'd like starting config files.
|
# ? Jan 25, 2020 15:05 |
|
Dominoes posted:- I highly recommend using Typescript; it combines modern JS, combined with a static type system. Python typing developers often refer to Typescript for inspiration.
|
# ? Jan 25, 2020 17:34 |
|
Thanks for the advice. I’m using yarn because it’s available in macports and npm isn’t. I don’t use homebrew. Is there a compelling enough reason for me to install homebrew just to install npm over just using yarn?
|
# ? Jan 26, 2020 09:44 |
Boris Galerkin posted:Thanks for the advice. No, yarn is superior last i checked. Also I've never heard of a nodejs installation that doesn't come with npm, interesting.
|
|
# ? Jan 26, 2020 09:58 |
|
Osmosisch posted:No, yarn is superior last i checked. What are you using yarn for that npm doesn't do?
|
# ? Jan 26, 2020 10:13 |
|
Can yarn and npm coexist or is my computer going to meltdown if I install both?
|
# ? Jan 26, 2020 10:47 |
|
if you're not squeamish about curling and sh'ing a url then you can just grab nvm from their website. you can then install node, which will then also have npm. also my advice is to not use the macports/homebrew version of node/npm. i think i originally had it on homebrew and just ran into issues down the line. use nvm. i don't know the latest diff between yarn/npm and if there is any it probably is irrelevant to what your needs are for deploying to lambda. npm has been significantly improved since yarn was released 3+ years to address facebook's issues with speed/security/consistency. yarn to me is another thing javascript beginners have to figure out and my advice would be to just skip it until you actually need it. having yarn and npm to manage your node app is pointless and adds an extra yarn.lock file you don't need.
|
# ? Jan 26, 2020 11:30 |
|
There's no reason to not have both yarn and npm, just don't use both on the same project. I don't think either is superior to the other nowadays.
|
# ? Jan 26, 2020 17:07 |
|
I haven't read this article yet, but just FYI yarn 2 is out and people are blowing up my Twitter timeline about it: https://dev.to/arcanis/introducing-yarn-2-4eh1 So yarn might be superior again?
|
# ? Jan 26, 2020 17:20 |
yarn is generally better yes. it's pretty trivial to convert a project from npm to yarn or the other way, so just use the one that you feel has the better package management and CLI (which is basically always yarn, imo) i'd also recommend typescript. even if you never manually annotate a type or engage with any of the other additional language features, having something to yell at you when you use the wrong types in standard and library functions is quite valuable. Jazerus fucked around with this message at 18:24 on Jan 26, 2020 |
|
# ? Jan 26, 2020 17:45 |
|
Grump posted:I haven't read this article yet, but just FYI yarn 2 is out and people are blowing up my Twitter timeline about it: Yeah, looks like they fixed and added a lot of interesting stuff. I'm particularly interested in trying out this normalized shell feature. Supporting multiple operating systems with package.json scripts is hell.
|
# ? Jan 26, 2020 18:22 |
|
Osmosisch posted:No, yarn is superior last i checked. Yeah, I’m guessing it’s just only available bundled in node and not standalone. I’m surprised yarn is available as a stand-alone download for that matter, isn’t it just another node package?
|
# ? Jan 26, 2020 19:27 |
|
Yarn still doesn't support npm audit fix, right?
|
# ? Jan 26, 2020 19:44 |
|
|
# ? May 16, 2024 18:57 |
|
Turns out by the way that npm is available in macports after all, as “npm6”.
|
# ? Jan 27, 2020 08:35 |