Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
New version supporting mapping mode to custom values.
Browse files Browse the repository at this point in the history
  • Loading branch information
hleinone committed Jan 29, 2012
1 parent 9628b5f commit edaa88d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/node_modules
2 changes: 2 additions & 0 deletions README.markdown
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion molt-2.1.0.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion molt-2.1.0.W.min.js → molt-2.2.0.W.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions molt-2.2.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/molt.js
@@ -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
Expand Down Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
@@ -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",
Expand Down

0 comments on commit edaa88d

Please sign in to comment.