Преглед на файлове

Fix homepage sort
Added Org mod Picks
misc css

causefx преди 8 години
родител
ревизия
af922c9570
променени са 5 файла, в които са добавени 97 реда и са изтрити 53 реда
  1. 57 21
      api/functions/homepage-connect-functions.php
  2. 2 17
      api/functions/homepage-functions.php
  3. 2 2
      api/pages/settings-tab-editor-homepage-order.php
  4. 6 0
      css/organizr.css
  5. 30 13
      js/functions.js

+ 57 - 21
api/functions/homepage-connect-functions.php

@@ -1149,24 +1149,32 @@ function getCouchCalendar($array, $number)
         return $gotCalendar;
     }
 }
-function getSickrageCalendarWanted($array,$number)
+function getSickrageCalendarWanted($array, $number)
 {
     $array = json_decode($array, true);
     $gotCalendar = array();
     $i = 0;
-    foreach($array['data']['missed'] AS $child) {
+    foreach ($array['data']['missed'] as $child) {
         $i++;
         $seriesName = $child['show_name'];
         $seriesID = $child['tvdbid'];
         $episodeID = $child['tvdbid'];
         $episodeAirDate = $child['airdate'];
-        $episodeAirDateTime = explode(" ",$child['airs']);
+        $episodeAirDateTime = explode(" ", $child['airs']);
         $episodeAirDateTime = date("H:i:s", strtotime($episodeAirDateTime[1].$episodeAirDateTime[2]));
         $episodeAirDate = strtotime($episodeAirDate.$episodeAirDateTime);
         $episodeAirDate = date("Y-m-d H:i:s", $episodeAirDate);
-        if (new DateTime() < new DateTime($episodeAirDate)) { $unaired = true; }
+        if (new DateTime() < new DateTime($episodeAirDate)) {
+            $unaired = true;
+        }
         $downloaded = "0";
-        if($downloaded == "0" && isset($unaired)){ $downloaded = "text-info"; }elseif($downloaded == "1"){ $downloaded = "text-success";}else{ $downloaded = "text-danger"; }
+        if ($downloaded == "0" && isset($unaired)) {
+            $downloaded = "text-info";
+        } elseif ($downloaded == "1") {
+            $downloaded = "text-success";
+        } else {
+            $downloaded = "text-danger";
+        }
         $bottomTitle = 'S' . sprintf("%02d", $child['season']) . 'E' . sprintf("%02d", $child['episode']) . ' - ' . $child['ep_name'];
 
         $cacheDirectory = dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
@@ -1202,19 +1210,27 @@ function getSickrageCalendarWanted($array,$number)
             "details" => $details,
         ));
     }
-    foreach($array['data']['today'] AS $child) {
+    foreach ($array['data']['today'] as $child) {
         $i++;
         $seriesName = $child['show_name'];
         $seriesID = $child['tvdbid'];
         $episodeID = $child['tvdbid'];
         $episodeAirDate = $child['airdate'];
-        $episodeAirDateTime = explode(" ",$child['airs']);
+        $episodeAirDateTime = explode(" ", $child['airs']);
         $episodeAirDateTime = date("H:i:s", strtotime($episodeAirDateTime[1].$episodeAirDateTime[2]));
         $episodeAirDate = strtotime($episodeAirDate.$episodeAirDateTime);
         $episodeAirDate = date("Y-m-d H:i:s", $episodeAirDate);
-        if (new DateTime() < new DateTime($episodeAirDate)) { $unaired = true; }
+        if (new DateTime() < new DateTime($episodeAirDate)) {
+            $unaired = true;
+        }
         $downloaded = "0";
-        if($downloaded == "0" && isset($unaired)){ $downloaded = "text-info"; }elseif($downloaded == "1"){ $downloaded = "text-success";}else{ $downloaded = "text-danger"; }
+        if ($downloaded == "0" && isset($unaired)) {
+            $downloaded = "text-info";
+        } elseif ($downloaded == "1") {
+            $downloaded = "text-success";
+        } else {
+            $downloaded = "text-danger";
+        }
         $bottomTitle = 'S' . sprintf("%02d", $child['season']) . 'E' . sprintf("%02d", $child['episode']) . ' - ' . $child['ep_name'];
 
         $cacheDirectory = dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
@@ -1250,19 +1266,27 @@ function getSickrageCalendarWanted($array,$number)
             "details" => $details,
         ));
     }
