popup width is now adjustable
This commit is contained in:
		
							parent
							
								
									0646f6bd65
								
							
						
					
					
						commit
						974aaee823
					
				| 
						 | 
					@ -464,6 +464,9 @@
 | 
				
			||||||
  "optionsBadgeDisabled": {
 | 
					  "optionsBadgeDisabled": {
 | 
				
			||||||
    "message": "Badge background color (when disabled)"
 | 
					    "message": "Badge background color (when disabled)"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  "optionsPopupWidth": {
 | 
				
			||||||
 | 
					    "message": "Popup width (in pixels)"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  "optionsUpdateInterval": {
 | 
					  "optionsUpdateInterval": {
 | 
				
			||||||
    "message": "Automatically check for and install all available userstyle updates (in hrs)"
 | 
					    "message": "Automatically check for and install all available userstyle updates (in hrs)"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,10 @@
 | 
				
			||||||
        <td i18n-text="optionsBadgeDisabled"></td>
 | 
					        <td i18n-text="optionsBadgeDisabled"></td>
 | 
				
			||||||
        <td><input type="color" id="badgeDisabled"></td>
 | 
					        <td><input type="color" id="badgeDisabled"></td>
 | 
				
			||||||
      </tr>
 | 
					      </tr>
 | 
				
			||||||
 | 
					      <tr>
 | 
				
			||||||
 | 
					        <td i18n-text="optionsPopupWidth"></td>
 | 
				
			||||||
 | 
					        <td><input type="number" id="popupWidth" min="200"></td>
 | 
				
			||||||
 | 
					      </tr>
 | 
				
			||||||
      <tr>
 | 
					      <tr>
 | 
				
			||||||
        <td i18n-text="optionsUpdateInterval"><sup>1</sup></td>
 | 
					        <td i18n-text="optionsUpdateInterval"><sup>1</sup></td>
 | 
				
			||||||
        <td><input type="number" min="0" id="updateInterval"></td>
 | 
					        <td><input type="number" min="0" id="updateInterval"></td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@ function restore () {
 | 
				
			||||||
  chrome.runtime.getBackgroundPage(bg => {
 | 
					  chrome.runtime.getBackgroundPage(bg => {
 | 
				
			||||||
    document.getElementById('badgeDisabled').value = bg.prefs.get('badgeDisabled');
 | 
					    document.getElementById('badgeDisabled').value = bg.prefs.get('badgeDisabled');
 | 
				
			||||||
    document.getElementById('badgeNormal').value = bg.prefs.get('badgeNormal');
 | 
					    document.getElementById('badgeNormal').value = bg.prefs.get('badgeNormal');
 | 
				
			||||||
 | 
					    document.getElementById('popupWidth').value = bg.prefs.get('popupWidth');
 | 
				
			||||||
    document.getElementById('updateInterval').value = bg.prefs.get('updateInterval');
 | 
					    document.getElementById('updateInterval').value = bg.prefs.get('updateInterval');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -12,6 +13,7 @@ function save () {
 | 
				
			||||||
  chrome.runtime.getBackgroundPage(bg => {
 | 
					  chrome.runtime.getBackgroundPage(bg => {
 | 
				
			||||||
    bg.prefs.set('badgeDisabled', document.getElementById('badgeDisabled').value);
 | 
					    bg.prefs.set('badgeDisabled', document.getElementById('badgeDisabled').value);
 | 
				
			||||||
    bg.prefs.set('badgeNormal', document.getElementById('badgeNormal').value);
 | 
					    bg.prefs.set('badgeNormal', document.getElementById('badgeNormal').value);
 | 
				
			||||||
 | 
					    bg.prefs.set('popupWidth', +document.getElementById('popupWidth').value);
 | 
				
			||||||
    bg.prefs.set(
 | 
					    bg.prefs.set(
 | 
				
			||||||
      'updateInterval',
 | 
					      'updateInterval',
 | 
				
			||||||
      Math.max(0, +document.getElementById('updateInterval').value)
 | 
					      Math.max(0, +document.getElementById('updateInterval').value)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,9 @@ body > .actions {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#unavailable {
 | 
					#unavailable {
 | 
				
			||||||
  border: none;
 | 
					  border: none;
 | 
				
			||||||
  display: none;
 | 
					  display: none; /* flex */
 | 
				
			||||||
 | 
					  align-items: center;
 | 
				
			||||||
 | 
					  justify-content: center;
 | 
				
			||||||
  font-size: 14px;
 | 
					  font-size: 14px;
 | 
				
			||||||
  text-indent: 6px;
 | 
					  text-indent: 6px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								popup.js
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								popup.js
									
									
									
									
									
								
							| 
						 | 
					@ -13,7 +13,7 @@ function updatePopUp(url) {
 | 
				
			||||||
	var urlWillWork = /^(file|http|https|ftps?|chrome\-extension):/.exec(url);
 | 
						var urlWillWork = /^(file|http|https|ftps?|chrome\-extension):/.exec(url);
 | 
				
			||||||
	if (!urlWillWork) {
 | 
						if (!urlWillWork) {
 | 
				
			||||||
		document.body.classList.add("blocked");
 | 
							document.body.classList.add("blocked");
 | 
				
			||||||
		document.getElementById("unavailable").style.display = "block";
 | 
							document.getElementById("unavailable").style.display = "flex";
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,3 +227,6 @@ document.querySelector('#popup-shortcuts-button').addEventListener("click", func
 | 
				
			||||||
        'url': 'chrome://extensions/configureCommands'
 | 
					        'url': 'chrome://extensions/configureCommands'
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// popup width
 | 
				
			||||||
 | 
					document.body.style.width = prefs.get('popupWidth') + 'px';
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -352,6 +352,8 @@ var prefs = chrome.extension.getBackgroundPage().prefs || new function Prefs() {
 | 
				
			||||||
		"badgeDisabled": "#8B0000",     // badge background color when disabled
 | 
							"badgeDisabled": "#8B0000",     // badge background color when disabled
 | 
				
			||||||
		"badgeNormal": "#006666",       // badge background color
 | 
							"badgeNormal": "#006666",       // badge background color
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							"popupWidth": 240,              // popup width in pixels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		"updateInterval": 0             // user-style automatic update interval, hour
 | 
							"updateInterval": 0             // user-style automatic update interval, hour
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	var values = deepCopy(defaults);
 | 
						var values = deepCopy(defaults);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user