I've implemented this javascript nearly at the bottom of my overall_header.html:
<script lang="javascript" type="text/javascript">
window.onload = function() {
var IMG = document.getElementsByTagName('img');
for (var i=0;i<IMG.length;i++) {
IMG[i].addEventListener('click',fullImage,false);
}
var SPOILER = document.getElementsByClassName('spoiler');
for (var i=0;i<SPOILER.length;i++) {
SPOILER[i].addEventListener('click',showSpoiler,false);
}
};
function fullImage() {
if (this.className == '') {
this.className = 'full-image';
} else {
this.className = '';
}
}
function showSpoiler() {
if (this.className == 'spoiler') {
this.className = 'spoiler show';
} else {
this.className = 'spoiler';
}
}
</script>
Then I've created a custom BBCode Tag in ACP:
[spoiler]{TEXT}[/spoiler]
<span class="spoiler" onclick="function('showSpoiler');>{TEXT}</span>
Also the corresponding CSS classes in my stylesheet.css
.spoiler { color: #000000; background: #000000; cursor: help; }
.spoiler img { visibility: hidden; pointer-events: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.spoiler.show { text-decoration: none; background: transparent; }
.spoiler.show img { visibility: visible; display: inline-block; -webkit-user-select: all; -moz-user-select: all; user-select: all; pointer-events: all; }
Now what happens is that text marked with a BBcode spoiler tag will be blacked out and when I hover the mouse over it, the cursor will change to the help cursor icon, but nothing happens "onclick". Please can you advise how I can get this stuff finally to work?
Please can you help me? Many thanks in advance!