|
|
|
function replaceIcon(imageSrc, text, classes, parentClasses=[]) { |
|
let imageSelector; |
|
if (imageSrc.startsWith('[') && imageSrc.endsWith(']')) { |
|
imageSelector = imageSrc; |
|
} else { |
|
imageSelector = `[src="https://sbisec.akamaized.net/sbisec/images/${imageSrc}"]`; |
|
} |
|
|
|
const images = document.querySelectorAll(imageSelector); |
|
// console.log(imageSrc, images); |
|
// console.log(imageSelector); |
|
images.forEach((image) => { |
|
const container = image.parentNode; |
|
|
|
const button = document.createElement("span"); |
|
button.innerHTML = text.replace("\n", "<br>"); |
|
classes.forEach ((cls) => button.classList.add(cls)); |
|
|
|
container.replaceChild(button, image); |
|
|
|
let parent = container; |
|
for (let i = 0; i < parentClasses.length; i++) { |
|
parentClasses[i].forEach((cls) => parent.classList.add(cls)); |
|
parent = parent.parentNode; |
|
} |
|
}); |
|
} |
|
//========================================================= |
|
replaceIcon('base02/b_fmmf001_01.gif', "Purchase", ["text-button", "small", "solid"]); |
|
|
|
replaceIcon('base02/b_fmmf006_01.gif', "Sell", ["text-button", "small", "danger"]); |
|
|
|
replaceIcon('base02/b_fmmf004_01.gif', "Place order", ["text-button"]); |
|
|
|
replaceIcon('base02/b_fmmf003_02.gif', "Go to order confirmation screen", ["text-button", "solid"]); |
|
|
|
replaceIcon('base02/dpst-btn-01.gif', "Next (confirm payment instructions)", ["text-button", "solid"]); |
|
|
|
|
|
//========================================================= |
|
|
|
replaceIcon('base02/b_fmmf007_02.gif', "Detail", ["text-button", "small"]); |
|
replaceIcon('base02/b_fmmf007_01.gif', "Cancel", ["text-button", "small", "danger"]); |
|
replaceIcon('base02/b_fmmf007_01_off.gif', "Cancel", ["text-button", "disabled", "small"]); |
|
|
|
replaceIcon('base02/b_koushin.gif', "Refresh", ["text-button"]); |
|
|
|
|
|
replaceIcon('base02/b_fund03_01_01.gif', "Search", ["text-button"]); |
|
//=======================NAV================================== |
|
replaceIcon('base02/g_head02_port.gif', "Portfolio", ["nav-title"]); |
|
replaceIcon('base02/g_head02_port_act.gif', "Portfolio", ["nav-title", "selected"]); |
|
|
|
replaceIcon('base02/g_head02_trade.gif', "Transactions", ["nav-title"]); |
|
replaceIcon('base02/g_head02_trade_act.gif', "Transactions", ["nav-title", "selected"]); |
|
|
|
replaceIcon('base02/g_head02_account02.gif', "Account management", ["nav-title"]); |
|
replaceIcon('base02/g_head02_account02_act.gif', "Account management", ["nav-title", "selected"]); |
|
|
|
replaceIcon('base02/g_head02_inout.gif', "Money transfer", ["nav-title"]); |
|
replaceIcon('base02/g_head02_inout_act.gif', "Money transfer", ["nav-title", "selected"]); |
|
|
|
//=======================MARKET NAV================================== |
|
replaceIcon('base02/g_head04_002.gif ', "Market", ["top-nav-title"], |
|
[["top-nav-title-container"]]); // There is a space at the end of the url |
|
replaceIcon('base02/g_head04_002.gif', "Market", ["top-nav-title"], |
|
[["top-nav-title-container"]]); // Another page does not have the tail space |
|
replaceIcon('base02/g_head04_002_act.gif', "Market", ["top-nav-title"], |
|
[["top-nav-title-container", "selected"]]); |
|
|
|
replaceIcon('base02/g_head04_003.gif', "Domestic\nStocks", ["top-nav-title"], |
|
[["top-nav-title-container"]]); |
|
replaceIcon('base02/g_head04_003_act.gif', "Domestic\nStocks", ["top-nav-title"], |
|
[["top-nav-title-container", "selected"]]); |
|
|
|
replaceIcon('base02/g_head04_004.gif', "Foreign\nStocks & ETF", ["top-nav-title"], |
|
[["top-nav-title-container"]]); |
|
replaceIcon('base02/g_head04_004_act.gif', "Foreign\nStocks & ETF", ["top-nav-title"], |
|
[["top-nav-title-container", "selected"]]); |