Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    will be better to rewrite my code using jquery selectors yt will be $('param[name=movie]').value after you restrict search only inside the $('div#test').

    best regards

  2. #17
    New Coder
    Join Date
    Dec 2009
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    will be better to rewrite my code using jquery selectors yt will be $('param[name=movie]').value after you restrict search only inside the $('div#test').

    best regards
    Code:
    $(document).ready(function() {
    var objid = document.getElementById('di#{PostID}');
    var plist = objid.getElementsByTagName('param');
    for(var i=0; i< plist.length; i++){
      if(plist[i].name == 'movie'){
        var yt = $('param[name=movie]').value;
        var vid = yt.replace(/v\/(.{11})/,"$1");
      }
    }
    
    $(function () {
    $("here").append("<div style="background: url(http://img.youtube.com/vi/" + vid + "/0.jpg) no-repeat middle; width: 150px; height: 150px;"></div>");
    });
    });
    So, like this? I'm not sure if it's right since it still is not appending.

  3. #18
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
    $(document).ready(function() {
      var yt = $('div#{PostID} > object > param[name=movie]').attr('value');
      var vid = yt.replace(/v\/(.{11})/,"$1");
      $("here").append('<div style="background: url(http://img.youtube.com/vi/' + vid + '/0.jpg) no-repeat middle; width: 150px; height: 150px;"></div>');
    });
    not sure what is {PostID} but must be a id value.

    best regards

  4. #19
    New Coder
    Join Date
    Dec 2009
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    Code:
    $(document).ready(function() {
      var yt = $('div#{PostID} > object > param[name=movie]').attr('value');
      var vid = yt.replace(/v\/(.{11})/,"$1");
      $("here").append('<div style="background: url(http://img.youtube.com/vi/' + vid + '/0.jpg) no-repeat middle; width: 150px; height: 150px;"></div>');
    });
    not sure what is {PostID} but must be a id value.

    best regards
    Oh, {PostID} is from tumblr's theme generator. I can inbox you the page, to see how it's not working.

  5. #20
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kotse View Post
    Oh, {PostID} is from tumblr's theme generator. I can inbox you the page, to see how it's not working.
    post a link if you can.

    best regards

  6. #21
    New Coder
    Join Date
    Dec 2009
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    post a link if you can.

    best regards
    http://onedraft.tumblr.com

    The blocks with a red background and a play button are the video posts. Where the red background is supposed to be the thumbnail of the video (if it's from YouTube). Check the source, as {PostID} generates a numeric ID for the specific post.

  7. #22
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kotse View Post
    http://onedraft.tumblr.com

    The blocks with a red background and a play button are the video posts. Where the red background is supposed to be the thumbnail of the video (if it's from YouTube). Check the source, as {PostID} generates a numeric ID for the specific post.
    - generated ids are invalid, must start with a char
    - the part of the script which use jquery.ready is inserted twice inside the body, what I found, line 662 and 697
    anyway something stop parsing and execute javascript before this lines.

    best regards

  8. #23
    New Coder
    Join Date
    Dec 2009
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    - generated ids are invalid, must start with a char
    - the part of the script which use jquery.ready is inserted twice inside the body, what I found, line 662 and 697
    anyway something stop parsing and execute javascript before this lines.

    best regards
    Well, the script has to be placed within the area of the video post, to obtain the video posts generated id (I will add a character at the beginning), considering that multiple video posts on one page is possible, which is also why I wanted a general script.

    Is this still possible?

  9. #24
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kotse View Post
    Well, the script has to be placed within the area of the video post, to obtain the video posts generated id (I will add a character at the beginning), considering that multiple video posts on one page is possible, which is also why I wanted a general script.
    I understand, that's because of {PostID} which is local in the template for each block.

    Is this still possible?
    yes, and if I'm not wrong it's easy. You can get all div elements with class name 'block_contains' and you can use jquery.each to append the code as you want.
    I assume that you don't use 'div.block_containts' combination in another place and each have a id.
    In my opinion first step is to make it work for a div with a given id, first for example, and then extend for the script for all.

    best regards

  10. Users who have thanked oesxyl for this post:

    Kotse (01-01-2010)

  11. #25
    New Coder
    Join Date
    Dec 2009
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    I understand, that's because of {PostID} which is local in the template for each block.


    yes, and if I'm not wrong it's easy. You can get all div elements with class name 'block_contains' and you can use jquery.each to append the code as you want.
    I assume that you don't use 'div.block_containts' combination in another place and each have a id.
    In my opinion first step is to make it work for a div with a given id, first for example, and then extend for the script for all.

    best regards
    I've figured out a different way to do this. Anyway, thanks for the help!

  12. #26
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kotse View Post
    I've figured out a different way to do this. Anyway, thanks for the help!
    you are welcome. I'm glad you solved,

    happy holidays and best regards


 
Page 2 of 2 FirstFirst 12

Posting Permissions

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