"File Permisions/Google Drive /Movie Modal /Info/Changing Backround/Movies in Same Category/ Bootstrap/jQuery"
Bootstrap 3.3.0 Snippet by deividas777

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <body></body>
$(document).ready(function(){ var video =[ { "id":190, "drive":"g", "title":"Genius", "format":"MP4", "lang":"en", "date":2016, "director":"Michael Grandage", "actor's":" Colin Firth, Jude Law, Nicole Kidman", "quality":"HDRip", "url":"https://goo.gl/2xL4jV", "des":"A chronicle of Max Perkins's time as the book editor at Scribner, where he oversaw works by Thomas Wolfe, Ernest Hemingway, F. Scott Fitzgerald and others.", "image":"https://goo.gl/bdARJl", "video":"https://goo.gl/v03ShX", "online":"", "rating":"6", "pg-rating":13, "cat":"Drama", "cat2":"Biography", "cat3":"", "length":104, "Tag":"Drama, Biography", "producer":"", "date_added":1481664092, "player":"" }, { "id":242, "drive":"", "title":"Dead Man Tell No Tales", "format":"MP4", "lang":"en", "date":2017, "director":"Joachim Rønning", "actor's":"Johnny Depp, Geoffrey Rush, Javier Bardem", "quality":"BlueRay", "url":"https://goo.gl/BfYTGk", "des":"Captain Jack Sparrow searches for the trident of Poseidon while being pursued by an undead sea captain and his crew.", "image":"https://goo.gl/SZDZwr", "video":"https://bit.ly/2OoDKli", "online":"", "rating":"5", "pg-rating":12, "cat":"Comedy", "cat2":"Action", "cat3":"", "length":129, "Tag":"Comedy", "producer":"", "date_added":1512307766, "player":"", "trailer":"" }, { "id":238, "drive":"", "title":"Atomic Blonde", "format":"MP4", "lang":"en", "date":2017, "director":"David Leitch", "actor's":"Charlize Theron, James McAvoy, John Goodman", "quality":"HDRip", "url":"http://bit.ly/2iAXWOX", "des":"An undercover MI6 agent is sent to Berlin during the Cold War to investigate the murder of a fellow agent and recover a missing list of double agents.", "image":"http://bit.ly/2iAXWOX", "video":"https://bit.ly/2SeeHQg", "online":"", "rating":"7", "pg-rating":15, "cat":"Action", "cat2":"Mystery", "cat3":"Thriller", "length":115, "Tag":"Action, Mystery, Thriller", "producer":"", "date_added":1511264940, "player":"", "trailer":"" }, { "id":233, "title":"Rough Night", "format":"MP4", "lang":"en", "date":2017, "director":"Lucia Aniello", "actor's":"Scarlett Johansson, Kate McKinnon, Zoë Kravitz", "quality":"HD", "url":"https://imdb.to/2qD4vEE", "des":"Things go terribly wrong for a group of girlfriends who hire a male stripper for a bachelorette party in Miami.", "image":"https://bit.ly/2FcuJro", "video":"https://bit.ly/2JO4Fl4", "online":"", "rating":"5", "pg-rating":18, "cat":"Comedy", "cat2":"", "cat3":"", "length":101, "Tag":"Comedy", "producer":"", "date_added":1506234924, "player":"", "trailer":"" } ]; var movie_window = function(drive,movie,title,image,des,cat){ var category = cat; var videoTitle = title; var tmp =[]; $('#myModal').html(""); $('footer').remove(); $('body').append($('<footer/>')); $('footer').append($('<div/>',{'class':'modal fade','id':'myModal','role':'dialog'})); $('#myModal').append($('<div/>',{'class':'modal-dialog'})); $('.modal-dialog').append($('<div/>',{'class':'modal-content'})); $('.modal-content').append($('<div/>',{'class':'modal-header'})); $('.modal-header').append($('<button/>',{'class':'close','data-dismiss':'modal','aria-label':'Close'})); $('.close').append($('<span/>',{'aria-hidden':true,text:'X'})); $('.modal-header').append($('<h2/>',{'class':'modal-title',html:'<label class="label label-lg label-info">' + title + '<label/>','style':'font-size:1.7em;font-family: "Gill Sans Extrabold", Helvetica, sans-serif;'})); $('.modal-content').append($('<div/>',{'class':'modal-body'})); $('.modal-body').append($('<img/>',{'src':image,'class':'img-responsive','width':'250px','height':'280px','id':'poster-image'})).append('<br />'); $('.modal-body').append($('<button/>',{'type':'button','class':'btn btn-primary',text:"About Movie",'data-container':'body','data-toggle':'popover','data-placement':'right','data-content':des})).append('<br><br />'); if(!drive){ setTimeout(function(){ var image = new Image(50,35); image.src = 'http://megaicons.net/static/img/icons_sizes/8/178/512/users-checked-user-icon.png'; image.className = 'img-responsive pull-right'; image.alt = "Secure Icon"; $(image).attr({'margin':'auto','data-toggle':'tooltip','title':'Available to everyone'}); $('.modal-title').append(image); }, 700); $('.modal-body').append($('<div/>',{'class':'player_modal'})); $('.player_modal').append($('<video/>',{'id':'video-player','width':'350','height':'220','controls':'controls', 'preload':'metadata'})).css({'margin':'2px'}); $('#video-player').append($('<source/>',{'src':movie})); }else if(drive === 'g'){ setTimeout(function(){ var image = new Image(50,35); image.src = 'http://www.rvalabs.com/wp-content/uploads/2014/01/antivirus2.gif'; image.className = 'img-responsive pull-right'; image.alt = "Secure Icon"; $(image).attr({'margin':'auto','data-toggle':'tooltip','title':'Protected: Only Users with Permissions can view this file'}); $('.modal-title').append(image); $(image).click(function(e){ e.preventDefault(); window.open("mailto:info@gmail.com?subject=I%20wish%20to%20view%20content%20of%20your%20site."); }); }, 700); $('.modal-body img').remove(''); $('.modal-body').append($('<iframe/>',{'src':image, 'width':'200','height':'180'})); $('.modal-body').append($('<div/>',{'class':'player_modal'})); $('.player_modal').append($('<iframe/>',{'src':movie,'id':'video-player','width':'350','height':'220','controls':'controls', 'preload':'metadata','frameborder':0, 'scrolling':'auto', 'allowfullscreen': true})).css({'margin':'2px'}); /* *Stop Playing video */ $('.close').click(function(){ $('#video-player').removeAttr('src'); }); }else{ return; } $('.modal-content').append($('<div/>',{'class':'modal-footer'})); $('.modal-footer').append($('<p/>',{'class':'label label-warning label-lg pull-left','id':'similar-movies',text:'Latest Movies In this Category'})); $('#similar-movies').append($('<hr/>')); for(var x in video){ if(video[x].cat == category && video[x].title !== videoTitle){ if(tmp.length >= 5){ break; }else{ tmp.push(video[x].title); } } } var displayInfo = function(){ for(var s in tmp){ $('#similar-movies').append($('<p/>',{ 'class':'label label-info label-lg pull-left', 'style':'margin:4px;', 'id':s, text:tmp[s]})); } }//end //Call Display info function displayInfo(); /* *Bug Fixed on 18/01/17 */ $('#similar-movies p').hover(function(e){ e.preventDefault(); var id = $(this).attr('id'); var image = new Image(80, 60); for(var x in video){ if(video[x].title == tmp[id]){ image.src = video[x].image; image.className = "img-responsive"; image.alt = tmp[id]; image.id = "similarMovies"; } } $(this).html(image); $('img').mouseenter(function(e){ e.preventDefault(); var title = $(this).attr('alt'); for(var x in video){ if(video[x].title == title){ var watchMovie = video[x]; $(this).attr({'data-tooltip':'toggle','title':watchMovie.des}); $(this).click(function(e){ e.preventDefault(); movie_window(watchMovie.drive,watchMovie.video,watchMovie.title,watchMovie.image,watchMovie.des,watchMovie.cat); }); break; } } }).mouseleave(function(){ $(this).removeAttr('title'); id = null; }); }); /* * Change background image, depends on category * look to change background() function */ change_background_image('.modal-body',cat); /* * Function toggles window */ $('#myModal').modal("toggle"); /* * Function toggles popover */ $('.modal-body button').mouseenter(function(){ $('.modal-body button').popover('show'); }).mouseleave(function(){ $('.modal-body button').popover('hide'); }); /* * Remove video player from window, stop downloading video from server */ $('.modal-header button').click(function(event){ event.preventDefault(); $('.player_modal video').remove(); return; }); };//end movie_window() /** * Function changes background images dependant on category */ var change_background_image = function(element,category){ var tmp_coll = []; this.element = element; var backgrounds = [ {"cat":"Action","image":"http://icons.iconarchive.com/icons/lajonard/movie-folder/256/Action-icon.png"}, {"cat":"Action","image":"http://icons.iconarchive.com/icons/limav/movie-genres-folder/512/Action-icon.png"}, {"cat":"Horror","image":"http://files.softicons.com/download/folder-icons/free-movie-folder-icons-by-design-bolts/png/256x256/Horror-Movies.png"}, {"cat":"Horror","image":"http://files.softicons.com/download/tv-movie-icons/movie-genres-icons-2013-by-sirubico/png/256x256/Folder_Horror_1.png"}, {"cat":"Comedy","image":"http://icons.iconarchive.com/icons/sirubico/movie-genre/256/Comedy-icon.png"}, {"cat":"Comedy","image":"http://orig05.deviantart.net/cf5f/f/2015/281/3/b/comedy_folder_icon_by_giilpereiraa-d9cenzn.png"}, {"cat":"Drama","image":"http://icons.iconarchive.com/icons/limav/movie-genres-folder/512/Drama-icon.png"}, {"cat":"Drama","image":"http://orig01.deviantart.net/fe0d/f/2015/281/6/c/drama_folder_icon_by_giilpereiraa-d9ceo6f.png"} ]; //$('#back').animate({opacity: 0}, 0).css({'background-image': 'url(http://vaughnroyko.com/jsfiddle/back.png)'}).animate({opacity: 1}, 2500); for(var x in backgrounds){ if(backgrounds[x].cat == category){ tmp_coll.push(backgrounds[x]); var tmp = Math.floor(Math.random() * tmp_coll.length); $(element).css({'background-image': 'url("'+ tmp_coll[tmp].image +'")', 'background-repeat':'no-repeat', 'background-size':'cover','opacity':'0'}).animate({'opacity':'1'}, 2500); } } if(tmp == null){ $(element).css({ 'background-image': 'url("https://image.tmdb.org/t/p/w500/edM906NOM5WxaaAMeTsgDeqnBDr.jpg")', 'background-repeat':'no-repeat', 'background-size':'cover', 'background-position':'80% 50%', 'opacity':'0'}).animate({'opacity':'1'}, 2500); } } var ran = Math.floor(Math.random() * video.length); movie_window(video[ran].drive, video[ran].video, video[ran].title, video[ran].image, video[ran].des, video[ran].cat); });

Related: See More


Questions / Comments: