{"action":"created","issue":{"url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/28","repository_url":"https://api.github.com/repos/marc2k3/foo_jscript_panel","labels_url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/28/comments","events_url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/28/events","html_url":"https://github.com/marc2k3/foo_jscript_panel/issues/28","id":336948917,"node_id":"MDU6SXNzdWUzMzY5NDg5MTc=","number":28,"title":"utils.InputBox","user":{"login":"Wil-B","id":35600752,"node_id":"MDQ6VXNlcjM1NjAwNzUy","avatar_url":"https://avatars0.githubusercontent.com/u/35600752?v=4","gravatar_id":"","url":"https://api.github.com/users/Wil-B","html_url":"https://github.com/Wil-B","followers_url":"https://api.github.com/users/Wil-B/followers","following_url":"https://api.github.com/users/Wil-B/following{/other_user}","gists_url":"https://api.github.com/users/Wil-B/gists{/gist_id}","starred_url":"https://api.github.com/users/Wil-B/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wil-B/subscriptions","organizations_url":"https://api.github.com/users/Wil-B/orgs","repos_url":"https://api.github.com/users/Wil-B/repos","events_url":"https://api.github.com/users/Wil-B/events{/privacy}","received_events_url":"https://api.github.com/users/Wil-B/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-29T10:33:34Z","updated_at":"2018-06-29T11:35:25Z","closed_at":null,"author_association":"NONE","body":"I tried to implement the new utils.InputBox. While some work fine, others don't.\r\n\r\nThe failures occur when the prefilled text (defaultValue) isn't edited:\r\n\r\nvar tmp = utils.InputBox(window.ID, \"Proceed with the action\", \"Heading\", prefilledText);\r\n\r\nPrefilled text could be current artist, loaded for convenience.\r\n\r\nDesired action when prefilledText is unedited:\r\n\r\nOK: proceed\r\nCANCEL: don't proceed\r\n\r\nWhat actually seems to happen:\r\n\r\n// Code option 1: FAILS\r\nif (tmp) proceed(tmp); // BOTH OK & CANCEL proceed with the action\r\n\r\n// Code option 2: FAILS\r\nif (tmp != prefilledText) proceed(tmp); // OK & CANCEL BOTH FAIL to proceed with the action.\r\nThis will however work if the prefilledText is edited, but there are occasions when it is desirable to proceed with the unedited text.\r\n\r\nI believe users should be able to correctly apply OK/CANCEL to the prefilled text or edit the text and apply OK/CANCEL.\r\n\r\nIs there an alternative code that will work?\r\n\r\nIf not, a possibility is for the cancel button to always return an empty string \"\". Alternatively it could operate like the (unsupported) window.prompt() method, where cancel returns null. Code option 1 then works. It's not clear why the cancel button needs to return the defaultValue. Its value is known."},"comment":{"url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/comments/401328504","html_url":"https://github.com/marc2k3/foo_jscript_panel/issues/28#issuecomment-401328504","issue_url":"https://api.github.com/repos/marc2k3/foo_jscript_panel/issues/28","id":401328504,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTMyODUwNA==","user":{"login":"marc2k3","id":34617027,"node_id":"MDQ6VXNlcjM0NjE3MDI3","avatar_url":"https://avatars0.githubusercontent.com/u/34617027?v=4","gravatar_id":"","url":"https://api.github.com/users/marc2k3","html_url":"https://github.com/marc2k3","followers_url":"https://api.github.com/users/marc2k3/followers","following_url":"https://api.github.com/users/marc2k3/following{/other_user}","gists_url":"https://api.github.com/users/marc2k3/gists{/gist_id}","starred_url":"https://api.github.com/users/marc2k3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marc2k3/subscriptions","organizations_url":"https://api.github.com/users/marc2k3/orgs","repos_url":"https://api.github.com/users/marc2k3/repos","events_url":"https://api.github.com/users/marc2k3/events{/privacy}","received_events_url":"https://api.github.com/users/marc2k3/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T11:35:25Z","updated_at":"2018-06-29T11:35:25Z","author_association":"OWNER","body":"Returning an empty string on Cancel isn't go to work. Let's say I have a Last.fm script that displays my charts and I store my username. Now I want to clear my username and I open an updated InputBox to do this. At this point, the script has no idea if I intentionally cleared the text and pressed OK or changed my mind and pressed Cancel.\r\n\r\nIt can't stay as it is either so definitely needs fixing. \r\n\r\nPossible fixes:\r\n1) fixed string response something like \"input cancelled\"\r\n2) script error on Cancel which means putting it inside try/catch"}}
{"actor":{"display_login":"marc2k3"}}