Recent Topics

1 Nov 28, 2009 20:39    

My b2evolution Version: 2.4.2

I want to put together some code that I wrap around a vulgar comment to a so that the viewer has to deliberately click a link to view it. I'm instituting a 'vulgar' class in style.css that makes the text the same color as the background, and thus unreadable. To change the color of the text to a readable color, I need to allow the "id" element for div and allow "onclick" for the anchor tag. Can anyone point out to me where to do make it so that b2e allows that content instead of giving me "not allowed" messages? I've searched the forum, but nothing obvious popped up. I have in mind something like this:

<font size='+2' color='red'>Warning!</font> This comment is vulgar. Click <a onclick='javascript:document.getElementById("c20091126a").style.color="#000000";'>here</a> if you want to read.
<div id='c20091126a' class='vulgar'>

Here's the vulgar content.

</div>

2 Nov 29, 2009 08:50

Okay, I'm making progress. To enable javascript as part of href, I had to add 'javascript' to the $schemes array in inc/_core/_url.funcs.php.

3 Nov 29, 2009 09:13

If it was me I'd probably play with the bbcode settings for comments :

search :

~[vulgar](.+?)[/vulgar]~is

replace :

<div class="vulgar"><span class="disclaimer">Click here to read this comment</span><div class="vulgar_content">$1</div></div>

css :

.vulgar .vulgar_content{
display:none;
}

js :

jQuery( '.vulgar .disclaimer').each(function(){
  jQuery( this ).click( function(){
    jQuery( this ).parent().parent().find( '.vulgar_content').show();
    jQuery( this ).remove();
  });
  });

Free-typed, so expect errors

¥

4 Nov 29, 2009 09:38

Alright, the last issues are resolved. I redefined

$A_coreattrs = 'class title id style onmouseover onmouseout onclick'

in \inc\xhtml_validator\_xhtml_dtd.inc.php

For some reason setting allow_javascript and comments_allow_css_tweaks to true, which should have done essentially the same thing, didn't work.

Also instead of using href for the javascript I used onclick.


Form is loading...