Last active
January 5, 2020 17:40
-
-
Save jonasbits/02afd475f46cd78a4607ac55765e50df to your computer and use it in GitHub Desktop.
TDD for Autodesk Tinkercad Circuits ( [email protected]:02afd475f46cd78a4607ac55765e50df.git )
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
//javascript:(function(){ <-remember this beginning when creating bookmarklets | |
javascript:(function(){ | |
var txField = document.getElementsByClassName("js-code_panel__serial__input")[0]; | |
var sendBtn = document.getElementsByClassName("js-code_panel__serial__send")[0]; | |
var newHash = 0; | |
/*step debug (use this comment style)*/ | |
if(window.location.hash) { | |
var hash = window.location.hash.substring(1); | |
newHash = parseInt(hash) + 1; | |
window.location.hash = newHash; | |
} else { | |
window.location.hash = 0; | |
} | |
switch(newHash) { | |
case 1: | |
txField.value = "USER"; | |
break; | |
case 2: | |
txField.value = "PASS"; | |
break; | |
case 3: | |
txField.value = "USER joe"; | |
break; | |
case 4: | |
txField.value = "PASS 1234"; | |
break; | |
default: | |
window.location.hash = 0; | |
break; | |
} | |
sendBtn.click(); | |
})(); | |
// })(); <-remember this ending when creating bookmarklets | |
// compiled to one line only is needed | |
// copy paste into browser URL bar, select that and copy paste here | |
//javascript: <- browser will remove this to stop unwanted javascripts pasting, add this | |
javascript:(function(){var txField = document.getElementsByClassName("js-code_panel__serial__input")[0];var sendBtn = document.getElementsByClassName("js-code_panel__serial__send")[0];var newHash = 0;/*step debug*/if(window.location.hash) { var hash = window.location.hash.substring(1); newHash = parseInt(hash) + 1; window.location.hash = newHash;} else { window.location.hash = 0;}switch(newHash) { case 1: txField.value = "USER"; break; case 2: txField.value = "PASS"; break; case 3: txField.value = "USER joe"; break; case 4: txField.value = "PASS 1234"; break; default: window.location.hash = 0; break;}sendBtn.click();})(); |
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
/* | |
* Det här är ett JavaScript-kladdblock. | |
*/ | |
/* | |
example payload | |
var txField = document.getElementsByClassName("js-code_panel__serial__input")[0]; | |
txField.value = "USER joe"; | |
txField.value = "PASS 1234"; | |
txField.value = "CAPA"; | |
var sendBtn = document.getElementsByClassName("js-code_panel__serial__send")[0]; | |
sendBtn.click(); | |
//step debug | |
if(window.location.hash) { | |
var hash = window.location.hash.substring(1); | |
var newHash = parseInt(hash) + 1; | |
window.location.hash = newHash; | |
} else { | |
window.location.hash = 0; | |
} | |
switch(newHash) { | |
case "1": | |
txField.value = "USER"; | |
break; | |
case "2": | |
txField.value = "PASS"; | |
break; | |
case "2": | |
txField.value = "USER joe"; | |
break; | |
case "2": | |
txField.value = "PASS 1234"; | |
break; | |
default: | |
break; | |
} | |
//auto interval send | |
var tdd = setInterval (payload, 10000); | |
clearInterval(tdd); | |
select, copy and paste from above*/ | |
var payload = function () { | |
window.alert(); | |
}; | |
var injectMe = document.createElement("button"); | |
injectMe.id = "tinkercad_tdd"; | |
injectMe.innerText = "TDD"; | |
injectMe.onclick = payload; | |
var para = document.getElementsByClassName("code_panel__serial__buttons")[0]; | |
var prev; | |
if( prev = document.getElementById("tinkercad_tdd") ){ | |
para.replaceChild(injectMe,prev); | |
} else { | |
para.appendChild(injectMe); | |
} | |
/* | |
https://www.tinkercad.com/things/lSBseQEok0l-serialdpopper/editel | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment