Skip to content
Browse files

changes for custom mount points

  • Loading branch information...
1 parent f1dfb60 commit db08775cbbce2f03c5be5a6ae4e5d6ee3db8b635 @substack committed Jul 4, 2011
View
20 README.markdown
@@ -51,10 +51,24 @@ browser-side
var progressify = require('progressify');
````
-var p = progressify()
----------------------
+var p = progressify(opts={})
+----------------------------
-Create a new progress object.
+Create a new progress object, loading resources from `opts.mount`.
+
+To mount the resources someplace special you can do
+
+````javascript
+var p = progressify({ mount : '/special' })
+````
+
+in the browser and
+
+````javascript
+app.use('/special', require('progressify'));
+````
+
+Otherwise the resources are just mounted at '/'.
p.appendTo(...)
---------------
View
9 browser.js
@@ -1,6 +1,9 @@
var $ = require('jquery-browserify');
-module.exports = function () {
+module.exports = function (opts) {
+ if (!opts) opts = {};
+ if (!opts.mount) opts.mount = '';
+
var div = $('<div>').css({
'margin-right' : '5px',
height : '40px',
@@ -30,13 +33,13 @@ module.exports = function () {
.appendTo(div)
;
var full = $('<img>')
- .attr('src', '/progressify/full.png')
+ .attr('src', opts.mount + '/_progressify_full.png')
.appendTo(finished)
;
var remaining = $('<div>').appendTo(div);
var empty = $('<img>')
- .attr('src', '/progressify/empty.png')
+ .attr('src', opts.mount + '/_progressify_empty.png')
.appendTo(remaining)
;
View
2 package.json
@@ -1,6 +1,6 @@
{
"name" : "progressify",
- "version" : "0.0.0",
+ "version" : "0.0.1",
"description" : "Hand-drawn progress bars for your webapps",
"main" : "index.js",
"browserify" : "browser.js",
View
0 static/progressify/empty.png → static/_progressify_empty.png
File renamed without changes
View
0 static/progressify/full.png → static/_progressify_full.png
File renamed without changes

0 comments on commit db08775

Please sign in to comment.
Something went wrong with that request. Please try again.