Thanks for the tool and I am able to fully create a valid xcode project with this tool. Bingo!
But if we take reference for SeaCreator, when we tap on the extension icon, it turns into blue to indicate the extension is active and whenever any page is rendered, all fish names will be automatically replaced with emojis.
What I need is I want the replace action to be executed only when I explicitly press the extension button. So, whenever I open a new webpage I must have to explicitly press extension toolbar button only then replacement should be done.
In the code I have attached, I did try few things but none help.
Code Block //browser.runtime.addEventListener("message", handleMessage, false); |
//function handleMessage(msgEvent) { |
// alert('message received'); |
var wordReplacementMap = {"Fish": "🐠", "Shark": "🦈", "Squid": "🦑", "Whale": "🐋"}; |
for (var wordToReplace in wordReplacementMap) { |
replace(document.body, wordToReplace, wordReplacementMap[wordToReplace]); |
} |
//} |
|
//chrome.runtime.sendMessage("message"); |
I am always facing ->
undefined browser or undefined chrome.In my original extension project I have used node modules and AJAX also so there are lots of dependencies why I did took reference for Apple's example.
The main thing is I want to turn off automatic script injection and only execute my script code when user taps on extension button. I don't need popup - just execution on tap of button.
I have also posted Stackoverflow questions for this here ->
https://stackoverflow.com/questions/62774734/safari-web-extension-injecting-script-only-when-extension-button-is-clickedI hope I have made my point clear. Please suggest me solution on this.
Thanks.