homepage.php 59 KB

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