Stories
Slash Boxes
Comments

SoylentNews is people

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Thursday October 12 2017, @06:20PM (8 children)

    by Anonymous Coward on Thursday October 12 2017, @06:20PM (#581260)

    Imagine you're writing OpenOffice in Javascript.

    OK. Imagining.....imagining.......laughing my curvy butt off.

    Domo Arigato, Mister Troll Otto. You're a troll.

    If you're confident in your ability to design and render a button and its events, without jQuery, get in touch.

    Yup. Wrote my own radio search and music player in vanilla HTML5 and vanilla JavaScript. Not jQuery, because jQuery is for trolls.

    JavaScript is crap. Events don't fire. Properties don't update. Timers don't run.

    All I wanted was a radio search and music player to play a track to the end and then search for another track. Continuously progress to the next track and never stop playing. Was that so hard? Yes because JavaScript is crap.

    What event do you think can be trusted to fire while a music player is playing: playing, progress, timeupdate? How about none of them. What event do you think can be trusted to fire when a file stops downloading while a player is playing: abort, error, stalled, suspend, waiting? How about none of them. Which property do you think can be trusted to update: error, networkState, readyState? How about none of them.

    Events can't be trusted, Mister Otto. The only event my music player listens for is ended because ended might actually work but I don't even trust that. No what I do is I run a huge error detection function on a timer which checks every seven seconds if the player is still playing and decides what to do if it isn't. The only way to know for sure if the player really is playing is to check the currentTime to see if the time actually advanced by seven seconds. And if it didn't then something went wrong, so either: flush the buffer; or rewind time to get playback back on track; or give up and skip to the next track. Good luck ever figuring out what went wrong, and if the next track doesn't load but there's still a track in the buffer then play it on a loop.

    Properties are only slightly more reliable than events. I had to learn from watching JavaScript fail, the minimum of properties that update almost most of the time: currentTime, duration, paused, ended, networkState, and even those few have limited usefulness.

    Oh and did you think timers can be trusted to keep running? No way, because JavaScript is crap. I use two different timers: setInterval and a looping video element, with error detection to switch timers when they fail.

    And then there are memory leaks. JavaScript has automatic garbage collection. Still leaks. Because JavaScript is crap. Don't ever call load() unless you really mean it.

    Most of the code in my radio search and music player app does error detection, because JavaScript is crap. Very little of the code does real work like API requests to search for tracks or, you know, actually playing music.

    And you want to write an office suite in JavaScript? You want to control robots with JavaScript? How about JavaScript is crap, and you're a troll.

    My app, my app, my lovely little app, check it out.

    http://jango-raid.ml/ [jango-raid.ml]

    Hope you like spaghetti code, Mister Troll Otto.

    Artist Name : Boston [ Search Jango ]

  • (Score: 0) by Anonymous Coward on Thursday October 12 2017, @09:01PM (1 child)

    by Anonymous Coward on Thursday October 12 2017, @09:01PM (#581343)

    It does indeed sound like Javascript in browsers has some problems, and I can only hope that node.js doesn't fully implement all of those problems!

    I'll have to check out the radio search. Does it play FM stations, or web radio casts? *research*

    • (Score: 0) by Anonymous Coward on Thursday October 12 2017, @10:43PM

      by Anonymous Coward on Thursday October 12 2017, @10:43PM (#581402)

      Jango Raid : Search for music on Jango Radio by artist name or song title. Find mp3, m4a, or video.

      It's a minimalist frontend to Jango, omits all the social features that I never use.

  • (Score: 2) by takyon on Friday October 13 2017, @05:08AM

    by takyon (881) <takyonNO@SPAMsoylentnews.org> on Friday October 13 2017, @05:08AM (#581575) Journal

    Thanks. I saved it to my hard drive. Keep on Jango trolling.

    --
    [SIG] 10/28/2017: Soylent Upgrade v14 [soylentnews.org]
  • (Score: 2) by takyon on Friday October 13 2017, @05:42AM (4 children)

    by takyon (881) <takyonNO@SPAMsoylentnews.org> on Friday October 13 2017, @05:42AM (#581588) Journal

    I added this to the show_results function:

    getElementById__song_name.innerHTML = song_name_display;
    document.title = song_name_display + " | " + artist_name_display + " | Jango Raid"; // new

    Other than that it would be nice to pass strings into the app by URL so you can link someone http://jango-raid.ml/?song_name=Title%20Title [jango-raid.ml] or http://jango-raid.ml/?artist_name=Group%20Name [jango-raid.ml] or etc. No need for autoplay, just autofill.

    --
    [SIG] 10/28/2017: Soylent Upgrade v14 [soylentnews.org]
    • (Score: 1, Informative) by Anonymous Coward on Friday October 13 2017, @06:46PM (3 children)

      by Anonymous Coward on Friday October 13 2017, @06:46PM (#581935)

      Time for some super lazy query string parsing.

      http://jango-raid.ml/?a=Boston&s=Peace+Of+Mind&st=113273851&a_id=8821&s_id=138609 [jango-raid.ml]

      Fills the whole search form.

      • (Score: 2) by takyon on Friday October 13 2017, @10:08PM (2 children)

        by takyon (881) <takyonNO@SPAMsoylentnews.org> on Friday October 13 2017, @10:08PM (#582042) Journal

        quetrystring? Heheh.

        I added this after the last form element:

        <p><input type="button" value="Link This" onclick="document.getElementById('url_text').value=window.location.href.split('?')[0]; if(song_usd_display!='') {document.getElementById('url_text').value+='?a='+escape(artist_name_display)+'\u0026s='+escape(song_name_display)+'\u0026st='+station+'\u0026a_id='+artist_usd_display+'\u0026s_id='+song_usd_display;}"> : <input type="text" id="url_text" size="50" onclick="this.select()" readonly></p>

        I also considered adding an autoplay parameter that would search and then play onload, but meh.

        If you're tired of talking about it in here I can set up an entry in my journal for it.

        --
        [SIG] 10/28/2017: Soylent Upgrade v14 [soylentnews.org]
        • (Score: 0) by Anonymous Coward on Saturday October 14 2017, @07:11PM (1 child)

          by Anonymous Coward on Saturday October 14 2017, @07:11PM (#582377)

          Haha! It was a cutsey typo cuz I was wrapping the function in a try block so quetrystring got an extra t.

          Few things. I really don't want to add more junk to make the form even bigger so I think the Link button can fill the empty space below WakeLock status and next to Song ID. And I think the generated link can fill the Song ID field because the search function already ignores everything except numbers in the ID fields so it won't matter if there's a URL in there. It ignores extra URL stuff so you can paste in station URLs directly from Jango Radio for when you want to search a genre station or whatever.

          Which reminds me song_id overrides station_id and station_id overrides artist_id and artist_id is redundant. If you want to link to a song you only need a song_id which means artist and song are just cosmetic labels. Potential for rickrolling right there.

          Oh and yeah the Link button needs a soapy name for NoAdRadio mode. NoAdRadio was a secondary deployment of Jango Radio with a silly theme, defunct now, but I still maintain a Soap mode because it's cute.