Comments (15)
What is your bookmarklet code? I just tested a basic script with both the popup menu and the context menu and it seems to be working.
from contextsearch-web-ext.
javascript:outText='';for(i=0;i<document.images.length;i++){if(outText.indexOf(document.images[i].src)==-1){outText+='<tr><td><img style=max-width:800px src='+document.images[i].src+'></td><td>'+document.images[i].naturalWidth+'x'+document.images[i].naturalHeight+'</td></tr><p>'}};if(outText!=''){imgWindow=window.open('','imgWin');imgWindow.document.write('<table style=margin:auto border=1 cellpadding=10><tr><th>Image</th><th>Size</th></tr><p>'+outText+'</table><p>');imgWindow.document.close()}else{alert('No Images!')}
try this code, thanks! @ssborbis
from contextsearch-web-ext.
It's failing because of CORS. A workaround would be to open the new tab to the current location, then wipe the old HTML before writing the new HTML
outText='';
for (i=0;i<document.images.length;i++){
if (outText.indexOf(document.images[i].src)==-1) {
outText+='<tr><td><img style=max-width:800px src='+document.images[i].src+'></td><td>'+document.images[i].naturalWidth+'x'+document.images[i].naturalHeight+'</td></tr><p>';
}
}
if (outText != '') {
imgWindow=window.open(window.location.href,'imgWin');
imgWindow.document.innerHTML = null;
imgWindow.document.write('<table style=margin:auto border=1 cellpadding=10><tr><th>Image</th><th>Size</th></tr><p>'+outText+'</table><p>');imgWindow.document.close();
} else{
alert('No Images!');
}
from contextsearch-web-ext.
thanks for your info,
but try this extension:https://addons.mozilla.org/en-US/firefox/addon/bookmarklets-context-menu
it works well, any alternative solution? @ssborbis
from contextsearch-web-ext.
I have a possible workaround going into the master branch if you want to test. You'll need to enable the advanced setting scriptsUseBlobs : true
from contextsearch-web-ext.
hi @ssborbis,
I just downloaded the master branch file you mentioned, and reload it from browser,
and i am sure the advanced setting scriptsUseBlobs : true is on,
but the test didn't go through on chrome.
in the end,
when will this new feature be pushed to the new version?
from contextsearch-web-ext.
It appears that the test code you provided is working in chromium without the need for the additional setting. I get the same results whether the setting is enabled or not.
Firefox, however, required the new setting enabled to avoid CORS issues. Are you testing using the code you provided to test with, or some other bookmarklet code?
from contextsearch-web-ext.
If you'd been testing with scripts that contain searchTerms, they would have been failing. Try the latest code in the master branch
from contextsearch-web-ext.
@ssborbis
Unfortunately,
The new version still not working. I tested it with the simplest code javascript:alert('hi');
I have to select text before I can run it,
what i hope for is that running it from the context menu.
from contextsearch-web-ext.
Ok, I think the failure was due to needing to select text first. The latest push has a fix for that.
(edit) I only tested using the contextual layout option. Let me know what your context menu settings are.
from contextsearch-web-ext.
@ssborbis
Finally!
It works now.
That's exactly what I hope for.
When will the new version to be released? I can't wait any longer!
from contextsearch-web-ext.
@ssborbis
A big thanks for your update!!!
In the latest version, chrome and edge are working fine,
but in firefox, some bookmarklets will only display a new tab, and the function cannot be executed.
try this code, doesn't work in firefox:
javascript:outText='';for(i=0;i<document.images.length;i++){if(outText.indexOf(document.images[i].src)==-1){outText+='<tr><td><img style=max-width:800px src='+document.images[i].src+'></td><td>'+document.images[i].naturalWidth+'x'+document.images[i].naturalHeight+'</td></tr><p>'}};if(outText!=''){imgWindow=window.open('','imgWin');imgWindow.document.write('<table style=margin:auto border=1 cellpadding=10><tr><th>Image</th><th>Size</th></tr><p>'+outText+'</table><p>');imgWindow.document.close()}else{alert('No Images!')}
from contextsearch-web-ext.
Update:
After set "scriptsUseBlobs": true, everything works fine now!
from contextsearch-web-ext.
is scriptsUseBlobs gonna be in a new version soon?
from contextsearch-web-ext.
is scriptsUseBlobs gonna be in a new version soon?
because I am trying to use this bookmarklet to load broken images:
javascript: (() => { (function()%7Bvar%20images%20%3D%20document.querySelectorAll('img')%3Bfor%20(var%20i%20%3D%200%3Bi%3C%20images.length%3Bi%2B%2B)%20%7Bif%20(images%5Bi%5D.naturalWidth%20%3D%3D%3D%200%20%7C%7C%20!images%5Bi%5D.complete)%20%7Bimages%5Bi%5D.src%20%3D%20images%5Bi%5D.src%3B%7D%7Dvar%20allEle%20%3D%20document.querySelectorAll('*')%3Bfor%20(var%20i%20%3D%200%3B%20i%3CallEle.length%3B%20i%2B%2B)%20%7Bvar%20bgimg%20%3D%20getComputedStyle(allEle%5Bi%5D).getPropertyValue('background-image').replace('url(%22'%2C'').replace('%22)'%2C'')%3Bif%20(bgimg%20!%3D%3D%20'none')%20%7BallEle%5Bi%5D.style.backgroundImage%20%3D%20'url(%22'%2B%20bgimg%20%2B'%22)'%3B%7D%7Dimages%20%3D%20%5B%5D%3BallEle%20%3D%20%5B%5D%7D)(); })();
from contextsearch-web-ext.
Related Issues (20)
- Is it possible to make the outline of the 'quick menu' square? HOT 2
- About auto copy text. HOT 9
- Search Engine Issues with React framework? HOT 8
- the highlight feature doesn't work anymore? HOT 6
- searchTerms with multi lines selection problem? HOT 9
- "Search engines manager" invisible buttons HOT 1
- Input Cursor HOT 8
- "Quick Menu" should be hidden in a text field when I type HOT 8
- link search doesn't get disabled HOT 4
- feature request: enable filtering based on element for recent search engines. HOT 1
- Open Image in external Viewer HOT 7
- Feature request: Automatically select Google as search engine after selecting text HOT 3
- How to disable items for non-images? HOT 2
- Make quick menu also appear on PDF files in Firefox HOT 3
- Exporting ContextSearch to search.json.mozlz4 doesn't work HOT 2
- Tiny Quick Menu with Resist Fingerprintig enabled HOT 6
- Get another tab from same page
- Single query search for multiple strings across separate lines
- Instant Search stops working after a few searches HOT 2
- Making the pop-up "QuickMenu" square with CSS "border-radius" HOT 1
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 contextsearch-web-ext.