// // 'View on Flickriver' Greasemonkey script v1.4 // // Written by Alex Sirota (http://iosart.com/) // // Copyright Alex Sirota (c) 2007-2010 All Rights Reserved // // (function () { function g(t, e) { if (typeof e === 'undefined') { e = document; } const u = document.evaluate("//*[@class='" + t + "']", e, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); return u.snapshotLength > 0 ? u.snapshotItem(0) : null; } function m(e) { if ( e.match(/photos\/([^/]+)\/?$/) || e.match(/photos\/([^/]+)\/page[0-9]+\/?$/) || e.match(/people\/([^/]+)\/?$/) || e.match(/photos\/([^/]+)\/popular-interesting\/?$/) || e.match(/photos\/([^/]+)\/sets\/?$/) || e.match(/photos\/([^/]+)\/tags\/?$/) || e.match(/photos\/([^/]+)\/sets\/([^/]+)\/?$/) || e.match(/photos\/([^/]+)\/tags\/([^/]+)\/?$/) || e.match(/photos\/([^/]+)\/favorites\/?$/) || e.match(/photos\/([^/]+)\/friends\/?$/) ) { return true; } return false; } function k(e) { if (e.match(/photos\/?$/) || e.match(/photos\/tags\/([^/]+)\/?$/) || e.match(/photos\/tags\/interesting\/?$/)) { return true; } return false; } function n(e) { if (e.match(/photos\/([^/]+)\/([0-9]+)\/?$/) || e.match(/photos\/([^/]+)\/([0-9]+)\/in\/[^/]+\/?$/)) { return true; } return false; } function c(e) { if (e.match(/groups\/([^/]+)\/?$/) || e.match(/groups\/([^/]+)\/pool\/page[0-9]+\/?$/) || e.match(/groups\/([^/]+)\/pool\/?$/)) { return true; } return false; } function s(e) { if (e.match(/explore\/?$/)) { return true; } return false; } function b(e) { const u = g('Extras'); e = e.cloneNode(true); if (u) { const t = document.createElement('style'); t.innerHTML = '.flickriver-extras-link, .flickriver-extras-link:visited, .flickriver-extras-link:link { font-size: 11px; font-weight: bold; color: #A1A1A1;}\n.flickriver-extras-link:hover { background: none; color: #0259C4 }'; e.className = 'flickriver-extras-link'; const v = document.createElement('div'); if (document.getElementById('SlideShowButton') && document.getElementById('ShareButton')) { v.style.textAlign = 'center'; } else { v.style.textAlign = 'right'; if (document.getElementById('ShareButton')) { v.style.paddingRight = '2px'; } else { v.style.paddingRight = '11px'; } } u.appendChild(t); v.appendChild(e); u.appendChild(v); return true; } return false; } function p() { const e = g('photoDescription'); if (!e) { return true; } if (e.innerHTML.match(/flickriver\.com/)) { return false; } return true; } function j(t) { const e = document.getElementById('DiscussPhoto'); if (!e) { return false; } const u = document.createElement('p'); u.appendChild(t); e.parentNode.insertBefore(u, e); return true; } function l(t) { const e = document.getElementById('Hint'); if (!e) { return false; } const u = document.createElement('p'); t.style.fontWeight = 'bold'; u.appendChild(t); e.appendChild(u); return true; } function i(v) { const e = document.getElementById('SubNav'); if (!e) { return false; } const u = g('Links', e); if (!u) { return false; } const t = u.getElementsByTagName('img'); if (t && t.length) { u.appendChild(t[0].cloneNode(true)); } u.appendChild(v); return true; } function a(t) { const e = g('ExploreChoose'); if (!e) { return false; } const u = e.getElementsByTagName('ul'); if (!u || !u.length) { return false; } u = u[0]; const v = document.createElement('li'); t.className = 'Plain'; v.appendChild(t); u.insertBefore(v, u.firstChild); return true; } function f(w) { const x = w ? 'person_menu_you_div' : 'person_menu_other_div'; const v = document.getElementById(x); const e = document.createElement('div'); e.className = 'menu_item_line_above'; const y = document.createElement('a'); y.className = 'block'; y.id = w ? 'personmenu_your_flickriver_link' : 'personmenu_flickriver_link'; y.href = '#'; y.innerHTML = 'View on Flickriver'; e.appendChild(y); v.appendChild(e); if (w) { const z = document.getElementById('personmenu_your_photos_link'); const u = z.href; if (u.match(/^http:\/\//)) { u = u.replace(/flickr.com/, 'flickriver.com'); } else { u = 'https://www.flickriver.com' + u; } y.href = u; return; } const t = document.getElementById('personmenu_photos_link'); function A() { const B = t.href; B = B.replace(/flickr.com/, 'flickriver.com'); B += 'popular-interesting/'; y.href = B; } t.addEventListener( 'DOMAttrModified', function () { A(); }, false, ); } function q(e) { const u = g('Paginator'); if (!u) { return; } const t = document.createElement('a'); t.setAttribute('href', e); t.innerHTML = 'view on flickriver'; t.setAttribute('style', 'margin-left: 20px'); u.appendChild(t); } try { f(true); } catch (r) {} try { f(false); } catch (r) {} const d = location.href; const o = d.replace(/\?.*$/, ''); o = o.replace(/flickr.com/, 'flickriver.com'); const h = document.createElement('a'); h.setAttribute('href', o); h.innerHTML = 'View on Flickriver'; if (m(d)) { q(h.cloneNode(true)); b(h); return; } if (n(d)) { if (p()) { j(h); } return; } if (k(d)) { q(h.cloneNode(true)); l(h); return; } if (c(d)) { q(h.cloneNode(true)); if (!b(h)) { i(h); } return; } if (s(d)) { a(h); return; } })();