Skip to content

Commit

Permalink
changed bower.json ver to 0.1-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarl committed Jan 3, 2014
1 parent 4cc7a95 commit c4b6dd2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "respeto",
"version": "0.1.0",
"version": "0.1.0-alpha",
"authors": [
"pkarl <pete.karl@gmail.com>"
],
Expand All @@ -13,7 +13,6 @@
"responsive"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
Expand Down
35 changes: 15 additions & 20 deletions src/respeto.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ var Respeto = function (options) {

// Create the defaults once
var defaults = {
imageDataAttribute: 'rsp-img',
imagePathAttribute: 'rsp-path',
imageDataAttribute: 'rsp-img',
imagePathAttribute: 'rsp-path',

imagePath: '',
imagePath: '',

retina: false, // don't append retina suffix
retinaSuffix: '_x2',
retina: false, // don't append retina suffix
retinaSuffix: '_x2',

// searchTags: ['img','div'] // FUTURE, assumes img + div for now
// scaleCSSPrefix: 'rsp-scale-', // FUTURE
// autoConserve: false, // FUTURE
};

this.lastState = null; // used to prevet loading multiple times...
// searchTags: ['img','div'] // FUTURE, assumes img + div for now
// scaleCSSPrefix: 'rsp-scale-', // FUTURE
// autoConserve: false, // FUTURE
};

this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
Expand Down Expand Up @@ -63,12 +61,6 @@ Respeto.prototype = {
_reSource: function(targets, label, retina) {
var _this = this;

if(label === this.lastState) {
return;
}

this.lastState = label;

targets.each(function() {
var $t = $(this);
var userImg = $t.data(_this.settings.imageDataAttribute);
Expand All @@ -90,6 +82,9 @@ Respeto.prototype = {
},

_buildImagePath: function(path, imgData, label, retina, pixelRatio) {

console.log(path, imgData, label, retina, pixelRatio);

var imgExt = imgData.slice(-4);
var imgBase = imgData.slice(0,-4);

Expand All @@ -98,7 +93,7 @@ Respeto.prototype = {
retinaSuffix = this.settings.retinaSuffix;
}

return path + imgBase + (label ? '-' + label : '') + retinaSuffix + imgExt;
return path + imgBase + (label ? '_' + label : '') + retinaSuffix + imgExt;
},

_fetchTargets: function(match, exclude, scope) {
Expand All @@ -111,10 +106,10 @@ Respeto.prototype = {
selector += this.settings.searchTags[x] + '[data-' + this.settings.imageDataAttribute + ']';
}

return $(scope).find('img[data-rsp-img],div[data-rsp-img],section[data-rsp-img]').not(exclude);
return $(scope).find('img[data-rsp-img],div[data-rsp-img]').not(exclude);
}
};

if ( typeof( module ) !== 'undefined' ) {
module.exports = Respeto;
}
}

0 comments on commit c4b6dd2

Please sign in to comment.