Skip to content
This repository was archived by the owner on Feb 3, 2018. It is now read-only.

Commit 730d0f0

Browse files
committed
initial commit
0 parents  commit 730d0f0

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Bryant Chandler
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# hyper-autohide-tabs
2+
3+
This plugin autohides tab bar when there is only one tab.
4+
5+
## Usage
6+
7+
Add plugin to `~/.hyper.js`:
8+
9+
```js
10+
plugins: [
11+
'hyper-autohide-tabs'
12+
]
13+
```

index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
4+
let styles = ''
5+
6+
try {
7+
styles = fs.readFileSync(path.join(__dirname, 'styles.css'), 'utf8')
8+
} catch (err) {
9+
throw err
10+
}
11+
12+
exports.decorateConfig = config => Object.assign({}, config, {
13+
css: (config.css || '') + styles
14+
})
15+
16+
exports.getTabsProps = (parentProps, props) => {
17+
const bodyClasses = document.body.classList
18+
19+
if (props.tabs.length <= 1) {
20+
console.log("one tab")
21+
bodyClasses.add('closed-tabs')
22+
} else {
23+
bodyClasses.remove('closed-tabs')
24+
}
25+
26+
return Object.assign({}, parentProps, props)
27+
}

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "hyper-autohide-tabs",
3+
"version": "0.0.1",
4+
"description": "Make hyper autohide tab bar when there is only one",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "xo"
8+
},
9+
"files": [
10+
"index.js",
11+
"styles.css"
12+
],
13+
"xo": {
14+
"esnext": true,
15+
"space": true,
16+
"semicolon": false,
17+
"globals": [
18+
"document"
19+
]
20+
},
21+
"repository": "brychanrobot/hyper-autohide-tabs",
22+
"keywords": [
23+
"hyper",
24+
"hyperterm",
25+
"theme",
26+
"ui",
27+
],
28+
"author": "Bryant Chandler",
29+
"license": "MIT",
30+
"bugs": {
31+
"url": "https://github.com/brychanrobot/hyper-autohide-tabs/issues"
32+
},
33+
"homepage": "https://github.com/brychanrobot/hyper-autohide-tabs#readme",
34+
"devDependencies": {
35+
"xo": "^0.17.1"
36+
}
37+
}

styles.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
body.closed-tabs .terms_terms {
2+
margin-top: 0px;
3+
}
4+
5+
body.closed-tabs .tabs_nav {
6+
display: none;
7+
}

0 commit comments

Comments
 (0)