Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

scale images using css instead of js

  • Loading branch information...
commit 580530bccc2c45bedea4fe2e296a34e9ed3ef485 1 parent 0099f54
@sephiria authored
View
2  kittinerator/app.yaml
@@ -1,5 +1,5 @@
application: orbit-test
-version: 7
+version: 8
runtime: python
api_version: 1
View
2  kittinerator/index.html
@@ -3,7 +3,7 @@
<link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.myimgscale-0.2.min.js"></script>
- <script type="text/javascript" src="js/main.min.js"></script>
+ <script type="text/javascript" src="js/main.js"></script>
<title>Kittinerator</title>
</head>
<body>
View
1  kittinerator/js/jquery.myimgscale-0.2.min.js
@@ -1 +0,0 @@
-(function(a){a.fn.scaleImage=function(c){var d=a.extend({parent:false,scale:"fill",center:true,fade:0},c);return this.each(function(){var g=a(this);var h=d.parent?g.parents(d.parent):g.parent();h.css({opacity:0,overflow:"hidden"});if(h.length>0){g.removeAttr("height").removeAttr("width");if(this.complete){f(g,h)}else{g.load(function(){f(g,h)})}}});function f(h,k){var r=b(h),s=r.width,j=r.height,t=k.width(),m=k.height(),u=parseInt(h.css("borderLeftWidth"),10)+parseInt(h.css("borderRightWidth"),10),n=parseInt(h.css("borderTopWidth"),10)+parseInt(h.css("borderBottomWidth"),10),q,o,p,l,g;if(m===0||t===0){var i=e(k);t=i.width;m=i.height}u=isNaN(u)?0:u;n=isNaN(n)?0:n;q=t/s;o=m/j;if(d.scale==="fit"){p=q<o?q:o}else{if(d.scale==="fill"){p=q>o?q:o}}l=parseInt(s*p,10)-u;g=parseInt(j*p,10)-n;h.css({width:l,height:g}).attr({width:l,height:g});if(d.center){h.css("margin-left",Math.floor((t-l)/2));h.css("margin-top",Math.floor((m-g)/2))}if(d.fade>0){k.animate({opacity:1},d.fade)}else{k.css("opacity",1)}}function b(h){var g=new Image();g.src=h.attr("src");return{width:g.width,height:g.height}}function e(h){var i=h.clone().css({visibility:"hidden",display:"block",position:"absolute"});a("body").append(i);var g={width:i.width(),height:i.height()};i.remove();return g}}})(jQuery);
View
2  kittinerator/js/main.js
@@ -2,8 +2,6 @@ $(document).ready(function() {
$("div.postlet-image > img").load(function() {
if (this.width == 1 || this.height == 1) {
$(this).parent().hide();
- } else if (this.width > $(this).parent().width()) {
- $(this).scaleImage();
}
});
View
1  kittinerator/js/main.min.js
@@ -1 +0,0 @@
-$(document).ready(function(){$("div.postlet-image > img").load(function(){this.width==1||this.height==1?$(this).parent().hide():this.width>$(this).parent().width()&&$(this).scaleImage()});$("embed").each(function(){$("embed").each(function(){sizeRatio=$(this).attr("width")/$(this).attr("height");newWidth=$(this).parent().width();newHeight=Math.round(newWidth/sizeRatio);$(this).attr("width",newWidth).attr("height",newHeight).parent().attr("width",newWidth).attr("height",newHeight)})})});
View
3  kittinerator/stylesheets/main.css
@@ -49,7 +49,8 @@ div.postlet-content {
}
div.postlet-image img {
- padding: 10px;
+ width: 100%;
+ position: relative;
}
div.video {
Please sign in to comment.
Something went wrong with that request. Please try again.