Skip to content

Commit 422bada

Browse files
committed
refactor: remove dead code
1 parent e98c07e commit 422bada

File tree

1 file changed

+1
-123
lines changed

1 file changed

+1
-123
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ function RemoteFunctions(config) {
3838
// we need this so that we can remove click styling from the previous element when a new element is clicked
3939
let previouslyClickedElement = null;
4040

41-
var experimental;
42-
if (!config) {
43-
experimental = false;
44-
} else {
45-
experimental = config.experimental;
46-
}
4741
var req, timeout;
4842
var animateHighlight = function (time) {
4943
if(req) {
@@ -76,19 +70,6 @@ function RemoteFunctions(config) {
7670
}
7771
}
7872

79-
// determine the color for a type
80-
function _typeColor(type, highlight) {
81-
switch (type) {
82-
case "html":
83-
return highlight ? "#eec" : "#ffe";
84-
case "css":
85-
return highlight ? "#cee" : "#eff";
86-
case "js":
87-
return highlight ? "#ccf" : "#eef";
88-
default:
89-
return highlight ? "#ddd" : "#eee";
90-
}
91-
}
9273

9374
// compute the screen offset of an element
9475
function _screenOffset(element) {
@@ -138,87 +119,6 @@ function RemoteFunctions(config) {
138119
return element.offsetTop + (element.offsetParent ? getDocumentOffsetTop(element.offsetParent) : 0);
139120
}
140121

141-
// construct the info menu
142-
function Menu(element) {
143-
this.element = element;
144-
_trigger(this.element, "showgoto", 1, true);
145-
window.setTimeout(window.remoteShowGoto);
146-
this.remove = this.remove.bind(this);
147-
}
148-
149-
Menu.prototype = {
150-
onClick: function (url, event) {
151-
event.preventDefault();
152-
_trigger(this.element, "goto", url, true);
153-
this.remove();
154-
},
155-
156-
createBody: function () {
157-
if (this.body) {
158-
return;
159-
}
160-
161-
// compute the position on screen
162-
var offset = _screenOffset(this.element),
163-
x = offset.left,
164-
y = offset.top + this.element.offsetHeight;
165-
166-
// create the container
167-
this.body = window.document.createElement("div");
168-
this.body.style.setProperty("z-index", 2147483647);
169-
this.body.style.setProperty("position", "absolute");
170-
this.body.style.setProperty("left", x + "px");
171-
this.body.style.setProperty("top", y + "px");
172-
this.body.style.setProperty("font-size", "11pt");
173-
174-
// draw the background
175-
this.body.style.setProperty("background", "#fff");
176-
this.body.style.setProperty("border", "1px solid #888");
177-
this.body.style.setProperty("-webkit-box-shadow", "2px 2px 6px 0px #ccc");
178-
this.body.style.setProperty("border-radius", "6px");
179-
this.body.style.setProperty("padding", "6px");
180-
},
181-
182-
addItem: function (target) {
183-
var item = window.document.createElement("div");
184-
item.style.setProperty("padding", "2px 6px");
185-
if (this.body.childNodes.length > 0) {
186-
item.style.setProperty("border-top", "1px solid #ccc");
187-
}
188-
item.style.setProperty("cursor", "pointer");
189-
item.style.setProperty("background", _typeColor(target.type));
190-
item.innerHTML = target.name;
191-
item.addEventListener("click", this.onClick.bind(this, target.url));
192-
193-
if (target.file) {
194-
var file = window.document.createElement("i");
195-
file.style.setProperty("float", "right");
196-
file.style.setProperty("margin-left", "12px");
197-
file.innerHTML = " " + target.file;
198-
item.appendChild(file);
199-
}
200-
this.body.appendChild(item);
201-
},
202-
203-
show: function () {
204-
if (!this.body) {
205-
this.createBody();
206-
}
207-
if (!this.body.parentNode) {
208-
window.document.body.appendChild(this.body);
209-
}
210-
window.document.addEventListener("click", this.remove);
211-
},
212-
213-
remove: function () {
214-
if (this.body && this.body.parentNode) {
215-
window.document.body.removeChild(this.body);
216-
}
217-
window.document.removeEventListener("click", this.remove);
218-
}
219-
220-
};
221-
222122
/**
223123
* This function gets called when the delete button is clicked
224124
* it sends a message to the editor using postMessage to delete the element from the source code
@@ -1354,9 +1254,7 @@ function RemoteFunctions(config) {
13541254
}
13551255
};
13561256

1357-
var _currentMenu;
13581257
var _localHighlight;
1359-
var _remoteHighlight;
13601258
var _hoverHighlight;
13611259
var _clickHighlight;
13621260
var _nodeInfoBox;
@@ -1541,25 +1439,9 @@ function RemoteFunctions(config) {
15411439

15421440
/** Public Commands **********************************************************/
15431441

1544-
// show goto
1545-
function showGoto(targets) {
1546-
if (!_currentMenu) {
1547-
return;
1548-
}
1549-
_currentMenu.createBody();
1550-
var i;
1551-
for (i in targets) {
1552-
_currentMenu.addItem(targets[i]);
1553-
}
1554-
_currentMenu.show();
1555-
}
15561442

15571443
// remove active highlights
15581444
function hideHighlight() {
1559-
if (_remoteHighlight) {
1560-
_remoteHighlight.clear();
1561-
_remoteHighlight = null;
1562-
}
15631445
if (_clickHighlight) {
15641446
_clickHighlight.clear();
15651447
_clickHighlight = null;
@@ -1610,9 +1492,6 @@ function RemoteFunctions(config) {
16101492

16111493
// redraw active highlights
16121494
function redrawHighlights() {
1613-
if (_remoteHighlight) {
1614-
_remoteHighlight.redraw();
1615-
}
16161495
if (_clickHighlight) {
16171496
_clickHighlight.redraw();
16181497
}
@@ -1637,7 +1516,7 @@ function RemoteFunctions(config) {
16371516
if (e.target === window.document) {
16381517
redrawHighlights();
16391518
} else {
1640-
if (_remoteHighlight || _localHighlight || _clickHighlight || _hoverHighlight) {
1519+
if (_localHighlight || _clickHighlight || _hoverHighlight) {
16411520
window.setTimeout(redrawHighlights, 0);
16421521
}
16431522
}
@@ -2082,7 +1961,6 @@ function RemoteFunctions(config) {
20821961

20831962
return {
20841963
"DOMEditHandler" : DOMEditHandler,
2085-
"showGoto" : showGoto,
20861964
"hideHighlight" : hideHighlight,
20871965
"highlight" : highlight,
20881966
"highlightRule" : highlightRule,

0 commit comments

Comments
 (0)