TV Search for Latest Episode
How do I make an tv search for latest episode?
What is a tv search for latest episode? How do you make a tv search for latest episode? This script and codes were developed by Sicontis on 12 July 2022, Tuesday.
TV Search for Latest Episode - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>TV Search for Latest Episode </title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/typicons/2.0.8/typicons.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="tvshows" id="app"> <!-- SHOW DETAILS --> <div class="detailsbox"> <img :src="tvshow.poster" /> <div id="info"> <h3>{{ tvshow.title }}</h3> <p>SEASONS: {{ tvshow.seasons }} | EPISODES: {{ tvshow.episodes }} | {{ tvshow.network }}</p> </div> </div>
<!-- SEARCH AREA --> <div class="searchbox"> <div class="search"> <input type="text" v-model="query" @keyup.enter="findShow" @focus="query = ''"/> </div> <dl class="results" v-if="searching"> <dt v-for="show in searchResults" @click="showDetails(show.id)">{{ show.name }} </dt> </dl> </div>
<!-- LATEST EPISODE --> <div class="latestbox"> <h3 @click="showInfo = !showInfo">Latest Episode <i :class="arrowCls"></i></h3> <span v-if="showInfo"> <img :src="latest.still" /> <p id="header">{{ latest.title }}</p> <p id="info">Season {{ latest.season }}, Episode {{ latest.episode }}, {{ latest.air_date }}</p> <p id="body">{{ latest.overview }}</p> </span> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/axios/0.14.0/axios.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
TV Search for Latest Episode - Script Codes CSS Codes
@import url('https://fonts.googleapis.com/css?family=Nunito');
body { font-family: 'Nunito', sans-serif; display: flex; justify-content: center; padding: 50px;
}
.tvshows { width: 800px; height: 460px; display: flex; position: relative;
}
/* Details */
.detailsbox { width: 800px; height: 460px; border: 1px solid silver; position: relative;
}
.detailsbox img { position: absolute; width: 100%; height: 100%; z-index: 10;
}
.detailsbox div#info { position: absolute; z-index: 20; bottom: 20px;
}
#info h3 { padding: 20px 10px; background: rgba(39, 39, 39, 0.7); color: #ff5f2e; font-size: 2em; text-transform: uppercase;
}
#info p { padding: 5px 10px; background: #ff5f2e; color: ; font-size: .7em; font-weight: 600; text-transform: uppercase;
}
/* Search Box */
.searchbox { width: 280px; position: absolute; z-index: 30; background: rgba(39, 39, 39, 0.8); padding: 0 10px;
}
.searchbox input { border: none; outline: none; background: none; width: 100%; color: #e1eef6; text-transform: uppercase; margin-top: 10px;
}
.search { height: 37px;
}
.results { margin-top: 10px
}
.results dt { padding: 5px 0; margin-bottom: 5px; color: #e1eef6; border-bottom: 1px dotted #ff5f2e;
}
.results dt:hover { background: rgba(225, 238, 246, .4); color: #000; cursor: pointer;
}
/* Latest Box */
.latestbox { position: absolute; width: 300px; background: rgba(39, 39, 39, 0.9); z-index: 40; top: 0; right: 0;
}
.latestbox h3 { height: 37px; padding: 0 10px; color: #fcbe32; text-transform: uppercase; display: flex; justify-content: space-between;align-items: center; cursor: pointer;
}
.latestbox i { font-size: 24px;
}
.latestbox p#header { padding: 5px 10px; background: rgba(252, 190, 50, .8); position: relative; top: -28px;
}
.latestbox p#info { padding: 0 10px 10px 10px; font-size: .8em; color: #e1eef6;
}
.latestbox p#body { padding: 10px; font-size: .8em; color: #e1eef6; line-height: 1.5em;
}
TV Search for Latest Episode - Script Codes JS Codes
new Vue({ el: '#app', data: { query: 'Search for show', apikey: '8587e72e12904f85c77440917cfe59e1', searchResults: [], tvshow: [], latest: [], searching: false, showInfo: false, arrowCls: 'typcn typcn-arrow-sorted-down' }, watch: { showInfo: function(val) { if(val == true) { this.arrowCls = 'typcn typcn-arrow-sorted-up'; return; } this.arrowCls = 'typcn typcn-arrow-sorted-down'; } }, methods: { findShow: function() { this.searching = true; return axios .get('https://api.themoviedb.org/3/search/tv?api_key=' + this.apikey + '&language=en-US&query='+ this.query +'&page=1') .then(res => { this.searchResults = res.data.results; }) .catch(error => console.log(error)) }, showDetails: function(id) { this.searching = false; return axios .get('https://api.themoviedb.org/3/tv/' + id + '?api_key=' + this.apikey + '&language=en-US') .then(res => { //console.log(res.data); let poster = 'https://image.tmdb.org/t/p/w780/' + res.data.backdrop_path; let latestSeason; if(res.data.seasons.length > 2) { latestSeason = res.data.seasons.length - 1; } else { latestSeason = res.data.seasons.length; } let latestEpisode = res.data.seasons[latestSeason]; this.tvshow = { 'title': res.data.name, 'premiered': res.data.first_air_date.substr(0, 4), 'seasons': res.data.number_of_seasons, 'episodes': res.data.number_of_episodes, 'poster': poster, 'network': res.data.networks[0].name }; this.getLatestEpisode(id, latestSeason); }) .catch(error => console.log(error)) }, getLatestEpisode: function(id, season) { let url = 'https://api.themoviedb.org/3/tv/' + id + '/season/' + season + '?api_key=' + this.apikey; return axios .get(url) .then(res => { //console.log(res.data); let episodes = res.data.episodes; let index = 0; let temp = []; episodes.filter(ep => { if (moment(ep.air_date).isSameOrBefore(moment())) { temp.push(ep); } }); index = temp.length - 1; let premiered = episodes[index].air_date; let still = 'https://image.tmdb.org/t/p/w300/' + episodes[index].still_path; this.latest = { 'season': season, 'episode': episodes[index].episode_number, 'title': episodes[index].name, 'overview': episodes[index].overview, 'air_date': moment(premiered).format('MMMM Do, YYYY'), 'still': still } }) } }, mounted: function() { this.showDetails(1403); }
});
Developer | Sicontis |
Username | Sicontis |
Uploaded | July 12, 2022 |
Rating | 3 |
Size | 3,662 Kb |
Views | 66,792 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Simple Modal | 2,898 Kb |
Simple Calendar | 2,790 Kb |
Laracasts Nav Bar | 1,909 Kb |
Weight Converter | 3,114 Kb |
Simple Day Timer | 2,549 Kb |
VueJS Logo SVG | 1,301 Kb |
Magazine Layout - Contents Page | 4,421 Kb |
VueJS Todo App | 3,141 Kb |
Striped Sliding Navigation | 4,272 Kb |
Pomodoro Timer | 3,327 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Count checked checkboxes with jQuery | Mestika | 2,343 Kb |
Magnus 3 | ARocketfish | 7,944 Kb |
Pure CSS Tooltip | APinix | 2,815 Kb |
03 - CSS Variables | Run-time | 2,682 Kb |
VerbalExpressions Converter | Cmalven | 2,607 Kb |
Image Stack Test SCSS | CalvinMorett | 2,799 Kb |
Playing with transition timing | Mattgrosswork | 1,993 Kb |
Replace url via jquery | Serluk | 1,429 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!