Last active
August 29, 2015 14:12
-
-
Save shtrih/834c30127b26935f3ea1 to your computer and use it in GitHub Desktop.
Добавляет кнопку для получения ссылки на полноразмерное изображение в G+: https://www.dropbox.com/s/6c0iza4m2tk2hhm/2014-12-24_06h03_40.png Устанавливать через Tampermonkey/Greazemonkey или аналоги.
This file contains hidden or 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
// ==UserScript== | |
// @name Image Full size link | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.1 | |
// @description Adds button to get full sized image link | |
// @match http://plus.google.com/* | |
// @match https://plus.google.com/* | |
// @grant unsafeWindow | |
// @grant GM_setClipboard | |
// @copyright 2014+, shtrih | |
// ==/UserScript== | |
if (window != window.top) { | |
return false; | |
} | |
var button = document.createElement('div'); | |
button.className = 'bQa Tkb'; | |
button.style.left = '88px'; | |
button.setAttribute('title', 'Click to copy full size image URL'); | |
button.innerHTML = '<div class="qab" style="background-position: 0px -55px"></div>'; | |
button.addEventListener('click', function (e) { | |
var img_link = document.querySelector('img.Eha').getAttribute('src'); | |
if (img_link) { | |
img_link = img_link.replace(/\/(w[0-9]+\-h[0-9]+|s[0-9]+)(\-[a-z]+)?\/([^/]+)/i, '/s0/$3'); | |
//window.prompt('Link to an Image:', 'https:' + img_link); | |
GM_setClipboard('https:' + img_link, 'text'); | |
} else | |
console.error('Cannot find G+ image link!'); | |
}); | |
setInterval(function () { | |
var bottom_bar = document.querySelector('.nab'), | |
el1 = document.querySelector('.pab'), | |
el2 = document.querySelector('.QGb') | |
; | |
if (el1) | |
el1.style.left = "132px"; | |
if (el1) | |
el2.style.left = "176px"; | |
if (bottom_bar && bottom_bar.lastChild !== button) { | |
bottom_bar.appendChild(button); | |
} | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment