Permalink
Browse files

New version supporting mapping mode to custom values.

  • Loading branch information...
1 parent 9628b5f commit edaa88d9d9e7d0874c3634262fc99b4b95f943bf @hleinone hleinone committed Jan 29, 2012
Showing with 10 additions and 6 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 README.markdown
  3. +0 −1 molt-2.1.0.min.js
  4. +1 −1 molt-2.1.0.W.min.js → molt-2.2.0.W.min.js
  5. +1 −0 molt-2.2.0.min.js
  6. +4 −3 src/molt.js
  7. +1 −1 src/package.json
View
@@ -0,0 +1 @@
+/node_modules
View
@@ -27,6 +27,8 @@ Numbers in brackets are modes. The selected mode will replace brackets: if the s
- for a 480px width, the 320 mode again
- but if a 1280px resolution is detected, the 1024 mode is chosen
+You can also map modes into different values, for example using `images/img-{320=small,1024=huge}.jpg` to load either `img-small.jpg` or `img-huge.jpg`.
+
Moreover, note that you can 'negate' a mode, like `!320`, to make your images hidden for that mode (please take a look at the listener example to know how deal with that special mode).
Finally, the `display` attribute is used when a previously hidden image (by a negative mode) shows up again. Currently, there's no way to distinguish which display CSS property is set on a node (really, no way at all, coming from a lack of specs). So, molt will reset that display property to the `display` attribute value, `inline` otherwise.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
/*
molt, image updater for responsive designs
- Version: 2.1.0
+ Version: 2.2.0
Author: Aurélien Delogu (dev@dreamysource.fr)
Homepage: https://github.com/pyrsmk/molt
License: MIT
@@ -46,10 +46,11 @@
modes=(url=node.getAttribute('url')).match(/\{\s*(.*?)\s*\}/)[1].split(/\s*,\s*/);
for(l=0;l<modes.length;l++){
mapping = modes[l].split("=");
- if(mapping.length===1)
+ if(mapping.length===1){
modes[l] = [mapping[0], mapping[0]];
- else
+ }else{
modes[l] = [mapping[0], mapping[1]];
+ }
}
j=modes.length;
while(j){
View
@@ -1,7 +1,7 @@
{
"name" : "molt",
"description" : "Image updater for responsive designs",
- "version" : "2.1.0",
+ "version" : "2.2.0",
"author" : "Aurélien Delogu <pyrsmk@dreamysource.fr> (http://dreamysource.fr)",
"repository" : {
"type" : "git",

0 comments on commit edaa88d

Please sign in to comment.