homepage.php 58 KB

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