Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imager 0.1.0 #49

Merged
merged 61 commits into from
Dec 8, 2013
Merged

Imager 0.1.0 #49

merged 61 commits into from
Dec 8, 2013

Conversation

thom4parisot
Copy link
Contributor

At last!

Conflicts:
	test/unit/core.js
…ternal dollar and tests

Conflicts:
	test/unit/core.js
- initial tests are failing because the old feature is still working (good way to know the old expectation we are going to break)
- new tests are  not working because basically it's not done yet
- removed Imager `regex` option
- implemented simple `{width}` interpolation
- added Imager.transforms to let room to customise things further on
- replacing {pixel_ratio} pattern in `data-src` URI
Also made the pixel ratio computation executed once, not every time an image is replaced (because it is not supposed to change within the lifecycle of a page).
- list of authors
- licensing
- created bower package
- made `imager` available for publication in npm (it is relevant to use it to host web component on npm)
- created the AUTHOR file for npm authors list
And making sure we detach any HTML/Array-like collection.
- moved event setup to init
- created dedicated method to register events whenever you want
- JS methods documentation
- late warning about a possible `scrollDelay` value set to `0`
@thom4parisot
Copy link
Contributor Author

Hu hu the fact it is again a 55 commits PR is a nice coincidence 8-)

@thom4parisot thom4parisot mentioned this pull request Dec 6, 2013
12 tasks
@MoOx
Copy link

MoOx commented Dec 6, 2013

yeahyeahyeah

pixelRatio: function(value){
return value === 1 ? '' : '-'+value+'x';
},
width: function transformWidth(width, map){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oncletom just wondering if this function needs to be named? It doesn't look like it's used by anything so it could be anonymous right?

@Integralist
Copy link
Contributor

@oncletom heya, just ran npm install && npm run test and got the following output, wasn't sure if this was expected or not (in that, although there are 404 errors, ultimately it looks like each Phantom check is succeeding)?

❯ npm run test

> imager@0.1.0 test /Users/Code/Imager
> jshint Imager.js && karma start --single-run

INFO [karma]: Karma v0.10.8 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.2 (Mac OS X)]: Connected on socket tY9nEXRUDwGAklr2ONt3
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/A-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 2 of 17 SUCCESS (0 secs / 0.029 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 3 of 17 SUCCESS (0 secs / 0.05 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 4 of 17 SUCCESS (0 secs / 0.071 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 5 of 17 SUCCESS (0 secs / 0.092 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 9 of 17 SUCCESS (0 secs / 0.237 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/B-640.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 10 of 17 SUCCESS (0 secs / 0.259 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/A-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 15 of 17 SUCCESS (0 secs / 0.284 secs)
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/A-320.jpg
WARN [web-server]: 404: /base/Demo%20-%20Grunt/Assets/Images/Generated/C-320.jpg
PhantomJS 1.9.2 (Mac OS X): Executed 17 of 17 SUCCESS (0.715 secs / 0.485 secs)

@@ -39,10 +60,6 @@
// Class name to give your resizable images.
className: '',

// Regular expression to match against your image endpoint's naming conventions
// e.g. http://yourserver.com/image/horse/400
regex: RegExp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oncletom I think the only config option missing is the onResize property. Would you be OK to add that please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the onResize from #47?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oncletom I'm referring to the config option onResize which can optionally be specified when creating a new Imager instance (see: https://github.com/BBC-News/Imager.js/blob/b7b31d795ff9d7a0cb39a9626ca426299007a1d2/README.md#onresize) - just thought that should probably be specified in that code comment block as the other config options are detailed there.

I'm going to add this myself now, but I'll just use what you've already written on the README :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, that's true, forgot to add it in the JS comment!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

```js
var imgr = new Imager();

$(document).on('load.lowPriority', $.proxy(imgr.registerResizeEvent, imgr));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oncletom can you clarify the load.lowPriority?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a fictional event on which someone could hook into to register the resizing event. This was the only idea I had at the time of writing the doc.

However if you think there is an existing DOM event which would be more suitable and relevant to register onto, I'm buying the idea!

var imgr = new Imager();

// Using jQuery to set-up the event handling and help keep the correct scope when executing the callback
$(document).on('load.lowPriority', $.proxy(imgr.registerResizeEvent, imgr));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oncletom can you clarify the load.lowPriority?

@Integralist
Copy link
Contributor

@oncletom I've made some tweaks (see last three commits). There are a couple of outstanding comments I've made (see above). If you could comment back please and then once that's done I'll give a final review and then merge :-)

@Integralist
Copy link
Contributor

@oncletom fixed that typo, whoops! Good spot :-)

@thom4parisot
Copy link
Contributor Author

No problem! Also the 404 in the tests are related to the fact they have not been generated by the grunt responsive images task. This is not making the tests failing, just raising a notice.

We could either run grunt responsive_images before the tests are launched or ship dedicated test images, independant from the demo.

@Integralist
Copy link
Contributor

@oncletom I reckon we ship dedicated test images, as it'll mean running the tests will be faster not having to rely on the grunt responsive_images task to run. Is this something you want to do now or wait until this get's merged? It's not a deal breaker by any means.

@Integralist
Copy link
Contributor

@oncletom regarding load.lowPriority I wonder whether it's worth changing that to just load (e.g. $(document).on('load', callback);) so it doesn't confuse people into thinking load.lowPriority is a real event.

@thom4parisot
Copy link
Contributor Author

We'll do that later then. Maybe in the same PR as moving all the demos in a dedicated folder.

Regarding the load.lowPriority, agreed, let's keep things simple by avoiding adding possible confusion.

@Integralist
Copy link
Contributor

@oncletom coolio. I've just updated the event btw

@Integralist
Copy link
Contributor

@oncletom I think this is good to merge now. You happy for me to push the big green button? :-)

@thom4parisot
Copy link
Contributor Author

@Integralist oh I appreciate but please do it, I like the symbol and the positive progress as an outcome from my first attempt :-) 👍

Integralist added a commit that referenced this pull request Dec 8, 2013
@Integralist Integralist merged commit 9fc85eb into master Dec 8, 2013
@thom4parisot thom4parisot deleted the refactoring-base branch December 8, 2013 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants