-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd291ee
commit 041f03e
Showing
2 changed files
with
47 additions
and
37 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
function generatePA() { | ||
const action = document.getElementById('t1').value.trim().replaceAll(/\s+/g, '_'); | ||
const element = document.getElementById('t2').value.trim(); | ||
function powerAutomate() { | ||
const actionField = document.getElementById('t1'); | ||
const elementField = document.getElementById('t2'); | ||
const response = document.getElementById('response'); | ||
const beforeAction = "first(body('"; | ||
const afterAction = "')?['value'])"; | ||
const beforeElement = "?['"; | ||
const afterElement = "']"; | ||
|
||
//clear whatever was in the output | ||
response.innerHTML = '' | ||
|
||
//create colorful span | ||
actionSpan = document.createElement("span") | ||
actionSpan.setAttribute("class", "actionColor") | ||
actionSpan.innerText = action | ||
actionField.addEventListener("input", generatePA); | ||
elementField.addEventListener("input", generatePA); | ||
|
||
response.append(beforeAction, actionSpan, afterAction); | ||
function generatePA() { | ||
const action = document.getElementById('t1').value.trim().replaceAll(/\s+/g, '_'); | ||
const element = document.getElementById('t2').value.trim(); | ||
const beforeAction = "first(body('"; | ||
const afterAction = "')?['value'])"; | ||
|
||
if (element.length > 0) { | ||
//clear whatever was in the output | ||
response.innerHTML = '' | ||
|
||
elementSpan = document.createElement("span"); | ||
elementSpan.setAttribute("class", "elementColor"); | ||
elementSpan.innerText = element; | ||
//create colorful span | ||
actionSpan = document.createElement("span") | ||
actionSpan.setAttribute("class", "actionColor") | ||
actionSpan.innerText = action | ||
|
||
response.append(beforeElement, elementSpan, afterElement); | ||
//show output with only action | ||
response.append(beforeAction, actionSpan, afterAction); | ||
|
||
if (element.length > 0) { | ||
beforeElement = "?['"; | ||
afterElement = "']"; | ||
|
||
elementSpan = document.createElement("span"); | ||
elementSpan.setAttribute("class", "elementColor"); | ||
elementSpan.innerText = element; | ||
|
||
//show output with action and element | ||
response.append(beforeElement, elementSpan, afterElement); | ||
} | ||
} | ||
} |