Skip to content

Instantly share code, notes, and snippets.

@koteq
Created June 23, 2017 11:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koteq/8157600a00f8af74f6fb0a192c08427b to your computer and use it in GitHub Desktop.
Save koteq/8157600a00f8af74f6fb0a192c08427b to your computer and use it in GitHub Desktop.
G+ hover image title
// ==UserScript==
// @name G+ hover image title
// @version 1.0
// @match *://plus.google.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
/* jshint esnext: true */
const decodeFileName = (src) => {
return decodeURIComponent(decodeURIComponent(src.split('/').pop().split(/[\?#]/)[0])).replace(/[\+_]/g, ' ');
};
document.body.addEventListener('mouseover', (e) => {
const t = e.target;
if (t && t.tagName && t.tagName === 'IMG' && t.src && !t.title && t.width > 160 && t.height > 120) {
const img = e.target;
img.title = decodeFileName(img.src);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment