1 2 3 4 5 Previous Next 91 Replies Latest reply: Dec 12, 2013 12:40 PM by GoddyJ Go to original post
  • 30. Re: Dashboard Movies Widget suddenly not working
    Fudelinuyasha Level 1 Level 1 (15 points)

    It did not work for me. I tied what it said will some one that got it to work show me what I did worong?

  • 31. Re: Dashboard Movies Widget suddenly not working
    Marcin Reszka Level 1 Level 1 (0 points)

    i have modified the file as stated in article

    but its NOT working, could someone please post working file?

    my file below

    var _gLastMovieDataFetchDate;

     

     

    function markLastMovieDataFetchDate() {

              _gLastMovieDataFetchDate = new Date();

    }

     

     

    // return true if midnight (local time) has passed since data was last fetched

    function getShouldFetchNewMovieData() {

              if (!_gLastMovieDataFetchDate) {

                        return true;

              }

              // getDate() returns day of month as number

              var midnightHasPassedSinceLastFetch = (new Date().getDate() != _gLastMovieDataFetchDate.getDate());

              return midnightHasPassedSinceLastFetch;

    }

     

     

    function markShouldFetchNewData() {

              _gLastMovieDataFetchDate = null;

    }

     

     

    function prepareAsyncGetRequest(url, successCallback) {

              Utils.hideElement($("errorMsgBox"));

     

     

              var req = new XMLHttpRequest();

              req.onload = function(evt) {successCallback(evt, req)};

              req.onerror = onHttpError;

              url = encodeURI(url);

              req.open("GET", url, true);

              req.overrideMimeType("text/xml");

              req.setRequestHeader("Cache-control","No-cache");

              req.setRequestHeader("Pragma","No-cache");

              return req;

    }

     

     

    function onHttpError(evt) {

              alert("Error occured while loading data: " + evt.target.status);

              handleNetworkError();

    }

     

     

    function handleNetworkError() {

              alert("MOVIES NETWORK ERROR");

              Utils.hideElement($("posterWrap"));

              if (!isInCompactView()) {

                        showingErrorMsgBox = true;

                        setTimeout(showErrorMsgBox, 2000);

                        shrinkWidget();

              } else if (!showingErrorMsgBox) {

                        showingErrorMsgBox = true;

                        showErrorMsgBox();

              }

    }

     

     

    function handleNoMovieDataAvailable() {

              alert("NO MOVIE DATA AVAILABLE");

              if (isInCompactView()) {

                        resizePhase1();

              } else{

                        setTimeout(showBack, 600);

                        setTimeout(function () {

                                  showMenuItem(getLocalizedString("No movie data available"));

                        }, 1300);

              }

    }

     

     

    var showingErrorMsgBox;

     

     

    function showErrorMsgBox() {

              var errorMsgBox = $("errorMsgBox");

              errorMsgBox.innerHTML = getLocalizedString("No movie data available");

              Utils.hideElement($("posterWrap"));

              Utils.showElement(errorMsgBox);

              markShouldFetchNewData();

              showingErrorMsgBox = false;

    }

     

     

    // returns either "&op=performancesbycitystatesearch&city=sunnyvale&state=ca"

    //  or "&op=performancesbypostalcodesearch&postalcode=94087"

    function getMethodAndLocationQueryStringFragment() {

              var location = getLocation();

              if (isValidPostalCode(location)) {

                        return "&op=performancesbypostalcodesearch&postalcode=" + location;

              } else {

                        var index = location.indexOf(",");

                        var city  = Utils.trimWhiteSpace(location.substring(0, index));

                        var state = location.substring(index+1);

                        if (state && state.length) {

                                  state = Utils.trimWhiteSpace(state);

                        } else {

                                  state = "";

                        }

                        return "&op=performancesbycitystatesearch&city=" + city + "&state=" + state;

              }

    }

     

     

    var _gWaitingForMoviesDataToLoad;

     

     

    function fetchAllData() {

              if (!getShouldFetchNewMovieData()) {

                        // skip fetching data and go to end of callback

                        afterAllDataFetched();

              } else {

                        _gWaitingForMoviesDataToLoad = false;

                        fetchMoviesData();

                        fetchAppleResourceUrlData();

              }

    }

     

     

    function fetchMoviesData() {

              if (fetchMoviesData.req) {

                        fetchMoviesData.req.abort();

                        fetchMoviesData.req = null;

              }

     

     

              var url = "http://www.fandango.com./"

                        + getDate() + getMethodAndLocationQueryStringFragment();

     

              var req = prepareAsyncGetRequest(url, moviesDataFetched);

              fetchMoviesData.req = req;

              markLastMovieDataFetchDate();

              req.send(null);

     

     

              initAllMoviesTable();

              initAllTheatersTable();

    }

     

     

    function moviesDataFetched(evt, req) {

              var doc;

              try {

                        doc = req.responseXML;

                        if (!doc || !doc.documentElement) {

                                  handleNetworkError();

                                  return;

                        }

     

                        var err = parseMovies(doc);

                        if (err) return;

                        err = parseTheaters(doc);

                        if (err) return;

     

                        if (_gWaitingForMoviesDataToLoad) {

                                  parseAppleResourceUrlData();

                        }

              } catch (e) {

                        alert("Runtime Error: " + e);

                        // handle missing network connection or no vendor data

                        handleNoMovieDataAvailable();

              } finally {

                        req = doc = null;

              }

    }

     

     

    function parseMovies(doc) {

              var movieEls = doc.getElementsByTagName("movie");

              var movie;

              if (!movieEls || !movieEls.length) {

                        handleNoMovieDataAvailable();

                        return -1;

              }

              for (var i = 0; i < movieEls.length; i++) {

                        movie = movieObjectForMovieElement(movieEls[i]);

                        allMoviesTable[movie.id] = movie;

              }

              allMoviesList = getSortedArrayForTable(allMoviesTable);

              return 0;

    }

     

     

    function parseTheaters(doc) {

              var theaterEls = doc.getElementsByTagName("theater");

              if (!theaterEls || !theaterEls.length) {

                        handleNoPerformanceDataAvailable();

                        return -1;

              }

     

     

              var theater, theaterEl;

              for (var i = 0; i < theaterEls.length; i++) {

                        theaterEl = theaterEls[i];

                        theater = theaterObjectForTheaterElement(theaterEl);

                        consumePerformanceDataForTheater(theater, theaterEl);

                        theater.movies.sort(comparatorFunction);

                        allTheatersTable[theater.id] = theater;

              }

              allTheatersList = getSortedArrayForTable(allTheatersTable);

              for (var id in allMoviesTable) {

                        allMoviesTable[id].theaters.sort(comparatorFunction);

              }

     

     

              if (!currentTheaterId) {

                        currentTheaterId = allTheatersList[0].id;

              }

              return 0;

    }

     

     

    var _gAppleResourceUrlDoc;

     

     

    function fetchAppleResourceUrlData() {

              _gAppleResourceUrlDoc = null;

              if (fetchAppleResourceUrlData.req) {

                        fetchAppleResourceUrlData.req.abort();

                        fetchAppleResourceUrlData.req = null;

              }

              var url = "http://www.apple.com/trailers/home/xml/widgets/indexall.xml" ;

              var req = prepareAsyncGetRequest(url, appleResourceUrlDataFetched);

              fetchAppleResourceUrlData.req = req;

              req.send(null);

    }

     

     

    function appleResourceUrlDataFetched(evt, req) {

              _gAppleResourceUrlDoc = req.responseXML;

              if (!allMoviesList) {

                        _gWaitingForMoviesDataToLoad = true;

              } else {

                        parseAppleResourceUrlData();

              }

    }

     

     

    function parseAppleResourceUrlData() {

              posterMovieIds = [];

              var doc;

              var id, movie;

              try {

                        doc = _gAppleResourceUrlDoc;

                        var movieInfoEl;

                        var posterEls;

                        var previewEls;

                        var movieInfoEls = doc.getElementsByTagName("movieinfo");

     

                        for (var i = 0; i < movieInfoEls.length; i++) {

                                  movieInfoEl = movieInfoEls[i];

                                  id = movieInfoEl.getAttribute("fandangoid");

                                  movie = allMoviesTable[id];

                                  if (movie) {

                                            consumeResourceUrlDataForMovie(movieInfoEl, movie);

                                            movie.complete = true;

                                            posterMovieIds.push(id);

                                  }

                        }

              } catch (e) {

                        // ignore. if there's no poster or trailer resources, no biggie.

              } finally {

                        req = null;

                        doc = null;

                        _gAppleResourceUrlDoc = null;

                        afterAllDataFetched();

              }

    }

     

     

    function afterAllDataFetched() {

              if (isInCompactView()) {

                        var posterUrl = kDefaultPosterUrl;

                        if (posterMovieIds && posterMovieIds.length) {

                                  posterIndex = randomIntegerZeroToNInclusive(posterMovieIds.length);

                                  posterUrl = allMoviesTable[posterMovieIds[posterIndex]].posterUrl;

                        }

                        poster1.src = posterUrl;

                        poster2.src = posterUrl;

                        startPosterFadeAnimationLoop();

                        addPosterClickedEventListener();

              } else {

                        displayAllMovieInfo();

              }

    }

     

     

    function getTicketPurchasePageUrl(movieId, theaterId, time) {

              //"07-18-2007+22:25"

              // must create this format string. create lazily here, rather than during initial response parsing.

              var len = time.time.length-2;

              var isPM = ("pm" == time.time.substring(len));

              var timeStr = time.time.substring(0, len);

              var indexOfColon = timeStr.indexOf(":");

              var hours = parseInt(timeStr.substring(0, indexOfColon), 10);

              var mins = timeStr.substring(indexOfColon);

              if (isPM) {

                        if (hours < 12) {

                                  hours += 12;

                                  timeStr = hours + mins;

                        }

              } else if (hours == 12) {

                        timeStr = "00" + mins;

              }

              var dateStr = time.date.replace(/\//g, "-");

              var url = "http://www.fandango.com./" + movieId

                         + "&a=11617&tid=" + theaterId

                         + "&dte=0&date=" + dateStr

                         + "+"  + timeStr;

              return url;

    }

     

     

    function validateLocation(location) {

              if (validateLocation.req) {

                        validateLocation.req.abort();

                        validateLocation.req = null;

              }

     

              var locStr = $("locationTextField").value;

              var city = "";

              var state = "";

     

              var index = locStr.indexOf(",");

              if (-1 == index) {

                        index = locStr.lastIndexOf(" ");

              }

              if (index > -1) {

                        city = locStr.substring(0, index);

                        state = locStr.substring(index+1);

              } else {

                        city = locStr;

              }

     

              var url = "http://www.fandango.com./"

                        + city + "&state=" + state;

     

              var req = prepareAsyncGetRequest(url, locationValidationFetched);

              validateLocation.req = req;

              req.send(null);

    }

     

     

    function locationValidationFetched(evt, req) {

              var doc = req.responseXML;

     

              var result;

              if (!doc || !doc.documentElement) {

                        result = {error:true};

              } else {

                        var locationEls = doc.getElementsByTagName("location");

                        result = {error:false, cities:new Array()};

     

     

                        for (var i = 0; i < locationEls.length; i++) {

                                  var locationEl = locationEls[i];

                                  var city              = locationEl.getElementsByTagName("city").item(0).textContent;

                                  var state              = locationEl.getElementsByTagName("state").item(0).textContent;

                                  result.cities.push({city:city, state:state});

                        }

              }

              validationCallback(result);

              req = doc = null;

    }

  • 32. Re: Dashboard Movies Widget suddenly not working
    skopcho Level 1 Level 1 (30 points)

    You replaced the entire URL, but you are only supposed to replace the server portion of the URL. Basically find and replace wu.apple.com with www.fandango.com, so the rest of the URL remains the same in each case.

  • 33. Re: Dashboard Movies Widget suddenly not working
    Marcin Reszka Level 1 Level 1 (0 points)

    ahhhh NOW it's working

    THANKS

  • 34. Re: Dashboard Movies Widget suddenly not working
    Topher Kessler Level 6 Level 6 (9,340 points)

    You can change all three of them if needed, but the first one is the one that is used for looking up the movie data. The others are used for validating locations and other tasks, but if the widget is validating data properly then it should grab the theater listings.

  • 35. Re: Dashboard Movies Widget suddenly not working
    moovyphreak Level 1 Level 1 (5 points)

    So, I commented to the author of the widget fix on CNET that many (including me and my sister) were getting confused and replacing the entire wu.apple.com URL string with http://www.fandango.com and were then having to go back to correct this mistake. I suggested he edit his article to further clarify. He commented in my favor and made the suggested changes. Hopefully users of this widget will be less confused from here on out!

  • 36. Re: Dashboard Movies Widget suddenly not working
    linda2009 Level 1 Level 1 (35 points)

    I do believe the author for the CNET article and Topher Kessler who is posting on this thread are the same person.  Right, Topher?

     

    No worries, just thought I would point that out.

  • 37. Re: Dashboard Movies Widget suddenly not working
    Topher Kessler Level 6 Level 6 (9,340 points)

    (yes)

  • 38. Re: Dashboard Movies Widget suddenly not working
    Fudelinuyasha Level 1 Level 1 (15 points)

    We want to know what we did wrong so we can fix it because both Marcin Reszka and I have thried it and it is not working. we would like the correct way to fix it showing us what the correct items need to be placed in so we can get it to work.

  • 39. Re: Dashboard Movies Widget suddenly not working
    EMSmac Level 1 Level 1 (0 points)

    Replace only the wu.apple.com portion of the URL with www.fandango.com, and be sure to leave the rest of the URL the same. Will work then.

  • 40. Re: Dashboard Movies Widget suddenly not working
    linda2009 Level 1 Level 1 (35 points)

    Personally, I found the Teminal way to be the easiest.

     

    This is what I did:

    Go to Spotlight, type in Terminal. Click on Terminal when it pops up.

    Type in Exactly this (copy & paste if you want):

     

    sudo nano /System/Library/WidgetResources/.parsers/moviesParser.js

     

    The Terminal will say:

    Password:

    Type in your password (you probably have to be logged in under an admin account)

    The window will change.  It will look black and white. Make sure your cursor is somewhere in that window.

    Using your keyboard hit - Control + w (where is command)

    type in:  wu.apple.com

    the "box" cursor will stop on the "w" of the first wu.apple.com

    Use your arrow key to get to the end of the wu.apple.com and then your delete key (backspacing) to delete all the letters of wu.apple.com.

    Then type in www.fandango.com

     

    I used the Control + w and found 3 of them and replaced all three.

     

    When you have done that, use your keyboard:  Control + x (exit command)

    It will ask if you want to Save.  Yes you want to save.

     

    Then you can also quit the Terminal (you can click the X, or keyboard: Command + q)

     

    Then I logged out and back in (don't know if absolutely necessary, but I did it)

     

    I then started the dashboard and the Movie widget was working.  It is still working now.

     

    Hope this helps.  I did also have a little trouble at the beginning, I think it was the black and white window which confused me.

     

    (Thanks, Topher!)

  • 41. Re: Dashboard Movies Widget suddenly not working
    Fudelinuyasha Level 1 Level 1 (15 points)

    That did not work. show us what we did wrong. we changed it what was said and still will not work.

  • 42. Re: Dashboard Movies Widget suddenly not working
    iMattPro Level 1 Level 1 (0 points)

    The widget is now functioning normally again. No need to edit anything.

  • 43. Re: Dashboard Movies Widget suddenly not working
    linda2009 Level 1 Level 1 (35 points)

    Does that mean that we should change the file back?

     

    Or, is it better just to leave it pointing to the fandango servers?

  • 44. Re: Dashboard Movies Widget suddenly not working
    DJMic Level 1 Level 1 (0 points)

    Not working for me in Canada! I even tried to edit the moviesParser.js had no luck either way.

1 2 3 4 5 Previous Next