// == UserScript == // @name Twitpic thumbnails // @include http://twitter.com/* // == / UserScript ==
(function () { if (typeof GM_addStyle == 'undefined') {
/ ** * Example: GM_addStyle ('* {color: red}') * @param {String} css * /
function GM_addStyle (css) { var head = document.getElementsByTagName ('head') [0]; if (head) { var style = document.createElement ("style"); style.type = "text / css"; style.appendChild (document.createTextNode (css)); head.appendChild (style); } } } GM_addStyle ('. Entry-content img {display: block; margin: .5em 0;}'); var links = document.links; for (var i = 0; i <links.length; i ++) { if (links [i] .href.indexOf ('http://twitpic.com/') == 0 && links [i] .className.indexOf ('tweet url')> -1) { var id = links [i] .href.split ("http://twitpic.com/") [1]; links [i] .innerHTML = '<img src = "http://twitpic.com/show/thumb/' + id + '" />'; } } }) ();
GM_
prefix . For other browsers you need to define it:if (typeof GM_addStyle == 'undefined') {
/ ** * Example: GM_addStyle ('* {color: red}') * @param {String} css * /
function GM_addStyle (css) { var head = document.getElementsByTagName ('head') [0]; if (head) { var style = document.createElement ("style"); style.type = "text / css"; style.appendChild (document.createTextNode (css)); head.appendChild (style); } } }
for (var i = 0; i <links.length; i ++) { if (links [i] .href.indexOf ('http://twitpic.com/') == 0 && links [i] .className.indexOf ('tweet-url')> -1) { var id = links [i] .href.split ("http://twitpic.com/") [1]; links [i] .innerHTML = '<img src = "http://twitpic.com/show/thumb/' + id + '" />'; } }
Source: https://habr.com/ru/post/74012/
All Articles