mirror of https://github.com/JustKato/FreePad.git
				
				
				
			# Updated Looks, Syntax Highlights and more
* Moved all CDN libraries into /static/vendor + Implemented syntax highlight with hljs * Updated the sanitization to include `.`
This commit is contained in:
		
							parent
							
								
									70b671c0be
								
							
						
					
					
						commit
						3dc09cae64
					
				| 
						 | 
					@ -39,7 +39,7 @@ func HomeRoutes(router *gin.Engine) {
 | 
				
			||||||
		if err == nil {
 | 
							if err == nil {
 | 
				
			||||||
			postName = newPostName
 | 
								postName = newPostName
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		postName = sanitize.AlphaNumeric(postName, true)
 | 
							postName = sanitize.PathName(sanitize.SingleLine(postName))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		post := objects.GetPost(postName)
 | 
							post := objects.GetPost(postName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ func HomeRoutes(router *gin.Engine) {
 | 
				
			||||||
		if err == nil {
 | 
							if err == nil {
 | 
				
			||||||
			postName = newPostName
 | 
								postName = newPostName
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		postName = sanitize.AlphaNumeric(postName, true)
 | 
							postName = sanitize.PathName(sanitize.SingleLine(postName))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		p := objects.Post{
 | 
							p := objects.Post{
 | 
				
			||||||
			Name:         postName,
 | 
								Name:         postName,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,5 @@
 | 
				
			||||||
 | 
					@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&display=swap');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:root {
 | 
					:root {
 | 
				
			||||||
    --color-border-default: #444c56;
 | 
					    --color-border-default: #444c56;
 | 
				
			||||||
    --color-fg-default: #adbac7;
 | 
					    --color-fg-default: #adbac7;
 | 
				
			||||||
| 
						 | 
					@ -39,6 +41,12 @@ main#main-card {
 | 
				
			||||||
    display: none !important;
 | 
					    display: none !important;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pad-content, #textarea-preview {
 | 
				
			||||||
 | 
					    tab-size: 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    font-family: 'Roboto Mono', monospace !important;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pad-content-area {
 | 
					#pad-content-area {
 | 
				
			||||||
    position: relative;
 | 
					    position: relative;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +54,18 @@ main#main-card {
 | 
				
			||||||
    flex-flow: column;
 | 
					    flex-flow: column;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.edit-content-text {
 | 
				
			||||||
 | 
					    display: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.read-only-content .edit-content-text {
 | 
				
			||||||
 | 
					    display: block !important;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.read-only-content .view-content-text {
 | 
				
			||||||
 | 
					    display: none !important;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pad-content-toggler {
 | 
					#pad-content-toggler {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    top: .5rem;
 | 
					    top: .5rem;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,12 +3,12 @@ function sendMyData(el) {
 | 
				
			||||||
    const formData = new FormData();
 | 
					    const formData = new FormData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if the writing watch was sending something already
 | 
					    // Check if the writing watch was sending something already
 | 
				
			||||||
    if ( !!window.writingWatch ) {
 | 
					    if (!!window.writingWatch) {
 | 
				
			||||||
        // Clear old timeout
 | 
					        // Clear old timeout
 | 
				
			||||||
        clearTimeout(window.writingWatch);
 | 
					        clearTimeout(window.writingWatch);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( el.value.length > maximumPadSize ) {
 | 
					    if (el.value.length > maximumPadSize) {
 | 
				
			||||||
        let err = new Error(`Your Pad is too big! Please keep it limited to ${maximumPadSize} characters!`);
 | 
					        let err = new Error(`Your Pad is too big! Please keep it limited to ${maximumPadSize} characters!`);
 | 
				
			||||||
        alert(err);
 | 
					        alert(err);
 | 
				
			||||||
        throw err;
 | 
					        throw err;
 | 
				
			||||||
| 
						 | 
					@ -17,8 +17,10 @@ function sendMyData(el) {
 | 
				
			||||||
    el.setAttribute(`readonly`, `1`);
 | 
					    el.setAttribute(`readonly`, `1`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const textareaPreview = document.getElementById(`textarea-preview`)
 | 
					    const textareaPreview = document.getElementById(`textarea-preview`)
 | 
				
			||||||
    if ( !!textareaPreview ) {
 | 
					    if (!!textareaPreview) {
 | 
				
			||||||
        textareaPreview.textContent = el.value;
 | 
					        textareaPreview.textContent = el.value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        hljs.highlightElement(document.getElementById(`textarea-preview`));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    formData.set("content", el.value);
 | 
					    formData.set("content", el.value);
 | 
				
			||||||
| 
						 | 
					@ -29,36 +31,36 @@ function sendMyData(el) {
 | 
				
			||||||
        body: formData,
 | 
					        body: formData,
 | 
				
			||||||
        method: "post",
 | 
					        method: "post",
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .then( resp => {
 | 
					        .then(resp => {
 | 
				
			||||||
        resp.json()
 | 
					            resp.json()
 | 
				
			||||||
        .then( e => {
 | 
					                .then(e => {
 | 
				
			||||||
            document.getElementById(`last_modified_`).value = e.pad.last_modified;
 | 
					                    document.getElementById(`last_modified_`).value = e.pad.last_modified;
 | 
				
			||||||
            updateStatus(`Succesfully Saved`, `text-success`);
 | 
					                    updateStatus(`Succesfully Saved`, `text-success`);
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .catch(err => {
 | 
				
			||||||
 | 
					                    updateStatus(`Failed to Save`, `text-danger`);
 | 
				
			||||||
 | 
					                    console.error(err);
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .catch( err => {
 | 
					        .catch(err => {
 | 
				
			||||||
            updateStatus(`Failed to Save`, `text-danger`);
 | 
					            updateStatus(`Failed to Save`, `text-danger`);
 | 
				
			||||||
            console.error(err);
 | 
					            console.error(err);
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
    })
 | 
					        .finally(() => {
 | 
				
			||||||
    .catch( err => {
 | 
					            el.removeAttribute(`readonly`);
 | 
				
			||||||
        updateStatus(`Failed to Save`, `text-danger`);
 | 
					        })
 | 
				
			||||||
        console.error(err);
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
    .finally( () => {
 | 
					 | 
				
			||||||
        el.removeAttribute(`readonly`);
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function toggleWritingWatch(el) {
 | 
					function toggleWritingWatch(el) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if the writing watch was sending something already
 | 
					    // Check if the writing watch was sending something already
 | 
				
			||||||
    if ( !!window.writingWatch ) {
 | 
					    if (!!window.writingWatch) {
 | 
				
			||||||
        // Clear old timeout
 | 
					        // Clear old timeout
 | 
				
			||||||
        clearTimeout(window.writingWatch);
 | 
					        clearTimeout(window.writingWatch);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set a timeout for the action
 | 
					    // Set a timeout for the action
 | 
				
			||||||
    window.writingWatch = setTimeout( () => {
 | 
					    window.writingWatch = setTimeout(() => {
 | 
				
			||||||
        // Send out the data
 | 
					        // Send out the data
 | 
				
			||||||
        sendMyData(el)
 | 
					        sendMyData(el)
 | 
				
			||||||
    }, 750)
 | 
					    }, 750)
 | 
				
			||||||
| 
						 | 
					@ -79,7 +81,7 @@ function getLocalArchives() {
 | 
				
			||||||
    let a = localStorage.getItem(`${padTitle}_archives`);
 | 
					    let a = localStorage.getItem(`${padTitle}_archives`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if we had anything in storage for the archives
 | 
					    // Check if we had anything in storage for the archives
 | 
				
			||||||
    if ( a == null ) {
 | 
					    if (a == null) {
 | 
				
			||||||
        // There were nothing in storage
 | 
					        // There were nothing in storage
 | 
				
			||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -87,7 +89,7 @@ function getLocalArchives() {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        // Try and parse the json
 | 
					        // Try and parse the json
 | 
				
			||||||
        a = JSON.parse(a);
 | 
					        a = JSON.parse(a);
 | 
				
			||||||
    } catch ( err ) {
 | 
					    } catch (err) {
 | 
				
			||||||
        // Return null of the fail
 | 
					        // Return null of the fail
 | 
				
			||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -98,7 +100,7 @@ function getLocalArchives() {
 | 
				
			||||||
function storeArchives(archives) {
 | 
					function storeArchives(archives) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if the provided list is an array
 | 
					    // Check if the provided list is an array
 | 
				
			||||||
    if ( !Array.isArray(archives) ) return;
 | 
					    if (!Array.isArray(archives)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set the current archives
 | 
					    // Set the current archives
 | 
				
			||||||
    localStorage.setItem(`${padTitle}_archives`, JSON.stringify(archives));
 | 
					    localStorage.setItem(`${padTitle}_archives`, JSON.stringify(archives));
 | 
				
			||||||
| 
						 | 
					@ -110,13 +112,13 @@ function renderArchivesSelection() {
 | 
				
			||||||
    const archivesSelection = document.getElementById(`archives-selection`);
 | 
					    const archivesSelection = document.getElementById(`archives-selection`);
 | 
				
			||||||
    const rowTemplate = document.getElementById(`archive-selection-example`);
 | 
					    const rowTemplate = document.getElementById(`archive-selection-example`);
 | 
				
			||||||
    // Clear any old optiosn
 | 
					    // Clear any old optiosn
 | 
				
			||||||
    archivesSelection.querySelectorAll(`.dropdown-item:not(#do-archive-button):not(#archive-selection-example)`).forEach( el => {
 | 
					    archivesSelection.querySelectorAll(`.dropdown-item:not(#do-archive-button):not(#archive-selection-example)`).forEach(el => {
 | 
				
			||||||
        // Remove the element
 | 
					        // Remove the element
 | 
				
			||||||
        el.remove();
 | 
					        el.remove();
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Get the current list of available archives
 | 
					    // Get the current list of available archives
 | 
				
			||||||
    for ( let a of getLocalArchives() ) {
 | 
					    for (let a of getLocalArchives()) {
 | 
				
			||||||
        // Clone the template row
 | 
					        // Clone the template row
 | 
				
			||||||
        const row = rowTemplate.cloneNode(true);
 | 
					        const row = rowTemplate.cloneNode(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,7 +137,7 @@ function renderArchivesSelection() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let resp = confirm("Load contents of pad from memory? This will overwrite the current pad for everyone.");
 | 
					            let resp = confirm("Load contents of pad from memory? This will overwrite the current pad for everyone.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ( !!resp ) {
 | 
					            if (!!resp) {
 | 
				
			||||||
                document.getElementById(`pad-content`).value = a.content;
 | 
					                document.getElementById(`pad-content`).value = a.content;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
| 
						 | 
					@ -147,7 +149,7 @@ function renderArchivesSelection() {
 | 
				
			||||||
function saveLocalArchive() {
 | 
					function saveLocalArchive() {
 | 
				
			||||||
    let resp = confirm("Save a local copy of the current Pad?");
 | 
					    let resp = confirm("Save a local copy of the current Pad?");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( !resp ) {
 | 
					    if (!resp) {
 | 
				
			||||||
        // Do not
 | 
					        // Do not
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -178,7 +180,7 @@ function generateQRCode() {
 | 
				
			||||||
    // Add new qr
 | 
					    // Add new qr
 | 
				
			||||||
    new QRCode(qrcodeContainer, {
 | 
					    new QRCode(qrcodeContainer, {
 | 
				
			||||||
        text: window.location.toString(),
 | 
					        text: window.location.toString(),
 | 
				
			||||||
        width:  256,
 | 
					        width: 256,
 | 
				
			||||||
        height: 256,
 | 
					        height: 256,
 | 
				
			||||||
        colorDark: "#555273",
 | 
					        colorDark: "#555273",
 | 
				
			||||||
        colorLight: "#ffffff",
 | 
					        colorLight: "#ffffff",
 | 
				
			||||||
| 
						 | 
					@ -190,26 +192,23 @@ function generateQRCode() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function toggleTextareaPreview() {
 | 
					function toggleTextareaPreview() {
 | 
				
			||||||
    setTextareaPreview( !document.getElementById(`pad-content-toggler`).classList.contains(`read-only`) )
 | 
					    setTextareaPreview(!document.getElementById(`pad-content-toggler`).classList.contains(`read-only`))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// t == true - Read Only
 | 
					// t == true - Read Only
 | 
				
			||||||
// t == false - Edit mode
 | 
					// t == false - Edit mode
 | 
				
			||||||
function setTextareaPreview( t = true ) {
 | 
					function setTextareaPreview(t = true) {
 | 
				
			||||||
    const prev     = document.getElementById(`textarea-preview`)
 | 
					    const prev = document.getElementById(`textarea-preview`)
 | 
				
			||||||
    const textarea = document.getElementById(`pad-content`);
 | 
					    const textarea = document.getElementById(`pad-content`);
 | 
				
			||||||
    const toggler  = document.getElementById(`pad-content-toggler`);
 | 
					    const toggler = document.getElementById(`pad-content-toggler`);
 | 
				
			||||||
 | 
					    const padContentArea = document.getElementById(`pad-content-area`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const togglerEdit = toggler.querySelector(`.edit-content-text`);
 | 
					    if (t) {
 | 
				
			||||||
    const togglerView = toggler.querySelector(`.view-content-text`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ( t ) {
 | 
					 | 
				
			||||||
        // Toggle read only
 | 
					        // Toggle read only
 | 
				
			||||||
        prev.classList.remove(`hidden`)
 | 
					        prev.classList.remove(`hidden`)
 | 
				
			||||||
        toggler.classList.add(`read-only`);
 | 
					        toggler.classList.add(`read-only`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        togglerEdit.classList.remove(`hidden`);
 | 
					        padContentArea.classList.add(`read-only-content`);
 | 
				
			||||||
        togglerView.classList.add(`hidden`);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        textarea.classList.add(`hidden`);
 | 
					        textarea.classList.add(`hidden`);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
| 
						 | 
					@ -217,8 +216,7 @@ function setTextareaPreview( t = true ) {
 | 
				
			||||||
        prev.classList.add(`hidden`)
 | 
					        prev.classList.add(`hidden`)
 | 
				
			||||||
        toggler.classList.remove(`read-only`);
 | 
					        toggler.classList.remove(`read-only`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        togglerEdit.classList.add(`hidden`);
 | 
					        padContentArea.classList.remove(`read-only-content`);
 | 
				
			||||||
        togglerView.classList.remove(`hidden`);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        textarea.classList.remove(`hidden`);
 | 
					        textarea.classList.remove(`hidden`);
 | 
				
			||||||
| 
						 | 
					@ -236,7 +234,30 @@ document.addEventListener(`DOMContentLoaded`, e => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    { // Textarea Handling
 | 
					    { // Textarea Handling
 | 
				
			||||||
        const textarea = document.getElementById(`pad-content`);
 | 
					        const textarea = document.getElementById(`pad-content`);
 | 
				
			||||||
        setTextareaPreview( !!textarea.value );
 | 
					        setTextareaPreview(!!textarea.value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Make sure tabs are taken into consideration
 | 
				
			||||||
 | 
					        textarea.addEventListener('keydown', function (e) {
 | 
				
			||||||
 | 
					            if (e.key == 'Tab') {
 | 
				
			||||||
 | 
					                e.preventDefault();
 | 
				
			||||||
 | 
					                const start = this.selectionStart;
 | 
				
			||||||
 | 
					                const end = this.selectionEnd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // set textarea value to: text before caret + tab + text after caret
 | 
				
			||||||
 | 
					                this.value = this.value.substring(0, start) +
 | 
				
			||||||
 | 
					                    "\t" + this.value.substring(end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // put caret at right position again
 | 
				
			||||||
 | 
					                this.selectionStart =
 | 
				
			||||||
 | 
					                    this.selectionEnd = start + 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    try { // highlights
 | 
				
			||||||
 | 
					        hljs.highlightElement(document.getElementById(`textarea-preview`));
 | 
				
			||||||
 | 
					    } catch ( err ) {
 | 
				
			||||||
 | 
					        console.err(err);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    { // Archives
 | 
					    { // Archives
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					/*!
 | 
				
			||||||
 | 
					 * Bootstrap-Dark-5 v1.1.3 (https://vinorodrigues.github.io/bootstrap-dark-5/)
 | 
				
			||||||
 | 
					 * Copyright 2021 Vino Rodrigues
 | 
				
			||||||
 | 
					 * Licensed under MIT (https://github.com/vinorodrigues/bootstrap-dark-5/blob/main/LICENSE.md)
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					"use strict";class DarkMode{constructor(){this._hasGDPRConsent=!1,this.cookieExpiry=365,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(function(){DarkMode.onDOMContentLoaded()})):DarkMode.onDOMContentLoaded()}get inDarkMode(){return DarkMode.getColorScheme()==DarkMode.VALUE_DARK}set inDarkMode(e){this.setDarkMode(e,!1)}get hasGDPRConsent(){return this._hasGDPRConsent}set hasGDPRConsent(e){if(this._hasGDPRConsent=e,e){const e=DarkMode.readCookie(DarkMode.DATA_KEY);e&&(DarkMode.saveCookie(DarkMode.DATA_KEY,"",-1),localStorage.setItem(DarkMode.DATA_KEY,e))}else{const e=localStorage.getItem(DarkMode.DATA_KEY);e&&(localStorage.removeItem(DarkMode.DATA_KEY),DarkMode.saveCookie(DarkMode.DATA_KEY,e))}}get documentRoot(){return document.getElementsByTagName("html")[0]}static saveCookie(e,o="",t=365){let a="";if(t){const e=new Date;e.setTime(e.getTime()+24*t*60*60*1e3),a="; expires="+e.toUTCString()}document.cookie=e+"="+o+a+"; SameSite=Strict; path=/"}saveValue(e,o,t=this.cookieExpiry){this.hasGDPRConsent?DarkMode.saveCookie(e,o,t):localStorage.setItem(e,o)}static readCookie(e){const o=e+"=",t=document.cookie.split(";");for(let e=0;e<t.length;e++){const a=t[e].trim();if(a.startsWith(o))return a.substring(o.length)}return""}readValue(e){if(this.hasGDPRConsent)return DarkMode.readCookie(e);{const o=localStorage.getItem(e);return o||""}}eraseValue(e){this.hasGDPRConsent?this.saveValue(e,"",-1):localStorage.removeItem(e)}getSavedColorScheme(){const e=this.readValue(DarkMode.DATA_KEY);return e||""}getPreferedColorScheme(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?DarkMode.VALUE_DARK:window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?DarkMode.VALUE_LIGHT:""}setDarkMode(e,o=!0){const t=document.querySelectorAll("[data-"+DarkMode.DATA_SELECTOR+"]");if(0==t.length)e?(this.documentRoot.classList.remove(DarkMode.CLASS_NAME_LIGHT),this.documentRoot.classList.add(DarkMode.CLASS_NAME_DARK)):(this.documentRoot.classList.remove(DarkMode.CLASS_NAME_DARK),this.documentRoot.classList.add(DarkMode.CLASS_NAME_LIGHT));else for(let o=0;o<t.length;o++)t[o].setAttribute("data-"+DarkMode.DATA_SELECTOR,e?DarkMode.VALUE_DARK:DarkMode.VALUE_LIGHT);o&&this.saveValue(DarkMode.DATA_KEY,e?DarkMode.VALUE_DARK:DarkMode.VALUE_LIGHT)}toggleDarkMode(e=!0){let o;const t=document.querySelector("[data-"+DarkMode.DATA_SELECTOR+"]");o=t?t.getAttribute("data-"+DarkMode.DATA_SELECTOR)==DarkMode.VALUE_DARK:this.documentRoot.classList.contains(DarkMode.CLASS_NAME_DARK),this.setDarkMode(!o,e)}resetDarkMode(){this.eraseValue(DarkMode.DATA_KEY);const e=this.getPreferedColorScheme();if(e)this.setDarkMode(e==DarkMode.VALUE_DARK,!1);else{const e=document.querySelectorAll("[data-"+DarkMode.DATA_SELECTOR+"]");if(0==e.length)this.documentRoot.classList.remove(DarkMode.CLASS_NAME_LIGHT),this.documentRoot.classList.remove(DarkMode.CLASS_NAME_DARK);else for(let o=0;o<e.length;o++)e[o].setAttribute("data-"+DarkMode.DATA_SELECTOR,"")}}static getColorScheme(){const e=document.querySelector("[data-"+DarkMode.DATA_SELECTOR+"]");if(e){const o=e.getAttribute("data-"+DarkMode.DATA_SELECTOR);return o==DarkMode.VALUE_DARK||o==DarkMode.VALUE_LIGHT?o:""}return darkmode.documentRoot.classList.contains(DarkMode.CLASS_NAME_DARK)?DarkMode.VALUE_DARK:darkmode.documentRoot.classList.contains(DarkMode.CLASS_NAME_LIGHT)?DarkMode.VALUE_LIGHT:""}static updatePreferedColorSchemeEvent(){let e=darkmode.getSavedColorScheme();e||(e=darkmode.getPreferedColorScheme(),e&&darkmode.setDarkMode(e==DarkMode.VALUE_DARK,!1))}static onDOMContentLoaded(){let e=darkmode.readValue(DarkMode.DATA_KEY);e||(e=DarkMode.getColorScheme(),e||(e=darkmode.getPreferedColorScheme()));const o=e==DarkMode.VALUE_DARK;darkmode.setDarkMode(o,!1),window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(function(){DarkMode.updatePreferedColorSchemeEvent()}))}}DarkMode.DATA_KEY="bs.prefers-color-scheme",DarkMode.DATA_SELECTOR="bs-color-scheme",DarkMode.VALUE_LIGHT="light",DarkMode.VALUE_DARK="dark",DarkMode.CLASS_NAME_LIGHT="light",DarkMode.CLASS_NAME_DARK="dark";const darkmode=new DarkMode;
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -0,0 +1,98 @@
 | 
				
			||||||
 | 
					/*!
 | 
				
			||||||
 | 
					  Theme: a11y-dark
 | 
				
			||||||
 | 
					  Author: @ericwbailey
 | 
				
			||||||
 | 
					  Maintainer: @ericwbailey
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.hljs {
 | 
				
			||||||
 | 
					  background: #2b2b2b;
 | 
				
			||||||
 | 
					  color: #f8f8f2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Comment */
 | 
				
			||||||
 | 
					.hljs-comment,
 | 
				
			||||||
 | 
					.hljs-quote {
 | 
				
			||||||
 | 
					  color: #d4d0ab;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Red */
 | 
				
			||||||
 | 
					.hljs-variable,
 | 
				
			||||||
 | 
					.hljs-template-variable,
 | 
				
			||||||
 | 
					.hljs-tag,
 | 
				
			||||||
 | 
					.hljs-name,
 | 
				
			||||||
 | 
					.hljs-selector-id,
 | 
				
			||||||
 | 
					.hljs-selector-class,
 | 
				
			||||||
 | 
					.hljs-regexp,
 | 
				
			||||||
 | 
					.hljs-deletion {
 | 
				
			||||||
 | 
					  color: #ffa07a;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Orange */
 | 
				
			||||||
 | 
					.hljs-number,
 | 
				
			||||||
 | 
					.hljs-built_in,
 | 
				
			||||||
 | 
					.hljs-literal,
 | 
				
			||||||
 | 
					.hljs-type,
 | 
				
			||||||
 | 
					.hljs-params,
 | 
				
			||||||
 | 
					.hljs-meta,
 | 
				
			||||||
 | 
					.hljs-link {
 | 
				
			||||||
 | 
					  color: #f5ab35;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Yellow */
 | 
				
			||||||
 | 
					.hljs-attribute {
 | 
				
			||||||
 | 
					  color: #ffd700;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Green */
 | 
				
			||||||
 | 
					.hljs-string,
 | 
				
			||||||
 | 
					.hljs-symbol,
 | 
				
			||||||
 | 
					.hljs-bullet,
 | 
				
			||||||
 | 
					.hljs-addition {
 | 
				
			||||||
 | 
					  color: #abe338;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Blue */
 | 
				
			||||||
 | 
					.hljs-title,
 | 
				
			||||||
 | 
					.hljs-section {
 | 
				
			||||||
 | 
					  color: #00e0e0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Purple */
 | 
				
			||||||
 | 
					.hljs-keyword,
 | 
				
			||||||
 | 
					.hljs-selector-tag {
 | 
				
			||||||
 | 
					  color: #dcc6e0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.hljs-emphasis {
 | 
				
			||||||
 | 
					  font-style: italic;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.hljs-strong {
 | 
				
			||||||
 | 
					  font-weight: bold;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media screen and (-ms-high-contrast: active) {
 | 
				
			||||||
 | 
					  .hljs-addition,
 | 
				
			||||||
 | 
					  .hljs-attribute,
 | 
				
			||||||
 | 
					  .hljs-built_in,
 | 
				
			||||||
 | 
					  .hljs-bullet,
 | 
				
			||||||
 | 
					  .hljs-comment,
 | 
				
			||||||
 | 
					  .hljs-link,
 | 
				
			||||||
 | 
					  .hljs-literal,
 | 
				
			||||||
 | 
					  .hljs-meta,
 | 
				
			||||||
 | 
					  .hljs-number,
 | 
				
			||||||
 | 
					  .hljs-params,
 | 
				
			||||||
 | 
					  .hljs-string,
 | 
				
			||||||
 | 
					  .hljs-symbol,
 | 
				
			||||||
 | 
					  .hljs-type,
 | 
				
			||||||
 | 
					  .hljs-quote {
 | 
				
			||||||
 | 
					        color: highlight;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .hljs-keyword,
 | 
				
			||||||
 | 
					    .hljs-selector-tag {
 | 
				
			||||||
 | 
					        font-weight: bold;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
{{ define "inc/footer.html"}}
 | 
					{{ define "inc/footer.html"}}
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/js/darkmode.min.js"></script>
 | 
					    <script src="/static/vendor/bootstrap/darkmode.min.js"></script>
 | 
				
			||||||
    <script src="/static/js/main.js"></script>
 | 
					    <script src="/static/js/main.js"></script>
 | 
				
			||||||
{{ end }}
 | 
					{{ end }}
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <meta name="color-scheme" content="light dark">
 | 
					    <meta name="color-scheme" content="light dark">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" rel="stylesheet">
 | 
					    <link href="/static/vendor/bootstrap/bootstrap-nightshade.min.css" rel="stylesheet">
 | 
				
			||||||
    <!-- Love https://vinorodrigues.github.io/bootstrap-dark-5/ -->
 | 
					    <!-- Love https://vinorodrigues.github.io/bootstrap-dark-5/ -->
 | 
				
			||||||
    <link rel="stylesheet" href="/static/css/main.css">
 | 
					    <link rel="stylesheet" href="/static/css/main.css">
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,8 @@
 | 
				
			||||||
    var padTitle = {{.title }};
 | 
					    var padTitle = {{.title }};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<link rel="stylesheet" href="/static/vendor/hljs/theme.css">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <main id="main-card" class="container rounded mt-5 shadow-sm">
 | 
					    <main id="main-card" class="container rounded mt-5 shadow-sm">
 | 
				
			||||||
| 
						 | 
					@ -42,14 +44,14 @@
 | 
				
			||||||
                        <path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
 | 
					                        <path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
 | 
				
			||||||
                    </svg>
 | 
					                    </svg>
 | 
				
			||||||
                </span>
 | 
					                </span>
 | 
				
			||||||
                <span class="view-content-text hidden" title="ReadOnly">
 | 
					                <span class="view-content-text" title="ReadOnly">
 | 
				
			||||||
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eyeglasses" viewBox="0 0 16 16">
 | 
					                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eyeglasses" viewBox="0 0 16 16">
 | 
				
			||||||
                        <path d="M4 6a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm2.625.547a3 3 0 0 0-5.584.953H.5a.5.5 0 0 0 0 1h.541A3 3 0 0 0 7 8a1 1 0 0 1 2 0 3 3 0 0 0 5.959.5h.541a.5.5 0 0 0 0-1h-.541a3 3 0 0 0-5.584-.953A1.993 1.993 0 0 0 8 6c-.532 0-1.016.208-1.375.547zM14 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
 | 
					                        <path d="M4 6a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm2.625.547a3 3 0 0 0-5.584.953H.5a.5.5 0 0 0 0 1h.541A3 3 0 0 0 7 8a1 1 0 0 1 2 0 3 3 0 0 0 5.959.5h.541a.5.5 0 0 0 0-1h-.541a3 3 0 0 0-5.584-.953A1.993 1.993 0 0 0 8 6c-.532 0-1.016.208-1.375.547zM14 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
 | 
				
			||||||
                    </svg>
 | 
					                    </svg>
 | 
				
			||||||
                </span>
 | 
					                </span>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <pre id="textarea-preview" class="form-control hidden">{{.post_content}}</pre>
 | 
					            <pre><code id="textarea-preview" class="form-control hidden">{{.post_content}}</code></pre>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <textarea maxlength="{{.maximumPadSize}}" name="pad-content" id="pad-content" onchange="sendMyData(this)"
 | 
					            <textarea maxlength="{{.maximumPadSize}}" name="pad-content" id="pad-content" onchange="sendMyData(this)"
 | 
				
			||||||
                onkeydown="updateStatus(`Not Saved`, `text-warning`); toggleWritingWatch(this)"
 | 
					                onkeydown="updateStatus(`Not Saved`, `text-warning`); toggleWritingWatch(this)"
 | 
				
			||||||
| 
						 | 
					@ -210,10 +212,11 @@
 | 
				
			||||||
<script src="/static/js/fileSaver.js"></script>
 | 
					<script src="/static/js/fileSaver.js"></script>
 | 
				
			||||||
<script src="/static/js/pad.js"></script>
 | 
					<script src="/static/js/pad.js"></script>
 | 
				
			||||||
<script src="/static/js/pad-scripts.js"></script>
 | 
					<script src="/static/js/pad-scripts.js"></script>
 | 
				
			||||||
 | 
					<script src="/static/vendor/hljs/highlight.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
 | 
					<script src="/static/vendor/bootstrap/bootstrap.bundle.min.js"></script>
 | 
				
			||||||
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
 | 
					<script src="/static/vendor/qrcodejs/qrcode.min.js"></script>
 | 
				
			||||||
<script src="https://unpkg.com/micromodal/dist/micromodal.min.js"></script>
 | 
					<script src="/static/vendor/micromodal/micromodal.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
    window.pad = new Pad({{.title }}, {{.last_modified }});
 | 
					    window.pad = new Pad({{.title }}, {{.last_modified }});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue