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

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="http://googlepage.googlepages.com/player.js"></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="http://googlepage.googlepages.com/player.js"></script>'); $Menu->CurrentTab = "discussions"; $Panel->CssClass = "CommentPanel"; $Panel->BodyCssClass = "Comments"; $Context->PageTitle = $CommentGrid->Discussion->Name;
«1

Comments

  • if your want to host the script on your own server you can find and download all the files here : the javascript : http://laurent.gandhi.free.fr/player.js the flash player : http://laurent.gandhi.free.fr/player.swf the icon : http://laurent.gandhi.free.fr/play.gif http://laurent.gandhi.free.fr/play2.gif http://laurent.gandhi.free.fr/stop.gif credit : del.icio.us mp3 player remied
  • of course you can change the icon, but then don't forget to change the size (width height) in the player.js
  • 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)

  • 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);
  • "classic regex" ???

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

  • 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.

    pic

    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)

  • 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.
  • 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?
  • Perhaps all it needs is to be told to fire when the page has finished loading, then it can be put in the head?
  • it would be wonderful to have this packaged up as an extension...
  • 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');
  • 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)

  • Sorry, too vague, I missed the point.

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

  • the point was that due to security reasons, the idea for a full Multimedia extension was scrapped.
  • 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)

  • 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)

    pic
    It's up now. pic

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

  • i'm guessing this won't work without a html formatter extension? i'm gonna test it now... (i have html turned off).
  • it's a great extention wanderer thanks a lot !
  • 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.