Adding Bookmarklet Javascript to Block? - javascript

Hello i've been trying to do this for about 2 years. I think it worked once but ever since then i just can't make it happen again. Im adding this code to a block-
<a href="javascript:u=document.location.href;t=document.title; s=window.getSelection();
void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));">Test</a>
When i try to drag that to my browser the url comes out as so-
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(
I am using the Full HTML filter option and isnt adding line breaks or anything. If i edit the link in my browser and add just
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));
Things work great. I have looked about and have asked here previously
http://drupal.org/node/235074
I must just be missing something so simple as it seems the whole internet doesnt have this problem. All help appreciated thanks.
Reg`

I think the problem is with the double-quotes in your window.open() call.
The browser thinks that you're closing the href="javascript... "
Replace the double quotes in "http://onlinebanter.com/node/add/web2ob?edit[title]=" with single quotes.

Related

How to add script tags to html

Here in the image you see the code is greyed out. Before I put in the <script> tag everything was not greyed out. Once I put in the tag is greys out the rest of the code. I might be missing a file needed to run the script tags?
I have been working with code for a while, but I am still a little stuck on how to get the code set up. I am wanting to use html/css and JavaScript to make a couple websites. I am not sure how to set everything up to make it work. I also am using github, and trying to figure out how to use github-pages.
A simple solution that works:
Just close the file being edited
Click "File->Reopen Last Item" to re-open it
This is an issue with Atom, it does not detect the tag when it auto completes, it works fine in VSCode, so it's not really a problem with your code, it's the IDE
enter image description here
As i recognize, the Atom text editor makes this error.
The best solution i tried:
IN ATOM TEXT EDITOR
Windows:
Ctrl + ,
MAC:
Cmd + ,
In settings:
1. Scroll to the bottom,
2. Uncheck "Use Tree Sitter Parsers",
3. Restart Atom IDE.
That works fine for me!
This is a known bug, but it seems no fix have been done yet, you can report your case here, I guess: HTML Syntax Colour Bug
But you may have solution in that StackOverflow subject, if so, it would be a duplicate: Atom Code Editor. Why is my code not in color?

Clicking JavaScript in Ruby/Watir

Is there ANY way to click a JavaScript link using the Watir webdriver? I've looked around for hours and nothing has helped me.
Here's what the link looks like: MULTIPLY YOUR BTC
I've tried using browser.link(:id, "double_your_btc_link2").click and a bunch of other stuff including Xpath (it kept saying it couldn't follow the path) and nothing works. Is it even possible?
If you need the page, here it is.
That should have been:
browser.link(:id => "double_your_btc_link2").click
Sorry to waste your time, guys. I just used Firefox instead of Chrome and it worked fine. This isn't even the first time I've had a problem with accessing JavaScript elements in Chrome...thanks anyway.

Ajax: blank space on IE

I have been working with some Ajax functions. All of them are working very well. But i have noticed that sometimes, when the function needs to write something on a <div> it does, but all the text appears to move one space down. This happens only on Internet Explore and only sometimes, not everytime. This does not happen on the other browsers.
I know that maybe a part of code would be appropiate, but this keeps happens on many functions, and all my codes are very long.
I only want to know if someone has experienced something like this??
Thanks a lot
Is your code in UTF-8? If so, you're probably facing the wrath of the BOM (Byte-Order Mark).
The BOM is not required or even desirable. Make sure it is not there when you save your UTF-8 documents. For example, in Notepad++ there is the option to "Encode in UTF-8 without BOM" that solves the problem nicely.
If this is not an option, try this:
data = data.replace(/^\xEF\xBB\xBF/,'');
where data is what you just received from AJAX and are about to insert into the document.

tinyMCE not working on firefox 5.0

I've just realized that tinyMCE is not working when you use firefox 5.0
First I thought that's my fault with some script , but then I went straight to TinyMCE demo page http://www.tinymce.com/tryit/full.php and there was the same result.
In normal way you open page, see editor, see text inside editor.
With firefox you see editor, but nothing is inside textarea. It is empy, blank. And what's more strange there is no mouse cursor inside of it. You cannot set it there, thus you cannot write there.
Later on I made one notice.
I've started to refresh the page fast, many times so the browser cannot work fast.
And I saw that it writes textarea, then converts it into tinyMCE editor with all text inside of textarera, and then on the final step it hides or removes all the data from textarea, leaving empty editor with all buttons visible.
Any idea what's going on?
Of course I've posted this on TinyMCE forum, and bugreported it also, but things there run very slow, and on StackOverflow I've got used to fast answers :)
So if anyone has any idea about how can I fix it please tell me.
UPDATE
I think something is wrong with my computer.
I've just tested cuteEditors demo and it acts the same way
http://cutesoft.net/example/general.aspx
So I think problem is inside my computer.
Is it Firefox or what?
SOLVED
Plugins were the problem. I disabled all the plugins and everything works fine!
SOLVED Plugins were the problem. I disabled all the plugins and everything works fine!

Chrome problems

I have a few annoying problems.
The thing is, that when I am looking with Firefox every thing work perfect, after I try it with Chrome, sometimes happens that the code appears one web page (it is not all the time).
So, it appears in input text it display " />" or some piece of code of java script, which is written inside input tag.
The web page is: www.kalahoo.eu (do not try it in English )
In this picture you can see the problem:
http://rhc.si/slike/problem.png
Thank you very much for you help!!!
Can you post a link to the exact page with this error?
Either way, I would imagine that if you use the Chrome developer tools, you should get pointed in the right direction. Might want to give that a try.
You seem to be improperly escaping code that's making the HTML end before the rest of the attributes are read.
Check the spot in the code where its doing that, its probably a bad ' or " or even a >.

Categories

Resources