Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- Show download link for each file (not applicable for folder / symlink).
- Copy file's contents directly to Clipboard (just won't work for markdown files).
- Download file while viewing its contents.
- Wrap long lines in markdown code blocks (optional, configurable in settings).

The extension handles the SPA behavior of GitHub website from `v3.0.0` onwards :)

Expand Down
49 changes: 48 additions & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@
input[type="text"]:focus {
border-bottom: 2px solid #5264AE;
}

.checkbox-container {
margin: 15px 0;
display: flex;
align-items: center;
}

.checkbox-container input[type="checkbox"] {
width: 18px;
height: 18px;
margin-right: 10px;
cursor: pointer;
}

.checkbox-container label {
cursor: pointer;
font-size: 14px;
color: #333;
user-select: none;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -152,7 +172,7 @@ <h3 style="padding-bottom: 10px; color: grey;">GitHub Access Token</h3>
<span id="status--text" class="success-msg vertical-center"></span>
</div>

<div class="push--top inline-block hidden" id="validation-block">
<div class="inline-block hidden" id="validation-block">
<svg
fill="#de973e"
height="24"
Expand All @@ -167,6 +187,33 @@ <h3 style="padding-bottom: 10px; color: grey;">GitHub Access Token</h3>
<span id="validation-warning" class="warning-msg vertical-center push--top"></span>
</div>

<h3 style="padding-top: 20px; padding-bottom: 10px; color: grey;">Display Settings</h3>

<div class="checkbox-container">
<input type="checkbox" id="show-repo-size" checked>
<label for="show-repo-size">Show repository size</label>
</div>

<div class="checkbox-container">
<input type="checkbox" id="show-file-size" checked>
<label for="show-file-size">Show file size in file browser</label>
</div>

<div class="checkbox-container">
<input type="checkbox" id="show-download-link" checked>
<label for="show-download-link">Show download links in file browser</label>
</div>

<div class="checkbox-container">
<input type="checkbox" id="show-copy-file-button" checked>
<label for="show-copy-file-button">Show copy file contents button</label>
</div>

<div class="checkbox-container">
<input type="checkbox" id="wrap-code-lines">
<label for="wrap-code-lines">Wrap long lines in code blocks</label>
</div>

<button class="btn" id="save-btn" style="margin-top: 20px;">Save</button>
</div>

Expand Down
26 changes: 24 additions & 2 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ function saveOptions() {
document.getElementById('save-btn').setAttribute('disabled', 'disabled');
document.getElementById('save-btn').style.background = '#DEDEDE';
var token = document.getElementById('x-github-token').value;
var showRepoSize = document.getElementById('show-repo-size').checked;
var showFileSize = document.getElementById('show-file-size').checked;
var showDownloadLink = document.getElementById('show-download-link').checked;
var showCopyFileButton = document.getElementById('show-copy-file-button').checked;
var wrapCodeLines = document.getElementById('wrap-code-lines').checked;

chrome.storage.sync.set(
{
'x-github-token': token
'x-github-token': token,
'show-repo-size': showRepoSize,
'show-file-size': showFileSize,
'show-download-link': showDownloadLink,
'show-copy-file-button': showCopyFileButton,
'wrap-code-lines': wrapCodeLines
},
function() {
// Update statusText to let user know options were saved.
Expand Down Expand Up @@ -58,11 +69,22 @@ function restoreOptions() {

chrome.storage.sync.get(
{
'x-github-token': ''
'x-github-token': '',
'show-repo-size': true,
'show-file-size': true,
'show-download-link': true,
'show-copy-file-button': true,
'wrap-code-lines': false
},
function(storedData) {
token = storedData['x-github-token'];
document.getElementById('x-github-token').value = token;
document.getElementById('show-repo-size').checked = storedData['show-repo-size'];
document.getElementById('show-file-size').checked = storedData['show-file-size'];
document.getElementById('show-download-link').checked = storedData['show-download-link'];
document.getElementById('show-copy-file-button').checked = storedData['show-copy-file-button'];
document.getElementById('wrap-code-lines').checked = storedData['wrap-code-lines'];

var validationWarning = document.getElementById('validation-warning');
validationWarning.textContent = validateUserToken(token);

Expand Down
Loading