Created
November 15, 2011 18:22
-
-
Save joncooper/1367858 to your computer and use it in GitHub Desktop.
chrome-pt-blog-1
This file contains hidden or 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
| <html> | |
| <head> | |
| <script> | |
| <!-- Inject the content script --> | |
| chrome.browserAction.onClicked.addListener(function(tab) { | |
| chrome.tabs.executeScript(null, { file: "jquery.min.js" }, function() { | |
| chrome.tabs.executeScript(null, { file: "ptcx.js" }); | |
| }); | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
This file contains hidden or 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
| { | |
| "name": "Pivotal Tracker Chrome Extension", | |
| "version": "0.0.1", | |
| "description": "Filter stories and generally make life with Tracker nicer.", | |
| "permissions": [ | |
| "tabs", | |
| "https://www.pivotaltracker.com/*" | |
| ], | |
| "background_page": "bootstrap.html", | |
| "browser_action": { | |
| "default_icon": "tracker_filter.png", | |
| } | |
| } |
This file contains hidden or 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
| $('.item').hide(); | |
| $('.item > .finished, .item > .started, .item > .delivered').closest('.item').fadeIn(); |
This file contains hidden or 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
| DropdownMenu = { | |
| register: function(name) { | |
| var button = $('#' + name + '_button'); | |
| var dropdown = $('#' + name + '_dropdown'); | |
| button.click(function(event) { | |
| var already_open = button.hasClass('active'); | |
| DropdownMenu.deactivateAll(); | |
| if (!already_open) { | |
| button.toggleClass('active'); | |
| dropdown.toggle(); | |
| dropdown.toggleClass('open'); | |
| $(document).click(DropdownMenu.deactivateAll); | |
| } | |
| event.stopPropagation(); | |
| }); | |
| }, | |
| deactivateAll: function() { | |
| $('.dropdown .active').removeClass('active'); | |
| $('.dropdown .open').hide(); | |
| $('.dropdown .open').removeClass('open'); | |
| $(document).unbind('click', DropdownMenu.deactivateAll); | |
| } | |
| }; |
This file contains hidden or 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
| var stories_button = $('#stories_button'); | |
| var dropdown = '<li class="dropdown">' + | |
| '<a id="filter_button" class="tab button" href="#">Filter</a>' + | |
| '<div class="knockout" style="display: none"></div>' + | |
| '<div id="filter_dropdown" class="nav_dropdown" style="display: none;">' + | |
| '<ul>' + | |
| '<li>' + | |
| '<div class="inner">' + | |
| '<a id="toggle_blocked" href="#">' + | |
| '<span>Toggle blocked</span>' + | |
| '</a>' + | |
| '</div>' + | |
| '</li>' + | |
| '<li>' + | |
| '<div class="inner">' + | |
| '<a id="toggle_only_needs_estimation" href="#">' + | |
| '<span>Toggle only needs estimation</span>' + | |
| '</a>' + | |
| '</div>' + | |
| '</li>' + | |
| stories_button.parent().after(dropdown); | |
| DropdownMenu.register('filter'); | |
| $('#filter_button').css('background-position', '50px 8px'); | |
| $('#filter_button').click(function() { | |
| var overlay = $('.overlay'); | |
| if (overlay) { | |
| overlay.hide(); | |
| } | |
| }); | |
| $('#toggle_blocked').click(PTCX.toggle_blocked); | |
| $('#toggle_only_needs_estimation').click(PTCX.toggle_only_needs_estimation); |
This file contains hidden or 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
| $('.storyLabels > [title*=blocked_]').closest('.item') |
This file contains hidden or 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
| $('.storyLabels > [title^=needs_estimation, .estimateIcon[title=Unestimated]').closest('.item') |
This file contains hidden or 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
| $('#current .item .accepted') |
This file contains hidden or 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
| $('.item > .started, .item > .delivered').closest('.item') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment