Skip to content

Instantly share code, notes, and snippets.

@s-hiiragi
Created October 6, 2022 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-hiiragi/b0f3efafd4cd1edb59a75d87ad387e00 to your computer and use it in GitHub Desktop.
Save s-hiiragi/b0f3efafd4cd1edb59a75d87ad387e00 to your computer and use it in GitHub Desktop.
(Redmine) 新しいチケットページの入力項目からチケットテンプレートURLを作成
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