-    foreach($array['data']['soon'] AS $child) {
+    foreach ($array['data']['soon'] as $child) {
         $i++;
         $seriesName = $child['show_name'];
         $seriesID = $child['tvdbid'];
         $episodeID = $child['tvdbid'];
         $episodeAirDate = $child['airdate'];
-        $episodeAirDateTime = explode(" ",$child['airs']);
+        $episodeAirDateTime = explode(" ", $child['airs']);
         $episodeAirDateTime = date("H:i:s", strtotime($episodeAirDateTime[1].$episodeAirDateTime[2]));
         $episodeAirDate = strtotime($episodeAirDate.$episodeAirDateTime);
         $episodeAirDate = date("Y-m-d H:i:s", $episodeAirDate);
-        if (new DateTime() < new DateTime($episodeAirDate)) { $unaired = true; }
+        if (new DateTime() < new DateTime($episodeAirDate)) {
+            $unaired = true;
+        }
         $downloaded = "0";
-        if($downloaded == "0" && isset($unaired)){ $downloaded = "text-info"; }elseif($downloaded == "1"){ $downloaded = "text-success";}else{ $downloaded = "text-danger"; }
+        if ($downloaded == "0" && isset($unaired)) {
+            $downloaded = "text-info";
+        } elseif ($downloaded == "1") {
+            $downloaded = "text-success";
+        } else {
+            $downloaded = "text-danger";
+        }
         $bottomTitle = 'S' . sprintf("%02d", $child['season']) . 'E' . sprintf("%02d", $child['episode']) . ' - ' . $child['ep_name'];
 
         $cacheDirectory = dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
@@ -1298,19 +1322,27 @@ function getSickrageCalendarWanted($array,$number)
             "details" => $details,
         ));
     }
-    foreach($array['data']['later'] AS $child) {
+    foreach ($array['data']['later'] as $child) {
         $i++;
         $seriesName = $child['show_name'];
         $seriesID = $child['tvdbid'];
         $episodeID = $child['tvdbid'];
         $episodeAirDate = $child['airdate'];
-        $episodeAirDateTime = explode(" ",$child['airs']);
+        $episodeAirDateTime = explode(" ", $child['airs']);
         $episodeAirDateTime = date("H:i:s", strtotime($episodeAirDateTime[1].$episodeAirDateTime[2]));
         $episodeAirDate = strtotime($episodeAirDate.$episodeAirDateTime);
         $episodeAirDate = date("Y-m-d H:i:s", $episodeAirDate);
-        if (new DateTime() < new DateTime($episodeAirDate)) { $unaired = true; }
+        if (new DateTime() < new DateTime($episodeAirDate)) {
+            $unaired = true;
+        }
         $downloaded = "0";
-        if($downloaded == "0" && isset($unaired)){ $downloaded = "text-info"; }elseif($downloaded == "1"){ $downloaded = "text-success";}else{ $downloaded = "text-danger"; }
+        if ($downloaded == "0" && isset($unaired)) {
+            $downloaded = "text-info";
+        } elseif ($downloaded == "1") {
+            $downloaded = "text-success";
+        } else {
+            $downloaded = "text-danger";
+        }
         $bottomTitle = 'S' . sprintf("%02d", $child['season']) . 'E' . sprintf("%02d", $child['episode']) . ' - ' . $child['ep_name'];
 
         $cacheDirectory = dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
@@ -1346,14 +1378,16 @@ function getSickrageCalendarWanted($array,$number)
             "details" => $details,
         ));
     }
-    if ($i != 0){ return $gotCalendar; }
+    if ($i != 0) {
+        return $gotCalendar;
+    }
 }
