-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
21,625 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#header-row { | ||
padding-top: 10px; | ||
} | ||
|
||
.header-left { | ||
padding-top: 3px; | ||
height: 18px; | ||
color: white; | ||
text-shadow: 0 0 3px black; | ||
text-overflow: ellipsis; | ||
overflow:hidden; | ||
} | ||
|
||
.header-item { | ||
padding-top: 8px; | ||
padding-right: 15px; | ||
padding-bottom: 8px; | ||
} | ||
|
||
.header-item:hover { | ||
cursor: pointer; | ||
opacity: 0.6; | ||
} | ||
|
||
.header-right { | ||
padding-left: 3px; | ||
padding-right: 5px; | ||
filter: invert(1) drop-shadow(0px 0px 3px rgb(0 0 0 / 0.4)); | ||
width: 18px; | ||
height: 18px; | ||
} | ||
|
||
.header-right:hover { | ||
cursor: pointer; | ||
opacity: 0.6; | ||
} | ||
|
||
#root_popup { | ||
top: 40px; | ||
max-height: 600px; | ||
max-width: 700px; | ||
position:fixed; | ||
overflow-y:auto; | ||
background-color: white; | ||
border-radius: 1em; | ||
box-shadow: 0 0 3px black; | ||
} | ||
|
||
.header-text { | ||
text-overflow: ellipsis; | ||
overflow:hidden; | ||
white-space: nowrap; | ||
height: 20px; | ||
border-radius: 10px; | ||
padding-left: 5px; | ||
padding-top: 2px; | ||
} | ||
|
||
.header-text:hover { | ||
background-color: #eee; | ||
} | ||
|
||
.pseudo-list-icon{ | ||
position: relative; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
.list-icon { | ||
position: absolute; | ||
width: 20px; | ||
height: 20px; | ||
left: -16px; | ||
} | ||
|
||
.site-icon { | ||
position: absolute; | ||
width: 15px; | ||
height: 15px; | ||
left: -13px; | ||
top: 3px; | ||
} | ||
|
||
li { | ||
cursor: pointer; | ||
padding-right: 20px; | ||
} | ||
ul{ | ||
padding-left: 30px; | ||
list-style: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
function updateHeaderMenu() { | ||
deleteHeaderMenu() | ||
chrome.storage.local.get(['show-header'], function (res) { | ||
if (res['show-header']) { | ||
createBookmarks() | ||
} | ||
}) | ||
} | ||
|
||
function deleteHeaderMenu() { | ||
$('#bookmarks').empty() | ||
} | ||
|
||
function createBookmarks() { | ||
chrome.bookmarks.getTree((bookmarkTreeNodes) => { | ||
let root = bookmarkTreeNodes[0]["children"][0]["children"] | ||
for (let i = 0; i < root.length; i++) { | ||
let root_str = '<span class="header-item" id="root-header-' + root[i].id + '">' | ||
let root_item = $(root_str) | ||
// if (hasChields(root[i].id)){ | ||
// $('#bookmarks').append(getListIcon()) | ||
// } | ||
$('#bookmarks').append(root_item.text(root[i].title)) | ||
$('#root-header-' + root[i].id).on('click', createRootElementTree) | ||
$('.app-container').on('click', deleteRootElementTree) | ||
} | ||
}) | ||
} | ||
|
||
function hasChields(item){ | ||
return !!(item.children && item.children.length > 0); | ||
} | ||
|
||
function deleteRootElementTree() { | ||
document.getElementById("root_popup").remove(); | ||
} | ||
|
||
function createRootElementTree() { | ||
let root_id = this.id.replace('root-header-', '') | ||
chrome.bookmarks.getSubTree(root_id, (rootitemNodes) => { | ||
if (rootitemNodes[0].children) { | ||
let root_popup = document.createElement('div') | ||
let app_container = document.getElementById('app-container') | ||
root_popup.id = "root_popup" | ||
app_container.appendChild(root_popup).className = 'root_popup' | ||
let root_item = document.getElementById(this.id) | ||
$(root_popup).css('left', root_item.offsetLeft + 'px') | ||
$(root_popup).append(dumpTreeNodes(rootitemNodes[0]['children'])) | ||
} else { | ||
openLink(rootitemNodes[0].url) | ||
} | ||
}) | ||
} | ||
|
||
function dumpTreeNodes(bookmarkNodes) { | ||
let list = $('<ul class="sublist">') | ||
for (let i = 0; i < bookmarkNodes.length; i++) { //bookmarkNodes.length | ||
list.append(dumpNode(bookmarkNodes[i])) | ||
} | ||
return list | ||
} | ||
|
||
function getListIcon(status='closed', link='none'){ | ||
let pseudofoldericon = $('<div class="pseudo-list-icon">') | ||
let foldericon = $('<img class="list-icon">') | ||
if (status === 'closed') | ||
{ | ||
foldericon.attr('src', 'images/icons/arrow_right.svg') | ||
pseudofoldericon.append(foldericon) | ||
} | ||
else if (status === 'opened'){ | ||
foldericon.attr('src', 'images/icons/arrow_drop.svg') | ||
pseudofoldericon.append(foldericon) | ||
} | ||
else if (status === 'site'){ | ||
// foldericon.attr('src', 'images/icons/language.svg') | ||
foldericon.attr('class', 'site-icon') | ||
foldericon.attr('src', 'https://s2.googleusercontent.com/s2/favicons?domain=' + getOpenLink(link) + '&sz=128') | ||
pseudofoldericon.append(foldericon) | ||
} | ||
return pseudofoldericon | ||
} | ||
|
||
function dumpNode(bookmarkNode) { | ||
if (bookmarkNode.title) { | ||
let anchor = $('<div class="header-text">') | ||
anchor.text(bookmarkNode.title) | ||
let span = $('<span class="span-header">') | ||
span.hover().append(anchor) // | ||
|
||
let pseudoli = $('<div class="pseudoli">') | ||
let li = $(bookmarkNode.title ? '<li>' : '<div>') | ||
li.attr('status', 'closed') | ||
li.append(span) | ||
if (bookmarkNode.children && bookmarkNode.children.length > 0) { | ||
li.on('click', (e) => { | ||
e.stopPropagation() | ||
if (li.attr('status') === 'closed') { | ||
li.attr('status', 'opened') | ||
li.append(dumpTreeNodes(bookmarkNode.children, li.attr('status'))) | ||
} else { | ||
li.attr('status', 'closed') | ||
li.children('.sublist').remove() | ||
} | ||
}) | ||
pseudoli.append(getListIcon(li.attr('status'))) | ||
|
||
} else { | ||
anchor.attr('link', bookmarkNode.url) | ||
anchor.on('click', (e) => { | ||
e.stopPropagation() | ||
openLink(anchor.attr('link')) | ||
}) | ||
pseudoli.append(getListIcon('site', anchor.attr('link'))) | ||
} | ||
return pseudoli.append(li); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.