Skip to content

Instantly share code, notes, and snippets.

@PedroHLC
Last active February 24, 2026 16:32
Show Gist options
  • Select an option

  • Save PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb to your computer and use it in GitHub Desktop.

Select an option

Save PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb to your computer and use it in GitHub Desktop.

Revisions

  1. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.12
    // @version 1.0.13
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -12,12 +12,11 @@
    // ==/UserScript==

    (function() {
    // Disable Turbo Drive when it initializes
    // Disable Turbo Drive when it initializes (but don't disconnect — breaks previews)
    Object.defineProperty(window, 'Turbo', {
    set(val) {
    if (val?.session) {
    val.session.drive = false;
    val.session.disconnect();
    }
    this._Turbo = val;
    },
  2. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.11
    // @version 1.0.12
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -43,13 +43,12 @@
    e.preventDefault();
    });

    // Strip turbo-frame targeting so clicks become normal navigations
    // Only disable the main navigation turbo-frame, leave others alone
    new MutationObserver(() => {
    document.querySelectorAll('[data-turbo-frame]').forEach(el => {
    document.querySelectorAll('[data-turbo-frame="repo-content-turbo-frame"]').forEach(el => {
    el.removeAttribute('data-turbo-frame');
    });
    document.querySelectorAll('turbo-frame').forEach(f => {
    f.setAttribute('disabled', '');
    });
    const navFrame = document.getElementById('repo-content-turbo-frame');
    if (navFrame) navFrame.setAttribute('disabled', '');
    }).observe(document.documentElement, { childList: true, subtree: true });
    })();
  3. PedroHLC revised this gist Feb 24, 2026. No changes.
  4. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 24 additions and 88 deletions.
    112 changes: 24 additions & 88 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.10
    // @version 1.0.11
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -12,108 +12,44 @@
    // ==/UserScript==

    (function() {
    // GitHub checks this meta tag natively
    const meta = document.createElement('meta');
    meta.name = 'disable-turbo';
    meta.content = 'true';

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
    meta2.name = 'turbo-visit-control';
    meta2.content = 'reload';

    // Insert meta tags into <head> once it exists
    new MutationObserver((_, obs) => {
    if (document.head) {
    document.head.prepend(meta2);
    document.head.prepend(meta);
    obs.disconnect();
    }
    }).observe(document.documentElement, { childList: true });

    // After Turbo boots, just disconnect it entirely
    document.addEventListener('turbo:load', function() {
    if (window.Turbo?.session) {
    window.Turbo.session.drive = false;
    window.Turbo.session.disconnect();
    }
    }, { once: true });

    // Intercept Turbo navigations
    document.addEventListener('turbo:before-visit', function(e) {
    e.preventDefault();
    window.location.href = e.detail.url;
    });

    document.addEventListener('turbo:before-fetch-request', function(e) {
    const frame = e.target.closest('turbo-frame');
    if (frame) {
    e.preventDefault();
    const url = e.detail.url?.href || e.detail.url;
    if (url) window.location.href = url;
    }
    });

    // Intercepts renders
    document.addEventListener('turbo:before-render', function(e) {
    // Patch the incoming page before it gets rendered
    const newBody = e.detail.newBody;
    if (newBody) {
    newBody.querySelectorAll?.('meta[name="disable-turbo"]').forEach(m => {
    m.content = 'true';
    });
    }

    // Also patch the new head if available
    const newHead = e.detail.newHead;
    if (newHead) {
    newHead.querySelectorAll?.('meta[name="disable-turbo"]').forEach(m => {
    m.content = 'true';
    });
    }
    });


    // Kill prefetch
    document.addEventListener('turbo:before-prefetch', function(e) {
    e.preventDefault();
    });

    // Disable Turbo.session.drive when it initializes
    // Disable Turbo Drive when it initializes
    Object.defineProperty(window, 'Turbo', {
    set(val) {
    if (val && val.session) {
    if (val?.session) {
    val.session.drive = false;
    val.session.disconnect();
    }
    this._Turbo = val;
    },
    get() { return this._Turbo; },
    configurable: true
    });

    // Nuclear: make ANY meta[name=disable-turbo] always report "true"
    // Make disable-turbo meta always report true when read
    const origGetAttribute = HTMLMetaElement.prototype.getAttribute;
    HTMLMetaElement.prototype.getAttribute = function(name) {
    if (name === 'content' && this.name === 'disable-turbo') {
    return 'true';
    }
    if (name === 'content' && this.name === 'disable-turbo') return 'true';
    return origGetAttribute.call(this, name);
    };

    // Also trap the .content property getter
    const contentDesc = Object.getOwnPropertyDescriptor(HTMLMetaElement.prototype, 'content')
    || Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'content')
    || Object.getOwnPropertyDescriptor(Element.prototype, 'content');
    // Intercept Turbo Drive navigations
    document.addEventListener('turbo:before-visit', function(e) {
    e.preventDefault();
    window.location.href = e.detail.url;
    });

    // Kill prefetch
    document.addEventListener('turbo:before-prefetch', function(e) {
    e.preventDefault();
    });

    if (contentDesc) {
    const origGetter = contentDesc.get;
    Object.defineProperty(HTMLMetaElement.prototype, 'content', {
    get() {
    if (this.name === 'disable-turbo') return 'true';
    return origGetter.call(this);
    },
    set: contentDesc.set,
    configurable: true
    // Strip turbo-frame targeting so clicks become normal navigations
    new MutationObserver(() => {
    document.querySelectorAll('[data-turbo-frame]').forEach(el => {
    el.removeAttribute('data-turbo-frame');
    });
    document.querySelectorAll('turbo-frame').forEach(f => {
    f.setAttribute('disabled', '');
    });
    }
    }).observe(document.documentElement, { childList: true, subtree: true });
    })();
  5. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 24 additions and 8 deletions.
    32 changes: 24 additions & 8 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.9
    // @version 1.0.10
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -91,13 +91,29 @@
    configurable: true
    });

    // Intercept any lookup of disable-turbo so it always returns true
    const origQuerySelector = Document.prototype.querySelector;
    Document.prototype.querySelector = function(selector) {
    const result = origQuerySelector.call(this, selector);
    if (result?.tagName === 'META' && result?.name === 'disable-turbo') {
    result.content = 'true';
    // Nuclear: make ANY meta[name=disable-turbo] always report "true"
    const origGetAttribute = HTMLMetaElement.prototype.getAttribute;
    HTMLMetaElement.prototype.getAttribute = function(name) {
    if (name === 'content' && this.name === 'disable-turbo') {
    return 'true';
    }
    return result;
    return origGetAttribute.call(this, name);
    };

    // Also trap the .content property getter
    const contentDesc = Object.getOwnPropertyDescriptor(HTMLMetaElement.prototype, 'content')
    || Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'content')
    || Object.getOwnPropertyDescriptor(Element.prototype, 'content');

    if (contentDesc) {
    const origGetter = contentDesc.get;
    Object.defineProperty(HTMLMetaElement.prototype, 'content', {
    get() {
    if (this.name === 'disable-turbo') return 'true';
    return origGetter.call(this);
    },
    set: contentDesc.set,
    configurable: true
    });
    }
    })();
  6. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 9 additions and 10 deletions.
    19 changes: 9 additions & 10 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.8
    // @version 1.0.9
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -91,14 +91,13 @@
    configurable: true
    });

    // Flip GitHub's own disable-turbo meta to true
    new MutationObserver((mutations) => {
    for (const m of mutations) {
    for (const node of m.addedNodes) {
    if (node.nodeType === 1 && node.tagName === 'META' && node.name === 'disable-turbo') {
    node.content = 'true';
    }
    }
    // Intercept any lookup of disable-turbo so it always returns true
    const origQuerySelector = Document.prototype.querySelector;
    Document.prototype.querySelector = function(selector) {
    const result = origQuerySelector.call(this, selector);
    if (result?.tagName === 'META' && result?.name === 'disable-turbo') {
    result.content = 'true';
    }
    }).observe(document.documentElement, { childList: true, subtree: true });
    return result;
    };
    })();
  7. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 21 additions and 1 deletion.
    22 changes: 21 additions & 1 deletion github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.7
    // @version 1.0.8
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -54,6 +54,26 @@
    }
    });

    // Intercepts renders
    document.addEventListener('turbo:before-render', function(e) {
    // Patch the incoming page before it gets rendered
    const newBody = e.detail.newBody;
    if (newBody) {
    newBody.querySelectorAll?.('meta[name="disable-turbo"]').forEach(m => {
    m.content = 'true';
    });
    }

    // Also patch the new head if available
    const newHead = e.detail.newHead;
    if (newHead) {
    newHead.querySelectorAll?.('meta[name="disable-turbo"]').forEach(m => {
    m.content = 'true';
    });
    }
    });


    // Kill prefetch
    document.addEventListener('turbo:before-prefetch', function(e) {
    e.preventDefault();
  8. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.6
    // @version 1.0.7
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -22,7 +22,7 @@
    meta2.name = 'turbo-visit-control';
    meta2.content = 'reload';

    // Prevent changes
    // Insert meta tags into <head> once it exists
    new MutationObserver((_, obs) => {
    if (document.head) {
    document.head.prepend(meta2);
  9. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.5
    // @version 1.0.6
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -70,4 +70,15 @@
    get() { return this._Turbo; },
    configurable: true
    });

    // Flip GitHub's own disable-turbo meta to true
    new MutationObserver((mutations) => {
    for (const m of mutations) {
    for (const node of m.addedNodes) {
    if (node.nodeType === 1 && node.tagName === 'META' && node.name === 'disable-turbo') {
    node.content = 'true';
    }
    }
    }
    }).observe(document.documentElement, { childList: true, subtree: true });
    })();
  10. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.4
    // @version 1.0.5
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -16,13 +16,20 @@
    const meta = document.createElement('meta');
    meta.name = 'disable-turbo';
    meta.content = 'true';
    document.documentElement.appendChild(meta);

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
    meta2.name = 'turbo-visit-control';
    meta2.content = 'reload';
    document.documentElement.appendChild(meta2);

    // Prevent changes
    new MutationObserver((_, obs) => {
    if (document.head) {
    document.head.prepend(meta2);
    document.head.prepend(meta);
    obs.disconnect();
    }
    }).observe(document.documentElement, { childList: true });

    // After Turbo boots, just disconnect it entirely
    document.addEventListener('turbo:load', function() {
  11. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.3
    // @version 1.0.4
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -37,6 +37,15 @@
    e.preventDefault();
    window.location.href = e.detail.url;
    });

    document.addEventListener('turbo:before-fetch-request', function(e) {
    const frame = e.target.closest('turbo-frame');
    if (frame) {
    e.preventDefault();
    const url = e.detail.url?.href || e.detail.url;
    if (url) window.location.href = url;
    }
    });

    // Kill prefetch
    document.addEventListener('turbo:before-prefetch', function(e) {
  12. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 9 additions and 10 deletions.
    19 changes: 9 additions & 10 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.2
    // @version 1.0.3
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -18,21 +18,20 @@
    meta.content = 'true';
    document.documentElement.appendChild(meta);

    // Override meta element's content property for disable-turbo
    const originalSetAttribute = Element.prototype.setAttribute;
    Element.prototype.setAttribute = function(name, value) {
    if (this.tagName === 'META' && this.name === 'disable-turbo' && name === 'content') {
    return originalSetAttribute.call(this, name, 'true');
    }
    return originalSetAttribute.call(this, name, value);
    };

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
    meta2.name = 'turbo-visit-control';
    meta2.content = 'reload';
    document.documentElement.appendChild(meta2);

    // After Turbo boots, just disconnect it entirely
    document.addEventListener('turbo:load', function() {
    if (window.Turbo?.session) {
    window.Turbo.session.drive = false;
    window.Turbo.session.disconnect();
    }
    }, { once: true });

    // Intercept Turbo navigations
    document.addEventListener('turbo:before-visit', function(e) {
    e.preventDefault();
  13. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 8 additions and 10 deletions.
    18 changes: 8 additions & 10 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.1
    // @version 1.0.2
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    @@ -18,16 +18,14 @@
    meta.content = 'true';
    document.documentElement.appendChild(meta);

    // Watch for GitHub's disable-turbo meta tag and flip it to true
    new MutationObserver((mutations) => {
    for (const m of mutations) {
    for (const node of m.addedNodes) {
    if (node.nodeType === 1 && node.tagName === 'META' && node.name === 'disable-turbo') {
    node.content = 'true';
    }
    }
    // Override meta element's content property for disable-turbo
    const originalSetAttribute = Element.prototype.setAttribute;
    Element.prototype.setAttribute = function(name, value) {
    if (this.tagName === 'META' && this.name === 'disable-turbo' && name === 'content') {
    return originalSetAttribute.call(this, name, 'true');
    }
    }).observe(document.documentElement, { childList: true, subtree: true });
    return originalSetAttribute.call(this, name, value);
    };

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
  14. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.0
    // @version 1.0.1
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
  15. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,17 @@
    meta.content = 'true';
    document.documentElement.appendChild(meta);

    // Watch for GitHub's disable-turbo meta tag and flip it to true
    new MutationObserver((mutations) => {
    for (const m of mutations) {
    for (const node of m.addedNodes) {
    if (node.nodeType === 1 && node.tagName === 'META' && node.name === 'disable-turbo') {
    node.content = 'true';
    }
    }
    }
    }).observe(document.documentElement, { childList: true, subtree: true });

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
    meta2.name = 'turbo-visit-control';
  16. PedroHLC revised this gist Feb 24, 2026. 1 changed file with 48 additions and 1 deletion.
    49 changes: 48 additions & 1 deletion github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,49 @@
    // ==UserScript==
    // ==/UserScript==
    // @name Disable Turbo on GitHub
    // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
    // @version 1.0.0
    // @author PedroHLC, Claude
    // @description Completely disables Turbo Drive on GitHub
    // @match https://github.com/*
    // @run-at document-start
    // @grant none
    // @updateURL https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb/raw/github-nuke-turbo.user.js
    // @downloadURL https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb/raw/github-nuke-turbo.user.js
    // ==/UserScript==

    (function() {
    // GitHub checks this meta tag natively
    const meta = document.createElement('meta');
    meta.name = 'disable-turbo';
    meta.content = 'true';
    document.documentElement.appendChild(meta);

    // Belt-and-suspenders: also set the standard turbo visit control
    const meta2 = document.createElement('meta');
    meta2.name = 'turbo-visit-control';
    meta2.content = 'reload';
    document.documentElement.appendChild(meta2);

    // Intercept Turbo navigations
    document.addEventListener('turbo:before-visit', function(e) {
    e.preventDefault();
    window.location.href = e.detail.url;
    });

    // Kill prefetch
    document.addEventListener('turbo:before-prefetch', function(e) {
    e.preventDefault();
    });

    // Disable Turbo.session.drive when it initializes
    Object.defineProperty(window, 'Turbo', {
    set(val) {
    if (val && val.session) {
    val.session.drive = false;
    }
    this._Turbo = val;
    },
    get() { return this._Turbo; },
    configurable: true
    });
    })();
  17. PedroHLC created this gist Feb 24, 2026.
    2 changes: 2 additions & 0 deletions github-nuke-turbo.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    // ==UserScript==
    // ==/UserScript==