Skip to content

Commit

Permalink
simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelmas committed Aug 3, 2014
1 parent 1f83948 commit 5ee0abb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion GithubTower.safariextension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>Chrome</key>
Expand Down
12 changes: 3 additions & 9 deletions GithubTower.safariextension/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
(function() {
var aElements = document.getElementsByTagName('a');
var buttonElement = document.querySelector("a[data-url^='github-mac://']");

for ( var i = 0; i < aElements.length; i++) {
var aElement = aElements[i];
var dataUrl = aElement.getAttribute("data-url");

if ( dataUrl != null && dataUrl.indexOf('github-mac://') == 0 ) {
aElement.href = dataUrl;
break;
}
if ( buttonElement != null ) {
buttonElement.href = buttonElement.getAttribute("data-url");
}
}());
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Download, open and install [GithubTower.safariextz](https://github.com/gdelmas/G
#Lightweight
Github's "Clone in Desktop" button only works if the official Github.app is installed on OS X. The [Github.app](https://mac.github.com) spawns a [helper "GitHub Conduit.app"](https://help.github.com/articles/github-conduit) which will always be running on the system. This helper has a webserver constantly listening for requests on the users local machine port 25035. If the Github website can reach this server it changes the "Clone in Desktop" button links to open in the users local Git App instead of redirecting to https://mac.github.com.

The Safari extensions eliminates the need to have a local webserver process running by injecting [13 lines of code](https://github.com/gdelmas/GithubTower/blob/master/GithubTower.safariextension/main.js) only into Github's website.
The Safari extensions eliminates the need to have a local webserver process running by injecting [7 lines of code](https://github.com/gdelmas/GithubTower/blob/master/GithubTower.safariextension/main.js) only into Github's website.

#Tower
Tower 2 is a wonderful Git client for OS X. It brings all of Git’s powerful features to your desktop. Try it out here: [http://www.git-tower.com](http://www.git-tower.com)

0 comments on commit 5ee0abb

Please sign in to comment.