Created
October 6, 2022 16:01
-
-
Save s-hiiragi/b0f3efafd4cd1edb59a75d87ad387e00 to your computer and use it in GitHub Desktop.
(Redmine) 新しいチケットページの入力項目からチケットテンプレートURLを作成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(()=>{ | |
const namedItems = Array.from(document.querySelectorAll('#issue-form [name]')) | |
.filter(e => e.value) | |
.filter(e => ! e.type?.match(/^(hidden|submit|button)$/) | |
.filter(e => ! e.name.match(/^issue\[(project_id|status_id|priority_id|start_date)\]$/) | |
; | |
const search = namedItems | |
.map(e => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`) | |
.join('&') | |
; | |
const urlBuilder = new URL(location); | |
urlBuilder.search = `?${search}`; | |
const url = urlBuilder.toString(); | |
prompt('New ticket URL with values', url); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment