Directory Tiles: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== Directory Tiles == | == Directory Tiles == | ||
For information about the ''progress and plans'' for | For information about the ''progress and plans'' for Tiles see the [[Content services]] page. | ||
For general information about Tiles and the New Tab page see the [[Tiles]] page. | |||
This technical information on how Directory Tiles are | This is technical information for advanced users or enterprise implementers on how Directory Tiles are stored and how you can change it. | ||
=== Previously === | |||
Directory Tiles | Directory Tiles were originally built into Desktop Firefox for en-US builds in the ''chrome://global/content/directoryLinks.json'' location. This file no longer exists in Firefox as Tiles are now downloaded from a web service. Additionally the preference ( ''browser.newtabpage.directorySource'' ) for Tiles has changed, the current details are listed below. | ||
=== Preferences === | |||
There are two main preferences for Tiles that control fetching and metrics. | |||
==== Source ==== | |||
This preference tells Firefox where to fetch Tiles from: | |||
browser.newtabpage.directory.source = https://tiles.services.mozilla.com/v2/links/fetch | |||
This preference can be set to anything that returns JSON, setting this to an empty JSON object will disable Tiles from showing and fetching new Tiles. With the change below a new user would only see empty Tiles and Firefox could no longer fetch new Tiles. | |||
browser.newtabpage.directory.source = data:application/json,{} | |||
==== Ping ==== | |||
This preference tells Firefox where metrics are reported: | |||
browser.newtabpage.directory.ping = https://tiles.services.mozilla.com/v2/links/ | |||
Changing or disabling this pref may prevent Firefox from being able to report metrics on Tiles. Do not set this to alternate URLs, setting this to nothing will disable the ping. | |||
=== Customizing Directory Tiles === | |||
If you wanted to have a custom set of Directory Tiles, for example in an Enterprise deployment, you could set the source preference to a custom set of local Tiles. | |||
Here's an example of a custom directory tiles ''source'' preference: | |||
data:application/json,{ | data:application/json,{ | ||
Line 51: | Line 51: | ||
} | } | ||
=== JSON Format === | |||
The JSON format is fairly simple, the top level needs to be a locale that Firefox understands. This allows you to offer multiple locales in a single JSON file. | The Tile JSON format is fairly simple, the top level needs to be a locale that Firefox understands. This allows you to offer multiple locales in a single JSON file. | ||
At a high level the data | At a high level the data object looks like this: | ||
{ "LOCALE" : [ ARRAY OF DIRECTORY TILE OBJECTS ] } | { "LOCALE" : [ ARRAY OF DIRECTORY TILE OBJECTS ] } | ||
You can have many locales | You can have many locales in the Tiles dictionary object to support multiple languages. | ||
e.g. | e.g. | ||
{ "en-US" : [ ARRAY OF US DIRECTORY TILES ], "en-CA" : [ ARRAY OF CA DIRECTORY TILES ] } | { "en-US" : [ ARRAY OF US DIRECTORY TILES ], "en-CA" : [ ARRAY OF CA DIRECTORY TILES ] } | ||
Each Directory Tile object requires a few | Each Directory Tile object requires a few attributes, most of which are self explanatory. | ||
{ | { | ||
Line 78: | Line 78: | ||
''Directory Tiles Object Attributes'' | ''Directory Tiles Object Attributes'' | ||
* '''url''' is the | * '''url''' is the URL you want the Tile to link to | ||
* '''bgColor''' provides a background fill color in case the image doesn't fill the space | * '''bgColor''' provides a background fill color in case the image doesn't fill the space | ||
* '''type''' isn't | * '''type''' isn't needed for custom tiles so please use the 'custom' attribute | ||
* '''imageURI''' provides the full URL to the image you want centered. Images need to be properly sized for the Tiles | * '''imageURI''' provides the full URL to the image you want centered. Images need to be properly sized for the Tiles. | ||
* '''title''' provides the display text that will appear below the Tile and for the link title attribute. | * '''title''' provides the display text that will appear below the Tile and for the link title attribute. | ||
* '''enhancedImageURI''' provides the full URL to the roll over image you want centered. Images need to be properly sized for the Tiles. If included a "Roll Over" image will be the image seen until a user mouses over the Tile, on mouse over the imageURI is then shown. | |||
==== Source Code ==== | |||
* Tiles Service | |||
** https://github.com/oyiptong/onyx/ | |||
* Tiles Firefox | |||
** https://mxr.mozilla.org/mozilla-central/source/toolkit/modules/DirectoryLinksProvider.jsm | |||
** https://mxr.mozilla.org/mozilla-central/source/browser/base/content/newtab/ |
Revision as of 16:08, 5 September 2014
Directory Tiles
For information about the progress and plans for Tiles see the Content services page.
For general information about Tiles and the New Tab page see the Tiles page.
This is technical information for advanced users or enterprise implementers on how Directory Tiles are stored and how you can change it.
Previously
Directory Tiles were originally built into Desktop Firefox for en-US builds in the chrome://global/content/directoryLinks.json location. This file no longer exists in Firefox as Tiles are now downloaded from a web service. Additionally the preference ( browser.newtabpage.directorySource ) for Tiles has changed, the current details are listed below.
Preferences
There are two main preferences for Tiles that control fetching and metrics.
Source
This preference tells Firefox where to fetch Tiles from:
browser.newtabpage.directory.source = https://tiles.services.mozilla.com/v2/links/fetch
This preference can be set to anything that returns JSON, setting this to an empty JSON object will disable Tiles from showing and fetching new Tiles. With the change below a new user would only see empty Tiles and Firefox could no longer fetch new Tiles.
browser.newtabpage.directory.source = data:application/json,{}
Ping
This preference tells Firefox where metrics are reported:
browser.newtabpage.directory.ping = https://tiles.services.mozilla.com/v2/links/
Changing or disabling this pref may prevent Firefox from being able to report metrics on Tiles. Do not set this to alternate URLs, setting this to nothing will disable the ping.
Customizing Directory Tiles
If you wanted to have a custom set of Directory Tiles, for example in an Enterprise deployment, you could set the source preference to a custom set of local Tiles.
Here's an example of a custom directory tiles source preference:
data:application/json,{ "en-US": [ { "url" : "http://www.mozilla.org/", "bgColor" : "%234d4e54", "type": "custom", "imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAABWCAQAAADMSHQwAAAFWklEQVR4AezBgQAAAACAoP2pF6kCAAAAAAAAAABgdu0sNqoyDOP4C1WWgCylKgqKoNRCqaxCiyx2bBGNAVrCJkRkUYFAMEGNVUjYRIIIuAYlBqKAUSBcWEUIBlDCBRU6pKINCAUU0CibbSyL9e%2FNmTdvpudMF2ZGj5nfc%2FcwyZCH6Xd6DlMXTGUbe1jEjYhJMgEK2M5WGiDYZDCJ1QTJRWId4f%2BTDwkpoanT5bKXcgDgEqJpyFrKCJmWGLr2ycNa4rQzQf1OY0RzFdTziaFrn41Yh%2FQTjSqnBaLZA2puYujaZy3Wt06bBepPkhFNIaj5iaFrn4FY0522F3boNohmE6gFiaHrkvmEbNQuw3PoDYlPdP0zmOWsYoRpunkOvT4xdDTj%2F6FpS3vESTo5ZNMBwaYBGeQQIBWJmNsZRB7DybJD1DvN6EE%2BraM0dGdyGct4HiMj3kM3pzdz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A9RfVnaah59DCMaydPOz0U7FKWOt62T3PJnYQ7hyZfhlayMfbZdJqfpWagUQYugALtjl9S8I47zmO2gjGfuh0FD%2BYPtvjrq0QRQ5iEqAMN0G6mCcONWvlDG3dbb43egBcT%2BqJWPCafd4Y8b%2Foyuka%2B6E7UOwkyBrTdze9PQsXEtQ%2F6YnY0IjZFNmDgW94CjEZTHHEBHlTB91u%2BtsQM%2FUbVJj36Gt%2BqoIo1ms%2Fi9NYUEw%2FhNkAQIY%2Fv0DTiVzGMJps2iExSgqPMpknCJBCEmLSh%2FFMZgTpNDJtY%2FJZyga2spFXGKr9SIoYhfwXh%2F6nHToQAQAAAADkb73IbXCjR49u9OhGjx7d6NGNHj260aMbPXp0o0c3evToRo8OZGoOg%2BFHUXQAAAAASUVORK5CYII%3D", "title": "Mozilla%20Foundation" } ] }
JSON Format
The Tile JSON format is fairly simple, the top level needs to be a locale that Firefox understands. This allows you to offer multiple locales in a single JSON file.
At a high level the data object looks like this:
{ "LOCALE" : [ ARRAY OF DIRECTORY TILE OBJECTS ] }
You can have many locales in the Tiles dictionary object to support multiple languages.
e.g.
{ "en-US" : [ ARRAY OF US DIRECTORY TILES ], "en-CA" : [ ARRAY OF CA DIRECTORY TILES ] }
Each Directory Tile object requires a few attributes, most of which are self explanatory.
{ "url" : "http://www.mozilla.org/", "bgColor" : "%234d4e54", "type": "custom", "imageURI": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAABWCAQAAADMSHQwAAAFWklEQVR4AezBgQAAAACAoP2pF6kCAAAAAAAAAABgdu0sNqoyDOP4C1WWgCylKgqKoNRCqaxCiyx2bBGNAVrCJkRkUYFAMEGNVUjYRIIIuAYlBqKAUSBcWEUIBlDCBRU6pKINCAUU0CibbSyL9e%2FNmTdvpudMF2ZGj5nfc%2FcwyZCH6Xd6DlMXTGUbe1jEjYhJMgEK2M5WGiDYZDCJ1QTJRWId4f%2BTDwkpoanT5bKXcgDgEqJpyFrKCJmWGLr2ycNa4rQz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BeqQX4YWPgf1FWJyDNR7TvckVhUpdRg6HdQ1bvG4Y12o7QSslq73oyX%2BGXoIVlePL8F0QxDuxKrkPqQOQ9%2BLlezx93rV4xqRqX17UBf9M7QQBHWeCbSmBeO4Uu3pXXNKsUrIYlhYRpLkOXQbz7vQt0Ad1LYb1iHnVO%2FFfqxh%2Fhk6FbAq%2BAPrvPPtueGA9RfVnaah59DCMaydPOz0U7FKWOt62T3PJnYQ7hyZfhlayMfbZdJqfpWagUQYugALtjl9S8I47zmO2gjGfuh0FD%2BYPtvjrq0QRQ5iEqAMN0G6mCcONWvlDG3dbb43egBcT%2BqJWPCafd4Y8b%2Foyuka%2B6E7UOwkyBrTdze9PQsXEtQ%2F6YnY0IjZFNmDgW94CjEZTHHEBHlTB91u%2BtsQM%2FUbVJj36Gt%2BqoIo1ms%2Fi9NYUEw%2FhNkAQIY%2Fv0DTiVzGMJps2iExSgqPMpknCJBCEmLSh%2FFMZgTpNDJtY%2FJZyga2spFXGKr9SIoYhfwXh%2F6nHToQAQAAAADkb73IbXCjR49u9OhGjx7d6NGNHj260aMbPXp0o0c3evToRo8OZGoOg%2BFHUXQAAAAASUVORK5CYII%3D", "title": "Mozilla%20Foundation" }
NOTE: You need to URL escape all the text, in the bgColor you'll see the # is replaced with %23 and the spaces are replaced with %20 in the title.
Directory Tiles Object Attributes
- url is the URL you want the Tile to link to
- bgColor provides a background fill color in case the image doesn't fill the space
- type isn't needed for custom tiles so please use the 'custom' attribute
- imageURI provides the full URL to the image you want centered. Images need to be properly sized for the Tiles.
- title provides the display text that will appear below the Tile and for the link title attribute.
- enhancedImageURI provides the full URL to the roll over image you want centered. Images need to be properly sized for the Tiles. If included a "Roll Over" image will be the image seen until a user mouses over the Tile, on mouse over the imageURI is then shown.