Hi, I have the mailto ling over an envelope icon, as usual

The link in particular is sth like that
Only local images are allowed.

Unfortunately the displayed output is a text with a scrambled link, but no image.
The desired result would be a clickable image

Comments

radiobuzzer’s picture

Sorry code was filtered. Let's try again

<a href="mailto:mymail@mail.vv"> <img src="mail.png"></a>

josdberd’s picture

Subscribing

deleron’s picture

not tested so I will not create a patch:

In spamspan.js (line 34), replace:

var _anchorText = $("span." +  Drupal.settings.spamspan.t, this).text().replace(/^ \((.*)\)$/, "$1");

with:

var _anchorText = $("span." +  Drupal.settings.spamspan.t, this).html().replace(/^ \((.*)\)$/, "$1");

Using .text() discards the Only local images are allowed. tag, using .html() keeps it.

Of course, to work, you have to compress again the spamspan.js file into spamspan.compressed.js

Hope this help.

lakka’s picture

Status: Active » Closed (fixed)

Fixed in 6--1.5. Thanks.

lakka’s picture

Version: 6.x-1.4 » 6.x-1.6
Status: Closed (fixed) » Active

Reviving this bug. The fix applied did not work when there was no nested element within the <a> tag, so I have removed it.

DizzySquirrelz’s picture

Version: 6.x-1.6 » 6.x-1.5

The fix also overrides the image alignment when linking the image to an email.

DizzySquirrelz’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1004 bytes

I have created a patch which solves the problems above.
The code first checks if an image is present and then utilizes .html (keeping the img tag in place) otherwise it just uses .text

There is still the issue where the filter_xss() function in spamspan.module throws out any styling inserted by wysiwyg, such as: style="align:right;"

So for that I replaced (Line 224):
$output = filter_xss($output, $allowed_tags = array('em', 'strong', 'cite', 'b', 'i', 'code', 'span', 'img'));
with:
//$output = filter_xss($output, $allowed_tags = array('em', 'strong', 'cite', 'b', 'i', 'code', 'span', 'img'));

This disables the filter, but then also presents a security risk. I am not too sure how to get around this one yet.

Anonymous’s picture

Thanks for the patch, DizzySquirrelz! I can confirm that this is working for me.

Maybe we can get this into a release? Seems like an important feature.

Anonymous’s picture

StatusFileSize
new2.54 KB

Found an issue in IE < 9 where the round brackets weren't being properly removed on output. I was able to use the same technique from ln 28 of spamspan.js to fix it by adding ?'s to the code:

.replace(/^ ?\((.*)\) ?$/, "$1");

I've rerolled the patch from #7 with changes included.

tomb-2’s picture

StatusFileSize
new744 bytes

Re-rolled the patch in #9 for version 7.x-1.1 beta 1

tomb-2’s picture

Version: 6.x-1.x-dev » 7.x-1.1-beta1
vitalie’s picture

Version: 7.x-1.1-beta1 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs review » Fixed
StatusFileSize
new4.39 KB

Thanks all for the patches. I have integrated the main idea of the patches in the patch below. In addition it deals with the fact that latest 7.x.-1.x dev code is first converting images to <!-- img $hash --> and then puts them back.

  • vitalie committed be9231f on 7.x-1.x
    Issue #723460 by DizzySquirrelz, rclations, tomb, vitalie, radiobuzzer,...
vitalie’s picture

Status: Fixed » Closed (fixed)
NaX’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Needs review

I don't know what happened, this was fixed in D6-1.5 but reverted in D6-1.6. When you compare the to version the 1.6 is reverted back to using the .text() method rather than the .html() method.

Can we maybe get this committed to the D6 branch and then get a new release.

anybody’s picture

Status: Needs review » Closed (outdated)