From abb7f5ff2a6b0113f23d979b5272906fdbeb3281 Mon Sep 17 00:00:00 2001 From: Jeff Lamb Date: Sat, 4 Mar 2017 23:33:39 -0500 Subject: [PATCH] Switch to lists and divs for schedule, not as pretty yet and not done.. baby steps --- src/main/webapp/index.html | 101 ++++++++++++++++++++++++++++++++++- src/main/webapp/js/rcrdit.js | 80 ++++++++++++++++++++++++++- 2 files changed, 179 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 1cb52c9..19095a0 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -23,9 +23,108 @@ Rcrdit + + -
+
diff --git a/src/main/webapp/js/rcrdit.js b/src/main/webapp/js/rcrdit.js index ff71ab8..9c198cc 100644 --- a/src/main/webapp/js/rcrdit.js +++ b/src/main/webapp/js/rcrdit.js @@ -5,7 +5,7 @@ */ $( document ).ready(function() { - getSchedule(null); + getSchedule2(null); }); function padToTwoDigits(ss){ @@ -17,6 +17,84 @@ function padToTwoDigits(ss){ } +function getSchedule2(requestObject){ + if(isNull(requestObject)){ + requestObject = {"channelsPerPage" : "4000", "pageNum" : "1"}; + } + $.ajax({ + url: 'rest/getSchedule', + type: 'post', + dataType: 'json', + contentType: "application/json", + data: JSON.stringify(requestObject), + success: function (data) { + var channelList = data.schedule; + var requestObject = data.requestObject; + var requestStartTimeEpochSeconds = requestObject.startTime.epochSecond; + var requestEndTimeEpochSeconds = requestObject.endTime.epochSecond; + + + $("#guideGoesHere").html(""); + var channelUl = $(""); + var channelGroupsUl = $("").attr("id","channelGroups").append($("
  • ").append(channelUl)); + for(var idx in channelList){ + var individualChannelLi = $("
  • "); + var channel = channelList[idx]; + var currentPercentOver = 0; + var channelProgramUl = $("").attr("channelNum",channel.displayName); + individualChannelLi.append(channelProgramUl); + var channelNameLi = $("
  • "); + channelNameLi.append("").addClass("channelNumLabel").append(channel.displayName); + channelProgramUl.append(channelNameLi); + + var programsLi = $("
  • ").addClass("programs"); + for(var idx2 in channel.programs){ + var program = channel.programs[idx2]; + programsLi.append(getProgramDiv(program,requestObject,currentPercentOver)); + currentPercentOver += program.widthPercent; + } + channelProgramUl.append(programsLi); + channelUl.append(individualChannelLi); + } + $("#guideGoesHere").append(channelGroupsUl); + }, + error: function ( jqXHR, textStatus, errorThrown ){ + alert(errorThrown); + } + }); +} + +function getProgramDiv(program, requestObject, startAtPercent){ + var programDiv = $("
    ").addClass("channelProgram"); + var titleInfoDiv = $("
    ").addClass("titleInfo"); + var otherStuffDiv = $("
    ").addClass("otherProgramStuff"); + titleInfoDiv.append(program.title); + if(!isNull(program.subTitle)){ + titleInfoDiv.append($("

    "+program.subTitle+"

    ").addClass("programSubtitle")); + } + programDiv.append(titleInfoDiv); + programDiv.append(otherStuffDiv); + + var requestStartTimeEpochSeconds = requestObject.startTime.epochSecond; + var requestEndTimeEpochSeconds = requestObject.endTime.epochSecond; + var showingMinutes = (requestEndTimeEpochSeconds-requestStartTimeEpochSeconds)/60; + var durationSeconds = program.stop.epochSecond-program.start.epochSecond; + var displayDurationSeconds = durationSeconds; + if(program.start.epochSecond < requestStartTimeEpochSeconds){ + displayDurationSeconds = displayDurationSeconds-(requestStartTimeEpochSeconds-program.start.epochSecond); + } + if(program.stop.epochSecond > requestEndTimeEpochSeconds){ + displayDurationSeconds = displayDurationSeconds-(program.stop.epochSecond-requestEndTimeEpochSeconds); + } + var displayDurationMinutes = displayDurationSeconds/60; + + var widthPercent = (displayDurationMinutes/showingMinutes)*100; + programDiv.attr("style","left: "+startAtPercent+"%; width: "+widthPercent+"%"); + program.widthPercent = widthPercent; + return programDiv; +} + + function getSchedule(requestObject){ if(isNull(requestObject)){ requestObject = {"channelsPerPage" : "100", "pageNum" : "1"};