Comments (8)
Answering your first question, you can just use document.title
.
2nd question: Luckily this is indeed just regular javascript, so just reading up on javascript will teach you a lot of this stuff. W3schools is a decent resource for getting into the basics, but there's probably lots of resources around the internet. Stuff that's got crmAPI
in it is generally exclusive to this extension (so there won't be any resources on it), but any javascript code will run in this extension as well.
3rd question: I'm not entirely sure, but I'm pretty sure you can just add %2
in the registry (like you suggested) and pass the second parameter either after a space (so window.open(`media://${crmAPI.contextData.target.src}___${location.href} ${nextArgument}`, '_blank');
) or a comma (so window.open(`media://${crmAPI.contextData.target.src}___${location.href},${nextArgument}`, '_blank');
). Not 100% sure but one of these might work. If that doesn't work, check out this section of the wiki. Using the python script you can customize the parameters it passes a bit more easily.
Let me know if you have any more questions, I could imagine the last question one is a bit hard to get working.
from customrightclickmenu.
Okay sorry. I figured some of that out last night but forgot to post back.
I really appreciate it. Obviously early on everything is quite exciting and you learn a lot very fast.
I try not to bug you too much. Thank you for your clarification.
I have twitter storing their @handles_image48756.jpg automatically now and fixed a lot of website downloads by finding referrer URL and passing it to the CURL request. Might figure out how to feed that cookie too :P lol
If you know how and what I mean
from customrightclickmenu.
Yeah I tried a couple syntaxes. The first one I tried already like you said that seemed it might work was spaces.
window.open(media://${crmAPI.contextData.target.src}/&${location.href}&tips
, '_blank');
window.open(media://${crmAPI.contextData.target.src}+${location.href}+tips
, '_blank');
window.open(media://${crmAPI.contextData.target.src},${location.href},tips
, '_blank');
Closing quotes sooner
window.open(media://${crmAPI.contextData.target.src}',${location.href},tips, '_blank'); window.open(
media://${crmAPI.contextData.target.src}', '_blank', ${location.href});
Putting them after the blank
These last 2 actually crashed the whole extension it seems lol
from customrightclickmenu.
But I can see you are just using "/" as delimiter which is fine. I'm good to go in that regard.
document.title worked thank you.
I'll have to write a javascript now to find like the artist for example on a pixiv illustration. And then send it along to be stored as METADATA. This is gonna organize so much.
https://www.pixiv.net/en/artworks/91575168
This is a perfect example of something quite easy to do with javascript right? It can search through entire HTML and so forth and pull bits of data like that?
from customrightclickmenu.
Good to hear it worked. Yep you're right, that's something that javascript is perfect for.
from customrightclickmenu.
I'm figuring it out. Pretty great.
Thanks
from customrightclickmenu.
@SanderRonde
Why will none of these pull the list of HTML elements for me to sort through and identify which data I need?
const matches = document.querySelectorAll();
alert(matches.length + ' nodes inside this page');
for (let i = 0; i < matches.length; i++) {
alert(matches[i]);
}
var nodeList = document.getElementsByTagName();
var i;
for (i = 0; i < nodeList.length; i++) {
alert(nodeList[i]);
}
var list = document.getElementsByClassName();
for (let item of list) {
alert(item.id);
}
==========================================================
I at-least can see the functions of the API here so that's opened some doors.
Doing the same with document actually gives me every HTML element right?
for (const prop in crmAPI) {
// prop
contains the name of each property, i.e. 'code'
or 'items'
alert(prop);
// consequently, data[prop]
refers to the value of each property, i.e.
//alert(crmAPI[prop]);
// either 42
or the array
}
from customrightclickmenu.
Why will none of these pull the list of HTML elements for me to sort through and identify which data I need?
They each require an argument to be passed. For example document.getElementsByTagName
requires you to pass a tag name as the argument to search for. For example document.getElementsByTagName('img')
gives you all image elements on the page. If you really want to find all elements on the page, you can do document.querySelectorAll('*')
(this is quite inefficient and slow but it's a lot easier than the better alternative). I also wouldn't recommend looping through each of them and alert
ing them since there are going to be a lot of matches. Running document.querySelectorAll('*')
on this page returns about 2700 matches. Instead of putting the javascript code in a script and running it like that, it's a lot easier to just go to the page, opening the developer tools (press F12), going to the console
tag and putting the code in there. Then just pressing enter immediately executes it and you'll be able to have a look at it.
The best course of action for then finding a single element (like the author's name you mentioned before) on a webpage is to open the developer tools, find the element that contains the author's name, get its ID or class and use getElementById('thatId')
to find the element. With a bit of luck that will work.
I at-least can see the functions of the API here so that's opened some doors. Doing the same with document actually gives me every HTML element right?
No that will just show you all functions and properties that the document
element has. Running document.querySelectorAll('*')
shows you all elements.
for (const prop in crmAPI) {
// prop contains the name of each property, i.e. 'code' or 'items'
alert(prop);
// consequently, data[prop] refers to the value of each property, i.e.
//alert(crmAPI[prop]);
// either 42 or the array
}
First of all I'd recommend replacing alert
with console.log
. That will show you the value in the console tab of the developer tools in a lot more user-friendly way. Alert is really only meant for text and isn't a good fit for debugging. Second you can just call console.log(crmAPI)
to explore all properties and their values in the console. It will give you a nice tree view. Alternatively you can run console.dir(crmAPI)
to do sort of the same thing. The difference is console.dir
will display everything as a tree-view, whereas console.log
will show for example strings as just their text.
See this page for more info on how the console and stuf works
from customrightclickmenu.
Related Issues (20)
- Stylesheets for select sites not working HOT 13
- Disabling handling of userscript installs HOT 1
- Get Selected Elements HOT 4
- Execute when visiting specified sites HOT 1
- [wiki] please give an example how to pass link as an argument for search engine HOT 3
- [wiki]How to add Copy Tab URL HOT 8
- CRX_SIGNATURE_VERIFICATION_FAILED - Cant add extension to edge HOT 3
- [wiki] Download Tutorial HOT 26
- An error occurred. The package is invalid:“CRX_SIGNATURE_VERIFICATION_FAILED” HOT 1
- Can't run the script on chrome-extension:// page. HOT 1
- Is it possible to add items straight to the context menu and not into the submenu? HOT 3
- Cannot rename main node (Custom Menu) to something else in EDGE (works in Google) HOT 3
- Manage permissions dialog is not working HOT 2
- Project abandoned or in development HOT 7
- Bug: Cannot view or edit submenu HOT 1
- Is it possible the use the current tab url in the link settings? HOT 2
- add text to the context menu that when you click on the text it adds it to the form text box HOT 5
- Get text from the CRM item clicked HOT 18
- True copy and paste operation vs determining which field I right clicked in HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customrightclickmenu.