On May 13, 6:30 pm, Aaron Boodman <[email protected]> wrote:
> I see.
>
> If you use the content script feature of Extensions instead, there is
> what might be a better way to do this. A content script can consist of
> multiple physical files,  so you could do this:
>
> manifest.json
>
> {
>   "name": "my extension",
>   "version": "1",
>   "content_scripts": [
>     {
>       "matches": ["http://*/*";],
>       "js": ["conf.js", "myscript.js"]
>     }
>   ]
>
> }
>
> With the user scripts feature, you can share data through the
> contentWindow object like this:
>
> scriptA.user.js
> contentWindow.__foo = 42;
>
> scriptB.user.js
> alert(contentWindow.__foo);
>
> But the user script feature is not going to be a first class feature
> the way extensions are (it won't have UI anytime soon). So it is
> recommended to use extensions instead.
>
> - a
>
>
>
> On Wed, May 13, 2009 at 9:06 AM, Charles L. <[email protected]> wrote:
>
> > On May 13, 6:00 pm, Aaron Boodman <[email protected]> wrote:
> >> I'm sorry, I don't understand the question. Can you give me a sample
> >> script you'd like to make work?
>
> > Sure. For instance, I create a file myscript.conf.user.js with this
> > content:
>
> > // ==UserScript==
> > // @name Test
> > // @description Config file
> > // @author Charles
> > // @run-at document-start
> > // ==/UserScript==
>
> > var version="1.0";
>
> > Then, I create another file called myscript.user.js  with this
> > content:
>
> > // ==UserScript==
> > // @name Test
> > // @description Test file
> > // @author Charles
> > // @run-at document-start
> > // ==/UserScript==
>
> > alert(version);
>
> > I put both files in my user script directory and I restart my browser.
> > It works in Opera but not in Chrome.
> > Thanks,
>
> > Charles.



Thanks, Aaron. Yes, but what I had in mind is allowing the user to
keep a configuration file on his computer. A file that could be read
by a user script to modify certain behaviors of the script, according
to the user's preferences. If it's part of the extension, first, the
extension is currently not easily updatable, and then when it is,
every update will overwrite the user's configuration file.

Charles.



--~--~---------~--~----~------------~-------~--~----~
Chromium Discussion mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to