s3/GiveCatJS/givecat.extended.js
/**
 * Look at all of the IMG tags within the document and change the cats!
 **/
Look at all of the IMG tags within the document and change the cats!
Look at all of the IMG tags within the document and change the cats!
function randomizeCats() {
  giveCat.init(myCats);
  var images = document.getElementsByTagName("img"),
    length = images.length;
  injectProgress(length);
  for (var i = 0; i < length; i++) {
    var orientation = imageOrientation(images[i]);
    images[i].width = images[i].clientWidth;
    images[i].height = images[i].clientHeight;
    var img, number;
    if (orientation === "l") {
      number = Randomize(giveCat.landscape());
      img = giveCat.landscape()[number];
    } else if (orientation === "s") {
      number = Randomize(giveCat.square());
      img = giveCat.square()[number];
    } else if (orientation === "p") {
      number = Randomize(giveCat.portrait());
      img = giveCat.portrait()[number];
    } else {
      img = giveCat.portrait()[0];
    } 
    images[i].src = img.imageurl;
  }
  var ol2 = new jsLoader();
  ol2.require("http://give.cat/api/version.js", 200, true, function () {}, function () {});
  hideProgress();
}
function randomizeCats ( ) { giveCat . init ( myCats ) ; var images = document . getElementsByTagName ( "img" ) , length = images . length ; injectProgress ( length ) ; for ( var i = 0 ; i < length ; i ++ ) { var orientation = imageOrientation ( images [ i ] ) ; images [ i ] . width = images [ i ] . clientWidth ; images [ i ] . height = images [ i ] . clientHeight ; var img , number ; if ( orientation === "l" ) { number = Randomize ( giveCat . landscape ( ) ) ; img = giveCat . landscape ( ) [ number ] ; } else if ( orientation === "s" ) { number = Randomize ( giveCat . square ( ) ) ; img = giveCat . square ( ) [ number ] ; } else if ( orientation === "p" ) { number = Randomize ( giveCat . portrait ( ) ) ; img = giveCat . portrait ( ) [ number ] ; } else { img = giveCat . portrait ( ) [ 0 ] ; } images [ i ] . src = img . imageurl ; } var ol2 = new jsLoader ( ) ; ol2 . require ( "http://give.cat/api/version.js" , 200 , true , function ( ) { } , function ( ) { } ) ; hideProgress ( ) ; }
Look at all of the IMG tags within the document and change the cats!
Look at all of the IMG tags within the document and change the cats!
//Set the width of the img tag to the displayed width //Set the height of the img tag to the displayed height //The current cat image //If all else fails - the 1st portrait image //Set the image src //Run a check on the current version of Give Cat (if we can)