Ok, I see what is happening. You use the template variableJohn connor wrote:Okay, I had the code in overall_footer_after.html so I added it to overall_footer_body_after.html and delted from the other file, cleared the cache and all I see load is the following:martti wrote:John connor wrote:Hey Martti, you made this code for me to play audio to banned members, but now it seems it won't work. Perhaps this is a 3.1.6 issue? It played before and now I just noticed this trying 4 browsers and changing the audio from MP3 to Ogg. Nothing worked. Not sure what to make of this. The code is in the overall_footer_after.html.
Code: Select all
<!-- play requiem for the banned --> <!-- IF SCRIPT_NAME == 'ucp' and CUSTOMCODE_PARAM_MODE == 'login' --> <audio src="https://mysite.com/images/banned.mp3"></audio> <script> $(document).ready( function() { window.setTimeout( function() { if ($('div#message > div.inner > p > em').text().indexOf('A ban has been issued') >= 0){ $('audio')[0].play(); } }, 100); }); </script> <!-- ENDIF -->
The script can be improved, by the way, because you're not limited anymore to certain events. When you use event
- Is the language in your board still English? See that the script searches for the string 'A ban has been issued'
- Do you see that the page tries to load the audio? For example you can inspect this with Firebug in Firefox.
overall_footer_body_after.html
you can forget about the SetTimeout function, because the event is located after jQuery:
Edit :overall_footer_body_after.html
Code: Select all
<!-- play requiem for the banned --> <!-- IF SCRIPT_NAME == 'ucp' and CUSTOMCODE_PARAM_MODE == 'login' --> <audio src="https://mysite.com/images/banned.mp3"></audio> <script> $(document).ready( function() { if ($('div#message > div.inner > p > em').text().indexOf('A ban has been issued') >= 0){ $('audio')[0].play(); } }); </script> <!-- ENDIF -->
No audio. Yes, my board is still in English. I'm wondering if an extension is interfering? I used Firebug, but not sure how to see if there are errors.Code: Select all
<!-- append to quickreply --> <!-- append to posting box --> <!-- play requiem for the banned -->
CUSTOMCODE_PARAM_MODE
, that was generated by the Custom Code extension. I wrote the Parameter Template Variables extension to replace this functionality(as I wrote at the bottom of this post)
Upload and enable this extension and replace
CUSTOMCODE_PARAM_MODE == 'login'
with PARAMTEMPVARS_MODE == 'login'