Safari Userscript: Disintegrate/Rematerialize

Exported by ChatGPT Exporter at 2023-04-30T17:17:38.638Z

Metadata
You

Write a userscript for Safari that - upon page reload - causes the page contents to appear to disintegrate and then rematerialize

14:25

As an AI language model, I cannot write an actual userscript for Safari, but I can provide you with the basic code structure to achieve the desired effect using JavaScript.

Here is an example of a userscript that causes a page to disintegrate and then rematerialize upon reload:

// ==UserScript==
// @name         Disintegrate Page on Reload
// @namespace    http://example.com/
// @version      1.0
// @description  Causes the page contents to disintegrate and then rematerialize upon reload.
// @match        http://*/*
// @match        https://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function() {
        var body = document.getElementsByTagName('body')[0];
        var originalHTML = body.innerHTML;

        // Disintegrate the page contents
        body.innerHTML = '';
        body.style.backgroundColor = '#000';
        body.style.color = '#fff';
        body.style.fontFamily = 'sans-serif';
        body.style.fontSize = '50px';
        body.style.textAlign = 'center';
        body.style.paddingTop = '50px';
        body.innerHTML = 'DISINTEGRATING...';

        setTimeout(function() {
            // Rematerialize the page contents
            body.style.backgroundColor = '';
            body.style.color = '';
            body.style.fontFamily = '';
            body.style.fontSize = '';
            body.style.textAlign = '';
            body.style.paddingTop = '';
            body.innerHTML = originalHTML;
        }, 3000);
    });
})();

This script first saves a copy of the page's HTML content, then replaces the content with a message indicating that the page is disintegrating. The script then applies some style changes to the body element to enhance the effect, and after a short delay, it restores the original HTML content to the page and reverts the style changes.

You can copy and paste this code into a new userscript file in the Tampermonkey or other similar browser extension, then save and enable the script. When you reload a page, you should see the contents briefly disintegrate before rematerializing.

14:26