Separate addon-class from show-class

This commit is contained in:
Buu Nguyen 2016-02-12 15:44:17 -08:00
parent 3b0513e76a
commit 5d5f93e887
8 changed files with 14 additions and 9 deletions

View File

@ -56,7 +56,7 @@ class Adapter {
const index = path.lastIndexOf('/')
const name = $dummyDiv.text(path.substring(index + 1)).html() // sanitizes, closes #9
item.id = PREFIX + path
item.id = NODE_PREFIX + path
item.text = name
item.icon = type // use `type` as class name for tree node

View File

@ -1,4 +1,4 @@
.octotree {
.octotree-show {
.octotree_github_only {
display: none;
}
@ -14,6 +14,7 @@
}
}
}
body.split-diff .container {
padding-left: 0;
}

View File

@ -1,4 +1,4 @@
.octotree {
.octotree-show {
.octotree_gitlab_only {
display: none;
}

View File

@ -1,4 +1,6 @@
const PREFIX = 'octotree'
const NODE_PREFIX = 'octotree'
const ADDON_CLASS = 'octotree'
const SHOW_CLASS = 'octotree-show'
const STORE = {
TOKEN : 'octotree.access_token',

View File

@ -35,6 +35,8 @@ $(document).ready(() => {
let currRepo = false
let hasError = false
$html.addClass(ADDON_CLASS)
$(window).resize((event) => {
if (event.target === window) layoutChanged()
})
@ -160,7 +162,7 @@ $(document).ready(() => {
toggleSidebar()
}
else {
$html.toggleClass(PREFIX)
$html.toggleClass(SHOW_CLASS)
$document.trigger(EVENT.TOGGLE, isSidebarVisible())
}
}
@ -172,7 +174,7 @@ $(document).ready(() => {
}
function isSidebarVisible() {
return $html.hasClass(PREFIX)
return $html.hasClass(SHOW_CLASS)
}
function isTogglerVisible() {

View File

@ -172,7 +172,7 @@
}
}
.octotree {
.octotree-show {
.octotree_sidebar {
transform: translate3d(0, 0, 0);
}

View File

@ -8,7 +8,7 @@ class HelpPopup {
const $view = this.$view
const store = this.store
const popupShown = store.get(STORE.POPUP)
const sidebarVisible = $('html').hasClass(PREFIX)
const sidebarVisible = $('html').hasClass(SHOW_CLASS)
if (popupShown || sidebarVisible) {
return hideAndDestroy()

View File

@ -161,7 +161,7 @@ class TreeView {
}
function selectPath(paths, index = 0) {
const nodeId = PREFIX + paths[index]
const nodeId = NODE_PREFIX + paths[index]
if ($jstree.get_node(nodeId)) {
$jstree.deselect_all()