Skip to content

Commit

Permalink
Fixed #14
Browse files Browse the repository at this point in the history
Thanks to Jerone and Notidart
  • Loading branch information
diegocr committed Apr 18, 2015
1 parent 3479814 commit 7581a18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GitHub Extension Installer - Mozilla Extension

This Add-On allows you to install browser extensions straight from GitHub Repositories, the only requirement in the current version is that the extension files are placed in the root of the repo. If that is the case (ie, a install.rdf file is found there), a new button will be added in the right-bottom side of the page as shown in the next screenshot.

![SS](https://addons.cdn.mozilla.net/img/uploads/previews/full/113/113974.png?modified=1380155370)
![GitHub Extension Installer Screenshot](https://addons.cdn.mozilla.net/user-media/previews/full/113/113974.png)

**Please note the installation is performed in the background, there won't be a confirmation dialog**, you'll just get a notification indicating whether the installation succeed or failed.

Expand Down
7 changes: 4 additions & 3 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* Contributor(s):
* Diego Casorran <dcasorran@gmail.com> (Original Author)
* Jeroen van Warmerdam <jeronevw@hotmail.com>
*
* ***** END LICENSE BLOCK ***** */

Expand Down Expand Up @@ -238,14 +239,14 @@ function addButton(n,u) {
if(typeof u !== 'object') {
n.className += ' button primary pseudo-class-active';
} else {
n.className = 'minibutton pseudo-class-active';
n.className = 'btn btn-sm minibutton pseudo-class-active';
n.firstChild.style.verticalAlign = 'baseline';
}
}
}

function onPageLoad(doc) {
if(doc.location.pathname.replace(/\/[^/]+$/,'').substr(-4) === 'pull') {
if(doc.location.pathname.split('/')[3] === 'pull') {
// Based on work by Jerone: https://github.com/jerone/UserScripts

let r = '' + doc.location.pathname.split('/').filter(String).slice(1,2),
Expand All @@ -269,7 +270,7 @@ function onPageLoad(doc) {
(n) => 'install.rdf' === n.textContent.trim())) {

let c = 7, n, z;
while(c-- && !(n=doc.querySelector('a.minibutton:nth-child('+c+')')));
while(c-- && !(n=doc.querySelector('a.minibutton:nth-child('+c+'),a.btn.btn-sm:nth-child('+c+')')));

if(n && n.textContent.trim() === 'Download ZIP') {
c = doc.querySelector('div.only-with-full-nav');
Expand Down
8 changes: 4 additions & 4 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<em:id>{86054B0A-BD85-42F9-8E58-8794EC6F6EA1}</em:id>
<em:type>2</em:type>
<em:name>GitHub Extension Installer</em:name>
<em:version>1.5.0</em:version>
<em:version>1.6a1</em:version>
<em:creator>Diego Casorran &lt;dcasorran@gmail.com&gt;</em:creator>
<em:description>Install Browser Extensions straight from GitHub Repositories</em:description>
<em:contributor>Jerone</em:contributor>
Expand All @@ -15,7 +15,7 @@
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>22.0</em:minVersion>
<em:maxVersion>27.*</em:maxVersion>
<em:maxVersion>37.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
Expand All @@ -39,8 +39,8 @@
<!-- Android -->
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
<em:minVersion>22.0</em:minVersion>
<em:maxVersion>27.*</em:maxVersion>
<em:maxVersion>37.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
</RDF>

0 comments on commit 7581a18

Please sign in to comment.