Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CHANGELOG
=============================
* 5.0.1
* Added light/dark mode style to injected div
* 5.0.0
* Upgrade to Extension Manifest v3
* 4.9.0
Expand Down
Binary file removed images/clipboard.png
Binary file not shown.
Binary file removed images/cross.png
Binary file not shown.
Binary file removed images/grid.png
Binary file not shown.
Binary file removed images/key.png
Binary file not shown.
Binary file removed images/popup_menu_background.png
Binary file not shown.
Binary file removed images/tick.png
Binary file not shown.
64 changes: 31 additions & 33 deletions js/contentWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ console.log("d3coder: Loaded contentWorker.js");
* @version 5.0.0
*/
D3content = {
createDiv: function(title, text)
{
createDiv: function (title, text) {
let hr = document.createElement('hr');
let infoDiv;
let infoText;
Expand All @@ -16,66 +15,66 @@ D3content = {
let startY;
let startHeight;

if(!document.getElementById('D3-inject')) {
infoDiv = document.createElement('div');
infoDiv.id = 'D3-inject';
if (!document.getElementById('D3-inject')) {
infoDiv = document.createElement('div');
infoDiv.id = 'D3-inject';
infoDiv.className = 'content';

resizeHandle = document.createElement('div');
resizeHandle.id = 'D3-inject_handle';
resizeHandle.className = 'handle vertical';
resizeHandle.style.backgroundColor = '#333';
resizeHandle.style.backgroundRepeat = ' no-repeat;';
resizeHandle = document.createElement('div');
resizeHandle.id = 'D3-inject_handle';

heading = document.createElement('h1');
heading.id = 'D3-inject-heading';
heading = document.createElement('h1');
heading.id = 'D3-inject-heading';
heading.innerText = 'd3coder Output:';

closeElem = document.createElement('a');
closeElem.id = 'D3-inject-close';
closeElem = document.createElement('a');
closeElem.id = 'D3-inject-close';
closeElem.innerText = 'CLOSE [X]';

document.body.appendChild(resizeHandle);
document.body.appendChild(infoDiv);
document.getElementById('D3-inject').appendChild(resizeHandle);
document.getElementById('D3-inject').appendChild(closeElem);
document.getElementById('D3-inject').appendChild(heading);
document.getElementById('D3-inject').appendChild(hr);

document.getElementById('D3-inject-close').addEventListener('click', function(){
document.getElementById('D3-inject_handle').parentNode.removeChild(document.getElementById('D3-inject_handle'));
document.body.style.marginBottom = document.defaultView.getComputedStyle(document.getElementById('D3-inject')).height;

document.getElementById('D3-inject-close').addEventListener('click', function () {
document.getElementById('D3-inject_handle').parentNode.removeChild(document.getElementById('D3-inject_handle'));
document.getElementById('D3-inject').parentNode.removeChild(document.getElementById('D3-inject'));
});

document.getElementById('D3-inject_handle').addEventListener('mousedown', initDrag, false);

function initDrag(e) {
var oldSelectStart = document.body.onselectstart;
document.body.onselectstart = function() {return false;};
document.body.onselectstart = function () {
return false;
};

function doDrag(e) {
var y = startHeight + (startY - e.clientY);
if (y < 100) {
return;
}

document.getElementById('D3-inject').style.height =
y + 'px';
document.getElementById('D3-inject_handle').style.bottom =
y + 'px';
document.getElementById('D3-inject').style.height = y + 'px';
document.getElementById('D3-inject_handle').style.bottom = y + 'px';
document.body.style.marginBottom = y + 'px';
}

function stopDrag(e) {
document.documentElement.removeEventListener('mousemove', doDrag, false);
document.documentElement.removeEventListener('mouseup', stopDrag, false);
document.body.onselectstart=oldSelectStart;
document.body.onselectstart = oldSelectStart;
}

startY = e.clientY;
startHeight = parseInt(
document.defaultView.getComputedStyle(
document.getElementById('D3-inject')
).height,
10);
document.defaultView.getComputedStyle(
document.getElementById('D3-inject')
).height,
10);

document.documentElement.addEventListener('mousemove', doDrag, false);
document.documentElement.addEventListener('mouseup', stopDrag, false);
Expand All @@ -84,23 +83,22 @@ D3content = {
infoDiv = document.getElementById('D3-inject');
}

infoHeading = document.createElement('h2');
infoHeading = document.createElement('h2');
infoHeading.className = 'D3-inject-heading';
infoHeading.innerText = title;

infoText = document.createElement('pre');
infoText = document.createElement('pre');
infoText.className = 'D3-inject-text';
infoText.innerText = text;

hr = document.createElement('hr');

infoDiv.appendChild(infoHeading);
infoDiv.appendChild(infoText);
infoDiv.appendChild(hr);
},

replaceText: function(text)
{
replaceText: function (text) {
console.log("replaceText", text);
var selection, range;

Expand All @@ -115,5 +113,5 @@ D3content = {
range = document.selection.createRange();
range.text = text;
}
}
}
};
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
"version": "5.0.0",
"version": "5.0.1",
"description": "__MSG_extDescription__",
"options_ui": {
"page": "html/menu_ui.html",
Expand Down
110 changes: 90 additions & 20 deletions styles/content.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,76 @@
@media (prefers-color-scheme: dark) {

#D3-inject,
#D3-inject-heading,
#D3-inject-close,
.D3-inject-heading {
color: #DDD !important;
}

#D3-inject {
background: #202124;
}

.D3-inject-text {
background-color: #444;
border: 1px solid #999;
color: #CCC;
}

#D3-inject > hr {
border-bottom: 1px solid #999;
}

#D3-inject_handle {
background: #333;
}

}

@media (prefers-color-scheme: light) {

#D3-inject,
#D3-inject-heading,
#D3-inject-close,
.D3-inject-heading {
color: #010409 !important;
}

#D3-inject {
background: #f7f7f7;
}

.D3-inject-text {
background-color: #e7e7e7;
border: 1px solid #b9d0e6;
}

#D3-inject > hr {
border-bottom: 1px solid #444;
}

#D3-inject_handle {
background: #575757;
}
}

#D3-inject {
box-sizing: border-box;
z-index: 1000;
position: fixed;
width: 100%;
height: 200px;
bottom: 0;
left: 0;
background: lightgrey;
border-top: 1px solid grey;
overflow: auto;
-webkit-box-shadow: 0px 0px 30px #000;
box-shadow: 0px 0px 30px #000;
text-align: left !important;
}

