mirror of
				https://github.com/simon987/sist2.git
				synced 2025-10-31 16:06:53 +00:00 
			
		
		
		
	Add image viewer (#2)
This commit is contained in:
		
							parent
							
								
									7f6f3c02fa
								
							
						
					
					
						commit
						2934ddb07f
					
				| @ -6,7 +6,7 @@ | ||||
| #define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0" | ||||
| 
 | ||||
| 
 | ||||
| static const char *const Version = "1.2.10"; | ||||
| static const char *const Version = "1.2.11"; | ||||
| static const char *const usage[] = { | ||||
|         "sist2 scan [OPTION]... PATH", | ||||
|         "sist2 index [OPTION]... INDEX", | ||||
|  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -75,6 +75,10 @@ function shouldPlayVideo(hit) { | ||||
|     return videoc !== "hevc" && videoc !== "mpeg2video" && videoc !== "wmv3"; | ||||
| } | ||||
| 
 | ||||
| function shouldDisplayRawImage(hit) { | ||||
|     return hit["_source"]["videoc"] !== "tiff"; | ||||
| } | ||||
| 
 | ||||
| function makePlaceholder(w, h, small) { | ||||
|     let calc; | ||||
|     if (small) { | ||||
| @ -96,10 +100,14 @@ function makePlaceholder(w, h, small) { | ||||
|     return el; | ||||
| } | ||||
| 
 | ||||
| function ext(hit) { | ||||
|     return hit["_source"].hasOwnProperty("extension") && hit["_source"]["extension"] !== "" ? "." + hit["_source"]["extension"] : ""; | ||||
| } | ||||
| 
 | ||||
| function makeTitle(hit) { | ||||
|     let title = document.createElement("div"); | ||||
|     title.setAttribute("class", "file-title"); | ||||
|     let extension = hit["_source"].hasOwnProperty("extension") && hit["_source"]["extension"] !== "" ? "." + hit["_source"]["extension"] : ""; | ||||
|     let extension = ext(hit); | ||||
| 
 | ||||
|     applyNameToTitle(hit, title, extension); | ||||
| 
 | ||||
| @ -156,7 +164,7 @@ function getTags(hit, mimeCategory) { | ||||
| function infoButtonCb(hit) { | ||||
|     return () => { | ||||
|         getDocumentInfo(hit["_id"]).then(doc => { | ||||
|             $("#modal-title").text(doc["name"] + (doc["extension"] ? "." + doc["extension"] : "")); | ||||
|             $("#modal-title").text(doc["name"] + ext(hit)); | ||||
| 
 | ||||
|             const tbody = $("<tbody>"); | ||||
|             $("#modal-body").empty() | ||||
| @ -379,6 +387,14 @@ function makeThumbnail(mimeCategory, hit, imgWrapper, small) { | ||||
|         } | ||||
|         thumbnail.setAttribute("src", `t/${hit["_source"]["index"]}/${hit["_id"]}`); | ||||
| 
 | ||||
|         if (!hit["_source"]["parent"] && shouldDisplayRawImage(hit)) { | ||||
|             imgWrapper.setAttribute("id", "sp" + hit["_id"]); | ||||
|             imgWrapper.setAttribute("href", `f/${hit["_id"]}`); | ||||
|             imgWrapper.setAttribute("data-caption", hit["_source"]["path"] + "/" + hit["_source"]["name"] + ext(hit)); | ||||
|             imgWrapper.setAttribute("data-group", "p" + Math.floor(docCount / SIZE)); | ||||
|             imgWrapper.classList.add("sp"); | ||||
|         } | ||||
| 
 | ||||
|         const placeholder = makePlaceholder(hit["_source"]["width"], hit["_source"]["height"], small); | ||||
|         imgWrapper.appendChild(placeholder); | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										56
									
								
								web/js/jquery-smartphoto.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								web/js/jquery-smartphoto.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -406,6 +406,10 @@ function search(after = null) { | ||||
|         let resultContainer = makeResultContainer(); | ||||
|         searchResults.appendChild(resultContainer); | ||||
| 
 | ||||
|         window.setTimeout(() => { | ||||
|             $(".sp").SmartPhoto({animationSpeed: 200}); | ||||
|         }, 100); | ||||
| 
 | ||||
|         if (!after) { | ||||
|             docCount = 0; | ||||
|         } | ||||
|  | ||||
| @ -11,7 +11,7 @@ | ||||
| 
 | ||||
| <nav class="navbar navbar-expand-lg"> | ||||
|     <a class="navbar-brand" href="/">sist2</a> | ||||
|     <span class="badge badge-pill version">v1.2.10</span> | ||||
|     <span class="badge badge-pill version">v1.2.11</span> | ||||
|     <span class="tagline">Lightning-fast file system indexer and search tool </span> | ||||
|     <a style="margin-left: auto" id="theme" class="btn" title="Toggle theme" href="/">Theme</a> | ||||
| </nav> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user