<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=clipthing.html</id>
	<title>clipthing.html - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=clipthing.html"/>
	<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=clipthing.html&amp;action=history"/>
	<updated>2026-05-24T23:58:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.randomness.nu/mediawiki/index.php?title=clipthing.html&amp;diff=83&amp;oldid=prev</id>
		<title>Derg: formatting</title>
		<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=clipthing.html&amp;diff=83&amp;oldid=prev"/>
		<updated>2024-09-18T01:41:36Z</updated>

		<summary type="html">&lt;p&gt;formatting&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:41, 18 September 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l157&quot;&gt;Line 157:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 157:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;lt;/script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;lt;/script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Derg</name></author>
	</entry>
	<entry>
		<id>https://wiki.randomness.nu/mediawiki/index.php?title=clipthing.html&amp;diff=82&amp;oldid=prev</id>
		<title>Derg: Created page with &quot;To try this thing out go to https://kserver.nu/tools/clipthing.php &lt;syntaxhighlight lang=&quot;html&quot;&gt; &lt;!DOCTYPE html&gt; &lt;html&gt;  &lt;head&gt;     &lt;title&gt;ClipThing&lt;/title&gt;     &lt;style&gt;         html {             color: #ffffff;             background-color: #000000;         }          #stuff {             width: 100%;         }          .item {             background-color: #111111;             margin-bottom: 10px;             padding: 5px;             width: 100%;         }          .c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=clipthing.html&amp;diff=82&amp;oldid=prev"/>
		<updated>2024-09-18T01:31:16Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;To try this thing out go to https://kserver.nu/tools/clipthing.php &amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt; &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt;  &amp;lt;head&amp;gt;     &amp;lt;title&amp;gt;ClipThing&amp;lt;/title&amp;gt;     &amp;lt;style&amp;gt;         html {             color: #ffffff;             background-color: #000000;         }          #stuff {             width: 100%;         }          .item {             background-color: #111111;             margin-bottom: 10px;             padding: 5px;             width: 100%;         }          .c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To try this thing out go to https://kserver.nu/tools/clipthing.php&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;ClipThing&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;style&amp;gt;&lt;br /&gt;
        html {&lt;br /&gt;
            color: #ffffff;&lt;br /&gt;
            background-color: #000000;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        #stuff {&lt;br /&gt;
            width: 100%;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        .item {&lt;br /&gt;
            background-color: #111111;&lt;br /&gt;
            margin-bottom: 10px;&lt;br /&gt;
            padding: 5px;&lt;br /&gt;
            width: 100%;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        .content {&lt;br /&gt;
            background-color: #282828;&lt;br /&gt;
        }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
    Paste or drag and drop some text, html or images here&lt;br /&gt;
    &amp;lt;div id=&amp;quot;stuff&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
        function doUpload() {&lt;br /&gt;
            console.log(this.parentNode)&lt;br /&gt;
            let imgs = this.parentNode.parentNode.getElementsByTagName(&amp;#039;img&amp;#039;)&lt;br /&gt;
            let img = imgs[0]&lt;br /&gt;
            console.log(img)&lt;br /&gt;
            var imgdata = img.src.split(&amp;#039;,&amp;#039;, 2)[1]&lt;br /&gt;
            var imgbin = atob(imgdata)&lt;br /&gt;
            var formdata = new FormData()&lt;br /&gt;
            let file = new File([imgbin], &amp;#039;image/png&amp;#039;, { type: &amp;#039;image/png&amp;#039; })&lt;br /&gt;
            formdata.append(&amp;#039;img&amp;#039;, file)&lt;br /&gt;
            fetch(&amp;#039;http://kserver.nu/api/nonexistent.php&amp;#039;, {&lt;br /&gt;
                method: &amp;#039;POST&amp;#039;,&lt;br /&gt;
                body: formdata,&lt;br /&gt;
            })&lt;br /&gt;
                .then(d =&amp;gt; d.text())&lt;br /&gt;
                .then(d =&amp;gt; {&lt;br /&gt;
                    console.log(d)&lt;br /&gt;
                    let el = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                    el.classList.add(&amp;#039;item&amp;#039;)&lt;br /&gt;
                    el.style.whiteSpace = &amp;#039;pre&amp;#039;&lt;br /&gt;
                    el.textContent = d&lt;br /&gt;
                    append(el)&lt;br /&gt;
                })&lt;br /&gt;
        }&lt;br /&gt;
        function onDataTransfer(data) {&lt;br /&gt;
            let items = data.items&lt;br /&gt;
            var selected = null;&lt;br /&gt;
            var itemtype = null;&lt;br /&gt;
            var ignorerest = false;&lt;br /&gt;
            for (let i = 0; i &amp;lt; items.length; i++) {&lt;br /&gt;
                let item = items[i]&lt;br /&gt;
                let type = item.type&lt;br /&gt;
                console.log(item)&lt;br /&gt;
                if (ignorerest) continue&lt;br /&gt;
                // Select whatever appears the first time&lt;br /&gt;
                if (selected === null) {&lt;br /&gt;
                    selected = item&lt;br /&gt;
                    itemtype = type&lt;br /&gt;
                    continue&lt;br /&gt;
                }&lt;br /&gt;
                // If there ever is an image we want it&lt;br /&gt;
                if (type.indexOf(&amp;#039;image/&amp;#039;) === 0) {&lt;br /&gt;
                    selected = item&lt;br /&gt;
                    itemtype = type&lt;br /&gt;
                    ignorerest = true&lt;br /&gt;
                    continue&lt;br /&gt;
                }&lt;br /&gt;
                // We want HTML if there is anything over text and alike&lt;br /&gt;
                if (selected !== &amp;#039;text/html&amp;#039; &amp;amp;&amp;amp; type === &amp;#039;text/html&amp;#039;) {&lt;br /&gt;
                    selected = item&lt;br /&gt;
                    itemtype = type&lt;br /&gt;
                }&lt;br /&gt;
                //item.getAsString(d =&amp;gt; console.log(d))&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (itemtype.indexOf(&amp;#039;image/&amp;#039;) === 0) {&lt;br /&gt;
                var a = selected.getAsFile()&lt;br /&gt;
                console.log(&amp;#039;file&amp;#039;, itemtype, a)&lt;br /&gt;
                let f = new FileReader()&lt;br /&gt;
                f.readAsDataURL(a)&lt;br /&gt;
                f.onload = () =&amp;gt; {&lt;br /&gt;
                    let el = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                    el.classList.add(&amp;#039;item&amp;#039;)&lt;br /&gt;
                    let info = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                    info.classList.add(&amp;#039;info&amp;#039;)&lt;br /&gt;
                    let typ = document.createElement(&amp;#039;span&amp;#039;)&lt;br /&gt;
                    typ.textContent = itemtype&lt;br /&gt;
                    info.append(typ)&lt;br /&gt;
                    el.append(info)&lt;br /&gt;
                    btn = document.createElement(&amp;#039;button&amp;#039;)&lt;br /&gt;
                    btn.textContent = &amp;#039;Upload&amp;#039;&lt;br /&gt;
                    btn.onclick = doUpload&lt;br /&gt;
                    info.append(btn)&lt;br /&gt;
                    let img = document.createElement(&amp;#039;img&amp;#039;)&lt;br /&gt;
                    img.src = f.result&lt;br /&gt;
                    el.append(img)&lt;br /&gt;
                    append(el)&lt;br /&gt;
                }&lt;br /&gt;
            } else {&lt;br /&gt;
                let el = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                el.classList.add(&amp;#039;item&amp;#039;)&lt;br /&gt;
                let info = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                info.classList.add(&amp;#039;info&amp;#039;)&lt;br /&gt;
                let typ = document.createElement(&amp;#039;span&amp;#039;)&lt;br /&gt;
                typ.textContent = itemtype&lt;br /&gt;
                info.append(typ)&lt;br /&gt;
                el.append(info)&lt;br /&gt;
                let content = document.createElement(&amp;#039;div&amp;#039;)&lt;br /&gt;
                content.classList.add(&amp;#039;content&amp;#039;)&lt;br /&gt;
                el.append(content)&lt;br /&gt;
                console.log(&amp;#039;string&amp;#039;, itemtype)&lt;br /&gt;
                if (itemtype === &amp;#039;text/html&amp;#039;) {&lt;br /&gt;
                    selected.getAsString(d =&amp;gt; {&lt;br /&gt;
                        content.innerHTML = d&lt;br /&gt;
                        append(el)&lt;br /&gt;
                    })&lt;br /&gt;
                } else {&lt;br /&gt;
                    selected.getAsString(d =&amp;gt; {&lt;br /&gt;
                        el.style.whiteSpace = &amp;#039;pre&amp;#039;&lt;br /&gt;
                        content.textContent = d&lt;br /&gt;
                        append(el)&lt;br /&gt;
                    })&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        function onPaste(e) {&lt;br /&gt;
            onDataTransfer(e.clipboardData);&lt;br /&gt;
        }&lt;br /&gt;
        function onDragover(e) {&lt;br /&gt;
            e.preventDefault()&lt;br /&gt;
        }&lt;br /&gt;
        function onDrop(e) {&lt;br /&gt;
            e.preventDefault()&lt;br /&gt;
            onDataTransfer(e.dataTransfer)&lt;br /&gt;
        }&lt;br /&gt;
        function append(elem) {&lt;br /&gt;
            stuff.insertBefore(elem, stuff.firstChild)&lt;br /&gt;
        }&lt;br /&gt;
        var stuff = document.getElementById(&amp;#039;stuff&amp;#039;)&lt;br /&gt;
        document.addEventListener(&amp;#039;paste&amp;#039;, onPaste)&lt;br /&gt;
        document.addEventListener(&amp;#039;dragover&amp;#039;, onDragover)&lt;br /&gt;
        document.addEventListener(&amp;#039;drop&amp;#039;, onDrop)&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Derg</name></author>
	</entry>
</feed>