#D3-inject > hr {
margin: 0.3rem;
}

#D3-inject-close {
z-index: 1100;
float: right;
Expand All @@ -30,27 +89,26 @@
#D3-inject,
#D3-inject-heading,
#D3-inject-close,
.D3-inject-heading {
color: black !important;
.D3-inject-heading,
.D3-inject-text {
margin: 0;
padding: .5rem;
}

.D3-inject-text {
word-wrap: break-word;
background-color: #CCC;
border: 1px solid #999;
border-radius: 2px;
white-space: break-spaces;
border-radius: 0.2rem;
margin: .3rem .5rem .5rem;
overflow: auto;
width: fit-content;
max-width: calc(100% - 3rem);
margin-right: 0;
}

div.handle {
background: #333;
z-index: 2;
position: absolute;
}

div.handle.vertical {
#D3-inject_handle {
bottom: 200px;
z-index: 1002;
position: fixed;
width: 100%;
height: 9px;
cursor: row-resize;
Expand All @@ -59,8 +117,20 @@ div.handle.vertical {
left: 0;
}

#D3-inject_handle {
bottom: 200px;
z-index: 1002;
position: fixed;
#D3-inject ::-webkit-scrollbar {
width: .4rem;
height: .4rem;
border-radius: 0.4rem;
}

#D3-inject ::-webkit-scrollbar-track {
background: #f1f1f1;
}

#D3-inject ::-webkit-scrollbar-thumb {
background: #888;
}

#D3-inject ::-webkit-scrollbar-thumb:hover {
background: #555;
}