Abstract
This research investigated the effects of two training groups on muscular strength and endurance among student-athletes at Salay Community College. Sixty-two participants were recruited and allocated to HIIT (three times a week) and MICT (five times a week) training protocols over eight weeks using a quasi-experimental pretest-posttest design. The researcher administered pre- and post-intervention assessments to measure changes in squat and push-up performance, evaluating both strength and endurance components. Analysis revealed that both training groups achieved significant improvements across the measured variables, with a statistically significant difference between the groups' pretest and posttest scores for muscular strength and endurance. However, the MICT group demonstrated superior gains in upper-body strength and endurance, as well as enhanced lower-body endurance capacity. Post-training assessments showed that MICT participants outperformed their HIIT counterparts in push-up strength, push-up endurance, and squat endurance, with statistically significant differences between groups. Regarding squat strength specifically, both training modalities produced similar improvement levels with no statistically significant difference between groups. These outcomes underscore the value of structured, research-informed exercise programs for student-athletes, indicating that MICT could offer greater advantages for overall athletic progress in school environments.
Keywords:
high-intensity interval training,
moderate-intensity continuous training,
muscular strength,
muscular endurance,
and student-athletes
View Publication Certificate
View PDF
Cite This Article
Back to Archives
Share This Paper
LinkedIn
Facebook
X
WhatsApp
Telegram
Reddit
Email
Copy Link
function copyShareLink(btn) {
navigator.clipboard.writeText(btn.dataset.url).then(function() {
btn.innerHTML = ' Copied!';
btn.classList.add('share-copied');
setTimeout(function() {
btn.innerHTML = ' Copy Link';
btn.classList.remove('share-copied');
}, 2000);
});
}
(adsbygoogle = window.adsbygoogle || []).push({});
Blockchain Confirmation
Send Tokens
Confirm at SciMatic Hybrid Blockchain
Token ID:
Hash:
Loading...
Upload to Blockchain
If you want to upload this article to SciMatic Hybrid Blockchain,
install MetaMask extension
to your web browser, create a wallet and buy SCI coins at
SciMatic using credit or contact your country coordinator.
One article costs 10 SCI coins to be in the Blockchain.
Buy SCI Coins
Bibliographic Information
Mea Ravalo
(2025). High-Intensity Interval and Moderate-Intensity Continuous Training: Effect on Athletes' Athletic Performance, Psychology and Education: A Multidisciplinary Journal, 49(5): 609-624
Bibtex Citation
@article{mea_ravalo2025pemj,
author = {Mea Ravalo},
title = {High-Intensity Interval and Moderate-Intensity Continuous Training: Effect on Athletes' Athletic Performance},
journal = {Psychology and Education: A Multidisciplinary Journal},
year = {2025},
volume = {49},
number = {5},
pages = {609-624},
doi = {10.70838/pemj.490504},
url = {https://scimatic.org/show_manuscript/6756}
}
APA Citation
Ravalo, M., (2025). High-Intensity Interval and Moderate-Intensity Continuous Training: Effect on Athletes' Athletic Performance. Psychology and Education: A Multidisciplinary Journal, 49(5), 609-624. https://doi.org/10.70838/pemj.490504
// Updated contract address and ABI for the new contract
const contractAddress = "0xC17994a40d9459dfEA21207dB34eCaf2a1c96804";
const CONTRACT_ABI = [
{
"inputs": [
{
"internalType": "string",
"name": "uri_",
"type": "string"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ERC1155InsufficientBalance",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "approver",
"type": "address"
}
],
"name": "ERC1155InvalidApprover",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "idsLength",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "valuesLength",
"type": "uint256"
}
],
"name": "ERC1155InvalidArrayLength",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "ERC1155InvalidOperator",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "ERC1155InvalidReceiver",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "ERC1155InvalidSender",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "ERC1155MissingApprovalForAll",
"type": "error"
},
{
"inputs": [],
"name": "EnforcedPause",
"type": "error"
},
{
"inputs": [],
"name": "ExpectedPause",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "doi",
"type": "string"
},
{
"indexed": true,
"internalType": "address",
"name": "creator",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "supply",
"type": "uint256"
}
],
"name": "ArticleMinted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "ipfsHash",
"type": "string"
}
],
"name": "MetadataUpdated",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "string",
"name": "doi",
"type": "string"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "articleId",
"type": "uint256"
}
],
"name": "mintArticle",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeBatchTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "newuri",
"type": "string"
}
],
"name": "setURI",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferArticle",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
}
],
"name": "TransferBatch",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "TransferSingle",
"type": "event"
},
{
"inputs": [],
"name": "unpause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "value",
"type": "string"
},
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "URI",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "string",
"name": "title",
"type": "string"
},
{
"internalType": "string",
"name": "authors",
"type": "string"
},
{
"internalType": "string",
"name": "journal",
"type": "string"
},
{
"internalType": "string",
"name": "url",
"type": "string"
}
],
"name": "updateArticleMetadata",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "string",
"name": "abstractText",
"type": "string"
},
{
"internalType": "string",
"name": "volume",
"type": "string"
},
{
"internalType": "string",
"name": "pages",
"type": "string"
},
{
"internalType": "string",
"name": "ipfsHash",
"type": "string"
}
],
"name": "updateArticleMetadataExt",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "articleMetadata",
"outputs": [
{
"internalType": "string",
"name": "title",
"type": "string"
},
{
"internalType": "string",
"name": "authors",
"type": "string"
},
{
"internalType": "string",
"name": "journal",
"type": "string"
},
{
"internalType": "string",
"name": "doi",
"type": "string"
},
{
"internalType": "string",
"name": "url",
"type": "string"
},
{
"internalType": "uint256",
"name": "articleId",
"type": "uint256"
},
{
"internalType": "address",
"name": "creator",
"type": "address"
},
{
"internalType": "uint256",
"name": "dateCreated",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "articleMetadataExt",
"outputs": [
{
"internalType": "string",
"name": "abstractText",
"type": "string"
},
{
"internalType": "string",
"name": "volume",
"type": "string"
},
{
"internalType": "string",
"name": "pages",
"type": "string"
},
{
"internalType": "string",
"name": "ipfsHash",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "accounts",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
}
],
"name": "balanceOfBatch",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "DEFAULT_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"name": "doiToTokenId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "exists",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getFullMetadata",
"outputs": [
{
"components": [
{
"internalType": "string",
"name": "title",
"type": "string"
},
{
"internalType": "string",
"name": "authors",
"type": "string"
},
{
"internalType": "string",
"name": "journal",
"type": "string"
},
{
"internalType": "string",
"name": "doi",
"type": "string"
},
{
"internalType": "string",
"name": "url",
"type": "string"
},
{
"internalType": "uint256",
"name": "articleId",
"type": "uint256"
},
{
"internalType": "address",
"name": "creator",
"type": "address"
},
{
"internalType": "uint256",
"name": "dateCreated",
"type": "uint256"
}
],
"internalType": "struct DeJournalNFT.ArticleMetadata",
"name": "metadata",
"type": "tuple"
},
{
"components": [
{
"internalType": "string",
"name": "abstractText",
"type": "string"
},
{
"internalType": "string",
"name": "volume",
"type": "string"
},
{
"internalType": "string",
"name": "pages",
"type": "string"
},
{
"internalType": "string",
"name": "ipfsHash",
"type": "string"
}
],
"internalType": "struct DeJournalNFT.ArticleMetadataExt",
"name": "metadataExt",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "doi",
"type": "string"
}
],
"name": "getTokenIdByDOI",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getUserTokens",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "tokenExists",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "uri",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "userTokens",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
];
// MD5 function (keep your existing MD5 implementation)
var MD5 = function(d){var r = M(V(Y(X(d),8*d.length)));return r.toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",r=0;r>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m5]|=(255&d.charCodeAt(m/8))>>m%32&255);return _}function Y(d,_){d[_>>5]|=128>9>16)+(m>>16) {
if (typeof window.ethereum !== 'undefined') {
const ethereum = window.ethereum;
// Event listeners for network/account changes
ethereum.on('chainChanged', function() {
location.reload();
});
ethereum.on('accountsChanged', function() {
location.reload();
});
// Check if the current network is SciMatic Chain
const currentNetworkId = await ethereum.request({ method: 'eth_chainId' });
if (currentNetworkId !== sciChainChainId) {
try {
// Request to switch to SciMatic Chain
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: sciChainChainId }],
});
} catch (switchError) {
// This error code indicates that the chain has not been added to MetaMask
if (switchError.code === 4902) {
try {
await ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: sciChainChainId,
chainName: 'Scimatic Network',
nativeCurrency: {
name: 'SciMatic Coin',
symbol: 'SCI',
decimals: 18,
},
rpcUrls: [providerUrl],
blockExplorerUrls: ['https://scimatic.net'],
}],
});
} catch (addError) {
console.error('Error adding Scimatic network:', addError);
}
}
}
}
// Request account access using modern method
await ethereum.request({ method: 'eth_requestAccounts' });
web3 = new Web3(ethereum);
contract = new web3.eth.Contract(CONTRACT_ABI, contractAddress);
} else {
console.error('MetaMask not available, using default provider');
web3 = new Web3(new Web3.providers.HttpProvider(providerUrl));
contract = new web3.eth.Contract(CONTRACT_ABI, contractAddress);
}
// Automatically check if article is already tokenized
setTimeout(() => {
checkTokenInfo();
}, 1000);
});
// Ensure MetaMask is on the SciMatic network. If not, switch to it;
// if the chain is not yet added, add it. The existing `chainChanged`
// listener reloads the page automatically after a successful switch/add.
async function ensureScimaticNetwork() {
if (typeof window.ethereum === 'undefined') {
showWarningAlert('MetaMask is not installed. Please install MetaMask to continue.');
return false;
}
try {
const currentNetworkId = await window.ethereum.request({ method: 'eth_chainId' });
if (currentNetworkId === sciChainChainId) {
return true;
}
try {
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: sciChainChainId }],
});
// chainChanged listener will reload the page
return false;
} catch (switchError) {
if (switchError.code === 4902) {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: sciChainChainId,
chainName: 'Scimatic Network',
nativeCurrency: {
name: 'SciMatic Coin',
symbol: 'SCI',
decimals: 18,
},
rpcUrls: [providerUrl],
blockExplorerUrls: ['https://scimatic.net'],
}],
});
// chainChanged listener will reload the page
return false;
} catch (addError) {
console.error('Error adding Scimatic network:', addError);
showWarningAlert('Please add the Scimatic network to MetaMask to continue.');
return false;
}
} else if (switchError.code === 4001) {
showWarningAlert('Please switch to the Scimatic network to continue.');
return false;
}
console.error('Error switching to Scimatic network:', switchError);
showWarningAlert('Failed to switch to Scimatic network: ' + (switchError.message || 'Unknown error'));
return false;
}
} catch (err) {
console.error('ensureScimaticNetwork error:', err);
return false;
}
}
async function getUserAddressFromMetaMask() {
if (!web3) {
console.error('Web3 not available');
alert('Web3 not available');
return null;
}
try {
const accounts = await web3.eth.getAccounts();
if (accounts.length > 0) {
return accounts[0];
} else {
console.error('No accounts found in MetaMask');
alert('No accounts found in MetaMask');
return null;
}
} catch (error) {
console.error('Error fetching accounts:', error);
return null;
}
}
async function uploadButtonClick() {
console.log('Upload button clicked!'); // Debug log
uploadArticleToBlockchain(
'6756',
"e2dca6e3ae19214660ef8fb27f4c5912",
"High-Intensity Interval and Moderate-Intensity Continuous Training: Effect on Athletes' Athletic Performance",
"This research investigated the effects of two training groups on muscular strength and endurance among student-athletes at Salay Community College. Sixty-two participants were recruited and allocated to HIIT (three times a week) and MICT (five times a week) training protocols over eight weeks using a quasi-experimental pretest-posttest design. The researcher administered pre- and post-intervention assessments to measure changes in squat and push-up performance, evaluating both strength and endurance components. Analysis revealed that both training groups achieved significant improvements across the measured variables, with a statistically significant difference between the groups' pretest and posttest scores for muscular strength and endurance. However, the MICT group demonstrated superior gains in upper-body strength and endurance, as well as enhanced lower-body endurance capacity. Post-training assessments showed that MICT participants outperformed their HIIT counterparts in push-up strength, push-up endurance, and squat endurance, with statistically significant differences between groups. Regarding squat strength specifically, both training modalities produced similar improvement levels with no statistically significant difference between groups. These outcomes underscore the value of structured, research-informed exercise programs for student-athletes, indicating that MICT could offer greater advantages for overall athletic progress in school environments.",
'Mea Ravalo',
'Psychology and Education: A Multidisciplinary Journal',
'49',
'609-624',
'https://scimatic.org/show_manuscript/6756'
);
}
// Updated function for the new contract structure
async function uploadArticleToBlockchain(
articleId,
uniqueId,
articleTitle,
articleAbstract,
authors,
journal,
volume,
pages,
url
) {
if (!web3) {
console.error('Web3 not available');
showWarningAlert('Web3 not available or Blockchain network under maintenance');
return;
}
// Force Scimatic network before minting (will switch/add and reload if needed)
if (!(await ensureScimaticNetwork())) {
return;
}
try {
const userAddress = await getUserAddressFromMetaMask();
if (!userAddress) {
alert('Failed to retrieve user address from MetaMask. Make sure MetaMask extension is installed in your Web Browser');
return;
}
console.log('User address:', userAddress);
console.log('Article data:', {
articleId,
uniqueId,
articleTitle: articleTitle.substring(0, 50) + '...',
authors,
journal,
volume,
pages,
url
});
// Show loading spinner
const spinner = document.getElementById('spinner');
spinner.classList.remove('d-none');
// Check if article is already tokenized
const existingTokenId = await contract.methods.getTokenIdByDOI(uniqueId).call();
console.log('Existing token ID check:', existingTokenId);
if (existingTokenId > 0) {
showWarningAlert('Article with this unique ID already exists on the blockchain. Token ID: ' + existingTokenId);
spinner.classList.add('d-none');
return;
}
// Debug: Check if DOI is not empty
if (!uniqueId || uniqueId.trim() === '') {
showWarningAlert('DOI/Unique ID cannot be empty');
spinner.classList.add('d-none');
return;
}
// Debug: Log the parameters we're sending
console.log('Minting with params:', {
to: userAddress,
doi: uniqueId,
amount: 1000000,
articleId: parseInt(articleId)
});
// Step 1: Mint the article with basic info
showInfoAlert('Minting NFT token...');
// Get gas price for legacy transaction
const gasPrice = await web3.eth.getGasPrice();
// Estimate gas first to catch errors early
let gasEstimate;
try {
gasEstimate = await contract.methods.mintArticle(
userAddress,
uniqueId, // Using hash as DOI
1000000, // 1 million tokens
parseInt(articleId) // Make sure it's a number
).estimateGas({
from: userAddress
});
console.log('Gas estimate:', gasEstimate);
// Convert BigInt to Number for calculations
gasEstimate = Number(gasEstimate);
} catch (estimateError) {
console.error('Gas estimation failed:', estimateError);
showWarningAlert('Transaction will fail. Error: ' + estimateError.message);
spinner.classList.add('d-none');
return;
}
const mintTx = await contract.methods.mintArticle(
userAddress,
uniqueId, // Using hash as DOI
1000000, // 1 million tokens
parseInt(articleId) // Make sure it's a number
).send({
from: userAddress,
gas: Math.floor(gasEstimate * 1.2), // Add 20% buffer
gasPrice: gasPrice.toString() // Convert to string for legacy transaction
});
// Get token ID from event
let tokenId;
if (mintTx.events && mintTx.events.ArticleMinted) {
tokenId = mintTx.events.ArticleMinted.returnValues.tokenId;
// Convert BigInt to string/number
tokenId = tokenId.toString();
} else {
// Fallback: get token ID by DOI
tokenId = await contract.methods.getTokenIdByDOI(uniqueId).call();
tokenId = tokenId.toString();
}
console.log('Token minted with ID:', tokenId);
// Success! NFT was minted
console.log('Article successfully tokenized!');
currentTokenId = tokenId; // Store globally
showSuccessAlert(`✅ Article successfully tokenized! \n\nToken ID: ${tokenId}\nSupply: 1,000,000 tokens\nContract: ${contractAddress}\n\nThe article has been permanently recorded on the blockchain.`);
// Show token ID in the info section
const tokenIdRow = document.getElementById('tokenIdRow');
const tokenIdValue = document.getElementById('tokenIdValue');
if (tokenIdRow && tokenIdValue) {
tokenIdRow.style.display = 'block';
tokenIdValue.textContent = tokenId;
}
// Show Add to MetaMask button
const addToMetaMaskBtn = document.getElementById('addToMetaMaskBtn');
if (addToMetaMaskBtn) {
addToMetaMaskBtn.style.display = 'inline-block';
}
// Show token info section
const tokenInfoSection = document.getElementById('tokenInfoSection');
const displayTokenId = document.getElementById('displayTokenId');
if (tokenInfoSection && displayTokenId) {
tokenInfoSection.style.display = 'block';
displayTokenId.textContent = tokenId;
}
// Try to add token to MetaMask
try {
await addTokenToMetaMask(tokenId);
} catch (error) {
console.error('Error adding token to MetaMask:', error);
}
// Store token info for reference
if (typeof(Storage) !== "undefined") {
localStorage.setItem(`article_${articleId}_tokenId`, tokenId);
localStorage.setItem(`article_${articleId}_txHash`, mintTx.transactionHash);
}
// Disable the upload button since it's already tokenized
const uploadButton = document.getElementById('uploadButton');
if (uploadButton) {
uploadButton.disabled = true;
uploadButton.innerHTML = ' Already Tokenized (Token ID: ' + tokenId + ')';
}
// Hide spinner
spinner.classList.add('d-none');
// Refresh the page after a short delay
setTimeout(() => {
location.reload();
}, 5000);
} catch (error) {
console.error('Error:', error);
// Hide spinner
const spinner = document.getElementById('spinner');
spinner.classList.add('d-none');
let errorMessage = 'Transaction failed. ';
// Parse specific error messages
if (error.message.includes('insufficient funds')) {
errorMessage += 'Insufficient balance for gas fees.';
} else if (error.code === 4001) {
errorMessage += 'Transaction cancelled by user.';
} else if (error.message.includes('DOI cannot be empty')) {
errorMessage += 'The article unique ID (DOI) cannot be empty.';
} else if (error.message.includes('Article already tokenized')) {
errorMessage += 'This article has already been tokenized.';
} else if (error.message.includes('Invalid amount')) {
errorMessage += 'Invalid token amount specified.';
} else if (error.message.includes('User denied transaction')) {
errorMessage += 'You rejected the transaction in MetaMask.';
} else {
errorMessage += error.message || 'Please try again later.';
}
showWarningAlert(errorMessage);
}
}
// Add token to MetaMask - Updated for better compatibility
async function addTokenToMetaMask(tokenId) {
try {
// First, let's check the user's balance of this token
const userAddress = await getUserAddressFromMetaMask();
const balance = await contract.methods.balanceOf(userAddress, tokenId).call();
console.log(`User balance for token ${tokenId}:`, balance);
// For ERC1155, we need to ensure the token URI is accessible
const tokenURI = await contract.methods.uri(tokenId).call();
console.log('Token URI:', tokenURI);
// Try adding as a custom token
const wasAdded = await window.ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC1155',
options: {
address: contractAddress,
tokenId: tokenId.toString(),
}
}
});
if (wasAdded) {
console.log('Token added to MetaMask!');
} else {
console.log('Token addition was cancelled');
}
} catch (error) {
console.error('Error adding token to MetaMask:', error);
// Provide manual instructions as fallback
showInfoAlert(`To view your NFT in MetaMask: Go to NFTs tab → Import NFT → Contract: ${contractAddress} → Token ID: ${tokenId}`);
}
}
// Updated check function for the new contract
async function checkTokenInfo() {
if (!web3) {
console.error('Web3 not available');
showWarningAlert('Web3 not available or Blockchain network under maintenance');
return;
}
const tokenId = document.getElementById('tokenId') ? parseInt(document.getElementById('tokenId').value) : 6756;
try {
// Show the spinner
const spinner = document.getElementById('spinner');
spinner.classList.remove('d-none');
// First check if this article's unique ID has a token
const uniqueId = "e2dca6e3ae19214660ef8fb27f4c5912";
const tokenIdByDOI = await contract.methods.getTokenIdByDOI(uniqueId).call();
if (tokenIdByDOI && tokenIdByDOI > 0) {
// Store the token ID globally
currentTokenId = tokenIdByDOI.toString();
const result = document.getElementById('result');
result.innerHTML = `
Article Successfully Tokenized!
Token ID: ${tokenIdByDOI}
DOI/Hash: ${uniqueId}
Supply: 1,000,000 tokens
Contract: ${contractAddress}
This article has been permanently recorded on the Scimatic blockchain.
`;
// Show token ID in the info section
const tokenIdRow = document.getElementById('tokenIdRow');
const tokenIdValue = document.getElementById('tokenIdValue');
if (tokenIdRow && tokenIdValue) {
tokenIdRow.style.display = 'block';
tokenIdValue.textContent = tokenIdByDOI;
}
// Show Add to MetaMask button in header
const addToMetaMaskBtn = document.getElementById('addToMetaMaskBtn');
if (addToMetaMaskBtn) {
addToMetaMaskBtn.style.display = 'inline-block';
}
// Show token info section (but hide the duplicate button there)
const tokenInfoSection = document.getElementById('tokenInfoSection');
const displayTokenId = document.getElementById('displayTokenId');
if (tokenInfoSection && displayTokenId) {
tokenInfoSection.style.display = 'block';
displayTokenId.textContent = tokenIdByDOI;
// Hide the duplicate button inside token info section
const duplicateBtn = tokenInfoSection.querySelector('.btn-warning');
if (duplicateBtn) {
duplicateBtn.style.display = 'none';
}
}
// Disable the upload button
const uploadButton = document.getElementById('uploadButton');
if (uploadButton) {
uploadButton.disabled = true;
uploadButton.innerHTML = ' Already Tokenized';
}
} else {
const result = document.getElementById('result');
result.innerHTML = '';
showWarningAlert('Article not found on the blockchain. Click the button below to upload.');
// Enable the upload button
const uploadButton = document.getElementById('uploadButton');
if (uploadButton) {
uploadButton.disabled = false;
}
}
} catch (error) {
console.error('Error:', error);
showWarningAlert('Network error occurred: ' + error.message);
} finally {
// Hide the spinner
const spinner = document.getElementById('spinner');
spinner.classList.add('d-none');
}
}
// Alert functions
function showWarningAlert(message) {
showAlert('warning', message);
}
function showSuccessAlert(message) {
showAlert('success', message);
}
function showInfoAlert(message) {
showAlert('info', message);
}
function showAlert(type, message) {
const alertDiv = document.createElement('div');
alertDiv.className = `alert alert-${type} alert-dismissible fade show mt-3`;
alertDiv.innerHTML = `
${message}
×
`;
const result = document.getElementById('result');
result.innerHTML = '';
result.appendChild(alertDiv);
}
Author Information
To change your profile photo, login to scimatic.org, go to your profile and change the photo.
Provide a face photo, and not full body.
It is better to remove the background from your photo. Go to Remove Background and then upload to profile
If you are unable to login, go to Reset My Password provide your email registered with the article and get new password.
In case of any other problem, contact your editor directly or write to us at info @ scimatic.org
Send Article Tokens
Transfer tokens for Article ID: -
Your Balance: 0 tokens
Recipient Wallet Address
Scan QR
Enter the Ethereum wallet address
Number of Tokens to Send
Maximum: 0 tokens
Cancel
Send Tokens
Processing transaction...
Processing transaction, please wait...
Confirm
Cancel
Confirm
Scan Wallet QR Code
Address Detected:
Use This Address
/* Card Styling */
.card {
margin-bottom: 2rem;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
border: none;
border-radius: 12px;
overflow: hidden;
}
.card-header {
padding: 1.2rem 1.5rem;
border-bottom: none;
display: flex;
justify-content: space-between;
align-items: center;
}
/* Manuscript Header */
.manuscript-header {
background: linear-gradient(45deg, #4834d4, #6c5ce7);
color: white;
padding: 1.5rem;
}
.retracted-header {
background: linear-gradient(45deg, #e53e3e, #f56565);
color: white;
padding: 1.5rem;
}
.manuscript-header-content {
flex: 1;
}
.article-type-badge {
display: inline-block;
background-color: #2FCC71;
color: white;
padding: 0.3rem 0.8rem;
border-radius: 50px;
font-size: 0.75rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.manuscript-title {
font-size: 1.5rem;
margin: 0;
line-height: 1.4;
word-wrap: break-word;
}
.conference-logos {
display: flex;
margin-top: 1rem;
gap: 1rem;
}
.conference-logo {
max-width: 80px;
height: auto;
border-radius: 4px;
}
.retraction-notice {
color: white;
font-weight: bold;
margin-top: 0.5rem;
background-color: rgba(0,0,0,0.2);
padding: 0.4rem 0.8rem;
border-radius: 4px;
display: inline-block;
}
.reads-counter {
background-color: #2D3748;
color: white;
padding: 0.75rem;
border-radius: 8px;
text-align: center;
min-width: 80px;
}
.reads-number {
display: block;
font-size: 1.75rem;
font-weight: 700;
line-height: 1;
}
.author-link {
color: #2d3748;
text-decoration: none;
transition: color 0.2s;
font-weight: 600;
}
.author-link:hover {
color: #4299e1;
text-decoration: underline;
}
.author-separator {
margin-right: 5px;
}
.reads-label {
display: block;
font-size: 0.8rem;
text-transform: uppercase;
opacity: 0.7;
}
/* Manuscript Content */
.manuscript-content {
background-color: white;
position: relative;
}
.manuscript-main-content {
padding: 2rem;
border-right: 1px solid #edf2f7;
}
.manuscript-sidebar {
padding: 1.5rem;
background-color: #f8fafc;
}
.manuscript-authors {
font-size: 1.1rem;
font-weight: 600;
color: #2d3748;
margin-bottom: 0.5rem;
text-transform: capitalize;
}
.manuscript-affiliations {
color: #718096;
margin-bottom: 1rem;
}
.manuscript-publication-info {
background-color: #f1f5f9;
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 0.9rem;
color: #4a5568;
margin-bottom: 1.5rem;
}
.journal-name {
font-style: italic;
}
.volume-info {
font-weight: 600;
}
.manuscript-abstract {
margin-bottom: 1.5rem;
}
.abstract-title {
font-size: 1.25rem;
color: #2d3748;
margin-bottom: 0.75rem;
font-weight: 600;
}
.abstract-content {
color: #4a5568;
line-height: 1.7;
font-size: 1.05rem;
text-align: justify;
}
.manuscript-keywords {
background-color: #edf2f7;
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 0.9rem;
color: #4a5568;
margin-top: 1.5rem;
text-transform: capitalize;
}
.keywords-label {
font-weight: 600;
margin-right: 0.5rem;
}
.admin-actions {
margin-top: 1.5rem;
}
/* Sidebar Content */
.author-photo {
text-align: center;
margin-bottom: 1.5rem;
border-radius: 8px;
overflow: hidden;
}
.author-photo img {
max-width: 100%;
height: auto;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.manuscript-actions {
margin-bottom: 1.5rem;
}
.action-buttons {
display: flex;
flex-direction: column;
gap: 0.75rem;
margin-bottom: 1.5rem;
}
.social-sharing {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid #e2e8f0;
}
.sharing-title {
font-size: 1rem;
color: #2d3748;
margin-bottom: 1rem;
text-align: center;
}
.sharing-buttons {
display: flex;
justify-content: center;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.share-btn {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.4rem 0.85rem;
border-radius: 2rem;
font-size: 0.82rem;
font-weight: 500;
text-decoration: none;
border: none;
cursor: pointer;
color: #fff;
transition: opacity 0.2s, transform 0.15s;
}
.share-btn:hover {
opacity: 0.85;
transform: translateY(-1px);
color: #fff;
text-decoration: none;
}
.share-linkedin { background: #0A66C2; }
.share-facebook { background: #1877F2; }
.share-x { background: #000; }
.share-whatsapp { background: #25D366; }
.share-telegram { background: #26A5E4; }
.share-reddit { background: #FF4500; }
.share-email { background: #6c757d; }
.share-copy { background: #495057; font-family: inherit; }
.share-copied { background: #198754 !important; }
/* Admin Form */
.admin-upload-form {
background-color: #f8fafc;
padding: 1.5rem;
border-radius: 8px;
}
.form-section-title {
font-size: 1.25rem;
color: #2d3748;
margin-bottom: 1.25rem;
}
/* Blockchain Section */
.blockchain-header {
background: linear-gradient(45deg, #3b82f6, #60a5fa);
color: white;
}
.blockchain-form {
display: flex;
flex-direction: column;
gap: 1rem;
margin-bottom: 1.5rem;
}
.form-row {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.token-id-group {
flex: 0 0 120px;
}
.hash-id-group {
flex: 1;
}
/* Bibliography Section */
.biblio-header {
background: linear-gradient(45deg, #0ea5e9, #38bdf8);
color: white;
}
.citation-text {
line-height: 1.7;
color: #4a5568;
}
/* Help Section */
.help-header {
background: linear-gradient(45deg, #f59e0b, #fbbf24);
color: white;
}
/* Supplementary Info Section */
.supp-header {
background: linear-gradient(45deg, #10b981, #34d399);
color: white;
}
.supp-info-content {
line-height: 1.7;
color: #4a5568;
}
/* Publication Certificate */
.publication-certificate {
margin: 2rem 0;
}
.certificate-outer {
width: 100%;
padding: 2%;
text-align: center;
border: 17px solid #787878;
}
.certificate-inner {
width: 100%;
padding: 20px;
text-align: center;
border: 5px solid #787878;
}
.certificate-header {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
}
.certificate-logo {
flex: 0 0 20%;
}
.certificate-logo img {
max-width: 100%;
height: auto;
}
.certificate-title {
flex: 0 0 60%;
padding: 0 1rem;
}
.certificate-title h2 {
font-size: 1.75rem;
font-weight: bold;
margin-bottom: 1rem;
}
.certificate-manuscript-title {
font-size: 1.25rem;
font-weight: bold;
margin: 1rem 0;
}
.certificate-journal-logo {
flex: 0 0 20%;
}
.certificate-journal-logo img {
max-width: 100%;
height: auto;
}
.certificate-divider {
border-top: 1px solid #787878;
margin: 1.5rem 0;
}
.certificate-authors {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1rem;
margin: 1.5rem 0;
}
.certificate-author {
flex: 0 0 150px;
text-align: center;
}
.certificate-author-photo {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
margin-bottom: 0.5rem;
}
.certificate-author-name {
font-size: 0.8rem;
}
.certificate-footer {
margin-top: 1.5rem;
}
.certificate-footer h3 {
font-size: 1.25rem;
font-style: italic;
margin: 0.5rem 0;
}
.certificate-date {
font-size: 0.9rem;
margin: 1rem 0;
}
.certificate-verification {
font-size: 0.8rem;
color: #718096;
}
.certificate-qr-code {
display: flex;
justify-content: center;
margin-top: 0.5rem;
}
/* Retraction Styling */
.retraction-reason {
color: #e53e3e;
font-size: 1.25rem;
line-height: 1.6;
padding: 1.5rem;
border: 2px dashed #e53e3e;
border-radius: 8px;
background-color: #fff5f5;
}
/* Responsive Styles */
@media (max-width: 991.98px) {
.manuscript-main-content,
.manuscript-sidebar {
padding: 1.5rem;
}
.certificate-header {
flex-direction: column;
}
.certificate-logo,
.certificate-title,
.certificate-journal-logo {
flex: 0 0 100%;
margin-bottom: 1rem;
}
.certificate-logo img,
.certificate-journal-logo img {
max-width: 120px;
}
}
@media (max-width: 767.98px) {
.manuscript-main-content {
border-right: none;
border-bottom: 1px solid #edf2f7;
}
.manuscript-header-content {
width: 100%;
}
.reads-counter {
position: absolute;
top: 1rem;
right: 1rem;
}
.form-row {
flex-direction: column;
}
.token-id-group,
.hash-id-group {
width: 100%;
}
.blockchain-header,
.biblio-header,
.help-header,
.supp-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.certificate-authors {
gap: 0.5rem;
}
.certificate-author {
flex: 0 0 calc(50% - 0.5rem);
}
}
@media (max-width: 575.98px) {
.manuscript-title {
font-size: 1.25rem;
}
.manuscript-main-content,
.manuscript-sidebar {
padding: 1rem;
}
.abstract-title {
font-size: 1.1rem;
}
.abstract-content {
font-size: 1rem;
}
.certificate-outer {
padding: 1%;
border-width: 10px;
}
.certificate-inner {
padding: 10px;
border-width: 3px;
}
.certificate-title h2 {
font-size: 1.25rem;
}
.certificate-manuscript-title {
font-size: 1rem;
}
}
// Global variables for send tokens functionality
let currentUserBalance = 0;
let selectedTokenId = null;
let html5QrcodeScanner = null;
let scannedAddress = null;
// Contract address is defined in script.blade.php as `contractAddress`
// Wait for document ready before loading QR scanner
document.addEventListener('DOMContentLoaded', function() {
// Load QR Code Scanner library
if (!document.getElementById('html5-qrcode-script')) {
const script = document.createElement('script');
script.id = 'html5-qrcode-script';
script.src = 'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js';
script.onload = function() {
console.log('QR Scanner library loaded successfully');
};
script.onerror = function() {
console.error('Failed to load QR Scanner library');
};
document.head.appendChild(script);
}
// Initialize send tokens form
const sendTokensForm = document.getElementById('sendTokensForm');
if (sendTokensForm) {
sendTokensForm.addEventListener('submit', handleSendTokens);
}
});
// Toast notification helper
function showToast(message, type = 'info') {
var icons = { success: 'check-circle', danger: 'exclamation-triangle', warning: 'exclamation-circle', info: 'info-circle' };
var colors = { success: '#198754', danger: '#dc3545', warning: '#ffc107', info: '#0d6efd' };
var container = document.getElementById('toastContainer');
var id = 'toast-' + Date.now();
var html = '' +
'' +
'' +
'' + message +
'
' +
'' +
'
' +
'
';
container.insertAdjacentHTML('beforeend', html);
var toastEl = document.getElementById(id);
var toast = new bootstrap.Toast(toastEl, { delay: type === 'success' ? 6000 : 5000 });
toast.show();
toastEl.addEventListener('hidden.bs.toast', function() { toastEl.remove(); });
}
// Confirmation dialog helper — returns a Promise
function showConfirmDialog(title, bodyHtml) {
return new Promise(function(resolve) {
var modalEl = document.getElementById('confirmDialogModal');
document.getElementById('confirmDialogTitle').textContent = title;
document.getElementById('confirmDialogBody').innerHTML = bodyHtml;
var okBtn = document.getElementById('confirmDialogOk');
var modal = new bootstrap.Modal(modalEl);
var resolved = false;
function cleanup() {
okBtn.removeEventListener('click', onOk);
modalEl.removeEventListener('hidden.bs.modal', onHidden);
}
function onOk() { resolved = true; cleanup(); modal.hide(); resolve(true); }
function onHidden() { if (!resolved) { cleanup(); resolve(false); } }
okBtn.addEventListener('click', onOk);
modalEl.addEventListener('hidden.bs.modal', onHidden);
modal.show();
});
}
// Function to open send tokens modal
async function openSendTokensModal() {
if (!currentTokenId) {
// Try to get token ID from the page
const tokenIdElement = document.getElementById('tokenIdValue');
if (tokenIdElement && tokenIdElement.textContent) {
currentTokenId = tokenIdElement.textContent;
} else {
showToast('Please verify the article first to get the token ID.', 'warning');
return;
}
}
selectedTokenId = currentTokenId.toString();
const modalTokenId = document.getElementById('modalTokenId');
if (modalTokenId) {
modalTokenId.textContent = selectedTokenId;
}
// Check user's balance
await checkUserBalance(selectedTokenId);
// Show the modal
var modal = new bootstrap.Modal(document.getElementById('sendTokensModal'));
modal.show();
}
// Function to close send tokens modal
function closeSendTokensModal() {
var modalEl = document.getElementById('sendTokensModal');
var modal = bootstrap.Modal.getInstance(modalEl);
if (modal) modal.hide();
// Reset form
const sendTokensForm = document.getElementById('sendTokensForm');
if (sendTokensForm) {
sendTokensForm.reset();
}
}
// Check user's balance for the token
async function checkUserBalance(tokenId) {
try {
const userAddress = await getUserAddressFromMetaMask();
if (!userAddress) {
const modalTokenBalance = document.getElementById('modalTokenBalance');
if (modalTokenBalance) {
modalTokenBalance.textContent = '0';
}
return;
}
const balance = await contract.methods.balanceOf(userAddress, tokenId.toString()).call();
currentUserBalance = parseInt(balance.toString());
const modalTokenBalance = document.getElementById('modalTokenBalance');
const tokenAmount = document.getElementById('tokenAmount');
const maxTokens = document.getElementById('maxTokens');
const confirmSendBtn = document.getElementById('confirmSendBtn');
if (modalTokenBalance) {
modalTokenBalance.textContent = currentUserBalance.toLocaleString();
}
if (tokenAmount) {
tokenAmount.max = currentUserBalance;
}
if (maxTokens) {
maxTokens.textContent = currentUserBalance.toLocaleString();
}
if (confirmSendBtn) {
if (currentUserBalance === 0) {
confirmSendBtn.disabled = true;
showToast('You do not own any tokens of this article.', 'warning');
} else {
confirmSendBtn.disabled = false;
}
}
} catch (error) {
console.error('Error checking balance:', error);
const modalTokenBalance = document.getElementById('modalTokenBalance');
if (modalTokenBalance) {
modalTokenBalance.textContent = 'Error';
}
}
}
// Handle send tokens form submission
async function handleSendTokens(e) {
e.preventDefault();
// Force Scimatic network before sending (will switch/add and reload if needed)
if (!(await ensureScimaticNetwork())) {
return;
}
const recipientAddress = document.getElementById('recipientAddress').value;
const amount = parseInt(document.getElementById('tokenAmount').value);
// Validate inputs
if (!web3.utils.isAddress(recipientAddress)) {
showToast('Invalid recipient address. Please enter a valid Ethereum wallet address.', 'danger');
return;
}
if (amount currentUserBalance) {
showToast('Invalid amount. Must be between 1 and ' + currentUserBalance + '.', 'danger');
return;
}
// Confirm transaction
var confirmed = await showConfirmDialog(
'Confirm Token Transfer',
'You are about to send:
' +
'' +
'Amount: ' + amount + ' token' + (amount > 1 ? 's' : '') + '
' +
'To: ' + recipientAddress + '
' +
'
' +
'This action cannot be undone.'
);
if (!confirmed) {
return;
}
// Show spinner
const sendTokensForm = document.getElementById('sendTokensForm');
const sendTokensSpinner = document.getElementById('sendTokensSpinner');
if (sendTokensForm) sendTokensForm.style.display = 'none';
if (sendTokensSpinner) sendTokensSpinner.classList.remove('d-none');
try {
const userAddress = await getUserAddressFromMetaMask();
// Check balance one more time
const currentBalance = await contract.methods.balanceOf(userAddress, selectedTokenId).call();
if (parseInt(currentBalance) < amount) {
throw new Error('Insufficient balance');
}
// Get gas price for legacy transaction
const gasPrice = await web3.eth.getGasPrice();
// Estimate gas
let gasEstimate;
try {
gasEstimate = await contract.methods.safeTransferFrom(
userAddress,
recipientAddress,
selectedTokenId,
amount.toString(),
'0x'
).estimateGas({
from: userAddress
});
} catch (error) {
console.error('Gas estimation failed:', error);
gasEstimate = 200000;
}
// Send the tokens
const tx = await contract.methods.safeTransferFrom(
userAddress,
recipientAddress,
selectedTokenId,
amount.toString(),
'0x'
).send({
from: userAddress,
gas: Math.floor(Number(gasEstimate) * 1.2),
gasPrice: gasPrice.toString()
});
console.log('Transaction successful:', tx);
// Show success message
showToast('Successfully sent ' + amount + ' tokens! TX: ' + tx.transactionHash.substring(0, 14) + '...', 'success');
// Close modal
closeSendTokensModal();
// Refresh token info
setTimeout(() => {
checkTokenInfo();
}, 2000);
} catch (error) {
console.error('Error sending tokens:', error);
showToast('Error sending tokens: ' + error.message, 'danger');
} finally {
// Hide spinner and show form
if (sendTokensSpinner) sendTokensSpinner.classList.add('d-none');
if (sendTokensForm) sendTokensForm.style.display = 'block';
}
}
// QR Scanner functions
function openQRScanner() {
var modal = new bootstrap.Modal(document.getElementById('qrScannerModal'));
modal.show();
// Reset previous results
const qrResult = document.getElementById('qrResult');
const useAddressBtn = document.getElementById('useAddressBtn');
if (qrResult) qrResult.classList.add('d-none');
if (useAddressBtn) useAddressBtn.classList.add('d-none');
scannedAddress = null;
// Clear the reader div
const qrReaderDiv = document.getElementById('qrReaderDiv');
if (qrReaderDiv) {
qrReaderDiv.innerHTML = '';
}
// Start QR scanner with delay to ensure modal is fully shown
setTimeout(() => startQRScanner(), 300);
}
function closeQRScanner() {
// Stop scanner if running
if (html5QrcodeScanner) {
html5QrcodeScanner.clear();
html5QrcodeScanner = null;
}
var modalEl = document.getElementById('qrScannerModal');
var qrModal = bootstrap.Modal.getInstance(modalEl);
if (qrModal) qrModal.hide();
}
function startQRScanner() {
if (typeof Html5QrcodeScanner === 'undefined') {
console.error('Html5QrcodeScanner is not defined');
const qrReaderDiv = document.getElementById('qrReaderDiv');
if (qrReaderDiv) {
qrReaderDiv.innerHTML = `
QR Scanner is loading...
Retry
`;
}
return;
}
try {
// Configure scanner
const config = {
fps: 10,
qrbox: { width: 250, height: 250 },
aspectRatio: 1.0,
showTorchButtonIfSupported: true,
experimentalFeatures: {
useBarCodeDetectorIfSupported: false
}
};
// Create new scanner instance
html5QrcodeScanner = new Html5QrcodeScanner("qrReaderDiv", config, false);
html5QrcodeScanner.render(
(decodedText, decodedResult) => {
console.log('QR Code detected:', decodedText);
handleQRCodeResult(decodedText);
},
(error) => {
if (!error.includes('NotFoundException')) {
console.log('QR scan error:', error);
}
}
);
} catch (error) {
console.error('Error starting QR scanner:', error);
}
}
function handleQRCodeResult(text) {
// Stop scanning
if (html5QrcodeScanner) {
html5QrcodeScanner.clear();
}
// Extract Ethereum address
let address = text;
// Handle ethereum: prefix
if (text.startsWith('ethereum:')) {
address = text.replace('ethereum:', '').split('?')[0];
}
// Validate address
if (/^0x[a-fA-F0-9]{40}$/.test(address)) {
scannedAddress = address;
const detectedAddress = document.getElementById('detectedAddress');
const qrResult = document.getElementById('qrResult');
const useAddressBtn = document.getElementById('useAddressBtn');
if (detectedAddress) detectedAddress.textContent = address;
if (qrResult) qrResult.classList.remove('d-none');
if (useAddressBtn) useAddressBtn.classList.remove('d-none');
} else {
showToast('Invalid Ethereum address detected. Please scan a valid wallet QR code.', 'danger');
startQRScanner();
}
}
function useScannedAddress() {
if (scannedAddress) {
const recipientAddress = document.getElementById('recipientAddress');
if (recipientAddress) {
recipientAddress.value = scannedAddress;
}
closeQRScanner();
}
}
function retryQRScanner() {
const qrReaderDiv = document.getElementById('qrReaderDiv');
if (qrReaderDiv) {
qrReaderDiv.innerHTML = 'Loading scanner...
';
}
if (typeof Html5QrcodeScanner === 'undefined') {
const existingScript = document.getElementById('html5-qrcode-script');
if (existingScript) {
existingScript.remove();
}
const script = document.createElement('script');
script.id = 'html5-qrcode-script';
script.src = 'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js';
script.onload = function() {
console.log('QR Scanner library loaded on retry');
setTimeout(() => startQRScanner(), 500);
};
document.head.appendChild(script);
} else {
startQRScanner();
}
}
Description
The study compares HIIT and MICT effects on athletic performance.