Add reblog txt condition
This commit is contained in:
		
							parent
							
								
									93edb9847e
								
							
						
					
					
						commit
						238892360e
					
				| @ -34,7 +34,7 @@ let MastodonApi = function (params_) { | |||||||
| 	this.mtIdContainer.addEventListener('click', function (event) { | 	this.mtIdContainer.addEventListener('click', function (event) { | ||||||
| 		let urlToot = event.target.closest('.mt-toot').dataset.location; | 		let urlToot = event.target.closest('.mt-toot').dataset.location; | ||||||
| 		// Open Toot in new page avoiding any other natural link
 | 		// Open Toot in new page avoiding any other natural link
 | ||||||
|  		if(event.target.localName != 'a' && event.target.localName != 'span' && urlToot){ | 		if (event.target.localName != 'a' && event.target.localName != 'span' && urlToot) { | ||||||
| 			window.open(urlToot, '_blank'); | 			window.open(urlToot, '_blank'); | ||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
| @ -51,7 +51,7 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 	}) | 	}) | ||||||
| 		.then(response => response.json()) | 		.then(response => response.json()) | ||||||
| 		.then(jsonData => { | 		.then(jsonData => { | ||||||
| 		// console.log('jsonData: ', jsonData);
 | 			console.log('jsonData: ', jsonData); | ||||||
| 
 | 
 | ||||||
| 			// Clear the loading message
 | 			// Clear the loading message
 | ||||||
| 			this.mtBodyContainer.innerHTML = ''; | 			this.mtBodyContainer.innerHTML = ''; | ||||||
| @ -66,7 +66,7 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 
 | 
 | ||||||
| 			// 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"); | ||||||
| 		for(let j=0; j<allHashtags.length; j++) { | 			for (let j = 0; j < allHashtags.length; j++) { | ||||||
| 				allHashtags[j].target = "_blank"; | 				allHashtags[j].target = "_blank"; | ||||||
| 				allHashtags[j].rel = "tag noopener noreferrer"; | 				allHashtags[j].rel = "tag noopener noreferrer"; | ||||||
| 			} | 			} | ||||||
| @ -133,12 +133,17 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Main content
 | 		// Main content
 | ||||||
| 		if(status_.spoiler_text != '') { | 		if (status_.spoiler_text != '') { | ||||||
| 			content = | 			content = | ||||||
| 				'<div class="toot-text">' | 				'<div class="toot-text">' | ||||||
| 				+ status_.spoiler_text | 				+ status_.spoiler_text | ||||||
| 				+ ' [Show more...]' | 				+ ' [Show more...]' | ||||||
| 				+ '</div>'; | 				+ '</div>'; | ||||||
|  | 		} else if (status_.reblog && status_.reblog.content != '') { | ||||||
|  | 			content = | ||||||
|  | 				'<div class="toot-text">' | ||||||
|  | 				+ status_.reblog.content | ||||||
|  | 				+ '</div>'; | ||||||
| 		} else { | 		} else { | ||||||
| 			content = | 			content = | ||||||
| 				'<div class="toot-text">' | 				'<div class="toot-text">' | ||||||
| @ -148,12 +153,12 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 
 | 
 | ||||||
| 		// Media attachments
 | 		// Media attachments
 | ||||||
| 		let media = ''; | 		let media = ''; | ||||||
| 		if (status_.media_attachments.length > 0 ) { | 		if (status_.media_attachments.length > 0) { | ||||||
| 			for (let picid in status_.media_attachments) { | 			for (let picid in status_.media_attachments) { | ||||||
| 				media = this.replaceMedias(status_.media_attachments[picid], status_.sensitive); | 				media = this.replaceMedias(status_.media_attachments[picid], status_.sensitive); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (status_.reblog && status_.reblog.media_attachments.length > 0 ) { | 		if (status_.reblog && status_.reblog.media_attachments.length > 0) { | ||||||
| 			for (let picid in status_.reblog.media_attachments) { | 			for (let picid in status_.reblog.media_attachments) { | ||||||
| 				media = this.replaceMedias(status_.reblog.media_attachments[picid], status_.sensitive); | 				media = this.replaceMedias(status_.reblog.media_attachments[picid], status_.sensitive); | ||||||
| 			} | 			} | ||||||
| @ -174,7 +179,7 @@ MastodonApi.prototype.getToots = function () { | |||||||
| 				+ '<ul>' | 				+ '<ul>' | ||||||
| 				+ pollOption | 				+ pollOption | ||||||
| 				+ '</ul>' | 				+ '</ul>' | ||||||
| 				+'</div>'; | 				+ '</div>'; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Date
 | 		// Date
 | ||||||
| @ -232,7 +237,7 @@ function removeSpinner(element) { | |||||||
| 	const spinnerCSS = 'loading-spinner'; | 	const spinnerCSS = 'loading-spinner'; | ||||||
| 	// Find closest parent container (1st, 2nd or 3rd level)
 | 	// Find closest parent container (1st, 2nd or 3rd level)
 | ||||||
| 	let spinnerContainer = element.closest('.' + spinnerCSS); | 	let spinnerContainer = element.closest('.' + spinnerCSS); | ||||||
| 	if(spinnerContainer){ | 	if (spinnerContainer) { | ||||||
| 		spinnerContainer.classList.remove(spinnerCSS); | 		spinnerContainer.classList.remove(spinnerCSS); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 idotj
						idotj