Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#1に戻しました
  • Loading branch information
toyodan authored May 22, 2019
1 parent 72fce20 commit 3af6166
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions assessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

assessmentButton.onclick = () => {
const userName = userNameInput.value;
// 診断結果表示エリアのクリア
removeAllChildren(resultDivided);
removeAllChildren(tweetDivided);
if (userName.length === 0) { // 名前が空の時は処理を終了する
return;
}

// 診断結果表示エリアの作成
removeAllChildren(resultDivided);
const header = document.createElement('h3');
header.innerText = '診断結果';
resultDivided.appendChild(header);
Expand All @@ -35,14 +33,14 @@
resultDivided.appendChild(paragraph);

// ツイートエリアの作成
removeAllChildren(tweetDivided);
const anchor = document.createElement('a');
const hrefValue = 'https://twitter.com/intent/tweet?button_hashtag=%E3%81%82%E3%81%AA%E3%81%9F%E3%81%AE%E3%81%84%E3%81%84%E3%81%A8%E3%81%93%E3%82%8D&text='
+ encodeURIComponent(result);
anchor.setAttribute('href', hrefValue);
anchor.className = 'twitter-hashtag-button';
anchor.innerText = 'Tweet #%E3%81%82%E3%81%AA%E3%81%9F%E3%81%AE%E3%81%84%E3%81%84%E3%81%A8%E3%81%93%E3%82%8D';
tweetDivided.appendChild(anchor);

twttr.widgets.load();
};

Expand Down

0 comments on commit 3af6166

Please sign in to comment.