I want to run a javascript code (or file) if the Toolbar Icon is
clicked.
would you please help me?
I am novice, please add more details on the html codes and so on :)
I can run a script by defining it in manifest.json but I want to run
it if the Icon is clicked.

in manifest.json file I have wrote:

{
"update_url":"http://clients2.google.com/service/update2/crx";,
   "name": "Pinglish to Persian Converter",
   "description": "Type in Persian using google transliteration
bookmarklet from the toolbar",
   "version": "1.0",
   "icons": { "128": "icon_128_128.png"
   },
   "permissions" : ["tabs"],
   "browser_action": {
        "default_icon" : "icon_128_128.png",
        "default_title": "Pinglish to Persian Converter"
   },
  "background_page": "background.html"
}


and in my background.html file I have wrote:

<script>
chrome.browserAction.onClicked.addListener(function(tab){

javascript:(t13nb=window.t13nb||function(l){var
t=t13nb,d=document,o=d.body,c="createElement",a="appendChild",w="clientWidth",i=d
[c]("span"),s=i.style,x=o[a](d[c]("script"));if(o){if(!t.l)
{t.l=x.id="t13ns";o[a](i).id="t13n";i.innerHTML="Loading
Transliteration";s.cssText="z-index:99;font-size:
18px;background:#FFF1A8;top:
0";s.position=d.all?"absolute":"fixed";s.left=((o[w]-i[w])/
2)+"px";x.src="http://t13n.googlecode.com/svn/trunk/blet/rt13n.js?
l="+l}}else setTimeout(t,500)})('fa')

})
</script>

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to