Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new feature (Hide on mouseover) #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Resources/CSS/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nav {
flex: 1;
vertical-align: middle;
text-align: right;
padding: 8px 8px 0 0;
padding: 9px 9px 0 0;
}

.title {
Expand Down
3 changes: 3 additions & 0 deletions Resources/HTML/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
</select>
<span i18n-content="optionsPageDisplayOptionsAutoHideSeconds">seconds</span>
</div>
<label class="preferences-label" for="hideonhover"><span i18n-content="hideonhover">Hide On Hover For</span> </label>
<input type="number" id="hideonhover" value="" placeholder="Enter How many Sec" />
<small i18n-content="hideonhovernote">Set it 0 or leave it empty to disable</small>
</div>
</div>
<div class="detail-row">
Expand Down
3 changes: 3 additions & 0 deletions Resources/HTML/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ <h2>Options</h2>
</select>
<span i18n-content="optionsPageDisplayOptionsAutoHideSeconds">seconds</span>
</div>
<label class="preferences-label" for="hideonhover"><span i18n-content="hideonhover">Hide On Hover For</span> </label>
<input type="number" id="hideonhover" value="" placeholder="Enter How many Sec" />
<small i18n-content="hideonhovernote">Set it 0 or leave it empty to disable</small>
<div>
<button id="goToOptions" i18n-content="buttonOptions">options page</button>
</div>
Expand Down
8 changes: 8 additions & 0 deletions Resources/JavaScript/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@ chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
break;
}
}
if(options.hideonhover != "" && options.hideonhover){
document.getElementById(containerId).addEventListener("mouseover", function(event){
document.getElementById(containerId).style.display = 'none';
setTimeout(function() {
document.getElementById(containerId).style.display = 'block';
}, options.hideonhover * 1000);
});
}

requestIds.forEach(function(requestId) {
// Render a request only once.
Expand Down
2 changes: 2 additions & 0 deletions Resources/JavaScript/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ function restoreOptions() {
timeout: result.timeout ? result.timeout : 3,
hidePanelAfterTimeout: isDefined(result.hidePanelAfterTimeout) ? result.hidePanelAfterTimeout : true,
renderMode: result.renderMode ? result.renderMode : 'microMode',
hideonhover: result.hideonhover ?? null,
hiddenRequestHeaders: result.hiddenRequestHeaders ? result.hiddenRequestHeaders.map(item => item.toLowerCase()) : [],
hiddenResponseHeaders: result.hiddenResponseHeaders ? result.hiddenResponseHeaders.map(item => item.toLowerCase()) : [],
shownResponseHeaders: result.shownResponseHeaders ? result.shownResponseHeaders.map(item => item.toLowerCase()) : ['^server$'],
Expand All @@ -681,6 +682,7 @@ function restoreOptions() {
timeout: localStorage.timeout ? localStorage.timeout : 3,
hidePanelAfterTimeout: isDefined(localStorage.hidePanelAfterTimeout) ? localStorage.hidePanelAfterTimeout : true,
renderMode: localStorage.renderMode ? localStorage.renderMode : 'microMode',
hideonhover: localStorage.hideonhover ?? null,
hiddenRequestHeaders: isDefined(localStorage.hiddenRequestHeaders) ? JSON.parse(localStorage.hiddenRequestHeaders).map(item => item.toLowerCase()) : [],
hiddenResponseHeaders: isDefined(localStorage.hiddenResponseHeaders) ? JSON.parse(localStorage.hiddenResponseHeaders).map(item => item.toLowerCase()) : [],
shownResponseHeaders: isDefined(localStorage.shownResponseHeaders) ? JSON.parse(localStorage.shownResponseHeaders).map(item => item.toLowerCase()) : ['^Server$'],
Expand Down
10 changes: 9 additions & 1 deletion Resources/JavaScript/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ document.addEventListener('DOMContentLoaded', function() {
timeout: document.getElementById('timeout').value,
hidePanelAfterTimeout: parseInt(document.getElementById('hidePanelAfterTimeout').value, 10) === 1,
renderMode: document.getElementById('renderMode').value,
theme: document.getElementById('theme').value
theme: document.getElementById('theme').value,
hideonhover: document.getElementById('hideonhover').value
};

multiSelectFields.forEach(function(fieldId) {
Expand All @@ -37,6 +38,7 @@ document.addEventListener('DOMContentLoaded', function() {
localStorage.hidePanelAfterTimeout = parseInt(document.getElementById('hidePanelAfterTimeout').value, 10) === 1;
localStorage.renderMode = document.getElementById('renderMode').value;
localStorage.theme = document.getElementById('theme').value;
localStorage.hideonhover = document.getElementById('hideonhover').value;

multiSelectFields.forEach(function(fieldId) {
localStorage[fieldId] = JSON.stringify(updatedValues[fieldId]);
Expand Down Expand Up @@ -91,6 +93,7 @@ document.addEventListener('DOMContentLoaded', function() {
theme: result.theme ? result.theme : 'light',
tabRequestLimit: result.tabRequestLimit ? result.tabRequestLimit : 25,
timeout: result.timeout ? result.timeout : 3,
hideonhover: result.hideonhover ?? null,
hidePanelAfterTimeout: isDefined(result.hidePanelAfterTimeout) ? result.hidePanelAfterTimeout : true,
renderMode: result.renderMode ? result.renderMode : 'microMode',
hiddenRequestHeaders: result.hiddenRequestHeaders ? result.hiddenRequestHeaders : [],
Expand All @@ -106,6 +109,7 @@ document.addEventListener('DOMContentLoaded', function() {
theme: localStorage.theme ? localStorage.theme : 'light',
tabRequestLimit: localStorage.tabRequestLimit ? localStorage.tabRequestLimit : 25,
timeout: localStorage.timeout ? localStorage.timeout : 3,
hideonhover: localStorage.hideonhover ?? null,
hidePanelAfterTimeout: isDefined(localStorage.hidePanelAfterTimeout) ? localStorage.hidePanelAfterTimeout : true,
renderMode: localStorage.renderMode ? localStorage.renderMode : 'microMode',
hiddenRequestHeaders: isDefined(localStorage.hiddenRequestHeaders) ? JSON.parse(localStorage.hiddenRequestHeaders) : [],
Expand All @@ -124,6 +128,7 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('hidePanelAfterTimeout').value = options.hidePanelAfterTimeout ? 1 : 0;
document.getElementById('renderMode').value = options.renderMode;
document.getElementById('theme').value = options.theme;
document.getElementById('hideonhover').value = options.hideonhover;

options.hiddenRequestHeaders.forEach(function(element) {
addElement(element, 'newHiddenRequestHeader', 'hiddenRequestHeaders');
Expand Down Expand Up @@ -157,6 +162,9 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('theme').addEventListener('change', function() {
saveOptions();
});
document.getElementById('hideonhover').addEventListener('keyup', function() {
saveOptions();
});

let multiSelectFields = {
'hiddenRequestHeaders': {addId: 'addHiddenRequestHeader', newId: 'newHiddenRequestHeader'},
Expand Down
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,5 +386,13 @@
"contentMessagesProEnableResponseTimes": {
"description": "enable response times",
"message": "enable response times"
},
"hideonhover": {
"description": "Hide on hover for",
"message": "Hide on hover for"
},
"hideonhovernote": {
"description": "leave it empty to disable",
"message": "leave it empty to disable"
}
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_extensionName__",
"short_name": "__MSG_extensionNameShort__",
"version": "2.0.49",
"version": "2.0.50",
"manifest_version": 2,
"minimum_chrome_version": "18",
"description": "__MSG_extensionDescription__",
Expand Down