Results 1 to 1 of 1

Thread: Text Rewrite JavaScript

  1. #1
    Join Date
    Oct 2005
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text Rewrite JavaScript

    Is there such a script that whenever it sees the url below,
    http://youtube.com/v/PRv_czxZKUw

    it will rewrite into

    http://img.youtube.com/vi/PRv_czxZKUw/1.jpg


    In my template, I have the following codes to display and play the video:

    <script>
    var image = "<?php echo $custom_34; ?>"
    if (image != "")
    {
    document.write("&nbsp;&nbsp;&nbsp;<a href=\"http://youtube.com/v/PRv_czxZKUw&autoplay=1\" rel=\"iframe\" rev=\"width::425::height::355::scrolling::no::frameborder::1\" title=\"+title.substr(0,60)\"><img src=\"http://img.youtube.com/vi/PRv_czxZKUw/2.jpg"></a>")
    }
    else {
    document.write("<a href=\"/members/user_login.php\"><img src=\"template/Yellow/images/no_video.png\" class=\"borderimage\" onMouseover=\"borderit(this,'green')\" onMouseout=\"borderit(this,'white')\"></a>")
    }
    </script>
    The link in blue is what the user will enter as the source of the video. My question no is if there is any script that will take the link in blue and modify to to resamble the tag in red. I see that the difference between the link in blue and red are the addition of "img,vi,2.jpg" in the red link.

    Or if there is a script that take the video link that the user enter and strip out the video reference code PRv_czxZKUw. If this is possible, I can setup my template to inclue "http://img.youtube.com/vi/XXXXXXX/2.jpg as fixed with XXXXXX=PRv_czxZKUw part being the variable that the script will insert.
    Last edited by vanbao; 02-24-2008 at 04:57 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •