Last active
August 29, 2015 13:56
-
-
Save bumi/9323651 to your computer and use it in GitHub Desktop.
This bookmarklet reorders the diff files in a github diff view. It tries to display the spec/test files directly after the actual code files. Add a new bookmark with the content of the bookmarklet.js file
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
javascript:(function(){$.each($('#files .js-details-container'), function(i, element) {var path = $(element).children('.meta').data('path'); if(!path.match(/_spec\.*$/)) { var extension_match = path.match(/\..*$/); if(extension_match) { var extension = extension_match[0]; var filename_match = path.match(/.*(\/.*)\..*$/); if(filename_match) { var filename = path.match(/.*(\/.*)\..*$/)[1]; var spec_path = filename + '_spec' + extension; var spec_dom = $('.meta[data-path$="' + spec_path + '"]').parent(); if(spec_dom.length > 0) { spec_dom.detach(); spec_dom.insertAfter(element); } } } }});})(); |
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
// jquery hacking... omg :) | |
// iterationg over all files, searching for the spec file and inserting that dom element after the actual file | |
$.each($('#files .js-details-container'), function(i, element) { | |
var path = $(element).children('.meta').data('path'); | |
if(!path.match(/_spec\.*$/)) { | |
var extension_match = path.match(/\..*$/); | |
if(extension_match) { | |
var extension = extension_match[0]; | |
var filename_match = path.match(/.*(\/.*)\..*$/); | |
if(filename_match) { | |
var filename = path.match(/.*(\/.*)\..*$/)[1]; | |
var spec_path = filename + '_spec' + extension; | |
var spec_dom = $('.meta[data-path$="' + spec_path + '"]').parent(); | |
if(spec_dom.length > 0) { | |
spec_dom.detach(); | |
spec_dom.insertAfter(element); | |
} | |
} | |
} | |
} | |
}) |
an idea how to fix it?
not using FF?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
missing semicolon on line 6.