| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  | <div class="status-spoiler {{isStatusInNotification ? 'status-in-notification' : ''}} {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}"> | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |   <p>{{{massagedSpoilerText}}}</p> | 
					
						
							| 
									
										
										
										
											2018-02-04 12:49:42 -08:00
										 |  |  | </div> | 
					
						
							| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  | <div class="status-spoiler-button {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}"> | 
					
						
							| 
									
										
										
										
											2018-03-04 17:16:33 -08:00
										 |  |  |   <button type="button" delegate-key="{{delegateKey}}"> | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |     {{spoilerShown ? 'Show less' : 'Show more'}} | 
					
						
							|  |  |  |   </button> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  |   .status-spoiler { | 
					
						
							| 
									
										
										
										
											2018-02-09 20:07:48 -08:00
										 |  |  |     grid-area: spoiler; | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |     word-wrap: break-word; | 
					
						
							|  |  |  |     overflow: hidden; | 
					
						
							|  |  |  |     white-space: pre-wrap; | 
					
						
							| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  |     font-size: 0.9em; | 
					
						
							|  |  |  |     margin: 10px 5px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |   :global(.status-spoiler .status-emoji) { | 
					
						
							|  |  |  |     width: 20px; | 
					
						
							|  |  |  |     height: 20px; | 
					
						
							|  |  |  |     margin: -3px 0; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  |   .status-spoiler.status-in-own-thread { | 
					
						
							|  |  |  |     font-size: 1.3em; | 
					
						
							|  |  |  |     margin: 20px 5px 10px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   .status-spoiler.status-in-notification { | 
					
						
							|  |  |  |     color: var(--very-deemphasized-text-color); | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   .status-spoiler-button { | 
					
						
							| 
									
										
										
										
											2018-02-09 22:55:11 -08:00
										 |  |  |     grid-area: spoiler-btn; | 
					
						
							|  |  |  |     margin: 10px 5px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   .status-spoiler-button.status-in-own-thread { | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   .status-spoiler-button button { | 
					
						
							|  |  |  |     padding: 5px 10px; | 
					
						
							|  |  |  |     font-size: 1.1em; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </style> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  |   import { store } from '../../_store/store' | 
					
						
							| 
									
										
										
										
											2018-04-17 21:47:30 -07:00
										 |  |  |   import { registerClickDelegate } from '../../_utils/delegate' | 
					
						
							| 
									
										
										
										
											2018-04-10 22:30:14 -07:00
										 |  |  |   import { mark, stop } from '../../_utils/marks' | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |   import { emojifyText } from '../../_utils/emojifyText' | 
					
						
							|  |  |  |   import escapeHtml from 'escape-html' | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   export default { | 
					
						
							| 
									
										
										
										
											2018-03-04 17:16:33 -08:00
										 |  |  |     oncreate() { | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |       let { delegateKey } = this.get() | 
					
						
							|  |  |  |       registerClickDelegate(this, delegateKey, () => this.onClickSpoilerButton()) | 
					
						
							| 
									
										
										
										
											2018-03-04 17:16:33 -08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |     store: () => store, | 
					
						
							|  |  |  |     computed: { | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |       spoilerText: (originalStatus) => originalStatus.spoiler_text, | 
					
						
							| 
									
										
										
										
											2018-04-16 20:54:16 -07:00
										 |  |  |       emojis: (originalStatus) => originalStatus.emojis, | 
					
						
							|  |  |  |       massagedSpoilerText: (spoilerText, emojis, $autoplayGifs) => { | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |         spoilerText = escapeHtml(spoilerText) | 
					
						
							| 
									
										
										
										
											2018-04-16 20:54:16 -07:00
										 |  |  |         return emojifyText(spoilerText, emojis, $autoplayGifs) | 
					
						
							| 
									
										
										
										
											2018-04-14 15:50:06 -07:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2018-03-15 20:04:24 -07:00
										 |  |  |       delegateKey: (uuid) => `spoiler-${uuid}` | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     methods: { | 
					
						
							|  |  |  |       onClickSpoilerButton() { | 
					
						
							| 
									
										
										
										
											2018-03-23 08:29:54 -07:00
										 |  |  |         requestAnimationFrame(() => { | 
					
						
							| 
									
										
										
										
											2018-04-10 22:30:14 -07:00
										 |  |  |           mark('clickSpoilerButton') | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |           let { uuid } = this.get() | 
					
						
							|  |  |  |           let { spoilersShown } = this.store.get() | 
					
						
							|  |  |  |           spoilersShown[uuid] = !spoilersShown[uuid] | 
					
						
							|  |  |  |           this.store.set({spoilersShown}) | 
					
						
							| 
									
										
										
										
											2018-03-23 08:29:54 -07:00
										 |  |  |           this.fire('recalculateHeight') | 
					
						
							| 
									
										
										
										
											2018-04-10 22:30:14 -07:00
										 |  |  |           stop('clickSpoilerButton') | 
					
						
							| 
									
										
										
										
											2018-03-23 08:29:54 -07:00
										 |  |  |         }) | 
					
						
							| 
									
										
										
										
											2018-02-04 10:44:04 -08:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </script> |