Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

add a mp3 player on all the mp3 link

hello this is not a real extention (with instalation) and to use it you need to edit the page with your ftp prog to add a player on all the mp3 link (only the clickable) just add this $Head->AddString('<script type="text/javascript" src=""></script>'); on your page for exemple on /yourvanilladirectory/comments.php in the Define properties of the page controls that are specific to this page (near line 37) then it's look like : // Define properties of the page controls that are specific to this page $Head->BodyId = 'CommentsPage'; $Head->AddString('<script type="text/javascript" src=""></script>'); $Menu->CurrentTab = "discussions"; $Panel->CssClass = "CommentPanel"; $Panel->BodyCssClass = "Comments"; $Context->PageTitle = $CommentGrid->Discussion->Name;


  • Options
    if your want to host the script on your own server you can find and download all the files here : the javascript : the flash player : the icon : credit : mp3 player remied
  • Options
    of course you can change the icon, but then don't forget to change the size (width height) in the player.js
  • Options
    This gadget works well as a standalone on my desktop.
    However, I tried to get this working as an extension but no luck.
    It seems this is failing...

    if(o.href.match(/\.mp3$/i)) {

    The link to the sound.mp3 file never gets replaced by the icon.

    Posted: Wednesday, 28 February 2007 at 3:50PM (AEDT)

  • Options
    the classic regex is this I guess $CONTENT = preg_replace('#h(ttps?://[0-9a-zA-Z\.\&\#\:/~\-_%=?]*\.(mp3))#i', '<embed src="xx$1" width="120" height="23" type="video/quicktime" controller="true" autoplay="false" loop="true" cache="false">', $CONTENT);
  • Options
    "classic regex" ???

    Posted: Thursday, 1 March 2007 at 7:44AM (AEDT)

  • Options
    edited March 2007
    I finally got this script to work, but not as an extension unfortunately.
    It worked when I added the player.js file manually to the page_end.php file.


    I think the extension adds it too early in the load order for it to work.
    Is there a way to add it later in the page load order using an extension?

    Posted: Thursday, 1 March 2007 at 12:52PM (AEDT)

  • Options
    Why not use $Head->AddScript rather than $Head->AddString? Probably wont make much of a difference though... then again I dont see why the head is too early for it to load - that's where all the other js gets instantiated.
  • Options
    Tried that, didn't work.

    The script replaces href tags ending in .mp3 with an image.

    Maybe if it loads before the page does, there are no such tags yet?

    Can an extension add a link to the bottom of a page?
  • Options
    Perhaps all it needs is to be told to fire when the page has finished loading, then it can be put in the head?
  • Options
    it would be wonderful to have this packaged up as an extension...
  • Options
    I guess you could add it to the page end then but I'm not sure what the 'rules' are about doing stuff like that
    To use it as an extension try wrapping whatever's necessary (probably just an echo '';) in a function, and using:
    $Context->AddToDelegate('PageEnd', 'PreRender', 'functionname');
  • Options
    Quote: circuit
    pic it would be wonderful to have this packaged up as an extension... pic
    Yes, my people are having a ball playing with it.
    I have even added a new button for the Quicktags extension to make it so easy to use.
    It's great that the usually huge .mp3 files are stored elsewhere on the web too!

    Unfortunately my attempt to make it into an extension failed due to the reasons outlined above so I had to install the script manually.

    Posted: Tuesday, 6 March 2007 at 2:39PM (AEDT)

  • Options
  • Options
    Sorry, too vague, I missed the point.

    Posted: Tuesday, 6 March 2007 at 3:49PM (AEDT)

  • Options
    the point was that due to security reasons, the idea for a full Multimedia extension was scrapped.
  • Options
    Who said anything about a full media extension?

    How dangerous is a link to an .mp3 file? pic

    All the script does is replace all <a> tags ending in .mp3 with an image and uses a hidden Flash gadget to play the sound file.

    If the .mp3 file is not valid, it simply fails elegantly, that is, the Flash gadget can't run malignant code if that's what the worry is.

    Posted: Tuesday, 6 March 2007 at 5:17PM (AEDT)

  • Options
    edited March 2007
    OK folks, I have found a way to make this into an extension.

    Testing in Safari and Mac/Firefox now.

    Stay tuned, it should be in the add-ons section soon, it will be called: Dplayer. pic

    Posted: Wednesday, 7 March 2007 at 11:29AM (AEDT)

    It's up now. pic

    Edited: Wednesday, 7 March 2007 at 12:40PM (AEDT)

  • Options
    i'm guessing this won't work without a html formatter extension? i'm gonna test it now... (i have html turned off).
  • Options
    it's a great extention wanderer thanks a lot !
  • Options
    ah no it doesn't work without HTML.

    i don't mind turning HTML on, but i can't seem to add it to the BBInsertBar in a way that will provide the correct formatting in both HTML and BBCode. i would really like to use this extension, if anyone has any suggestions as to how i could do it, please share!
This discussion has been closed.