修改以适用于Pleroma
This commit is contained in:
		
							parent
							
								
									370986cd21
								
							
						
					
					
						commit
						38e0b5a451
					
				
							
								
								
									
										2
									
								
								dist/mastodon-timeline.esm.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/mastodon-timeline.esm.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/mastodon-timeline.umd.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/mastodon-timeline.umd.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -132,7 +132,9 @@ | ||||
|     <!-- JavaScript --> | ||||
|     <script src="../dist/mastodon-timeline.umd.js"></script> | ||||
|     <script> | ||||
|       const myTimeline = new MastodonTimeline.Init(); | ||||
|       const myTimeline = new MastodonTimeline.Init({ | ||||
|       instanceUrl: "https://mastodon.social" | ||||
|     }); | ||||
|     </script> | ||||
|   </body> | ||||
| </html> | ||||
|  | ||||
							
								
								
									
										28
									
								
								examples/mastodon-show.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								examples/mastodon-show.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
|   <head> | ||||
|     <meta charset="utf-8" /> | ||||
|     <title>Mastodon embed timeline</title> | ||||
|     <link rel="stylesheet" href="../dist/mastodon-timeline.min.css" /> | ||||
|       <div class="dummy-wrapper-timeline"> | ||||
|         <!-- Mastodon Timeline --> | ||||
|         <div id="mt-container" class="mt-container"> | ||||
|           <div class="mt-body" role="feed"> | ||||
|             <div class="mt-loading-spinner"></div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </div> | ||||
| 
 | ||||
|     <!-- JavaScript --> | ||||
|     <script src="../dist/mastodon-timeline.umd.js"></script> | ||||
|     <script> | ||||
|       const myTimeline = new MastodonTimeline.Init({ | ||||
|         instanceUrl: "https://wb.kunjk.top", | ||||
|         timelineType: "profile", | ||||
|         userId: "AhVoZyMjM1sRAccpEW", | ||||
|         profileName: "@aaa", | ||||
|       }); | ||||
|     </script> | ||||
|   </body> | ||||
| </html> | ||||
| @ -107,9 +107,9 @@ | ||||
|     <script src="../dist/mastodon-timeline.umd.js"></script> | ||||
|     <script> | ||||
|       const myTimeline = new MastodonTimeline.Init({ | ||||
|         instanceUrl: "https://mastodon.online", | ||||
|         instanceUrl: "https://wb.kunjk.top", | ||||
|         timelineType: "profile", | ||||
|         userId: "000180745", | ||||
|         userId: "AhT6JrTQPecQY1Ztaq", | ||||
|         profileName: "@idotj", | ||||
|       }); | ||||
|     </script> | ||||
|  | ||||
							
								
								
									
										26
									
								
								src/backup_code.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/backup_code.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
|     if (type === "image") { | ||||
|       media = | ||||
|         '<div class="mt-post-media ' + | ||||
|         (spoiler ? "mt-post-media-spoiler " : "") + | ||||
|         this.mtSettings.spinnerClass + | ||||
|         '" data-media-type="' + | ||||
|         type + | ||||
|         '" data-media-url-hd="' + | ||||
|         m.url + | ||||
|         '" data-media-alt-txt="' + | ||||
|         (m.description ? this.#escapeHTML(m.description) : "") + | ||||
|         '" data-media-width-hd="' + | ||||
|         m.meta.original.width + | ||||
|         '" data-media-height-hd="' + | ||||
|         m.meta.original.height + | ||||
|         '" style="padding-top: calc(100%/' + | ||||
|         m.meta.small.aspect + | ||||
|         ')">' + | ||||
|         (spoiler ? spoilerBtns : "") + | ||||
|         '<img src="' + | ||||
|         m.preview_url + | ||||
|         '" alt="' + | ||||
|         (m.description ? this.#escapeHTML(m.description) : "") + | ||||
|         '" loading="lazy" />' + | ||||
|         "</div>"; | ||||
|     } | ||||
| @ -243,14 +243,7 @@ export class Init { | ||||
|         } | ||||
| 
 | ||||
|         // Fetch more posts if maxNbPostFetch is not reached
 | ||||
|         if (this.#isNbPostsFulfilled()) { | ||||
|         resolve(); | ||||
|         } else { | ||||
|           do { | ||||
|             await this.#fetchMorePosts(); | ||||
|           } while (!this.#isNbPostsFulfilled() && this.linkHeader.next); | ||||
|           resolve(); | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|   } | ||||
| @ -1010,7 +1003,7 @@ export class Init { | ||||
| 
 | ||||
|     if (type === "image") { | ||||
|       media = | ||||
|         '<div class="mt-post-media ' + | ||||
|         '<div class="mt-post-mediaa ' + | ||||
|         (spoiler ? "mt-post-media-spoiler " : "") + | ||||
|         this.mtSettings.spinnerClass + | ||||
|         '" data-media-type="' + | ||||
| @ -1019,15 +1012,9 @@ export class Init { | ||||
|         m.url + | ||||
|         '" data-media-alt-txt="' + | ||||
|         (m.description ? this.#escapeHTML(m.description) : "") + | ||||
|         '" data-media-width-hd="' + | ||||
|         m.meta.original.width + | ||||
|         '" data-media-height-hd="' + | ||||
|         m.meta.original.height + | ||||
|         '" style="padding-top: calc(100%/' + | ||||
|         m.meta.small.aspect + | ||||
|         ')">' + | ||||
|         '" style="position: relative; float: left; inset: auto;">' + | ||||
|         (spoiler ? spoilerBtns : "") + | ||||
|         '<img src="' + | ||||
|         '<img style="max-width:150%; overflow:hidden;" src="' + | ||||
|         m.preview_url + | ||||
|         '" alt="' + | ||||
|         (m.description ? this.#escapeHTML(m.description) : "") + | ||||
| @ -1499,30 +1486,7 @@ export class Init { | ||||
|           </a>`; | ||||
|     } | ||||
| 
 | ||||
|     // Create button to refresh the timeline
 | ||||
|     if (this.mtSettings.btnReload) { | ||||
|       btnReloadHTML = ` | ||||
|           <button class="mt-btn-violet btn-refresh"> | ||||
|             <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M21 3v5m0 0h-5m5 0l-3-2.708C16.408 3.867 14.305 3 12 3a9 9 0 1 0 0 18c4.283 0 7.868-2.992 8.777-7" stroke="var(--mt-color-btn-txt)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> | ||||
|             </svg> | ||||
|               ${this.mtSettings.btnReload} | ||||
|           </button>`; | ||||
|     } | ||||
| 
 | ||||
|     // Add footer container
 | ||||
|     this.mtBodyNode.parentNode.insertAdjacentHTML( | ||||
|       "beforeend", | ||||
|       '<div class="mt-footer">' + btnSeeMoreHTML + btnReloadHTML + "</div>" | ||||
|     ); | ||||
| 
 | ||||
|     // Add event listener to the button "Refresh"
 | ||||
|     if (this.mtSettings.btnReload) { | ||||
|       const reloadBtn = | ||||
|         this.mtContainerNode.getElementsByClassName("btn-refresh")[0]; | ||||
|       reloadBtn.addEventListener("click", () => { | ||||
|         this.mtUpdate(); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 BuildTools
						BuildTools