Xycho / Reddit IMGR .gif to .gifv Link Changer

// ==UserScript==
// @name        Reddit IMGR .gif to .gifv Link Changer
// @description Changes all the links on reddit linking to .gif format into .gifv
// @icon        http://i.imgur.com/pnepHgS.png
// @include     *reddit.com/r/*
// @version     1.02
// @author      Xycho
// @grant       none
// ==/UserScript==

var images = document.getElementsByTagName('a');

for (var i = 0; i < images.length; i++) {
  var isImgur = images[i].href.search('imgur.com');
  if (isImgur != -1) {
    var imageExtension = images[i].href.slice(images[i].href.lastIndexOf('.'));
    
    if (imageExtension == '.gif') {
      images[i].href = images[i].href + 'v';
    }
  }
}