nate 3 lat temu
rodzic
commit
7da2abece1
4 zmienionych plików z 22 dodań i 8 usunięć
  1. 4 1
      component-favorite.php
  2. 6 7
      component-list.php
  3. 6 0
      script/js/3Dpic-favorite.js
  4. 6 0
      script/js/3Dpic.js

+ 4 - 1
component-favorite.php

@@ -98,11 +98,14 @@ if (!isset($_SESSION['loggedin'])) {
 				for (var i = 0; i < data.year.length; i++) {
 					$("#revitVersion").append('<label><input type="checkbox" value=".' + data.year[i] + '" />   ' + data.year[i] + '</label> ');
 				}
-				initThreeJS();
 				$grid = $("#content").isotope({
 					itemSelector: ".isotope-item",
 					layoutMode: 'fitRows'
 				})
+				$.when(initThreeJS()).then(
+					$grid.isotope()
+				);
+
 			}).error(function(error) {
 				console.log(error);
 			});

+ 6 - 7
component-list.php

@@ -96,13 +96,14 @@ if (!isset($_SESSION['loggedin'])) {
 				for (var i = 0; i < data["categoryList"].length; i++) {
 					$("#filters").append('<li><a class="button" data-filter=".' + i + '">' + data['categoryList'][i] + '</a></li>');
 				}
-				initThreeJS();
 				$grid = $("#content").isotope({
 					itemSelector: ".isotope-item",
 					layoutMode: 'fitRows'
-				})
-				setTimeout(() => {$grid.isotope()}, 100);
-
+				});
+				$.when(initThreeJS()).then(
+					$grid.isotope()
+				);
+				
 			}).error(function(error) {
 				console.log(error);
 			});
@@ -116,6 +117,7 @@ if (!isset($_SESSION['loggedin'])) {
 				dataType: "json"
 			}).done(function(data) {
 				for (var i = 0; i < data.length; i++) {
+					
 					$("#revitVersion").append('<label><input type="checkbox" value=".' + data[i] + '" />   ' + data[i] + '</label> ');
 				}
 			}).error(function(error) {
@@ -124,9 +126,6 @@ if (!isset($_SESSION['loggedin'])) {
 
 		});
 	</script>
-	<script>
-		//$grid.isotope({});
-	</script>
 	<script src="script/js/3Dpic.js" type="module"></script>
 	
 </body>

+ 6 - 0
script/js/3Dpic-favorite.js

@@ -76,6 +76,8 @@
 			smallRvt.innerText = ".rvt";
 			h5.appendChild(smallRvt);
 
+			h5.innerText = ellipsis(h5.innerText);
+
 			const mgdescription = document.createElement('div');
 			mgdescription.className = 'mg-description';
 			thumbnail.appendChild(mgdescription);
@@ -194,6 +196,10 @@
 		animate();
 	}
 
+	function ellipsis(str){
+		return (str.length > 32) ? str.substr(0, 31) + '...' : str;
+	}
+
 	function updateSize() {
 
 		const width = canvas.clientWidth;

+ 6 - 0
script/js/3Dpic.js

@@ -72,6 +72,8 @@
 			smallRvt.innerText = ".rvt";
 			h5.appendChild(smallRvt);
 
+			h5.innerText = ellipsis(h5.innerText);
+
 			const mgdescription = document.createElement('div');
 			mgdescription.className = 'mg-description';
 			thumbnail.appendChild(mgdescription);
@@ -192,6 +194,10 @@
 		animate();
 	}
 
+	function ellipsis(str){
+		return (str.length > 32) ? str.substr(0, 31) + '...' : str;
+	}
+
 	function updateSize() {
 
 		const width = canvas.clientWidth;