Home of the Squeezebox™ & Transporter® network music players.
Page 8 of 8 FirstFirst ... 678
Results 71 to 79 of 79
  1. #71
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,669
    Erland,

    just in case you read my first reply, that was wrong, should've read your post more carefully.

    If you are using the NowPlaying page, the JS code in the <script> section is being executed in the context of the callback function (which happens to be in the prototype library). The result of this is, that functions that are only DEFINED but not CREATED during that callback execution will not be accessible outside the callback function. It's like writing

    Code:
    function outer() {
    
      function inner() { ... }
    
    }
    Now your '<a>' links are being called from a global context, so they cannot access "inner".

    What you have to do to avoid this, is actually CREATE the function using the syntax

    inner = function() {...}

    In this case, the parser does not only register the function name, but also creates a function object that can be used outside the creating context. It's also what you use when writing object oriented JS code.

    In short: change your function declaration to

    Code:
    <SCRIPT type="text/javascript">
    refreshTrackStat = function (refnum) {...};
    </SCRIPT>
    And it should work.

    Another side effect is, that this way you can also use this function directly within the callback so you could write

    Code:
     href="javascript:callJSONRPC([...], refreshTrackStat);
    Of course, refreshTrackStat would have to render the response parameter directly then, but it could get you a bit more compact code. I rarely use this since I prefer to have general purpose functions and render the JSON/RPC response data directly but in this case it may make sense.


    BTW, Michael's Biography plugin has the same problem, however I think it's not that simple to solve it there since I believe he get's the JS code from another site.

    [JavaScript Tutorial OFF]
    Last edited by pippin; 2008-04-16 at 03:29.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  2. #72
    Senior Member
    Join Date
    Dec 2006
    Location
    Denmark
    Posts
    129

    Sounds good...

    Quote Originally Posted by pippin View Post
    What do you have to send? If you can package that into a url (like http://sune@home:192.168.178.1:1234/login.html), that's possible with iPeng 0.4, you can just define your own command button for that.
    It sounds good. However, it is a special "wake-on-lan" ping I need to send, somehow. I do not know how to do this, but as far as I know this does involve a bit of javascripting. What is needed does btw. seem to be the MAC-address and the URL of the server.

    And then there is the embarrasing part. I can program a bit of basic HTML. That's it. Nothing more :-( A bit more info + some internet-based services can be found here:

    http://en.wikipedia.org/wiki/Wake-on-lan

    In case it cannot be programmed into the iPeng skin directly, perhaps it could (somehow) integrate with the web service. I must, however, say, that the external service that I have tried to use (only one) did not work, even though my Mini is connected to the internet on it's LAN port (which is required). My setup is: ADSL -> WLAN -> (wireless) -> SqueezeBox (acting as a bridge) -> Mac Mini.

    Over and out

    Sune

  3. #73
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,669
    Quote Originally Posted by Sune View Post
    It sounds good. However, it is a special "wake-on-lan" ping I need to send, somehow. I do not know how to do this, but as far as I know this does involve a bit of javascripting. What is needed does btw. seem to be the MAC-address and the URL of the server.
    Yep. You definitely need those two. You DO know the IP address of the server (that's where you are directing the iPod to), you will also need the MAC of the network card. You get that somewhere in your Mac's network settings under "Advanced". Can't check it right now, my Air only has WLAN, there it's called "AirPort ID".
    Then try to call this url:
    <serverip>/FFFFFFFFFFFF010203040506....010203040506
    010203040506 has to be replaced with your MAC (without the ":"'s) and repeated 16 times.

    Probably only will work if you use DHCP.

    IF that works you can configure a url of javascript:ajaxRequest(url, null); in an .ipeng.xml file and you are done ;-)
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  4. #74
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,039
    Is there some way to get the browser "back" button to work correctly after I've moved out of the Now Playing page by clicking on a link ?

    One example is when I'm standing on the leftmost swipe page in the Now Playing page and click on a link and then hit back after the new page has been loaded. In this case I correctly get back to the leftmost swipe page when I hit the "back" button, but it isn't possible to swipe to the other pages.
    Erland Isaksson (My homepage)
    Developer of many plugins/applets

  5. #75
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,669
    Quote Originally Posted by erland View Post
    Is there some way to get the browser "back" button to work correctly after I've moved out of the Now Playing page by clicking on a link ?

    One example is when I'm standing on the leftmost swipe page in the Now Playing page and click on a link and then hit back after the new page has been loaded. In this case I correctly get back to the leftmost swipe page when I hit the "back" button, but it isn't possible to swipe to the other pages.
    Pooh, that's a hard one. I'll try to dig into how to manipulate the history on MobileSafari...
    Did you see the answer to that other question of yours? Did it work? I've done this a few times now (importing JS) and it works fine with me.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  6. #76
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,039
    Quote Originally Posted by pippin View Post
    Did you see the answer to that other question of yours? Did it work? I've done this a few times now (importing JS) and it works fine with me.
    Yes, it solved the problem, thanks for your help.
    It's part of the TrackStat version released a few minutes ago.
    Erland Isaksson (My homepage)
    Developer of many plugins/applets

  7. #77
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,669
    Quote Originally Posted by erland View Post
    Is there some way to get the browser "back" button to work correctly after I've moved out of the Now Playing page by clicking on a link ?

    One example is when I'm standing on the leftmost swipe page in the Now Playing page and click on a link and then hit back after the new page has been loaded. In this case I correctly get back to the leftmost swipe page when I hit the "back" button, but it isn't possible to swipe to the other pages.
    This clearly looks like a Safari issue to me, at least if it's the same behavior as I'm seeing:
    What happens, is that the onscroll handler is not reinstated after you come back from the link.
    As a workaround I now put it back in place whenever my central processing loop gets called (which can be after a few seconds) or when you tap the content of the leftmost swipe.
    I'll upload that to the repository, please give it a try.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  8. #78
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,039
    Quote Originally Posted by pippin View Post
    This clearly looks like a Safari issue to me, at least if it's the same behavior as I'm seeing:
    What happens, is that the onscroll handler is not reinstated after you come back from the link.
    As a workaround I now put it back in place whenever my central processing loop gets called (which can be after a few seconds) or when you tap the content of the leftmost swipe.
    I'll upload that to the repository, please give it a try.
    That seems to have solved it. Swiping now works a few seconds after I've reached the "back" page"
    Erland Isaksson (My homepage)
    Developer of many plugins/applets

  9. #79
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,669
    Just in case somebody is interested in the latest iPeng developments - there will be no more "unstable" releases but instead there's a google code repository now where the latest versions are available.
    It's at
    ipeng.googlecode.com
    and can be checked out with
    Code:
    svn checkout http://ipeng.googlecode.com/svn/trunk/plugin ipeng-read-only
    As usual for nightlies: no guarantees given...

    Latest changes:
    - The NowPlaying plugin page now supports JavaScript for the plugin button display through the html-tag.
    - The NowPlaying plugin page is now updated on TrackChange, not only the plugin content page

    Reference implementation for this is a "Favorites" button that works like expected, that is, it's an "add to favorites" button for new tracks/stations and a "remove from favorites" button when the track/station is already in favorites.
    Complete code for this is in favorites.ipeng.xml - ok except for a bit of ajax magic I had to add to the plugin's index.html since I did not find any other way to determine the "favorite" state of a track.

    Other upcoming features already available there:
    - Lyrics plugin support
    - Rescan Page for Main menu
    - Improved load time for main menu by dropping main page js file and moving subpages to separate files.
    Last edited by pippin; 2008-04-22 at 18:23.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

Posting Permissions

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