Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

div background image.

1401912699

Edited 1401914386
DXWarlock
Sheet Author
API Scripter
Ok this is driving me crazy, I'm on the dev server by the way if it matters. Sending a div in API with /w works great (not sure when they changed it long ago it didn't, but it works now) I'm trying to send one with an image as the BG and its not working Here is a test script as basic as I can give an example: It sends the div with an image as /direct and /w. the direct works BUT It also sends a div with color BG, and it works for both /direct AND /w on("chat:message", function (msg) { if(msg.type == "api" && msg.content.indexOf("!test") !== -1) { //---test image var image = "&lt;div style='background-image: url(<a href="http://tutorials-cdn.pixelmator.com/gradient-tool/top.jpg" rel="nofollow">http://tutorials-cdn.pixelmator.com/gradient-tool/top.jpg</a>); border: 1px solid #000; border-radius: 8px 8px 8px 8px;'&gt;TEST&lt;/div&gt;"; sendChat("test image direct", "/direct " + image); sendChat("test image whisper", "/w gm " + image); //---test color var color = "&lt;div style='background-color:#70D16D; border: 1px solid #000; border-radius: 8px 8px 8px 8px;'&gt;TEST&lt;/div&gt;"; sendChat("test color direct", "/direct " + color); sendChat("test color whisper", "/w gm " + color); }; }); This results is this, notice the second one using an image and /w results in it totally breaking: <a href="http://i.imgur.com/fXkgooH.jpg" rel="nofollow">http://i.imgur.com/fXkgooH.jpg</a> The only difference is I change background-color:#70D16D; to background-image: url( <a href="http://tutorials-cdn.pixelmator.com/gradient-tool/top.jpg" rel="nofollow">http://tutorials-cdn.pixelmator.com/gradient-tool/top.jpg</a> ); Is this a bug i should report in the bug section? or is being able to send partially working html at all with /w an 'unintended feature' and I should consider being able to do it at all a bonus? :)
1401915136

Edited 1401915155
Lithl
Pro
Sheet Author
API Scripter
The url should be quoted. Try either "&lt;div style='background-image: url(\'http://...\');&gt;TEST&lt;/div&gt;" or "&lt;div style='background-image: url(\"http://...\");&gt;TEST&lt;/div&gt;" and see if it works.
1401915970

Edited 1401916153
DXWarlock
Sheet Author
API Scripter
I tried that also :\ both do the same, just return the text and breaks the div. after playing with it it seems its the '//' in the address. I remove it and it of course does not show an image, but the div box shows up EDIT: I got it! it needed background-image: url(http:\\//tutorials-cdn.pixelmator.com/gradient-tool/top.jpg); adding the 2 \\ before the // fixed it :) weird how /w needs it, but all other sendChat types dont :|