homepage.php 47 KB

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