Results 1 to 6 of 6

This is a discussion on Help needed within the Plugins Development section, part of the Chrome Plugins category: It's a little bit hard to explain but i will try. In my Better Gmail extension as you can see ...


  1. #1
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Unhappy Help needed

    It's a little bit hard to explain but i will try. In my Better Gmail extension as you can see I'm using a dozen of content scripts inside one extension. I am using
    Code:
    "include_globs": [ "http://mail.google.com/*", "https://mail.google.com/*"],
    to make the work only on gmail website. So far so good.

    BUT I want to add a functionality like this Open mailto links with Gmail which should work on every website
    Code:
    "matches": [ "http://*/*", "https://*/*" ]
    When I don't add the "http://*/*", "https://*/*" to the include_globs mailto-thingy is not working. When I add it ALL the content scripts work on EVERY page and funny things happen such as images change to attachment icons

    Have tried having both lines in my manifest - mailto not working.
    Have tried even having 2 content_scripts sections in my manifest with different include globs - no luck

    So I'm in desperate need of suggestions. (despite the obvious not to implement this feature)

    Thanks
    Last edited by mg2; 02-21-2010 at 09:40 PM.
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

  2. #2
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    First up, currently include_globs and exclude_globs are meant for greasemonkey scripts so dont be suprised if they stop working for you one day (in which youll prolly have to add the importedfromgreasemonkey or woteva it is tag).
    Currently your content script part of your manifest looks like this....
    Code:
       "content_scripts": [ {
          "exclude_globs": [  ],
          "include_globs": [ "http://mail.google.com/*", "https://mail.google.com/*" ],
          "js": [ "ads.js", "chat.js", "footer.js", "icons.js", "favicon.js", "invites.js", "row.js", "sponsor.js" ],
          "matches": [ "http://*/*", "https://*/*" ]
       } ],
    ...you need to make it something like this....
    Code:
        "content_scripts": [ {
          "exclude_globs": [  ],
          "include_globs": [ "http://mail.google.com/*", "https://mail.google.com/*" ],
          "js": [ "ads.js", "chat.js", "footer.js", "icons.js", "favicon.js", "invites.js", "row.js", "sponsor.js" ],
          "matches": [ "http://*/*", "https://*/*" ]
       },
       {
          "exclude_globs": [  ],
           "js": [ "mailto.js" ],
          "matches": [ "http://*/*", "https://*/*" ]
       } ],
    ...thats prolly not right but hopefully you get the idea, you can declare more than one script in the contentscripts bit and give them their own matches tag. Im not sure how/if the include/exclude globs will work, as they wherent made for this.
    And haveing an include_globs and matches in the same section seems a little redundant, you should prolly only have one or the other.

  3. #3
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Default

    THANK YOU!!!
    You saved my day again!
    I tried something similar to this before but instead of just
    using
    },
    {
    i tried closing the content_scripts and than opening another one

    But now it works perfectly!
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

  4. #4
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Default

    I also cleaned up the manifest a little bit and it looks now like this
    Code:
    "content_scripts": [ {
          "js": [ "ads.js", "chat.js", "footer.js", "icons.js", "favicon.js", "invites.js", "row.js", "sponsor.js"  ],
          "matches": [ "http://mail.google.com/*", "https://mail.google.com/*" ]
       },
       {
    	  "all_frames": true,
          "js": [ "mailto.js" ],
          "matches": [ "http://*/*", "https://*/*" ]
       }
    Any idea what the " "all_frames": true, " does? I saw it in the other manifest and guessed i need it...
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

  5. #5
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    A frame is just like a page in a page I guess...
    http://www.htmlcodetutorial.com/frames/frames.html
    ....theres a random page on frames.
    Frames run in the own context (Im no good at using the right words ) and so if you dont have all frames the page that has the frame in it gets the script run in it but the frame doesnt. When you set all_frames to true it should run your content script in all the frames. I say should because far as I know theres still a bug concerning that and it doesnt get run in all frames, but most.
    Your mailto should be run in all frames.

  6. #6
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Default

    Nice.
    Thank you again.
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

Similar Threads

  1. IE tab needed
    By mcalkins in forum Chrome Plugins
    Replies: 51
    Last Post: 04-28-2011, 04:04 PM
  2. Moderators Needed
    By Chrome in forum Chrome Central
    Replies: 24
    Last Post: 01-03-2010, 10:32 PM
  3. Help needed
    By emr1028 in forum Chrome Plugins
    Replies: 3
    Last Post: 12-17-2009, 05:09 PM
  4. Sidewiki ext. needed
    By Chaotic Cow in forum Chrome Plugins
    Replies: 3
    Last Post: 11-14-2009, 03:25 PM
  5. plugin advice needed
    By csprh in forum Plugins Development
    Replies: 2
    Last Post: 09-13-2009, 07:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •