Add feature - hide replies and boosts
This commit is contained in:
		
							parent
							
								
									340fa3d086
								
							
						
					
					
						commit
						0e823ba2a9
					
				| @ -10,6 +10,8 @@ document.addEventListener("DOMContentLoaded", () => { | |||||||
| 		user_id: '180745', | 		user_id: '180745', | ||||||
| 		profile_name: '@idotj', | 		profile_name: '@idotj', | ||||||
| 		toots_limit: 13, | 		toots_limit: 13, | ||||||
|  | 		hide_reblog: false, | ||||||
|  | 		hide_replies: true,		 | ||||||
| 		btn_see_more: 'See more posts at Mastodon' | 		btn_see_more: 'See more posts at Mastodon' | ||||||
| 	}); | 	}); | ||||||
| }); | }); | ||||||
| @ -21,6 +23,8 @@ let MastodonApi = function (params_) { | |||||||
| 	this.USER_ID = params_.user_id; | 	this.USER_ID = params_.user_id; | ||||||
| 	this.PROFILE_NAME = params_.profile_name; | 	this.PROFILE_NAME = params_.profile_name; | ||||||
| 	this.TOOTS_LIMIT = params_.toots_limit || 20; | 	this.TOOTS_LIMIT = params_.toots_limit || 20; | ||||||
|  | 	this.HIDE_REBLOG = typeof params_.hide_reblog !== 'undefined' ? params_.hide_reblog : false; | ||||||
|  | 	this.HIDE_REPLIES = typeof params_.hide_replies !== 'undefined' ? params_.hide_replies : false;		 | ||||||
| 	this.BTN_SEE_MORE = params_.btn_see_more || 'See more' | 	this.BTN_SEE_MORE = params_.btn_see_more || 'See more' | ||||||
| 
 | 
 | ||||||
| 	// Target selectors
 | 	// Target selectors
 | ||||||
| @ -58,11 +62,15 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 
 | 
 | ||||||
| 			// Add toots
 | 			// Add toots
 | ||||||
| 			for (let i in jsonData) { | 			for (let i in jsonData) { | ||||||
| 				if (jsonData[i].visibility == 'public') { |  | ||||||
| 				// List only public toots
 | 				// List only public toots
 | ||||||
|  | 				if (jsonData[i].visibility == 'public') { | ||||||
|  | 					if(mapi.HIDE_REBLOG && jsonData[i].reblog || mapi.HIDE_REPLIES && jsonData[i].in_reply_to_id){ | ||||||
|  | 						// Nothing here (Don't append boosts and/or replies toots)
 | ||||||
|  | 					}else{ | ||||||
| 						appendToot.call(mapi, jsonData[i]); | 						appendToot.call(mapi, jsonData[i]); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 
 | 
 | ||||||
| 			// Add target="_blank" to all hashtags
 | 			// Add target="_blank" to all hashtags
 | ||||||
| 			let allHashtags = document.querySelectorAll("#mt-timeline .hashtag"); | 			let allHashtags = document.querySelectorAll("#mt-timeline .hashtag"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 i.j
						i.j