@@ -40,27 +40,29 @@ export default function () {
4040 // const testName = '$test-name$'
4141 // const xbucket = bucket(testName)
4242 // if (xbucket === TREATMENT) { ... }
43- // x.addEventListener('click', evt => evt.preventDefault(); await sendSuccess(testName); evt() )
43+ // x.addEventListener('click', () => { sendSuccess(testName) } )
4444
45- const treatment = document . getElementById ( 'quickstart-treatment' )
46- if ( ! treatment ) return
47-
48- const testName = 'quickstart-hello'
45+ const testName = 'helpfulness-prompt-to-bottom'
4946 const xbucket = bucket ( testName )
5047
5148 if ( xbucket === TREATMENT ) {
52- Array . from (
53- document . querySelectorAll ( '#article-contents > *' )
54- ) . forEach ( el => { el . hidden = true } )
55- treatment . hidden = false
49+ const bigHelpfulness = document . querySelector ( '#helpfulness-xl' )
50+ const smallHelpfulness = document . querySelector ( '#helpfulness-sm' )
51+
52+ // Check that helpfulness prompt is present on this page
53+ if ( ! ( bigHelpfulness && smallHelpfulness ) ) {
54+ return
55+ }
56+
57+ // Remove the -xl prompts
58+ bigHelpfulness . parentElement . parentElement . removeChild ( bigHelpfulness . parentElement )
59+
60+ // Always show the -sm prompt
61+ smallHelpfulness . parentElement . classList . remove ( 'd-xl-none' )
5662 }
5763
58- document . documentElement . addEventListener ( 'copy' , ( ) => {
59- sendSuccess ( testName )
64+ const votes = Array . from ( document . querySelectorAll ( '.js-helpfulness [type=radio]' ) )
65+ votes . forEach ( voteEl => {
66+ voteEl . addEventListener ( 'change' , ( ) => { sendSuccess ( testName ) } )
6067 } )
61-
62- // Hide sidebar navigation during test
63- Array . from (
64- document . querySelectorAll ( '.article-grid-toc-content > h3, .article-grid-toc-content ul' )
65- ) . forEach ( el => { el . hidden = true } )
6668}
0 commit comments