Permalink
Browse files

Poczatek

  • Loading branch information...
0 parents commit c63af6f000662f6e65d551adb61572df9db4be53 @pokonski pokonski committed Mar 28, 2012
Showing with 85 additions and 0 deletions.
  1. +13 −0 css/humpinator.css
  2. +21 −0 humpinator.js
  3. BIN icon.ico
  4. +2 −0 jquery.imagesloaded.min.js
  5. +4 −0 jquery.min.js
  6. +27 −0 manifest.json
  7. +18 −0 utils.js
@@ -0,0 +1,13 @@
+.humpinator-wrapper{
+ display: inline-block;
+ position: relative;
+ overflow: hidden;
+}
+.humpinator-wrapper > .humpinator-label{
+ color: white;
+ background: rgba(0,0,0,0.6);
+ padding: 5px;
+ position: absolute;
+ top: -60px;
+ left: 0;
+}
@@ -0,0 +1,21 @@
+var buffer = 50;
+var max_width = $(window).width();
+var selector = 'td.postRow img[src^="http"]';
+var dfd = $(selector).imagesLoaded();
+
+dfd.progress(function( isBroken, $images, $proper, $broken ){
+ fitImages($proper,max_width, buffer);
+});
+
+$(document).on('mouseenter mouseleave','a.humpinator-wrapper',function(e){
+ $(this).find('span.humpinator-label').animate({top: (e.type == 'mouseenter' ? 0 : -60)},100);
+});
+
+$(window).on('resize',function(){
+ fitImages($(selector), $(window).width(), buffer);
+});
+
+// fit images once spoiler is opened
+$('td.postRow img[src="templates/NFOrce8/images/icon_expand.gif"]').on('click',function(){
+ fitImages($('td.postRow div[name^="spoiler"] img[src^="http"]'), $(window).width(),buffer);
+});
BIN icon.ico
Binary file not shown.

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

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,27 @@
+{
+ "name": "Humpinator",
+ "version": "0.0.4",
+ "description": "Augment my Hump!",
+ "homepage_url": "http://nfohump.com/forum/",
+ "minimum_chrome_version" : "14.0",
+ "update_url": "http://dl.dropbox.com/u/69553763/humpdates.xml",
+ "icons": {
+ "16": "icon.ico"
+ },
+ "content_scripts": [
+ {
+ "matches": ["http://www.nfohump.com/forum/viewtopic.php*"],
+ "css": ["css/humpinator.css"],
+ "js": [
+ "jquery.min.js",
+ "jquery.imagesloaded.min.js",
+ "utils.js",
+ "humpinator.js"
+ ],
+ "run_at" : "document_end"
+ }
+ ],
+ "permissions": [
+ "http://www.nfohump.com/"
+ ]
+}
@@ -0,0 +1,18 @@
+var fitImages = function(list,max_width, buffer){
+ list.each(function(i,image){
+ var img = $(image);
+ if (img.width() > max_width || (typeof img.data('originalWidth') != 'undefined' && img.data('originalWidth') > max_width)){
+ if (!img.data('originalWidth')){
+ img.attr('data-original-width',img.width());
+ img.attr('data-original-height',img.height());
+ }
+ var wrapper = img.parent('a.humpinator-wrapper');
+ if (wrapper.length == 0){
+ wrapper = img.wrap($("<a class='humpinator-wrapper'/>")).parent();
+ wrapper.prepend($("<span class='humpinator-label'/>").text('Resized from ' + img.data('originalWidth') + 'x' + img.data('originalHeight')));
+ }
+ img.css('width',max_width - img.offset().left - buffer);
+ wrapper.attr('href',img.attr('src')).attr('target','_blank');
+ }
+ });
+};

0 comments on commit c63af6f

Please sign in to comment.