Skip to content

Commit

Permalink
Merge pull request #13 from rickpastoor/feature/firefox-plugin
Browse files Browse the repository at this point in the history
Check in initial version of Firefox build
  • Loading branch information
rickpastoor committed Sep 19, 2015
2 parents 20c9d33 + e090684 commit 0e33fe3
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 49 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ sudo: false
env:
matrix:
- BROWSER=chromium EXT=zip
- BROWSER=firefox EXT=xpi
script: ./tools/make-${BROWSER}.sh all
deploy:
provider: releases
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,29 @@ Sketching out your sprints is pretty hard, just like planning in general. I foun

Add a new card with the contents `#!!` anywhere in your board. It will count the points that are added to the card above it. You can add multiple separators in a single column: it will always start counting from the separator above. This allows you to prepare your sprints in advance, all within your Trello board.

## Developing and testing
## Developing and testing Chrome

To get started with developing your own additions to this plugin, clone this repo and run this command:
To get started with developing your own additions to this plugin, run this command:

```
tools/make-chromium.sh
```

After this, add a new unpacked extension to your local Google Chrome and point this to the `dist/build/scrummer.chromium` folder. Now make your changes, run `make-chromium` and refresh your plugin
in Chrome to see if everything is working as it should. There are no tests yet, because YOLO.

## Developing and testing Firefox

To get started with developing your own additions to this plugin, run this command:

```
tools/make-firefox.sh
```

After this, install JPM:

```
npm install jpm --global
```

With JPM, you can run the plugin in a debug environment. Change your directory to `dist/build/scrummer.firefox` and run `jpm run`. Now open your Trello board to see if your changes are working as expected. Happy coding!
2 changes: 1 addition & 1 deletion platform/chromium/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Scrummer",
"version": "0.10",
"version": "0.11",
"description": "Adds Storypoints to Trello",
"content_scripts": [
{
Expand Down
9 changes: 9 additions & 0 deletions platform/firefox/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");

pageMod.PageMod({
include: "*.trello.com",
contentScriptFile: data.url("scrummer.js"),
contentStyleFile: data.url("scrummer.css"),
attachTo: ["top"]
});
13 changes: 13 additions & 0 deletions platform/firefox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Scrummer",
"name": "scrummer",
"version": "0.11.0",
"description": "",
"main": "index.js",
"author": "Rick Pastoor",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": ""
}
14 changes: 10 additions & 4 deletions src/scrummer.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.scrummer-points, .scrummer-list-points, .scrummer-picker-button {
background-color: #50BBE4;
background-image: -webkit-linear-gradient(bottom, #4CB2D9 50%, #50BBE4 50%);
background: #47bae0; /* Old browsers */
background: -moz-linear-gradient(top, #47bae0 50%, #4dbbe2 50%, #33b5e0 50%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#47bae0), color-stop(50%,#4dbbe2), color-stop(50%,#33b5e0)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #47bae0 50%,#4dbbe2 50%,#33b5e0 50%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(to bottom, #47bae0 50%,#4dbbe2 50%,#33b5e0 50%); /* W3C */
padding: 1px 5px;
margin-right: 3px;
border-radius: 5px;
Expand Down Expand Up @@ -30,8 +33,11 @@
}

.scrummer-separator-card {
background-color: #50BBE4;
background-image: -webkit-linear-gradient(bottom, #4CB2D9 50%, #50BBE4 50%);
background: #47bae0; /* Old browsers */
background: -moz-linear-gradient(top, #47bae0 50%, #4dbbe2 50%, #33b5e0 50%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#47bae0), color-stop(50%,#4dbbe2), color-stop(50%,#33b5e0)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #47bae0 50%,#4dbbe2 50%,#33b5e0 50%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(to bottom, #47bae0 50%,#4dbbe2 50%,#33b5e0 50%); /* W3C */
}

.scrummer-separator-card .list-card-title {
Expand Down
84 changes: 42 additions & 42 deletions src/scrummer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var calculateStoryPointsForCard = function (card, pointsSinceSeparator) {
cardNameElement.insertBefore(badgeElement, cardNameElement.firstChild);
}

badgeElement.innerText = calculatedPoints;
badgeElement.textContent = calculatedPoints;

cardNameElement.lastChild.textContent = originalTitle.replace('(' + calculatedPoints + ')', '').trim();

Expand Down Expand Up @@ -163,7 +163,7 @@ var calculateStoryPointsForList = function (list) {
listHeader.insertBefore(badgeElement, listHeader.firstChild);
}

badgeElement.innerText = listPoints;
badgeElement.textContent = listPoints;
}

var calculateStoryPointsForBoard = function () {
Expand All @@ -183,6 +183,46 @@ var calculateStoryPointsForBoardDebounced = function () {
debounce(calculateStoryPointsForBoard, 200, true)();
}

/**
* The point picker
*/
var buildPicker = function (values, callback) {
var itemsContainer = document.createElement('div');
itemsContainer.className = 'scrummer-picker-container';

values.forEach(function (value) {
var button = document.createElement('a');
button.textContent = value;
button.addEventListener('click', callback.bind(this, value));
button.href = 'javascript:;';
button.className = 'scrummer-picker-button';
itemsContainer.appendChild(button);
});

return itemsContainer;
}

/**
* This sets up a listener to see if a detail window is presented
*/
var setupWindowListener = function (callback) {
var windowChangeObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.target.classList.contains('edit-controls') &&
mutation.target.previousSibling.classList.contains('single-line')) {
callback();
}
});
});

windowChangeObserver.observe(document.querySelector('.window-overlay'), {
childList: true,
characterData: false,
attributes: false,
subtree: true
});
}

var checkForLists = function () {
if (document.querySelectorAll('.list').length > 0) {
calculateStoryPointsForBoard();
Expand Down Expand Up @@ -222,43 +262,3 @@ var checkForLists = function () {
// Launch the plugin by checking at a certain interval if any
// lists have been loaded.
checkForLists();

/**
* The point picker
*/
var buildPicker = function (values, callback) {
var itemsContainer = document.createElement('div');
itemsContainer.className = 'scrummer-picker-container';

values.forEach(function (value) {
var button = document.createElement('a');
button.innerText = value;
button.addEventListener('click', callback.bind(this, value));
button.href = 'javascript:;';
button.className = 'scrummer-picker-button';
itemsContainer.appendChild(button);
});

return itemsContainer;
}

/**
* This sets up a listener to see if a detail window is presented
*/
var setupWindowListener = function (callback) {
var windowChangeObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.target.classList.contains('edit-controls') &&
mutation.target.previousSibling.classList.contains('single-line')) {
callback();
}
});
});

windowChangeObserver.observe(document.querySelector('.window-overlay'), {
childList: true,
characterData: false,
attributes: false,
subtree: true
});
}
25 changes: 25 additions & 0 deletions tools/make-firefox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# This script assumes a linux environment

echo "*** uMatrix.firefox: Copying files"

DES=dist/build/scrummer.firefox
rm -rf $DES
mkdir -p $DES
mkdir -p $DES/data

cp -R src/* $DES/data
cp platform/firefox/index.js $DES/
cp platform/firefox/package.json $DES/
cp -R platform/chromium/img $DES/
mv $DES/img/icon128.png $DES/icon.png

if [ "$1" = all ]; then
echo "*** scrummer.firefox: Creating package..."
pushd $DES/
zip ../scrummer.firefox.xpi -qr *
popd
fi

echo "*** scrummer.firefox: Package done."

0 comments on commit 0e33fe3

Please sign in to comment.