Well, actually, I meant that you do not even need a manifest or anything. A
user script would have been converted to an extension automatically.
But since you already created an extension, let us continue. ;)

So, what you need is a Browser Action (or a Page Action, to be on the safe
side, since Browser Actions cannot be remove and you might not want it to be
laying around there for any page\image\whatever).
BrowserAction reference -
http://code.google.com/chrome/extensions/browserAction.html
PageAction reference -
http://code.google.com/chrome/extensions/pageAction.html

Now, when the button is clicked, you should send a message (see the Message
Passing API - http://code.google.com/chrome/extensions/messaging.html to
send and receive one) to the tab (see the Tabs API -
http://code.google.com/chrome/extensions/tabs.html to get the selected tab).
The content script in that tab will get the message and will execute the
same lines that are currently in the blabla.user.js file you have.


☆PhistucK


On Sat, Dec 12, 2009 at 18:37, yanivkoren <ya...@korenf.com> wrote:

> PhistucK,
>
> Many thanks for your help.
>
> I have made a file name "blabla.user.js" with the code you wrote.
> I have made a file name "manifest.json" with this code:
>
> "
> {
>  "name": "Switch Page Direction rtl",
>  "version": "1.0",
>  "description": "Switch Page Direction rtl",
>
>
>  "content_scripts": [
>    {
>      "matches": ["http://lifehacker.com/*";],
>
>      "js": ["blabla.user.js"]
>    }
>  ]
>
> }
> "
> Now every time I enter lifehacker.com It is right to left.
>
> Can I make the extention smarter?
> I mean that it will have an icon (I know how to make an icon) and when
> I press the icon the js will change the page I'm in to right to left?
>
> Many Tanks
> Yaniv
> On 12 דצמבר, 17:04, PhistucK <phist...@gmail.com> wrote:
> > You want the easiest way?
> > Create a user script (meaning, create a file called blabla.user.js), put
> > there -
> >
> > document.getElementsByTagName("HTML")[0].dir = "rtl";
> > document.body.dir = "rtl";
> >
> > Drag it to Chrome and install it.
> >
> > Note - this will only work with the Dev or Beta version of Google
> > Chrome<http://dev.chromium.org/getting-involved/dev-channel>(or the
> > trunk version of Chromium).
> >
> > ☆PhistucK
> >
> >
> >
> > On Sat, Dec 12, 2009 at 09:45, yanivkoren <ya...@korenf.com> wrote:
> > > I'm trying to write an extantion that replace the "<body_" elent with
> > > "<body_dir=rtl" so all my pages will be right to left.
> > > I'm not a programmer and i faild to do so.
> > > can any one help me with that
> > > many thanks
> > > Yaniv
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Chromium-extensions" group.
> > > To post to this group, send email to
> chromium-extensi...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com><chromium-extensions%2Bunsu
> bscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/chromium-extensions?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensi...@googlegroups.com.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=en.
>
>
>

--

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


Reply via email to