Skip to content

Commit

Permalink
Added more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
apratimshukla6 committed Oct 13, 2023
1 parent 05bb891 commit ddc9986
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 4 deletions.
27 changes: 27 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,33 @@
<input data-nexres="update-multi-id1" id="16" type="text" class="form-control" placeholder="Enter transaction ID here">
</div>

<div class="form-group">
<input data-nexres="update-multi-amount1" id="17" type="text" class="form-control" placeholder="Enter your amount here">
</div>

<div class="form-group">
<input data-nexres="update-multi-data1" id="18" type="text" class="form-control" placeholder="Enter your data here">
</div>

<div class="form-group">
<input data-nexres="update-multi-address1" id="19" type="text" class="form-control" placeholder="Enter your address here">
</div>

<div class="form-group">
<input data-nexres="update-multi-id2" id="20" type="text" class="form-control" placeholder="Enter transaction ID here">
</div>

<div class="form-group">
<input data-nexres="update-multi-amount2" id="21" type="text" class="form-control" placeholder="Enter your amount here">
</div>

<div class="form-group">
<input data-nexres="update-multi-data2" id="22" type="text" class="form-control" placeholder="Enter your data here">
</div>

<div class="form-group">
<input data-nexres="update-multi-address2" id="23" type="text" class="form-control" placeholder="Enter your address here">
</div>

<button data-nexres="update-multi-page-script" id="24" class="btn btn-success mb-3">Update Multiple</button>
</div>
Expand Down
86 changes: 82 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,95 @@ sdk.addMessageListener((event) => {
});

var commit = document.querySelector('[data-nexres="commit-page-script"]');
var fetcher = document.querySelector('[data-nexres="get-page-script"]');
var update = document.querySelector('[data-nexres="update-page-script"]');
var updateMulti = document.querySelector('[data-nexres="update-multi-page-script"]');
var filter = document.querySelector('[data-nexres="filter-page-script"]');
var account = document.querySelector('[data-nexres="account-page-script"]');
var data = document.querySelector('[data-nexres="get-data"]');
var amount = document.querySelector('[data-nexres="get-amount"]');
var address = document.querySelector('[data-nexres="get-address"]');
var id = document.querySelector('[data-nexres="get-id"]');
var updateId = document.querySelector('[data-nexres="update-id"]');
var updateData = document.querySelector('[data-nexres="update-data"]');
var updateAmount = document.querySelector('[data-nexres="update-amount"]');
var updateAddress = document.querySelector('[data-nexres="update-address"]');
var ownerPublicKey = document.querySelector('[data-nexres="filter-owner-key"]');
var recipientPublicKey = document.querySelector('[data-nexres="filter-recipient-key"]');
var updateMultiId1 = document.querySelector('[data-nexres="update-multi-id1"]');
var updateMultiData1 = document.querySelector('[data-nexres="update-multi-data1"]');
var updateMultiAmount1 = document.querySelector('[data-nexres="update-multi-amount1"]');
var updateMultiAddress1 = document.querySelector('[data-nexres="update-multi-address1"]');
var updateMultiId2 = document.querySelector('[data-nexres="update-multi-id2"]');
var updateMultiData2 = document.querySelector('[data-nexres="update-multi-data2"]');
var updateMultiAmount2 = document.querySelector('[data-nexres="update-multi-amount2"]');
var updateMultiAddress2 = document.querySelector('[data-nexres="update-multi-address2"]');

commit.addEventListener("click", messageContentScript);
commit.addEventListener("click", commitContentScript);
fetcher.addEventListener("click", fetchContentScript);
update.addEventListener("click", updateContentScript);
updateMulti.addEventListener("click", updateMultiContentScript);
filter.addEventListener("click", filterContentScript);
account.addEventListener("click", accountContentScript);

function messageContentScript() {
function commitContentScript() {
sdk.sendMessage({
direction: "commit-page-script",
message: data.value,
amount: amount.value,
address: address.value,
address: address.value
});
}
}

function fetchContentScript() {
sdk.sendMessage({
direction: "get-page-script",
id: id.value
});
}

function updateContentScript() {
sdk.sendMessage({
direction: "update-page-script",
id: updateId.value,
message: updateData.value,
amount: updateAmount.value,
address: updateAddress.value
});
}

function updateMultiContentScript() {
const valuesList = [
{
id: updateMultiId1.value,
message: updateMultiData1.value,
amount: updateMultiAmount1.value,
address: updateMultiAddress1.value,
},
{
id: updateMultiId2.value,
message: updateMultiData2.value,
amount: updateMultiAmount2.value,
address: updateMultiAddress2.value,
}
];

sdk.sendMessage({
direction: "update-multi-page-script",
values: valuesList
});
}

function filterContentScript() {
sdk.sendMessage({
direction: "filter-page-script",
owner: ownerPublicKey.value,
recipient: recipientPublicKey.value,
});
}

function accountContentScript() {
sdk.sendMessage({
direction: "account-page-script",
});
}

0 comments on commit ddc9986

Please sign in to comment.