homepage.php 58 KB

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