Просмотр исходного кода

minor js tweaks, fix double call on recent items metadata call

causefx 8 лет назад
Родитель
Сommit
125e5ed9e4
2 измененных файлов с 39 добавлено и 35 удалено
  1. 8 9
      js/custom.js
  2. 31 26
      js/functions.js

+ 8 - 9
js/custom.js

@@ -1573,10 +1573,10 @@ $(document).on("click", ".refreshImage", function(e) {
 	message('',' Refreshing Image...','bottom-right','#FFF','success','1000');
 	e.preventDefault;
 	var orginalElement = $(this).parent().parent().parent().parent().find('.imageSource');
-    console.log(orginalElement)
+    //console.log(orginalElement)
 	var original = $(this).attr('data-image');
 	orginalElement.attr('src', original);
-	console.log('replaced image with : '+original);
+	//console.log('replaced image with : '+original);
 	setTimeout(function(){
         message('Image Refreshed ',' Clear Cache Please','bottom-right','#FFF','success','3000');
 	}, 1000);
@@ -1601,7 +1601,6 @@ $(document).on("click", ".openTab", function(e) {
 });
 // metadata start
 $(document).on("click", ".metadata-get", function(e) {
-    $('.metadata-info').html('');
     var key = $(this).attr('data-key');
 	var uid = $(this).attr('data-uid');
     var source = $(this).attr('data-source');
@@ -1618,7 +1617,7 @@ $(document).on("click", ".metadata-get", function(e) {
     ajaxloader(".content-wrap","in");
 	organizrAPI('POST','api/?v1/homepage/connect',{action:action, key:key}).success(function(data) {
 		var response = JSON.parse(data);
-        console.log(response);
+        $('.'+uid+'-metadata-info').html('');
 		$('.'+uid+'-metadata-info').html(buildMetadata(response.data, source));
         $('.'+uid).trigger('click')
 	}).fail(function(xhr) {
@@ -1627,18 +1626,18 @@ $(document).on("click", ".metadata-get", function(e) {
 	ajaxloader();
 
 });
-// sad play/resume
+// sab play/resume
 $(document).on("click", ".downloader", function(e) {
     var action = $(this).attr('data-action');
     var source = $(this).attr('data-source');
     var target = $(this).attr('data-target');
-    console.log(action);
-    console.log(source);
-    console.log(target);
+    //console.log(action);
+    //console.log(source);
+    //console.log(target);
     ajaxloader(".content-wrap","in");
 	organizrAPI('POST','api/?v1/downloader',{action:action, source:source, target:target}).success(function(data) {
 		var response = JSON.parse(data);
-        console.log(response);
+        //console.log(response);
 		homepageDownloader(source);
 	}).fail(function(xhr) {
 		console.error("Organizr Function: API Connection Failed");

+ 31 - 26
js/functions.js

@@ -1930,36 +1930,40 @@ function buildStreamItem(array,source){
 	});
 	return cards;
 }
-function buildRecentItem(array, type){
+function buildRecentItem(array, type, extra=null){
 	var items = '';
 	$.each(array, function(i,v) {
-		var className = '';
-		switch (v.type) {
-			case 'music':
-				className = 'recent-cover recent-item recent-music';
-				break;
-			case 'movie':
-				className = 'recent-poster recent-item recent-movie';
-				break;
-			case 'tv':
-				className = 'recent-poster recent-item recent-tv';
-				break;
-			case 'video':
-				className = 'recent-poster recent-item recent-video';
-				break;
-			default:
+		if(extra == null){
+			var className = '';
+			switch (v.type) {
+				case 'music':
+					className = 'recent-cover recent-item recent-music';
+					break;
+				case 'movie':
+					className = 'recent-poster recent-item recent-movie';
+					break;
+				case 'tv':
+					className = 'recent-poster recent-item recent-tv';
+					break;
+				case 'video':
+					className = 'recent-poster recent-item recent-video';
+					break;
+				default:
 
-		}
-		items += `
-		<div class="item lazyload `+className+` metadata-get mouse" data-source="`+type+`" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`" data-src="`+v.imageURL+`">
-			<span class="elip recent-title">`+v.title+`</span>
+			}
+			items += `
+			<div class="item lazyload `+className+` metadata-get mouse" data-source="`+type+`" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`" data-src="`+v.imageURL+`">
+				<span class="elip recent-title">`+v.title+`</span>
+				<div id="`+v.uid+`-metadata-div" class="white-popup mfp-with-anim mfp-hide">
+			        <div class="col-md-8 col-md-offset-2 `+v.uid+`-metadata-info"></div>
+			    </div>
+			</div>
+			`;
+		}else{
+			items += `
 			<a class="inline-popups `+v.uid+` hidden" href="#`+v.uid+`-metadata-div" data-effect="mfp-zoom-out"></a>
-			<div id="`+v.uid+`-metadata-div" class="white-popup mfp-with-anim mfp-hide">
-		        <div class="col-md-8 col-md-offset-2 `+v.uid+`-metadata-info"></div>
-		    </div>
-		</div>
-		`;
-
+			`;
+		}
 
 	});
 	return items;
@@ -2009,6 +2013,7 @@ function buildRecent(array, type){
                     <div class="owl-carousel owl-theme recent-items `+type+`-recent">
 						`+buildRecentItem(array.content, type)+`
                     </div>
+					`+buildRecentItem(array.content, type, true)+`
                 </div>
             </div>
         </div>