Created
February 24, 2020 05:08
-
-
Save Guley/615a29a9b85e02eddb4d140ecbc9ed0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var imagesRef = document.getElementsByTagName('img'); | |
for(var i = 0; i < imagesRef.length; i++) { | |
var filename = imagesRef[i].src; | |
var oldAlt = imagesRef[i].alt; | |
if(oldAlt != null){ | |
var newRa = filename.substring(0, filename.lastIndexOf('.')); | |
var imgObj = newRa.split("/"); | |
imagesRef[i].alt = imgObj.slice(-1); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment