homepage.php 58 KB

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