') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - tomstuart/rubyforge-redirects: Crowdsourced redirects for old RubyForge URLs · GitHub
Skip to content
This repository was archived by the owner on Mar 5, 2019. It is now read-only.

Repository files navigation

Crowdsourced RubyForge redirects

Build Status

RubyForge was taken offline long ago. Many RubyForge-hosted projects have moved their sites elsewhere, but there are plenty of pages on the web which still link to their now-defunct rubyforge.org URLs.

For example, blog posts referencing the Rack specification might link to http://rack.rubyforge.org/doc/SPEC.html, but the correct URL is now http://www.rubydoc.info/github/rack/rack/master/file/SPEC.

This repository contains a simple web application which can accept requests for old RubyForge URLs and permanently redirect them to their new location. It’s deployed on Heroku at http://rubyforge-redirects.herokuapp.com/, where it’s configured to serve all requests for *.rubyforge.org hostnames.

You can take advantage of it right now by adding entries to your /etc/hosts file to point supported *.rubyforge.org hostnames at whatever IP address rubyforge-redirects.herokuapp.com currently resolves to. (I’d hoped to run something like dnsmasq locally to serve a CNAME, but I don’t see an easy way to make that work. Help!)

Why?

Right now all *.rubyforge.org hostnames just go nowhere, which seems a waste. The goal of this app is to accumulate enough redirects that I can convince Ruby Central to point the real rubyforge.org DNS at it, thereby unbreaking all the rubyforge.org links in the wild. (I’d happily transfer ownership of the Heroku app and GitHub repo to Ruby Central in that case, or of course they could choose to run/fork their own.)

Contributing

The main thing this app needs is more redirects. Please contribute redirects by adding examples to the Cucumber feature, making them pass in the Rack app (you should be able to run bundle exec cucumber successfully), and submitting a pull request.

There are also several feature-related issues which you could help with.

Less importantly, the current implementation uses Rack::Rewrite and is extremently rudimentary; please feel free to improve upon it.

About

Crowdsourced redirects for old RubyForge URLs

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages