newTab.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  3. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. "use strict";
  5. var Cu = Components.utils;
  6. var Ci = Components.interfaces;
  7. Cu.import("resource://gre/modules/XPCOMUtils.jsm");
  8. Cu.import("resource://gre/modules/Services.jsm");
  9. Cu.import("resource://gre/modules/PageThumbs.jsm");
  10. Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm");
  11. Cu.import("resource://gre/modules/NewTabUtils.jsm");
  12. XPCOMUtils.defineLazyModuleGetter(this, "Rect",
  13. "resource://gre/modules/Geometry.jsm");
  14. XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
  15. "resource://gre/modules/PrivateBrowsingUtils.jsm");
  16. var {
  17. links: gLinks,
  18. allPages: gAllPages,
  19. linkChecker: gLinkChecker,
  20. pinnedLinks: gPinnedLinks,
  21. blockedLinks: gBlockedLinks,
  22. gridPrefs: gGridPrefs
  23. } = NewTabUtils;
  24. XPCOMUtils.defineLazyGetter(this, "gStringBundle", function() {
  25. return Services.strings.
  26. createBundle("chrome://browser/locale/newTab.properties");
  27. });
  28. function newTabString(name, args) {
  29. let stringName = "newtab." + name;
  30. if (!args) {
  31. return gStringBundle.GetStringFromName(stringName);
  32. }
  33. return gStringBundle.formatStringFromName(stringName, args, args.length);
  34. }
  35. function inPrivateBrowsingMode() {
  36. return PrivateBrowsingUtils.isContentWindowPrivate(window);
  37. }
  38. const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
  39. const XUL_NAMESPACE = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
  40. const TILES_EXPLAIN_LINK = "https://support.mozilla.org/kb/how-do-tiles-work-firefox";
  41. const TILES_INTRO_LINK = "https://www.mozilla.org/firefox/tiles/";
  42. const TILES_PRIVACY_LINK = "https://www.mozilla.org/privacy/";
  43. #include transformations.js
  44. #include page.js
  45. #include grid.js
  46. #include cells.js
  47. #include sites.js
  48. #include drag.js
  49. #include dragDataHelper.js
  50. #include drop.js
  51. #include dropTargetShim.js
  52. #include dropPreview.js
  53. #include updater.js
  54. #include undo.js
  55. #include search.js
  56. // Everything is loaded. Initialize the New Tab Page.
  57. gPage.init();