Skip to content

Commit

Permalink
fix: remove duplicate meta* headers
Browse files Browse the repository at this point in the history
  • Loading branch information
double-beep committed Oct 14, 2024
1 parent 545939a commit 1cbb29b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 75 deletions.
19 changes: 5 additions & 14 deletions dist/headers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// ==UserScript==
// @name Comment Image Upload
// @namespace userscripters
// @version 0.2.0
// @author Oleg Valter <[email protected]>
// @contributors double beep (https://github.com/double-beep)
// @description Userscript for uploading comment images
// @grant none
// @homepage https://github.com/userscripters/comment-image-upload#readme
// @license GPL-3.0-or-later
// @match https://stackoverflow.com/questions/*
// @match https://serverfault.com/questions/*
Expand All @@ -26,18 +26,9 @@
// @match https://ru.meta.stackoverflow.com/questions/*
// @match https://es.stackoverflow.com/questions/*
// @match https://es.meta.stackoverflow.com/questions/*
// @match https://meta.meta.superuser.com/questions/*
// @match https://meta.meta.serverfault.com/questions/*
// @match https://meta.meta.askubuntu.com/questions/*
// @match https://meta.meta.mathoverflow.net/questions/*
// @match https://pt.meta.meta.stackoverflow.com/questions/*
// @match https://meta.meta.stackoverflow.com/questions/*
// @match https://ja.meta.meta.stackoverflow.com/questions/*
// @match https://ru.meta.meta.stackoverflow.com/questions/*
// @match https://es.meta.meta.stackoverflow.com/questions/*
// @namespace userscripters
// @grant none
// @run-at document-body
// @source git+https://github.com/userscripters/comment-image-upload.git
// @supportURL https://github.com/userscripters/comment-image-upload/issues
// @version 0.2.0
// @source git+https://github.com/userscripters/comment-image-upload.git
// @homepage https://github.com/userscripters/comment-image-upload#readme
// ==/UserScript==
19 changes: 5 additions & 14 deletions dist/legacy/index.min.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions dist/legacy/index.user.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// ==UserScript==
// @name Comment Image Upload
// @namespace userscripters
// @version 0.2.0
// @author Oleg Valter <[email protected]>
// @contributors double beep (https://github.com/double-beep)
// @description Userscript for uploading comment images
// @grant none
// @homepage https://github.com/userscripters/comment-image-upload#readme
// @license GPL-3.0-or-later
// @match https://stackoverflow.com/questions/*
// @match https://serverfault.com/questions/*
Expand All @@ -26,20 +26,11 @@
// @match https://ru.meta.stackoverflow.com/questions/*
// @match https://es.stackoverflow.com/questions/*
// @match https://es.meta.stackoverflow.com/questions/*
// @match https://meta.meta.superuser.com/questions/*
// @match https://meta.meta.serverfault.com/questions/*
// @match https://meta.meta.askubuntu.com/questions/*
// @match https://meta.meta.mathoverflow.net/questions/*
// @match https://pt.meta.meta.stackoverflow.com/questions/*
// @match https://meta.meta.stackoverflow.com/questions/*
// @match https://ja.meta.meta.stackoverflow.com/questions/*
// @match https://ru.meta.meta.stackoverflow.com/questions/*
// @match https://es.meta.meta.stackoverflow.com/questions/*
// @namespace userscripters
// @grant none
// @run-at document-body
// @source git+https://github.com/userscripters/comment-image-upload.git
// @supportURL https://github.com/userscripters/comment-image-upload/issues
// @version 0.2.0
// @source git+https://github.com/userscripters/comment-image-upload.git
// @homepage https://github.com/userscripters/comment-image-upload#readme
// ==/UserScript==

"use strict";
Expand Down
19 changes: 5 additions & 14 deletions dist/modern/index.min.user.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// ==UserScript==
// @name Comment Image Upload
// @namespace userscripters
// @version 0.2.0
// @author Oleg Valter <[email protected]>
// @contributors double beep (https://github.com/double-beep)
// @description Userscript for uploading comment images
// @grant none
// @homepage https://github.com/userscripters/comment-image-upload#readme
// @license GPL-3.0-or-later
// @match https://stackoverflow.com/questions/*
// @match https://serverfault.com/questions/*
Expand All @@ -26,20 +26,11 @@
// @match https://ru.meta.stackoverflow.com/questions/*
// @match https://es.stackoverflow.com/questions/*
// @match https://es.meta.stackoverflow.com/questions/*
// @match https://meta.meta.superuser.com/questions/*
// @match https://meta.meta.serverfault.com/questions/*
// @match https://meta.meta.askubuntu.com/questions/*
// @match https://meta.meta.mathoverflow.net/questions/*
// @match https://pt.meta.meta.stackoverflow.com/questions/*
// @match https://meta.meta.stackoverflow.com/questions/*
// @match https://ja.meta.meta.stackoverflow.com/questions/*
// @match https://ru.meta.meta.stackoverflow.com/questions/*
// @match https://es.meta.meta.stackoverflow.com/questions/*
// @namespace userscripters
// @grant none
// @run-at document-body
// @source git+https://github.com/userscripters/comment-image-upload.git
// @supportURL https://github.com/userscripters/comment-image-upload/issues
// @version 0.2.0
// @source git+https://github.com/userscripters/comment-image-upload.git
// @homepage https://github.com/userscripters/comment-image-upload#readme
// ==/UserScript==

