mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
Adding Interactive Tutorial files - incomplete
This commit is contained in:
@@ -18,4 +18,14 @@ function addOffset(n, percentage) {
|
||||
var offset = n * (percentage / 100);
|
||||
|
||||
return n * (Math.random() * (2 * offset) - offset);
|
||||
}
|
||||
|
||||
//Given an element by its Id(usually an 'a' element), removes all event listeners
|
||||
//from that element by cloning and replacing. Then returns the new cloned element
|
||||
function clearEventListeners(elemId) {
|
||||
var elem = document.getElementById(elemId);
|
||||
if (elem == null) {console.log("ERR: Could not find element for: " + elemId); return null;}
|
||||
var newElem = elem.cloneNode(true);
|
||||
elem.parentNode.replaceChild(newElem, elem);
|
||||
return elem;
|
||||
}
|
||||
Reference in New Issue
Block a user