-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently it has only one option — to increase panel width.
- Loading branch information
Showing
8 changed files
with
186 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>TopScroll Options</title> | ||
<style> | ||
body { | ||
padding: 10px; | ||
} | ||
p { | ||
color: gray; | ||
margin-bottom: 0; | ||
} | ||
.saved { | ||
float: right; | ||
color: white; | ||
background: forestgreen; | ||
border: 5px solid forestgreen; | ||
border-radius: 5px; | ||
opacity: 0; | ||
transition: .1s; | ||
text-transform: uppercase; | ||
} | ||
.range-wrapper { | ||
width: 200px; | ||
margin: 15px auto 10px auto; | ||
} | ||
.range-labels { | ||
margin: 0 7px; | ||
font-weight: 700; | ||
} | ||
.range-input { | ||
width: 100%; | ||
display: block; | ||
margin: 0; | ||
} | ||
.range-label-1 { | ||
float: left; | ||
text-align: left; | ||
} | ||
.range-label-1 > span { | ||
margin-left: -50%; | ||
} | ||
.range-label-2 { | ||
float: right; | ||
text-align: right; | ||
} | ||
.range-label-2 > span { | ||
margin-right: -50%; | ||
} | ||
.demo { | ||
padding: 10px; | ||
transition: 1s; | ||
} | ||
.demo-1 { | ||
border-left: 1px solid blue; | ||
} | ||
.demo-2 { | ||
border-left: 10px solid blue; | ||
} | ||
.demo-image { | ||
width: 400px; | ||
box-shadow: 0 0 10px gray; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="saved" class="saved"></div> | ||
<div id="panel-size-title"></div> | ||
<div class="range-wrapper"> | ||
<div class="range-labels"> | ||
<div class="range-label-1"><span id="panel-size-1"></span></div> | ||
<div class="range-label-2"><span id="panel-size-2"></span></div> | ||
</div> | ||
<input id="panel-type" class="range-input" type="range" min=1 max=2 list="panel-options"> | ||
<datalist id="panel-options"> | ||
<option>1</option> | ||
<option>2</option> | ||
</datalist> | ||
</div> | ||
<div id="demo-text" class="demo"></div> | ||
<img class="demo-image" src="lama.jpg"> | ||
<p>TopScroll on <a href="https://github.com/sv3k/topscroll">GitHub</a></p> | ||
<script src="options.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function saveOptions() { | ||
var type = document.getElementById('panel-type').value; | ||
var status = document.getElementById('saved'); | ||
chrome.storage.sync.set({ | ||
panelType: type | ||
}, () => { | ||
// Update status to let user know options were saved | ||
status.style.opacity = 1; | ||
setTimeout(() => { | ||
status.style.opacity = 0; | ||
}, 1000); | ||
}); | ||
} | ||
|
||
function showOptions() { | ||
chrome.storage.sync.get({ panelType: 1 }, options => { | ||
document.getElementById('panel-type').value = options.panelType; | ||
var demo = document.getElementById('demo-text'); | ||
demo.className = 'demo demo-' + options.panelType; | ||
demo.textContent = '← ' + chrome.i18n.getMessage('panelSize' + options.panelType + 'Desc'); | ||
}); | ||
} | ||
|
||
// Init locale-specific strings | ||
document.getElementById('saved').textContent = "✓ " + chrome.i18n.getMessage('savedMsg'); | ||
document.getElementById('panel-size-title').textContent = chrome.i18n.getMessage('panelSizeTitle'); | ||
document.getElementById('panel-size-1').textContent = chrome.i18n.getMessage('panelSize1'); | ||
document.getElementById('panel-size-2').textContent = chrome.i18n.getMessage('panelSize2'); | ||
|
||
document.addEventListener('DOMContentLoaded', showOptions); | ||
document.getElementById('panel-type').addEventListener('change', () => { | ||
saveOptions(); | ||
showOptions(); | ||
}); |