Skip to content

Commit

Permalink
- Move addEventListener part to lib/static
Browse files Browse the repository at this point in the history
- Remove comments
  • Loading branch information
fiennyangeln committed Oct 27, 2018
1 parent c54abee commit 070678a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
2 changes: 1 addition & 1 deletion v1/lib/core/CodeTabsMarkdownBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MarkdownBlock extends React.Component {

const tabs = this.props.children.map(({title, content}) => ({
id: _.uniqueId(),
groupId: groupId,
groupId,
label: title,
lang: title,
panelContent: <Remarkable source={content} />,
Expand Down
2 changes: 0 additions & 2 deletions v1/lib/core/Doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ class Doc extends React.Component {
);
}

// const a = this.props.content.split(/(DOCUSAURUS_CODE_TABS)(.*?)(END_DOCUSAURUS_CODE_TABS)/gms)
// console.log(a.length, a);
return (
<div className="post">
<header className="postHeader">
Expand Down
1 change: 1 addition & 0 deletions v1/lib/core/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class Head extends React.Component {
rel="stylesheet"
href={`${this.props.config.baseUrl}css/main.css`}
/>
<script src={`${this.props.config.baseUrl}js/codetabs.js`} />
</head>
);
}
Expand Down
21 changes: 0 additions & 21 deletions v1/website/static/js/code-blocks-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,4 @@ window.addEventListener('load', function() {
textEl.textContent = 'Copy';
}, 2000);
});

// add event listener for all tab
document.querySelectorAll('.nav-link').forEach(function(el) {
el.addEventListener('click', function(e) {
const groupId = e.target.getAttribute('data-group');
document
.querySelectorAll(`.nav-link[data-group=${groupId}]`)
.forEach(function(el) {
el.classList.remove('active');
});
document
.querySelectorAll(`.tab-pane[data-group=${groupId}]`)
.forEach(function(el) {
el.classList.remove('active');
});
e.target.classList.add('active');
document
.querySelector(`#${e.target.getAttribute('data-tab')}`)
.classList.add('active');
});
});
});

0 comments on commit 070678a

Please sign in to comment.