async function uploadImage(e){var t=new FormData,e=(t.append("file",e),t.append("fkey",StackExchange.options.user.fkey),new URL(location.origin+"/upload/image")),t=await fetch(e,{method:"POST",body:t});if(!t.ok)throw new Error(`Request to ${e.toString()} failed.`);var{Success:e,UploadedImage:a}=await t.json();if(e)return a;throw console.error(t),new Error("Failed to upload image.")}function findImage(e){e=e instanceof ClipboardEvent?e.clipboardData?.items||e.clipboardData?.files:e.dataTransfer?.items||e.dataTransfer?.files;if(e){e=[...e].find(e=>e.type.includes("image/"));if(e){e=e instanceof File?e:e.getAsFile();if(e){var t=StackExchange.settings.image.maxImageUploadSizeInBytes;if(!(e.size>=t))return e}}}}async function insertText(e,t){var a=t.selectionStart,n=`[Uploading ${e.name}...]()`,e=(t.setRangeText(n,a,t.selectionEnd,"start"),await uploadImage(e)),i="enter image description here";t.setRangeText(`[${i}](${e})`,a,a+n.length,"start"),t.setSelectionRange(a+1,a+1+i.length,"forward")}async function handleEvent(e){var t=e.target;if(t.matches("textarea.js-comment-text-input")){e.preventDefault();e=findImage(e);if(e)try{await insertText(e,t)}catch(e){console.error(e)}}}function appendButton(a){let n=document.createElement("input");n.type="file",n.addEventListener("change",async()=>{var e=n.files?.[0],t=a.querySelector("textarea.js-comment-text-input");if(e&&t)try{await insertText(e,t)}catch(e){console.error(e)}});var e=document.createElement("button"),t=(e.classList.add("s-btn","s-btn__link","ta-left","px2"),e.type="button",e.innerText="Upload image",e.addEventListener("click",()=>{n.click()}),a.querySelector(".js-comment-help-link"));t&&(t.parentElement?.classList.add("g4"),t.before(e))}window.addEventListener("paste",handleEvent),window.addEventListener("drop",handleEvent),document.querySelectorAll(".js-add-link").forEach(t=>{t.addEventListener("click",()=>{setTimeout(()=>{var e=t.closest(".post-layout--right");e&&appendButton(e)},200)})});
19 changes: 5 additions & 14 deletions dist/modern/index.user.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// ==UserScript==
// @name Comment Image Upload
// @namespace userscripters
// @version 0.2.0
// @author Oleg Valter <[email protected]>
// @contributors double beep (https://github.com/double-beep)
// @description Userscript for uploading comment images
// @grant none
// @homepage https://github.com/userscripters/comment-image-upload#readme
// @license GPL-3.0-or-later
// @match https://stackoverflow.com/questions/*
// @match https://serverfault.com/questions/*
Expand All @@ -26,20 +26,11 @@
// @match https://ru.meta.stackoverflow.com/questions/*
// @match https://es.stackoverflow.com/questions/*
// @match https://es.meta.stackoverflow.com/questions/*
// @match https://meta.meta.superuser.com/questions/*
// @match https://meta.meta.serverfault.com/questions/*
// @match https://meta.meta.askubuntu.com/questions/*
// @match https://meta.meta.mathoverflow.net/questions/*
// @match https://pt.meta.meta.stackoverflow.com/questions/*
// @match https://meta.meta.stackoverflow.com/questions/*
// @match https://ja.meta.meta.stackoverflow.com/questions/*
// @match https://ru.meta.meta.stackoverflow.com/questions/*
// @match https://es.meta.meta.stackoverflow.com/questions/*
// @namespace userscripters
// @grant none
// @run-at document-body
// @source git+https://github.com/userscripters/comment-image-upload.git
// @supportURL https://github.com/userscripters/comment-image-upload/issues
// @version 0.2.0
// @source git+https://github.com/userscripters/comment-image-upload.git
// @homepage https://github.com/userscripters/comment-image-upload#readme
// ==/UserScript==

"use strict";
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@eslint/js": "^9.12.0",
"@stylistic/eslint-plugin": "^2.9.0",
"@types/tampermonkey": "^5.0.3",
"@userscripters/generate-headers": "^3.4.2",
"@userscripters/generate-headers": "^3.5.0",
"@userscripters/generate-readme": "^3.0.2",
"@userscripters/stackexchange-global-types": "^2.8.2",
"typescript": "^5.6.3",
Expand Down

0 comments on commit 1cbb29b

Please sign in to comment.