homepage.php 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. <?php
  2. $data = false;
  3. ini_set("display_errors", 1);
  4. ini_set("error_reporting", E_ALL | E_STRICT);
  5. require_once("user.php");
  6. require_once("functions.php");
  7. $USER = new User("registration_callback");
  8. $group = $USER->role;
  9. // Check if connection to homepage is allowed
  10. qualifyUser(HOMEPAGEAUTHNEEDED, true);
  11. // Load Colours/Appearance
  12. foreach(loadAppearance() as $key => $value) {
  13. ${$key} = $value;
  14. }
  15. ?>
  16. <!DOCTYPE html>
  17. <html lang="en" class="no-js">
  18. <head>
  19. <meta charset="UTF-8">
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  21. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  22. <meta name="msapplication-tap-highlight" content="no" />
  23. <title><?=$title;?> Homepage</title>
  24. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  25. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  26. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  27. <script src="js/menu/modernizr.custom.js"></script>
  28. <link rel="stylesheet" href="bower_components/animate.css/animate.min.css">
  29. <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">
  30. <link rel="stylesheet" href="css/style.css?v=<?php echo INSTALLEDVERSION; ?>">
  31. <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  32. <link rel="stylesheet" href="bower_components/google-material-color/dist/palette.css?v=<?php echo INSTALLEDVERSION; ?>">
  33. <link rel="stylesheet" type="text/css" href="bower_components/slick/slick.css?v=<?php echo INSTALLEDVERSION; ?>">
  34. <link rel="stylesheet" href="bower_components/sweetalert/dist/sweetalert.css">
  35. <link rel="stylesheet" href="bower_components/smoke/dist/css/smoke.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  36. <!--Scripts-->
  37. <script src="bower_components/jquery/dist/jquery.min.js"></script>
  38. <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  39. <script src="bower_components/moment/min/moment.min.js"></script>
  40. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  41. <script src="bower_components/slimScroll/jquery.slimscroll.min.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  42. <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  43. <script src="bower_components/cta/dist/cta.min.js"></script>
  44. <script src="bower_components/fullcalendar/dist/fullcalendar.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  45. <script src="bower_components/slick/slick.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  46. <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
  47. <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
  48. <!--Other-->
  49. <script src="js/ajax.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  50. <script src="bower_components/sweetalert/dist/sweetalert.min.js"></script>
  51. <script src="bower_components/smoke/dist/js/smoke.min.js"></script>
  52. <!--[if lt IE 9]>
  53. <script src="bower_components/html5shiv/dist/html5shiv.min.js"></script>
  54. <script src="bower_components/respondJs/dest/respond.min.js"></script>
  55. <![endif]-->
  56. <style>
  57. <?php if($USER->role !== "admin"){ echo '.refreshImage { display: none; }';}?>
  58. .refreshImage{
  59. top: -10px;
  60. opacity: 0;
  61. z-index: 1000;
  62. }
  63. .refreshNP {
  64. z-index: 1001;
  65. }
  66. .w-refresh {
  67. opacity: 1;
  68. }
  69. .ultra-widget.refreshImage .w-refresh.w-p-icon {
  70. opacity: 1;
  71. }
  72. .refreshImage:hover, .refreshNP:hover{
  73. opacity: 1 !important;
  74. }
  75. .refreshImage .w-refresh {
  76. font-size: 36px;
  77. opacity: 1;
  78. right: 0;
  79. left: 5px;
  80. }
  81. .refreshImage span.w-refresh:hover::before {
  82. content: "Refresh";
  83. font-size: 17px;
  84. float: right;
  85. top: 18px;
  86. position: absolute;
  87. left: 15px;
  88. color: white;
  89. background: black;
  90. border-radius: 5px;
  91. padding: 0px 20px;
  92. }
  93. .fc-day-grid-event{
  94. cursor: pointer;
  95. }
  96. .recentItems {
  97. padding-top: 10px;
  98. margin: 5px 0;
  99. }
  100. .slick-image-tall{
  101. width: 125px;
  102. height: 180px;
  103. }
  104. .slick-image-short{
  105. width: 125px;
  106. height: 130px;
  107. margin-top: 50px;
  108. }
  109. .overlay{
  110. position: absolute;
  111. top: 0;
  112. left: 0;
  113. width: 100%;
  114. height: 100%;
  115. display: none;
  116. z-index: 0;
  117. opacity: .98;
  118. }
  119. sort {
  120. display: none;
  121. }
  122. table.fc-list-table {
  123. table-layout: auto;
  124. }.tabbable{
  125. margin-bottom: 0;
  126. }.fc-day-grid-event .fc-content {
  127. white-space: normal;
  128. }.fc-list-item {
  129. table-layout: auto;
  130. position: inherit;
  131. margin: 10px;
  132. border-radius: 4px;
  133. padding: 0 5px 0 5px;
  134. color: #fff !important;
  135. }.fc-calendar .fc-toolbar {
  136. background: <?=$topbar;?>;
  137. color: <?=$topbartext;?>;
  138. border-radius: 5px 5px 0 0;
  139. padding: 15px;
  140. }.fc-calendar .fc-toolbar .fc-right {
  141. bottom: 0px;
  142. right: 20px;
  143. }.fc-calendar .fc-toolbar .fc-right button {
  144. color: <?=$topbartext;?>;
  145. }.fc-calendar .fc-toolbar .fc-prev-button, .fc-calendar .fc-toolbar .fc-next-button {
  146. color: <?=$topbartext;?>;
  147. }.carousel-image{
  148. width: 100px !important;
  149. height: 150px !important;
  150. border-radius: 3px 0 0 3px;
  151. }.carousel-image.album{
  152. width: 150px !important;
  153. height: 150px !important;
  154. border-radius: 3px 0 0 3px;
  155. }.carousel-control.album {
  156. top: 5px !important;
  157. width: 4% !important;
  158. }.carousel-control {
  159. top: 5px !important;
  160. width: 4% !important;
  161. }.carousel-caption.album {
  162. position: absolute;
  163. right: 4%;
  164. top: 0px;
  165. left: 160px;
  166. z-index: 10;
  167. bottom: 0px;
  168. padding-top: 0px;
  169. color: #fff;
  170. text-align: left;
  171. }.carousel-caption {
  172. position: absolute;
  173. right: 4%;
  174. top: 0px;
  175. left: 110px;
  176. z-index: 10;
  177. bottom: 0px;
  178. padding-top: 0px;
  179. color: #fff;
  180. text-align: left;
  181. padding-bottom: 2px !important;
  182. overflow: hidden !important;
  183. } @media screen and (max-width: 576px) {
  184. .nzbtable {
  185. padding-left: 5px !important;
  186. padding-right: 2px !important;
  187. font-size: 10px !important;
  188. word-break: break-word !important;
  189. }
  190. .nzbtable-file-row {
  191. padding-left: 5px !important;
  192. padding-right: 2px !important;
  193. font-size: 10px !important;
  194. white-space: normal !important;
  195. word-break: break-all !important;
  196. width: 0% !important;
  197. }
  198. } .nzbtable-file-row {
  199. white-space: normal !important;
  200. word-break: break-all !important;
  201. width: 0% !important;
  202. }.nzbtable-row {
  203. white-space: normal !important;
  204. width: 0% !important;
  205. font-size: 12px; !important;
  206. }<?php customCSS(); ?>
  207. </style>
  208. </head>
  209. <body id="body-homepage" class="scroller-body group-<?php echo $group;?>" style="padding: 0px;">
  210. <div class="main-wrapper" style="position: initial;">
  211. <div id="content" class="container-fluid">
  212. <br/>
  213. <?php if (qualifyUser(HOMEPAGENOTICEAUTH) && HOMEPAGENOTICETITLE && HOMEPAGENOTICETYPE && HOMEPAGENOTICEMESSAGE && HOMEPAGENOTICELAYOUT) { echo buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE); } ?>
  214. <?php if((qualifyUser(PLEXSEARCHAUTH) && PLEXSEARCH == "true" && qualifyUser(PLEXHOMEAUTH))) { ?>
  215. <div id="searchPlexRow" class="row">
  216. <div class="col-lg-12">
  217. <div class="content-box box-shadow big-box todo-list">
  218. <form id="plexSearchForm" onsubmit="return false;" autocomplete="off">
  219. <div class="">
  220. <div class="input-group">
  221. <div style="border-radius: 25px 0 0 25px; border:0" class="input-group-addon gray-bg"><i class="fa fa-search white"></i></div>
  222. <input id="searchInput" type="text" style="border-radius: 0;" autocomplete="off" name="search-title" class="form-control input-group-addon gray-bg" placeholder="Media Search">
  223. <div id="clearSearch" style="border-radius: 0 25px 25px 0;border:0; cursor: pointer;" class="input-group-addon gray-bg"><i class="fa fa-close white"></i></div>
  224. <button style="display:none" id="plexSearchForm_submit" class="btn btn-primary waves"></button>
  225. </div>
  226. </div>
  227. </form>
  228. <div id="resultshere" class="table-responsive"></div>
  229. </div>
  230. </div>
  231. </div>
  232. <?php } ?>
  233. <?php if (qualifyUser(HOMEPAGECUSTOMHTML1AUTH) && HOMEPAGECUSTOMHTML1) { echo "<div>" . HOMEPAGECUSTOMHTML1 . "</div>"; } ?>
  234. <?php if(SPEEDTEST == "true" && qualifyUser(SPEEDTESTAUTH)){ ?>
  235. <style type="text/css">
  236. .flash {
  237. animation: flash 0.6s linear infinite;
  238. }
  239. @keyframes flash {
  240. 0% { opacity: 0.6; }
  241. 50% { opacity: 1; }
  242. }
  243. </style>
  244. <script type="text/javascript">
  245. var w = null
  246. function runTest() {
  247. document.getElementById('startBtn').style.display = 'none'
  248. document.getElementById('testArea').style.display = ''
  249. document.getElementById('abortBtn').style.display = ''
  250. w = new Worker('bower_components/speed/speedtest_worker.js')
  251. var interval = setInterval(function () { w.postMessage('status') }, 100)
  252. w.onmessage = function (event) {
  253. var data = event.data.split(';')
  254. var status = Number(data[0])
  255. var dl = document.getElementById('download')
  256. var ul = document.getElementById('upload')
  257. var ping = document.getElementById('ping')
  258. var jitter = document.getElementById('jitter')
  259. dl.className = status === 1 ? 'w-name flash' : 'w-name'
  260. ping.className = status === 2 ? 'w-name flash' : 'w-name'
  261. jitter.className = ul.className = status === 3 ? 'w-name flash' : 'w-name'
  262. if (status >= 4) {
  263. clearInterval(interval)
  264. document.getElementById('abortBtn').style.display = 'none'
  265. document.getElementById('startBtn').style.display = ''
  266. w = null
  267. }
  268. if (status === 5) {
  269. document.getElementById('testArea').style.display = 'none'
  270. }
  271. dl.textContent = data[1] + " Mbit/s";
  272. $("#downloadpercent").attr("style", "width: " + data[1] + "%;");
  273. $("#uploadpercent").attr("style", "width: " + data[2] + "%;");
  274. $("#pingpercent").attr("style", "width: " + data[3] + "%;");
  275. $("#jitterpercent").attr("style", "width: " + data[5] + "%;");
  276. ul.textContent = data[2] + " Mbit/s";
  277. ping.textContent = data[3] + " ms";
  278. jitter.textContent = data[5] + " ms";
  279. }
  280. w.postMessage('start {"telemetry_level":"basic"}')
  281. //w.postMessage('start')
  282. }
  283. function abortTest() {
  284. if (w) w.postMessage('abort')
  285. }
  286. </script>
  287. <div class="row" id="testArea" style="display:none">
  288. <div class="test col-sm-3 col-lg-3">
  289. <div class="content-box ultra-widget green-bg" data-counter="">
  290. <div id="downloadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  291. <div class="w-content">
  292. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-download"></i></div>
  293. <div class="w-descr left pull-left text-center">
  294. <span class="testName text-uppercase w-name">Download</span>
  295. <br>
  296. <span class="w-name counter" id="download" ></span>
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. <div class="test col-sm-3 col-lg-3">
  302. <div class="content-box ultra-widget red-bg" data-counter="">
  303. <div id="uploadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  304. <div class="w-content">
  305. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-upload"></i></div>
  306. <div class="w-descr left pull-left text-center">
  307. <span class="testName text-uppercase w-name">Upload</span>
  308. <br>
  309. <span class="w-name counter" id="upload" ></span>
  310. </div>
  311. </div>
  312. </div>
  313. </div>
  314. <div class="test col-sm-3 col-lg-3">
  315. <div class="content-box ultra-widget yellow-bg" data-counter="">
  316. <div id="pingpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  317. <div class="w-content">
  318. <div class="w-icon right pull-right"><i class="mdi mdi-timer"></i></div>
  319. <div class="w-descr left pull-left text-center">
  320. <span class="testName text-uppercase w-name">Latency</span>
  321. <br>
  322. <span class="w-name counter" id="ping" ></span>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. <div class="test col-sm-3 col-lg-3">
  328. <div class="content-box ultra-widget blue-bg" data-counter="">
  329. <div id="jitterpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  330. <div class="w-content">
  331. <div class="w-icon right pull-right"><i class="mdi mdi-pulse"></i></div>
  332. <div class="w-descr left pull-left text-center">
  333. <span class="testName text-uppercase w-name">Jitter</span>
  334. <br>
  335. <span class="w-name counter" id="jitter" ></span>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. <br/>
  341. </div>
  342. <div id="abortBtn" class="row" style="display: none" onclick="javascript:abortTest()">
  343. <div class="col-lg-12">
  344. <div class="content-box red-bg" style="cursor: pointer;">
  345. <h1 style="margin: 10px" class="text-uppercase text-center">Abort Speed Test</h1>
  346. <div class="clearfix"></div>
  347. </div>
  348. </div>
  349. </div>
  350. <div id="startBtn" class="row" onclick="javascript:runTest()">
  351. <div class="col-lg-12">
  352. <div class="content-box green-bg" style="cursor: pointer;">
  353. <h1 style="margin: 10px" class="text-uppercase text-center">Run Speed Test</h1>
  354. <div class="clearfix"></div>
  355. </div>
  356. </div>
  357. </div>
  358. <?php } ?>
  359. <?php if(NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)){
  360. echo buildDownloader('nzbget');
  361. }
  362. if(SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH)) {
  363. echo buildDownloader('sabnzbd');
  364. } ?>
  365. <?php if (qualifyUser(PLEXHOMEAUTH) && PLEXTOKEN) { ?>
  366. <div id="plexRowNowPlaying" class="row">
  367. <?php if(qualifyUser(PLEXPLAYINGNOWAUTH) && PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12, PLEXSHOWNAMES, $USER->role); } ?>
  368. </div>
  369. <div id="plexRow" class="row">
  370. <div class="col-lg-12">
  371. <?php
  372. if(qualifyUser(PLEXRECENTMOVIEAUTH) && PLEXRECENTMOVIE == "true" || qualifyUser(PLEXRECENTTVAUTH) && PLEXRECENTTV == "true" || qualifyUser(PLEXRECENTMUSICAUTH) && PLEXRECENTMUSIC == "true"){
  373. $plexArray = array("movie" => PLEXRECENTMOVIE, "season" => PLEXRECENTTV, "album" => PLEXRECENTMUSIC);
  374. echo getPlexRecent($plexArray);
  375. }
  376. ?>
  377. </div>
  378. </div>
  379. <div id="plexPlaylists" class="row">
  380. <div class="col-lg-12">
  381. <?php if(qualifyUser(PLEXPLAYLISTSAUTH) && PLEXPLAYLISTS == "true"){ echo getPlexPlaylists($plexArray); } ?>
  382. </div>
  383. </div>
  384. <?php } ?>
  385. <?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
  386. <div id="embyRowNowPlaying" class="row">
  387. <?php if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12, EMBYSHOWNAMES, $USER->role); } ?>
  388. </div>
  389. <div id="embyRow" class="row">
  390. <div class="col-lg-12">
  391. <?php
  392. if(EMBYRECENTMOVIE == "true" || EMBYRECENTTV == "true" || EMBYRECENTMUSIC == "true"){
  393. $embyArray = array("Movie" => EMBYRECENTMOVIE, "Episode" => EMBYRECENTTV, "MusicAlbum" => EMBYRECENTMUSIC, "Series" => EMBYRECENTTV);
  394. echo getEmbyRecent($embyArray);
  395. }
  396. ?>
  397. </div>
  398. </div>
  399. <?php } ?>
  400. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH)) || (COUCHURL != "" && qualifyUser(COUCHHOMEAUTH))) { ?>
  401. <div id="calendarLegendRow" class="row" style="padding: 0 0 10px 0;">
  402. <div class="col-lg-12 content-form form-inline">
  403. <div class="form-group pull-right">
  404. <span class="swal-legend label label-primary well-sm">Legend</span>&nbsp;
  405. <div class="btn-group" role="group">
  406. <button id="calendarSelected" style="margin-right: 0px;" type="button" class="btn waves btn-default btn-sm dropdown-toggle waves-effect waves-float" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">View All&nbsp;<span class="caret"></span></button>
  407. <ul style="right:0; left: auto" class="dropdown-menu">
  408. <li><a class="calendarOption" calendarOption="all" href="javascript:void(0)">View All</a></li>
  409. <?php if(RADARRURL != ""){ echo '<li><a class="calendarOption" calendarOption="film" href="javascript:void(0)">Movies</a></li>'; }?>
  410. <?php if(SONARRURL != ""){ echo '<li><a class="calendarOption" calendarOption="tv" href="javascript:void(0)">TV Shows</a></li>'; }?>
  411. <?php if(HEADPHONESURL != ""){ echo '<li><a class="calendarOption" calendarOption="music" href="javascript:void(0)">Music</a></li>'; }?>
  412. </ul>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. <div id="calendarRow" class="row">
  418. <div class="col-lg-12">
  419. <div id="calendar" class="fc-calendar box-shadow fc fc-ltr fc-unthemed"></div>
  420. </div>
  421. </div>
  422. <?php } ?>
  423. </div>
  424. </div>
  425. <script>
  426. //Tooltips
  427. $('[data-toggle="tooltip"]').tooltip();
  428. $(document).on("click", ".refreshImage", function(e) {
  429. parent.$.smkAlert({
  430. text: 'Refreshing Image...',
  431. type: 'info',
  432. time: 1
  433. });
  434. e.preventDefault;
  435. var orginalElement = $(this).parent().find('.refreshImageSource');
  436. var original = orginalElement.attr('original-image');
  437. orginalElement.attr('src', original);
  438. console.log('replaced image with : '+original);
  439. setTimeout(function(){
  440. parent.$.smkAlert({
  441. text: 'Image Refreshed - Clear Cache Please.',
  442. type: 'info',
  443. time: 3
  444. });
  445. }, 1000);
  446. });
  447. $(".swal-legend").click(function () {
  448. swal({
  449. title: "Calendar Legend",
  450. text: '<span class="label label-primary well-sm">Available</span>&nbsp;<span class="label label-danger well-sm">Unavailable</span>&nbsp;<span class="label indigo-bg well-sm">Unreleased</span>&nbsp;<span class="label light-blue-bg well-sm">Premier</span>',
  451. html: true,
  452. confirmButtonColor: "#63A8EB"
  453. });
  454. });
  455. $('.close-btn').click(function(e){
  456. var closedBox = $(this).closest('div.content-box').remove();
  457. e.preventDefault();
  458. });
  459. $('#clearSearch').click(function(e){
  460. $('#searchInput').val("");
  461. $('#resultshere').html("");
  462. $('#searchInput').focus();
  463. e.preventDefault();
  464. });
  465. $(document).on("click", ".openTab", function(e) {
  466. parent.$.smkAlert({
  467. text: 'Loading...',
  468. type: 'info',
  469. time: 1
  470. });
  471. var Title = $(this).attr("extraTitle");
  472. var Type = $(this).attr("extraType");
  473. var openTab = $(this).attr("openTab");
  474. var location = $(this).attr("href");
  475. if( Type === 'season' || Type === 'episode' || Type === 'show'){
  476. Type = "tv";
  477. SearchType = "show";
  478. }else if( Type === 'movie'){
  479. Type = "movie";
  480. SearchType = "movie";
  481. }
  482. if( Type === 'tv' || Type === 'movie' ){
  483. ajax_request('POST', 'tvdb-search', {
  484. name: Title,
  485. type: SearchType,
  486. }).done(function(data){
  487. if( data.trakt && data.trakt.tmdb !== null) {
  488. $('#calendarExtra').modal('show');
  489. var refreshBox = $('#calendarMainID');
  490. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  491. setTimeout(function(){
  492. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  493. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  494. refreshPreloader.remove();
  495. });
  496. },600);
  497. $.ajax({
  498. type: 'GET',
  499. url: 'https://api.themoviedb.org/3/'+Type+'/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
  500. cache: true,
  501. async: true,
  502. complete: function(xhr, status) {
  503. var result = $.parseJSON(xhr.responseText);
  504. if (xhr.statusText === "OK") {
  505. if( Type === "movie"){
  506. $('#calendarTitle').html(result.title);
  507. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  508. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(result.runtime)+'</span>&nbsp;');
  509. $('#calendarSummary').text(result.overview);
  510. $('#calendarTagline').text(result.tagline);
  511. $('#calendarTrailer').html(convertTrailer(result.videos)+'&nbsp;<span class="label openPlex palette-Amber-600 bg" openTab="'+openTab+'" location="'+location+'" style="width:100%;display:block;cursor:pointer;"><i style="vertical-align:sub;" class="fa fa-play white"></i><text style="vertical-align:sub;"> Watch Now on PLEX</text></span>');
  512. $('#calendarCast').html(convertCast(result.credits));
  513. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  514. $('#calendarLang').html(convertArray(result.spoken_languages, "MOVIE"));
  515. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  516. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  517. $('#calendarExtra').modal('show');
  518. }else if (Type === "tv"){
  519. $('#calendarTitle').html(result.name);
  520. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  521. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(whatWasIt(result.episode_run_time))+'</span>&nbsp;');
  522. $('#calendarSummary').text(result.overview);
  523. $('#calendarTagline').text("");
  524. $('#calendarTrailer').html(convertTrailer(result.videos)+'&nbsp;<span class="label openPlex palette-Amber-600 bg" openTab="'+openTab+'" location="'+location+'" style="width:100%;display:block;cursor:pointer;"><i style="vertical-align:sub;" class="fa fa-play white"></i><text style="vertical-align:sub;"> Watch Now on PLEX</text></span>');
  525. $('#calendarCast').html(convertCast(result.credits));
  526. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  527. $('#calendarLang').html(convertArray(result.languages, "TV"));
  528. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  529. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  530. $('#calendarExtra').modal('show');
  531. }
  532. }
  533. }
  534. });
  535. }else{
  536. swal("Sorry!", "No info was found for this item!", "error");
  537. }
  538. });
  539. e.preventDefault();
  540. }else{
  541. if($(this).attr("openTab") === "true") {
  542. var isActive = parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']");
  543. var activeFrame = isActive.children('iframe');
  544. if(isActive.length === 1){
  545. activeFrame.attr("src", $(this).attr("href"));
  546. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  547. }else{
  548. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  549. parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']").children('iframe').attr("src", $(this).attr("href"));
  550. }
  551. e.preventDefault();
  552. }else{
  553. var source = $(this).attr("href");
  554. window.open(source, '_blank');
  555. }
  556. }
  557. });
  558. $(document).on("click", ".openPlex", function(e) {
  559. if($(this).attr("openTab") === "true") {
  560. var isActive = parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']");
  561. var activeFrame = isActive.children('iframe');
  562. if(isActive.length === 1){
  563. activeFrame.attr("src", $(this).attr("location"));
  564. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  565. }else{
  566. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  567. parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']").children('iframe').attr("src", $(this).attr("location"));
  568. }
  569. }else{
  570. var source = $(this).attr("location");
  571. window.open(source, '_blank');
  572. }
  573. });
  574. function localStorageSupport() {
  575. return (('localStorage' in window) && window['localStorage'] !== null)
  576. }
  577. function loadSlick(){
  578. $('div[class*=recentItems-]').each(function() {
  579. if($(this).hasClass('slick-initialized')){
  580. console.log('skipping slick addon');
  581. return false;
  582. }
  583. var name = $(this).attr("data-name");
  584. console.log('creating slick for '+name);
  585. $(this).slick({
  586. slidesToShow: 13,
  587. slidesToScroll: 13,
  588. infinite: true,
  589. lazyLoad: 'ondemand',
  590. prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
  591. nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
  592. appendArrows: $('.'+name),
  593. arrows: true,
  594. responsive: [
  595. {
  596. breakpoint: 1750,
  597. settings: {
  598. slidesToShow: 12,
  599. slidesToScroll: 12,
  600. }
  601. },
  602. {
  603. breakpoint: 1600,
  604. settings: {
  605. slidesToShow: 11,
  606. slidesToScroll: 11,
  607. }
  608. },
  609. {
  610. breakpoint: 1450,
  611. settings: {
  612. slidesToShow: 10,
  613. slidesToScroll: 10,
  614. }
  615. },
  616. {
  617. breakpoint: 1300,
  618. settings: {
  619. slidesToShow: 9,
  620. slidesToScroll: 9,
  621. }
  622. },
  623. {
  624. breakpoint: 1150,
  625. settings: {
  626. slidesToShow: 8,
  627. slidesToScroll: 8,
  628. }
  629. },
  630. {
  631. breakpoint: 1000,
  632. settings: {
  633. slidesToShow: 7,
  634. slidesToScroll: 7,
  635. }
  636. },
  637. {
  638. breakpoint: 850,
  639. settings: {
  640. slidesToShow: 6,
  641. slidesToScroll: 6,
  642. }
  643. },
  644. {
  645. breakpoint: 700,
  646. settings: {
  647. slidesToShow: 5,
  648. slidesToScroll: 5,
  649. }
  650. },
  651. {
  652. breakpoint: 675,
  653. settings: {
  654. slidesToShow: 4,
  655. slidesToScroll: 4
  656. }
  657. },
  658. {
  659. breakpoint: 480,
  660. settings: {
  661. slidesToShow: 3,
  662. slidesToScroll: 3
  663. }
  664. }
  665. ]
  666. });
  667. });
  668. }
  669. $( document ).ready(function() {
  670. $('#plexSearchForm').on('submit', function () {
  671. var refreshBox = $(this).closest('div.content-box');
  672. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  673. setTimeout(function(){
  674. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  675. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  676. refreshPreloader.remove();
  677. });
  678. },1000);
  679. ajax_request('POST', 'search-plex', {
  680. searchtitle: $('#plexSearchForm [name=search-title]').val(),
  681. }).done(function(data){ $('#resultshere').html(data);});
  682. });
  683. $('.repeat-btn').click(function(){
  684. var refreshBox = $(this).closest('div.content-box');
  685. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  686. setTimeout(function(){
  687. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  688. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  689. refreshPreloader.remove();
  690. });
  691. },1500);
  692. });
  693. $(document).on('click', '.w-refresh', function(){
  694. var id = $(this).attr("link");
  695. $("div[np^='"+id+"']").toggle();
  696. });
  697. //load slick
  698. loadSlick();
  699. //RECENT ITEMS
  700. // each filter we click on
  701. $(".filter-recent-event > li").on("click", function() {
  702. var name = $(this).attr('data-name');
  703. var filter = $(this).attr('data-filter');
  704. $('#recentContent-title').text('Recently Added '+name);
  705. // now filter the slides.
  706. if(filter !== 'item-all'){
  707. $('.recentItems-recent')
  708. .slick('slickUnfilter')
  709. .slick('slickFilter' , '.'+filter );
  710. }else{
  711. $('.recentItems-recent')
  712. .slick('slickUnfilter')
  713. }
  714. });
  715. //PLAYLIST SHIT
  716. // each filter we click on
  717. $(".filter-recent-playlist > li").on("click", function() {
  718. var name = $(this).attr('data-name');
  719. var filter = $(this).attr('data-filter');
  720. $('#playlist-title').text(name);
  721. // now filter the slides.
  722. $('.recentItems-playlists')
  723. .slick('slickUnfilter')
  724. .slick('slickFilter' , '.'+filter );
  725. });
  726. $("body").niceScroll({
  727. //cursorwidth: "12px"
  728. scrollspeed: 30,
  729. mousescrollstep: 60,
  730. grabcursorenabled: false
  731. });
  732. $(".table-responsive").niceScroll({
  733. railpadding: {top:0,right:0,left:0,bottom:0},
  734. scrollspeed: 30,
  735. mousescrollstep: 60,
  736. grabcursorenabled: false
  737. });
  738. $(".playlist-listing").niceScroll({
  739. railpadding: {top:0,right:0,left:0,bottom:0},
  740. scrollspeed: 30,
  741. mousescrollstep: 60,
  742. grabcursorenabled: false
  743. });
  744. <?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))){ ?>
  745. var queueRefresh = <?php echo DOWNLOADREFRESH; ?>;
  746. var historyRefresh = <?php echo HISTORYREFRESH; ?>; // This really doesn't need to happen that often
  747. var queueLoad = function() {
  748. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-queue.sabnzbd").load("ajax.php?a=sabnzbd-update&list=queue");'; } ?>
  749. <?php if(NZBGETURL != "") { echo '$("tbody.dl-queue.nzbget").load("ajax.php?a=nzbget-update&list=listgroups");'; } ?>
  750. };
  751. var historyLoad = function() {
  752. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-history.sabnzbd").load("ajax.php?a=sabnzbd-update&list=history");'; } ?>
  753. <?php if(NZBGETURL != "") { echo '$("tbody.dl-history.nzbget").load("ajax.php?a=nzbget-update&list=history");'; } ?>
  754. };
  755. // Initial Loads
  756. queueLoad();
  757. historyLoad();
  758. // Interval Loads
  759. var queueInterval = setInterval(queueLoad, queueRefresh);
  760. var historyInterval = setInterval(historyLoad, historyRefresh);
  761. // Manual Load
  762. $("#getDownloader").click(function() {
  763. queueLoad();
  764. historyLoad();
  765. });
  766. <?php } ?>
  767. });
  768. $( window ).on( "load", function() {
  769. $( "ul.filter-recent-playlist > li:first" ).trigger("click");
  770. });
  771. </script>
  772. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH))) { ?>
  773. <script>
  774. $(function () {
  775. var date = new Date();
  776. var d = date.getDate();
  777. var m = date.getMonth();
  778. var y = date.getFullYear();
  779. $('#calendar').fullCalendar({
  780. eventLimit: false,
  781. firstDay: <?php echo CALENDARSTART;?>,
  782. height: "auto",
  783. defaultView: '<?php echo CALENDARVIEW;?>',
  784. header: {
  785. left: 'prev,next,',
  786. center: 'title',
  787. right: 'today, month, basicDay,basicWeek,'
  788. },
  789. views: {
  790. basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
  791. basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
  792. month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
  793. today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
  794. },
  795. //events: [ <?php //echo getCalendar(); ?> ],
  796. eventRender: function eventRender( event, element, view ) {
  797. //return ['all', event.imagetype].indexOf($('#imagetype_selector').val()) >= 0
  798. if (typeof filter !== 'undefined') {
  799. if(filter === "all"){
  800. return event.imagetype === event.imagetype;
  801. }else if(filter !== "all"){
  802. return filter === event.imagetype;
  803. }
  804. if(filter === null){
  805. return event.imagetype === event.imagetype;
  806. }
  807. }else {
  808. return event.imagetype === event.imagetype;
  809. }
  810. },
  811. editable: false,
  812. droppable: false,
  813. timeFormat: '<?php echo CALTIMEFORMAT; ?>',
  814. });
  815. });
  816. $(document).on('click', ".calendarOption", function(){
  817. window.filter = $(this).attr("calendarOption");
  818. if(filter ==="all"){
  819. title = "View All";
  820. }else if(filter ==="tv"){
  821. title = "TV Shows";
  822. }else if(filter ==="film"){
  823. title = "Movies";
  824. }else if(filter ==="music"){
  825. title = "Music";
  826. }
  827. console.log("Calendar Filter: "+title);
  828. $('#calendar').fullCalendar('rerenderEvents');
  829. $('#calendarSelected').html(title+"&nbsp;<span class=\"caret\"></span>");
  830. });
  831. $.ajax({
  832. type: 'GET',
  833. url: 'ajax.php?a=get-calendar',
  834. success: function(data)
  835. {
  836. newData = $.parseJSON(data);
  837. $('#calendar').fullCalendar('removeEvents');
  838. $('#calendar').fullCalendar('addEventSource', newData);
  839. console.log('Calendar Entries Added');
  840. }
  841. });
  842. setInterval(function() {
  843. $.ajax({
  844. type: 'GET',
  845. url: 'ajax.php?a=get-calendar',
  846. success: function(data)
  847. {
  848. newData = $.parseJSON(data);
  849. $('#calendar').fullCalendar('removeEvents');
  850. $('#calendar').fullCalendar('addEventSource', newData);
  851. console.log('Calendar refreshed');
  852. }
  853. });
  854. }, <?php echo CALENDARREFRESH; ?>);
  855. </script>
  856. <?php } ?>
  857. <script>
  858. function convertTime(a){
  859. if(a){
  860. var hours = Math.trunc(a/60);
  861. var minutes = a % 60;
  862. return hours+"h "+minutes+"m";
  863. }else{
  864. return "N/A";
  865. }
  866. }
  867. function convertArray(a, type){
  868. var result = "";
  869. var count = 1;
  870. var color = "";
  871. $.each( a, function( key, value ) {
  872. if (count == 1){ color = "gray"; }else{ color = "gray"; }
  873. if(type == "MOVIE"){
  874. result += '<span class="label label-'+color+'">'+value['name']+'</span>&nbsp;';
  875. }else if(type == "TV"){
  876. result += '<span class="label label-'+color+'">'+value+'</span>&nbsp;';
  877. }
  878. count++;
  879. });
  880. return result;
  881. }
  882. function convertTrailer(a){
  883. var result = "";
  884. var count = 1;
  885. $.each( a.results, function( key, value ) {
  886. if (count == 1){
  887. result += '<span id="openTrailer" style="cursor:pointer;width: 100%;display: block;" data-key="'+value['key']+'" data-name="'+value['name']+'" data-site="'+value['site']+'" class="label label-danger"><i style="vertical-align:sub;" class="fa fa-youtube-play" aria-hidden="true"></i><text style="vertical-align:sub;"> Watch Trailer</text></span>&nbsp;';
  888. }
  889. count++;
  890. });
  891. return result;
  892. }
  893. function convertCast(a){
  894. var result = "";
  895. var count = 1;
  896. $.each( a.cast, function( key, value ) {
  897. if( value['profile_path'] ){
  898. if (count <= 6){
  899. result += '<div class="col-lg-4 col-xs-4"><div class="zero-m"><img class="pull-left" style="border-radius:10%;margin-left: auto;margin-right: auto;display: block;" height="100px" src="https://image.tmdb.org/t/p/w150'+value['profile_path']+'" alt="profile"><h5 class="text-center"><strong>'+value['name']+'</strong></h5><h6 class="text-center">'+value['character']+'</h6></div></div>';
  900. count++;
  901. }
  902. }
  903. });
  904. return result;
  905. }
  906. function whatIsIt(a){
  907. var what = Object.prototype.toString;
  908. if(what.call(a) == "[object Array]"){
  909. return a[0].fileName;
  910. }else if(what.call(a) == "[object Object]"){
  911. return a.fileName;
  912. }
  913. }
  914. function whatWasIt(a){
  915. var what = Object.prototype.toString;
  916. if(what.call(a) == "[object Array]"){
  917. return a[0];
  918. }else if(what.call(a) == "[object Object]"){
  919. return a;
  920. }
  921. }
  922. $(document).on('click', "#openTrailer", function(){
  923. var key = $(this).attr("data-key");
  924. $('#iFrameYT').html('<iframe id="calendarYoutube" class="embed-responsive-item" src="https://www.youtube.com/embed/'+key+'" allowfullscreen=""></iframe>');
  925. $('#calendarVideo').modal('show');
  926. });
  927. $(document).on('click', "a[class*=ID-]", function(){
  928. parent.$.smkAlert({
  929. text: 'Loading...',
  930. type: 'info',
  931. time: 1
  932. });
  933. var check = $(this).attr("class");
  934. var ID = check.split("--")[1];
  935. if (~check.indexOf("tvID")){
  936. var type = "TV";
  937. ajax_request('POST', 'tvdb-get', {
  938. id: ID,
  939. }).done(function(data){
  940. if( data.trakt && data.trakt.tmdb !== null) {
  941. $('#calendarExtra').modal('show');
  942. var refreshBox = $('#calendarMainID');
  943. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  944. setTimeout(function(){
  945. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  946. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  947. refreshPreloader.remove();
  948. });
  949. },600);
  950. $.ajax({
  951. type: 'GET',
  952. url: 'https://api.themoviedb.org/3/tv/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
  953. cache: true,
  954. async: true,
  955. complete: function(xhr, status) {
  956. var result = $.parseJSON(xhr.responseText);
  957. if (xhr.statusText === "OK") {
  958. $('#calendarTitle').text(result.name);
  959. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  960. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(whatWasIt(result.episode_run_time))+'</span>&nbsp;');
  961. $('#calendarSummary').text(result.overview);
  962. $('#calendarTagline').text("");
  963. $('#calendarTrailer').html(convertTrailer(result.videos));
  964. $('#calendarCast').html(convertCast(result.credits));
  965. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  966. $('#calendarLang').html(convertArray(result.languages, "TV"));
  967. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  968. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  969. $('#calendarExtra').modal('show');
  970. }
  971. }
  972. });
  973. }else{
  974. swal("Sorry..", "No info was found for this item!", "error");
  975. }
  976. });
  977. }else if (~check.indexOf("movieID")){
  978. var type = "MOVIE";
  979. $.ajax({
  980. type: 'GET',
  981. url: 'https://api.themoviedb.org/3/movie/'+ID+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
  982. cache: true,
  983. async: true,
  984. complete: function(xhr, status) {
  985. var result = $.parseJSON(xhr.responseText);
  986. console.log(result);
  987. console.log(convertCast(result.credits));
  988. if (xhr.statusText === "OK") {
  989. $('#calendarTitle').text(result.title);
  990. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  991. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(result.runtime)+'</span>&nbsp;');
  992. $('#calendarSummary').text(result.overview);
  993. $('#calendarTagline').text(result.tagline);
  994. $('#calendarTrailer').html(convertTrailer(result.videos));
  995. $('#calendarCast').html(convertCast(result.credits));
  996. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  997. $('#calendarLang').html(convertArray(result.spoken_languages, "MOVIE"));
  998. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  999. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  1000. $('#calendarExtra').modal('show');
  1001. }
  1002. }
  1003. });
  1004. }
  1005. });
  1006. </script>
  1007. <div id="calendarExtra" class="modal fade in" tabindex="-1" role="dialog">
  1008. <div class="modal-dialog modal-lg gray-bg" role="document">
  1009. <div id="calendarMainID" class="modal-content">
  1010. <div class="modal-content" id="calendarMain"></div>
  1011. <div style="position: inherit; padding: 15px">
  1012. <span id="calendarRuntime" class="pull-left"></span>
  1013. <span id="calendarRating" class="pull-left"></span>
  1014. <span id="calendarGenres" class="pull-right"></span>
  1015. </div>
  1016. <div class="modal-body">
  1017. <div class="row">
  1018. <div class="col-sm-4">
  1019. <img style="width:100%;border-radius: 10px;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);" id="calendarPoster" src="">
  1020. </div>
  1021. <div class="col-sm-8">
  1022. <h2 id="calendarTitle" class="modal-title text-center">Modal title</h2>
  1023. <h6 id="calendarTagline" class="modal-title text-center"><em>Modal title</em></h6>
  1024. <p id="calendarSummary">Modal Summary</p>
  1025. <div class="" id="calendarCast">Modal Summary</div>
  1026. </div>
  1027. </div>
  1028. </div>
  1029. <div style="position: inherit; padding: 15px 0px 30px 0px; margin-top: -20px;">
  1030. <div class="col-sm-4">
  1031. <span id="calendarTrailer" class="pull-left" style="width:100%;display: flex;"></span>
  1032. </div>
  1033. <div class="col-sm-8">
  1034. <span id="calendarLang" class="pull-right"></span>
  1035. </div>
  1036. </div>
  1037. </div>
  1038. </div>
  1039. </div>
  1040. <div id="calendarVideo" class="modal fade in palette-Grey-900 bg" tabindex="-1" role="dialog">
  1041. <div class="modal-dialog modal-lg gray-bg" role="document">
  1042. <div id="calendarMainVideo" class="modal-content gray-bg">
  1043. <div class="">
  1044. <!-- 16:9 aspect ratio -->
  1045. <div id="iFrameYT" class="embed-responsive embed-responsive-16by9 gray-bg"></div>
  1046. </div>
  1047. </div>
  1048. </div>
  1049. </div>
  1050. </body>
  1051. </html>