-function getSickrageCalendarHistory($array,$number)
+function getSickrageCalendarHistory($array, $number)
 {
     $array = json_decode($array, true);
     $gotCalendar = array();
     $i = 0;
-    foreach($array['data'] AS $child) {
+    foreach ($array['data'] as $child) {
         $i++;
         $seriesName = $child['show_name'];
         $seriesID = $child['tvdbid'];
@@ -1395,7 +1429,9 @@ function getSickrageCalendarHistory($array,$number)
             "details" => $details,
         ));
     }
-    if ($i != 0){ return $gotCalendar; }
+    if ($i != 0) {
+        return $gotCalendar;
+    }
 }
 function ombiAPI($array)
 {

+ 2 - 17
api/functions/homepage-functions.php

@@ -1468,7 +1468,7 @@ function getHomepageList()
 function buildHomepageSettings()
 {
     $homepageOrder = homepageOrder();
-    $homepageList = '<h4>Drag Homepage Items to Order Them</h4><div id="homepage-items" class="external-events">';
+    $homepageList = '<h4>Drag Homepage Items to Order Them</h4><div id="homepage-items-sort" class="external-events">';
     $inputList = '<form id="homepage-values" class="row">';
     foreach ($homepageOrder as $key => $val) {
         switch ($key) {
@@ -1558,28 +1558,13 @@ function buildHomepageSettings()
                 break;
         }
         $homepageList .= '
-		<div class="col-md-3 sort-homepage m-t-10 hvr-grow">
+		<div class="col-md-3 col-xs-12 sort-homepage m-t-10 hvr-grow">
 			<div class="homepage-drag fc-event '.$class.' lazyload"  data-src="'.$image.'">
 				<span class="ordinal-position text-uppercase badge bg-org homepage-number" data-link="'.$key.'" style="float:left;width: 30px;">'.$val.'</span>
 				<span class="homepage-text">&nbsp; '.strtoupper(substr($key, 13)).'</span>
 
 			</div>
 		</div>
-		<!--
-		<div class="col-lg-2 col-md-2 col-sm-4 col-xs-4 sort-homepage m-b-10">
-			<div class="white-box bg-org '.$class.'">
-				<div class="el-card-item p-0">
-					<div class="el-card-avatar el-overlay-1 m-0">
-						<img class="lazyload loaded" data-src="'.$image.'">
-					</div>
-					<div class="el-card-content">
-						<h3 class="box-title">'.strtoupper(substr($key, 13)).'</h3>
-						<small class="elip ordinal-position text-uppercase p-b-10" data-link="'.$key.'">'.$val.'</small>
-					</div>
-				</div>
-			</div>
-		</div>
-		-->
 		';
         $inputList .= '<input type="hidden" name="'.$key.'">';
     }

+ 2 - 2
api/pages/settings-tab-editor-homepage-order.php

@@ -2,8 +2,8 @@
 if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
 $pageSettingsTabEditorHomepageOrder = '
 <script>
-    $("#homepage-items").sortable({
-    placeholder:    "sort-placeholder col-md-3",
+    $("#homepage-items-sort").sortable({
+    placeholder:    "sort-placeholder col-md-3 col-xs-12 clearfix",
     forcePlaceholderSize: true,
     start: function( e, ui ){
         ui.item.data( "start-pos", ui.item.index()+1 );

+ 6 - 0
css/organizr.css

@@ -570,3 +570,9 @@ span.homepage-text {
     color: #2cabe3;
     text-decoration: none;
 }
+@media (pointer: coarse) {
+	#side-menu > li > a:hover,
+	#side-menu > li > a:focus {
+	  background: transparent;
+	}
+}

+ 30 - 13
js/functions.js

@@ -2161,10 +2161,10 @@ function buildStreamItem(array,source){
 					<div class="el-card-avatar el-overlay-1 m-b-0">`+bg+`<img class="imageSource" style="width:`+width+`%;margin-left: auto;margin-right: auto;" src="`+v.nowPlayingImageURL+`">
 						<div class="el-overlay">
 							<ul class="el-info p-t-20 m-t-20">
-								<li><a class="btn default btn-outline inline-popups" href="#`+v.session+`" data-effect="mfp-zoom-out"><i class="mdi mdi-server-network mdi-24px"></i></a></li>
-								<li><a class="btn default btn-outline metadata-get" data-source="`+source+`" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`"><i class="mdi mdi-information mdi-24px"></i></a></li>
-								<li><a class="btn default btn-outline openTab" data-tab-name="`+v.tabName+`" data-type="`+v.type+`" data-open-tab="`+v.openTab+`" data-url="`+v.address+`" href="javascript:void(0);"><i class=" mdi mdi-`+source+` mdi-24px"></i></a></li>
-								<li><a class="btn default btn-outline refreshImage" data-type="nowPlaying" data-image="`+v.nowPlayingOriginalImage+`" href="javascript:void(0);"><i class="mdi mdi-refresh mdi-24px"></i></a></li>
+								<li><a class="btn b-none inline-popups" href="#`+v.session+`" data-effect="mfp-zoom-out"><i class="mdi mdi-server-network mdi-24px"></i></a></li>
+								<li><a class="btn b-none metadata-get" data-source="`+source+`" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`"><i class="mdi mdi-information mdi-24px"></i></a></li>
+								<li><a class="btn b-none openTab" data-tab-name="`+v.tabName+`" data-type="`+v.type+`" data-open-tab="`+v.openTab+`" data-url="`+v.address+`" href="javascript:void(0);"><i class=" mdi mdi-`+source+` mdi-24px"></i></a></li>
+								<li><a class="btn b-none refreshImage" data-type="nowPlaying" data-image="`+v.nowPlayingOriginalImage+`" href="javascript:void(0);"><i class="mdi mdi-refresh mdi-24px"></i></a></li>
 								<a class="inline-popups `+v.uid+` hidden" href="#`+v.uid+`-metadata-div" data-effect="mfp-zoom-out"></a>
 							</ul>
 						</div>
@@ -2343,6 +2343,7 @@ function buildRequestItem(array, extra=null){
                 </div>`;
 				adminFunctions = (activeInfo.user.groupID <= 1) ? adminFunctions : '';
 				var user = (activeInfo.user.groupID <= 1) ? '<span lang="en">Requested By:</span> '+v.user : '';
+				var user2 = (activeInfo.user.groupID <= 1) ? '<br>'+v.user : '';
 				items += `
 				<div class="item lazyload recent-poster request-item request-`+v.type+` `+className+` mouse" data-target="request-`+v.id+`" data-src="`+v.poster+`">
 					<div class="outside-request-div">
@@ -2350,7 +2351,7 @@ function buildRequestItem(array, extra=null){
 						<div class="inside-request-div `+badge+`"></div>
 					</div>
 					<div class="hover-homepage-item"></div>
-					<span class="elip recent-title">`+v.title+`</span>
+					<span class="elip recent-title">`+v.title+user2+`</span>
 					<div id="request-`+v.id+`" class="white-popup mfp-with-anim mfp-hide">
 						<div class="col-md-8 col-md-offset-2">
 							<div class="white-box m-b-0">
@@ -2581,6 +2582,7 @@ function buildRequest(array){
                         <div class="input-group-btn">
                             <button type="button" class="btn waves-effect waves-light btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span lang="en">Suggestions</span> <span class="caret"></span></button>
                             <ul class="dropdown-menu dropdown-menu-right">
+								<li><a onclick="requestList('org-mod', 'movie');" href="javascript:void(0)" lang="en">Organizr Mod Picks</a></li>
 								<li><a onclick="requestList('theatre-movie', 'movie');" href="javascript:void(0)" lang="en">In Theatres</a></li>
 								<li><a onclick="requestList('top-movie', 'movie');" href="javascript:void(0)" lang="en">Top Movies</a></li>
 								<li><a onclick="requestList('pop-movie', 'movie');" href="javascript:void(0)" lang="en">Popular Movies</a></li>
@@ -2600,17 +2602,18 @@ function buildRequest(array){
 	` : '';
 }
 function buildRequestResult(array,media_type=null,list=null,page=null,search=false){
-	//var result = (typeof array !== 'undefined') ? true : false;
+	var comments = (typeof array.comments !== 'undefined') ? true : false;
+	var comment = '';
 	var results = ``;
 	var buttons = ``;
 	var next = ``;
 	var tv = 0;
 	var movie = 0;
 	var total = 0;
-	if(array.length == 0){
+	if(array.results.length == 0){
 		return '<h2 class="text-center" lang="en">No Results</h2>';
 	}
-	$.each(array, function(i,v) {
+	$.each(array.results, function(i,v) {
 		media_type = (v.media_type) ? v.media_type : media_type;
 		if(media_type == 'tv' || media_type == 'movie'){
 			total = total + 1;
@@ -2619,12 +2622,18 @@ function buildRequestResult(array,media_type=null,list=null,page=null,search=fal
 			var bg = (v.poster_path !== null) ? `https://image.tmdb.org/t/p/w300/`+v.poster_path : 'plugins/images/cache/no-list.png';
 			var top = (v.title) ? v.title : (v.original_title) ? v.original_title : (v.original_name) ? v.original_name : '';
 			var bottom = (v.release_date) ? v.release_date : (v.first_air_date) ? v.first_air_date : '';
+			if(comments){
+				if(array.comments[media_type+':'+v.id] !== null){
+					comment = array.comments[media_type+':'+v.id];
+				}
+			}
 			results += `
 			<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 m-t-20 request-result-item request-result-`+media_type+`">
 	            <div class="white-box m-b-10">
 	                <div class="el-card-item p-b-0">
 	                    <div class="el-card-avatar el-overlay-1 m-b-5 preloader-`+v.id+`"> <img class="lazyload resultImages" data-src="`+bg+`">
 	                        <div class="el-overlay">
+								<span class="text-info p-5 font-normal">`+comment+`</span>
 	                            <ul class="el-info">
 	                                <li><a class="btn default btn-outline" href="javascript:void(0);" onclick="processRequest('`+v.id+`','`+media_type+`');"><i class="icon-link"></i>&nbsp; <span lang="en">Request</span></a></li>
 	                            </ul>
@@ -2639,7 +2648,7 @@ function buildRequestResult(array,media_type=null,list=null,page=null,search=fal
 	        </div>
 			`;
 		}
-
+		comment = '';
 	});
 	if(total == 20 && (list) && (page) && (search == false)){
 		page = ((page * 1) + 1);
@@ -2718,9 +2727,9 @@ function doneTyping () {
 	searchTerm = title;
 	$('#request-page').val(page);
 	requestSearch(title, page).success(function(data) {
-		$('#request-results').html(buildRequestResult(data.results,'',title,page,true));
+		$('#request-results').html(buildRequestResult(data,'',title,page,true));
 		$('.mfp-wrap').animate({
-			scrollTop: $("#request-results").offset().top
+			scrollTop:  '0'
 		}, 500);
 		ajaxloader();
 	}).fail(function(xhr) {
@@ -2731,9 +2740,14 @@ function doneTyping () {
 function requestList (list, type, page=1) {
 	ajaxloader('.search-div', 'in');
 	requestSearchList(list,page).success(function(data) {
-		$('#request-results').html(buildRequestResult(data.results, type, list, page));
+		if(typeof data.results !== 'undefined'){
+			var results = data.results;
+		}else if(typeof data.items !== 'undefined'){
+			var results = data.items;
+		}
+		$('#request-results').html(buildRequestResult(data, type, list, page));
 		$('.mfp-wrap').animate({
-			scrollTop: $("#request-results").offset().top
+			scrollTop: '0'
 		}, 500);
 		ajaxloader();
 	}).fail(function(xhr) {
@@ -3434,6 +3448,9 @@ function requestSearchList(list,page=1) {
 		case 'today-tv':
 			url = 'https://api.themoviedb.org/3/tv/airing_today?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&language='+activeInfo.language+'&page='+page;
 			break;
+		case 'org-mod':
+			url = 'https://api.themoviedb.org/4/list/64438?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&language='+activeInfo.language+'&page='+page;
+			break;
 		default:
 
 	}