Page 1 of 1

Bookmarklet Issue 2.6.8.15rc5?

Posted: Sat Feb 22, 2014 2:34 am
by therube
Bookmarklet Issue, 2.6.8.15rc5?

Code: Select all

javascript:Qr=document.getSelection();if(Qr)location.href='es:'+(Qr)
Don't know if it's NoScript or not?
In the past, clicking the bookmarklet would send the highlighted text to Everything Search.

It still does that, but it also "loads a page" (or at least displays on a page, & replacing the existing) my search term.

Like if I highlighted "NoScript" & clicked the bookmarklet, "NoScript" is sent to Everything Search AND the exist page is replaced by "es:NoScript".

Back-Arrow & I'm where I was, but it shouldn't be like that ... IMO.

Nothing special about my code.
Again don't know if it is NoScript related?
If it is & if there is some other code that will accomplish the same, I'll all for it.

"es:" is a "protocol" if you will, like http: or ftp: ...

http://forum.voidtools.com/viewtopic.php?f=9&t=2217

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sat Feb 22, 2014 2:40 am
by therube
OK, it is rc5.

rc4 behaves "correctly".

So if you have a bit of JS...

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sun Feb 23, 2014 2:48 pm
by therube
Issue persists with 2.6.8.15rc6.

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sun Feb 23, 2014 3:06 pm
by Giorgio Maone
Add

Code: Select all

;void(0)
at the end of your code.

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sun Feb 23, 2014 5:26 pm
by Giorgio Maone
... or check latest development build 2.6.8.16rc1, thanks.

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sun Feb 23, 2014 5:41 pm
by therube
2.6.8.16rc1 also does not work correctly.

Though ;void(0) does work :-).

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Mon Feb 24, 2014 4:17 pm
by Alexm
I have the same problem with 2.6.8.16rc1 and this search bookmarklet:

Code: Select all

javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e;};
On click nothing happen. No search window, etc...

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Mon Feb 24, 2014 4:21 pm
by Alexm
Works again with 2.6.8.16rc2.

Tnx

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Mon Feb 24, 2014 5:27 pm
by therube
(Just to note, SeaMonkey's built-in Translate Page function was not affected by 2.6.8.15rc5.)

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sat Mar 01, 2014 2:32 am
by Tommy2Tone
First time having trouble with an old bookmarklet used to show imgur images (and image zooming) on Reddit with 2.6.8

Code: Select all

javascript:document.ondragstart=function(){return%20false};dst=function(e){return%20(p=Math.pow)(p(e.clientX-(rc=e.target.getBoundingClientRect()).left,2)+p(e.clientY-rc.top,2),.5)};$("[href\x2a=imgur]").not($(t="[href$=jpeg],[href$=gif],[href$=png],[href$=jpg]")).each(function(){this.href+='.jpg'});void($(t).not(".EGraw,.click-gadget%20a,.domain%20a,.thumbnail").attr({'class':'%45%47%72%61%77',target:'blank'}).each(function(){$(this).append($('<span%20/>').toggle(function(e){$(this).html('%20[-]').nextAll().show();return%20false},function(e){$(this).html('%20[+]').nextAll().hide();return%20false}).click()).append($('<img>').attr({src:this.href,style:'display:block;max-width:780px;height:auto',title:'Drag%20to%20resize'}).mousedown(function(e){(t=this).iw=t.width;t.d=dst(e);t.dr=false;e.preventDefault();}).mousemove(function(e){if((t=this).d){t.style.maxWidth=t.style.width=((dst(e))%2At.iw/t.d)+"px";this.dr=true}}).mouseout(f=function(e){this.d=false;if(this.dr)return%20false}).click(f)).append($('<span%20/>').html('%26#8635;').click(function(e){(i=$(t=this).prev()).css({MozTransform:r='rotate('+(t.rot=(t.rot?(++t.rot):1)%4)%2A90+'deg)',WebkitTransform:r,filter:'progid:DXImageTransform.Microsoft.BasicImage(rotation='+t.rot+')',marginBottom:(m=t.rot%2?(i.attr('width')-i.attr('height'))/(1+(nie=!$.browser.msie)):0)+'px',marginTop:(m=nie%2Am)+'px',marginLeft:-m+'px',marginRight:-m+'px'});return%20false}))}))

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Sat Mar 01, 2014 9:45 pm
by Giorgio Maone
Please check latest development build 2.6.8.17rc1, thanks.

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Mon Mar 03, 2014 4:18 pm
by Tommy2Tone
Giorgio Maone wrote:Please check latest development build 2.6.8.17rc1, thanks.
Nice work, my bookmarklet is now functioning again... Thanks!

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Wed Mar 12, 2014 2:12 pm
by barbaz
Giorgio Maone wrote:Add

Code: Select all

;void(0)
at the end of your code.
I'm having the same issue with URL bar JS and bookmarklets. If I enter a code that returns something, and I don't append void(0); to the end, the displayed webpage becomes the shell representation of the return value of the code.
And as therube said, 2.6.8.15rc4 doesn't require that workaround.
Should NoScript silently stick ;void(0); on the end of URL bar JS and bookmarklets before emulating? If that shouldn't be default, Giorgio, could you please add an about:config pref which, when set, triggers that behavior?

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Wed Mar 12, 2014 3:11 pm
by Giorgio Maone
barbaz wrote: Should NoScript silently stick ;void(0); on the end of URL bar JS and bookmarklets before emulating? If that shouldn't be default, Giorgio, could you please add an about:config pref which, when set, triggers that behavior?
Nope.
That's always be the normal behavior for code executed from the URL bar, and as such is considered a "feature".
NoScript actually puts quite an effort in emulating it, and it's often useful.
The bug in the OP was about this being emulated with a synchronous replacement, rather than an asynchronous one, causing the load initiated by the "location.href = xyz" statement being overridden by the returned expression replacing the content.

Therefore yes, for your use case either ";void(0)" or any other statement not returning any value (e.g. "alert(something)") is mandatory and expected in the end if you don't want to trigger this feature.

Re: Bookmarklet Issue 2.6.8.15rc5?

Posted: Wed Mar 12, 2014 3:33 pm
by barbaz
Ah, didn't realize that not displaying the return values of javascript: URLs in their own page was actually a bug, and that my bookmarklets in fact weren't returning anything. Thanks for the clarification!