forked from cory/tildefriends
Add some tooltips.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3816 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -15,12 +15,7 @@ var kErrorColor = "#dc322f";
|
||||
var kStatusColor = "#fff";
|
||||
|
||||
window.addEventListener("keydown", function(event) {
|
||||
if (event.keyCode == 69 && event.altKey) {
|
||||
if (!editing()) {
|
||||
edit();
|
||||
event.preventDefault();
|
||||
}
|
||||
} else if (event.keyCode == 83 && (event.altKey || event.ctrlKey)) {
|
||||
if (event.keyCode == 83 && (event.altKey || event.ctrlKey)) {
|
||||
if (editing()) {
|
||||
save();
|
||||
event.preventDefault();
|
||||
@ -74,11 +69,23 @@ function editing() {
|
||||
return document.getElementById("editPane").style.display != 'none';
|
||||
}
|
||||
|
||||
function toggleEdit() {
|
||||
if (editing()) {
|
||||
closeEditor();
|
||||
} else {
|
||||
edit();
|
||||
}
|
||||
}
|
||||
|
||||
function edit() {
|
||||
if (editing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gSplit) {
|
||||
gSplit.destroy();
|
||||
gSplit = undefined;
|
||||
}
|
||||
gSplit = Split(['#editPane', '#viewPane'], {minSize: 0});
|
||||
|
||||
ensureLoaded([
|
||||
@ -277,10 +284,6 @@ function load(path) {
|
||||
|
||||
function closeStats() {
|
||||
document.getElementById("statsPane").style.display = 'none';
|
||||
if (gSplit) {
|
||||
gSplit.destroy();
|
||||
gSplit = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function closeEditor() {
|
||||
@ -822,6 +825,30 @@ window.addEventListener("load", function() {
|
||||
window.addEventListener("message", message, false);
|
||||
window.addEventListener("online", connectSocket);
|
||||
document.getElementById("name").value = window.location.pathname;
|
||||
for (let tag of document.getElementsByTagName('a')) {
|
||||
if (tag.accessKey) {
|
||||
tag.classList.add('tooltip_parent');
|
||||
var tooltip = document.createElement('div');
|
||||
tooltip.classList.add('tooltip');
|
||||
if (tag.dataset.tip) {
|
||||
var description = document.createElement('div');
|
||||
description.innerText = tag.dataset.tip;
|
||||
tooltip.appendChild(description);
|
||||
}
|
||||
var parts = tag.accessKeyLabel.split('+');
|
||||
for (var i = 0; i < parts.length; i++)
|
||||
{
|
||||
var key = parts[i];
|
||||
var kbd = document.createElement('kbd');
|
||||
kbd.innerText = key;
|
||||
tooltip.appendChild(kbd);
|
||||
if (i < parts.length - 1) {
|
||||
tooltip.appendChild(document.createTextNode('+'));
|
||||
}
|
||||
}
|
||||
tag.appendChild(tooltip);
|
||||
}
|
||||
}
|
||||
enableDragDrop();
|
||||
connectSocket(window.location.pathname);
|
||||
});
|
||||
|
Reference in New Issue
Block a user