Skip to content

Commit

Permalink
Remove default bootstrap, add custom bootstrap
Browse files Browse the repository at this point in the history
Remove option to toggle jstree creation
  • Loading branch information
Graham Holtslander committed Apr 21, 2015
1 parent d7e00b6 commit 26e6493
Show file tree
Hide file tree
Showing 14 changed files with 740 additions and 5,856 deletions.
389 changes: 389 additions & 0 deletions bootstrap/config.json

Large diffs are not rendered by default.

3,772 changes: 294 additions & 3,478 deletions bootstrap/css/bootstrap.css
100644 → 100755

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bootstrap/css/bootstrap.css.map

This file was deleted.

7 changes: 6 additions & 1 deletion bootstrap/css/bootstrap.min.css
100644 → 100755

Large diffs are not rendered by default.

Empty file modified bootstrap/fonts/glyphicons-halflings-regular.eot
100644 → 100755
Empty file.
Empty file modified bootstrap/fonts/glyphicons-halflings-regular.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified bootstrap/fonts/glyphicons-halflings-regular.ttf
100644 → 100755
Empty file.
Empty file modified bootstrap/fonts/glyphicons-halflings-regular.woff
100644 → 100755
Empty file.
Empty file modified bootstrap/fonts/glyphicons-halflings-regular.woff2
100644 → 100755
Empty file.
2,317 changes: 0 additions & 2,317 deletions bootstrap/js/bootstrap.js

This file was deleted.

7 changes: 0 additions & 7 deletions bootstrap/js/bootstrap.min.js

This file was deleted.

6 changes: 0 additions & 6 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ <h1>Options</h1>
</label>
<input id="url" type="url" class="form-control">
</div>
<div class="checkbox">
<label>
<input id="doJsTree" type="checkbox" /> Make a diff tree on pull requests?
</label>
<p class="help-block">If you find Prettypullrequests is slow to load on pull request pages, you can try turning this off.</p>
</div>
<button class="btn btn-primary" id="save">Save</button>
</form>
<div id="status" class="bg-success"></div>
Expand Down
3 changes: 0 additions & 3 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
$(document).ready(function () {
loadItemsFromChromeStorage({
url: '',
doJsTree: true,
// Add new items here to get them loaded and their values put in the form.
}, setFormValues);

Expand All @@ -45,11 +44,9 @@

var $form = $(e.currentTarget);
var url = $form.find('#url').val();
var doJsTree = $form.find('#doJsTree').is(':checked');

saveOptionsToChromeStorage({
'url': url,
'doJsTree': doJsTree,
}, function () {
var status = $('#status');
status.text('Options saved.');
Expand Down
94 changes: 51 additions & 43 deletions pullrequest.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,60 @@

var isGitHub = $("meta[property='og:site_name']").attr('content') === 'GitHub';

function htmlIsInjected() {
return $('.collapse-lines').length !== 0;
}

function injectHtml() {
$('<span class="collapse-lines">' +
'<label><input type="checkbox" class="js-collapse-additions" checked="yes">+</label>' +
'<label><input type="checkbox" class="js-collapse-deletions" checked="yes">-</label>' +
'</span>').insertAfter('.actions, .file-actions');

$('<div class="bottom-collapse meta">Click to Collapse</div>').insertAfter('.data.highlight.blob-wrapper');
}

function collapseAdditions() {
if (isGitHub) {
$(this).closest('[id^=diff-]').find('.blob-code-addition').parent('tr').slideToggle();
} else {
$(this).closest('[id^=diff-]').find('.gi').slideToggle();
}
}

function collapseDeletions() {
if (isGitHub) {
$(this).closest('[id^=diff-]').find('.blob-code-deletion').parent('tr').slideToggle();
} else {
$(this).closest('[id^=diff-]').find('.gd').slideToggle();
}
}

function getDiffSpans(path) {
return $('.js-selectable-text').filter(function () {
return this.innerHTML.trim().match(path);
});
}

function collapseDiffs(path) {
var spans = getDiffSpans(path).closest('[id^=diff-]');
spans.children('.data, .image').slideUp(200);
spans.children('div.bottom-collapse').hide();
}

function expandDiffs(path) {
var spans = getDiffSpans(path).closest('[id^=diff-]');
spans.children('.data, .image').slideDown(200);
spans.children('div.bottom-collapse').show();
}

chrome.storage.sync.get({url: ''}, function(items) {
if (items.url == window.location.origin ||
"https://github.com" === window.location.origin
) {
$(
'<span class="collapse-lines">' +
'<label><input type="checkbox" class="js-collapse-additions" checked="yes">+</label>' +
'<label><input type="checkbox" class="js-collapse-deletions" checked="yes">-</label>' +
'</span>'
).insertAfter('.actions, .file-actions');
"https://github.com" === window.location.origin) {

$('<div class="bottom-collapse meta">Click to Collapse</div>').insertAfter('.data.highlight.blob-wrapper');
if (!htmlIsInjected()) {
injectHtml();
}

var $body = $('body');

Expand Down Expand Up @@ -61,37 +103,3 @@ chrome.storage.sync.get({url: ''}, function(items) {
});
}
});

function collapseAdditions() {
if (isGitHub) {
$(this).closest('[id^=diff-]').find('.blob-code-addition').parent('tr').slideToggle();
} else {
$(this).closest('[id^=diff-]').find('.gi').slideToggle();
}
}

function collapseDeletions() {
if (isGitHub) {
$(this).closest('[id^=diff-]').find('.blob-code-deletion').parent('tr').slideToggle();
} else {
$(this).closest('[id^=diff-]').find('.gd').slideToggle();
}
}

function getDiffSpans(path) {
return $('.js-selectable-text').filter(function () {
return this.innerHTML.trim().match(path);
});
}

function collapseDiffs(path) {
var spans = getDiffSpans(path).closest('[id^=diff-]');
spans.children('.data, .image').slideUp(200);
spans.children('div.bottom-collapse').hide();
}

function expandDiffs(path) {
var spans = getDiffSpans(path).closest('[id^=diff-]');
spans.children('.data, .image').slideDown(200);
spans.children('div.bottom-collapse').show();
}

0 comments on commit 26e6493

Please sign in to comment.