homepage.php 47 KB

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