Change new style into a dropdown
This commit is contained in:
		
							parent
							
								
									0dfd6680f8
								
							
						
					
					
						commit
						6c747faccf
					
				|  | @ -3,6 +3,14 @@ | ||||||
|     "message": "Write new style", |     "message": "Write new style", | ||||||
|     "description": "Label for the button to go to the add style page" |     "description": "Label for the button to go to the add style page" | ||||||
|   }, |   }, | ||||||
|  |   "addPlainStyleLabel": { | ||||||
|  |     "message": "New plain style", | ||||||
|  |     "description": "Label for the button to go to the add style page" | ||||||
|  |   }, | ||||||
|  |   "addUserCSSStyleLabel": { | ||||||
|  |     "message": "New UserCSS style", | ||||||
|  |     "description": "Label for the button to go to the add style page" | ||||||
|  |   }, | ||||||
|   "addStyleTitle": { |   "addStyleTitle": { | ||||||
|     "message": "Add Style", |     "message": "Add Style", | ||||||
|     "description": "Title of the page for adding styles" |     "description": "Title of the page for adding styles" | ||||||
|  |  | ||||||
|  | @ -221,12 +221,16 @@ | ||||||
|     </span> |     </span> | ||||||
|   </div> |   </div> | ||||||
|   <div id="main-actions"> |   <div id="main-actions"> | ||||||
|     <a href="edit.html" i18n-data-title="addStyleLabel" class="new-style tt-w"> |     <div class="new-style tt-w"> | ||||||
|       <svg class="svg-icon" viewBox="0 0 24 24"> |       <svg class="svg-icon" viewBox="0 0 24 24"> | ||||||
|         <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 |         <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 | ||||||
|           16H5V5h14v14zm-8-2h2v-4h4v-2h-4V7h-2v4H7v2h4z"/> |           16H5V5h14v14zm-8-2h2v-4h4v-2h-4V7h-2v4H7v2h4z"/> | ||||||
|       </svg> |       </svg> | ||||||
|     </a> |       <div class="dropdown"> | ||||||
|  |         <a href="edit.html" id="add-usercss" i18n-text="addUserCSSStyleLabel"></a> | ||||||
|  |         <a href="edit.html" id="add-reg-css" i18n-text="addPlainStyleLabel"></a> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
| 
 | 
 | ||||||
|     <span class="spacer"></span> |     <span class="spacer"></span> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -79,6 +79,7 @@ function initGlobalEvents() { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   $$('#header a[href^="http"]').forEach(a => (a.onclick = handleEvent.external)); |   $$('#header a[href^="http"]').forEach(a => (a.onclick = handleEvent.external)); | ||||||
|  |   $$('#add-usercss, #add-reg-css').forEach(a => (a.onclick = handleEvent.newStyle)); | ||||||
| 
 | 
 | ||||||
|   document.addEventListener('visibilitychange', onVisibilityChange); |   document.addEventListener('visibilitychange', onVisibilityChange); | ||||||
| 
 | 
 | ||||||
|  | @ -162,6 +163,12 @@ Object.assign(handleEvent, { | ||||||
|     handleEvent.edit(event); |     handleEvent.edit(event); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |   newStyle(event) { | ||||||
|  |     event.preventDefault(); | ||||||
|  |     prefs.set('newStyleAsUsercss', event.target.id === 'add-usercss'); | ||||||
|  |     window.location.href = 'edit.html'; | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|   edit(event) { |   edit(event) { | ||||||
|     if (event.altKey) { |     if (event.altKey) { | ||||||
|       return; |       return; | ||||||
|  |  | ||||||
|  | @ -809,11 +809,13 @@ a svg, .svg-icon.sort { | ||||||
|   text-overflow: ellipsis; |   text-overflow: ellipsis; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* export/import buttons */ | /* dropdown buttons */ | ||||||
|  | .new-style, | ||||||
| .manage-backups { | .manage-backups { | ||||||
|   position: relative; |   position: relative; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .new-style .dropdown, | ||||||
| .manage-backups .dropdown { | .manage-backups .dropdown { | ||||||
|   display: none; |   display: none; | ||||||
|   background: transparent; |   background: transparent; | ||||||
|  | @ -824,6 +826,7 @@ a svg, .svg-icon.sort { | ||||||
|   z-index: 101; |   z-index: 101; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .new-style .dropdown a, | ||||||
| .manage-backups .dropdown a { | .manage-backups .dropdown a { | ||||||
|   background-color: #f9f9f9; |   background-color: #f9f9f9; | ||||||
|   color: black; |   color: black; | ||||||
|  | @ -833,12 +836,14 @@ a svg, .svg-icon.sort { | ||||||
|   display: block; |   display: block; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #main-header .new-style .dropdown a:hover, | ||||||
| #main-header .manage-backups .dropdown a:hover { | #main-header .manage-backups .dropdown a:hover { | ||||||
|   /* background-color: #f2f2f2 */ |   /* background-color: #f2f2f2 */ | ||||||
|   background-color: #e9e9e9; |   background-color: #e9e9e9; | ||||||
|   color: var(--header-text-hover-color); |   color: var(--header-text-hover-color); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .new-style:hover .dropdown, | ||||||
| .manage-backups:hover .dropdown { | .manage-backups:hover .dropdown { | ||||||
|   display: block; |   display: block; | ||||||
|   right: -20px; |   right: -20px; | ||||||
|  | @ -917,10 +922,12 @@ a svg, .svg-icon.sort { | ||||||
|     width: 100%; |     width: 100%; | ||||||
|     height: auto; |     height: auto; | ||||||
|   } |   } | ||||||
|  |   .new-style, | ||||||
|   .manage-backups { |   .manage-backups { | ||||||
|     display: inline-block; |     display: inline-block; | ||||||
|     vertical-align: center; |     vertical-align: center; | ||||||
|   } |   } | ||||||
|  |   .new-style:hover .dropdown, | ||||||
|   .manage-backups:hover .dropdown { |   .manage-backups:hover .dropdown { | ||||||
|     display: block; |     display: block; | ||||||
|     left: -20px; |     left: -20px; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user