summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 19:54:05 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 19:54:05 +0000
commitde17ab159c33d8a89dcccae69c167c5d4a6cda68 (patch)
treec6912bdfc4af4954cf65ef4ff1f7dfd6c2d5a3e6 /chrome
parentca936213e4aaff3bc046623161f658100af2d084 (diff)
downloadchromium_src-de17ab159c33d8a89dcccae69c167c5d4a6cda68.zip
chromium_src-de17ab159c33d8a89dcccae69c167c5d4a6cda68.tar.gz
chromium_src-de17ab159c33d8a89dcccae69c167c5d4a6cda68.tar.bz2
Move the shared JS and CSS out of the HTML files and into separate files.
Review URL: http://codereview.chromium.org/99151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/resources/dom_ui.css32
-rw-r--r--chrome/browser/resources/history.html74
-rw-r--r--chrome/browser/resources/local_strings.js39
-rw-r--r--chrome/browser/resources/new_tab.html42
5 files changed, 77 insertions, 112 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 8ca4fd0..51ee1b0 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -25,6 +25,8 @@ without changes to the corresponding grd file. -->
<include name="IDR_CREDITS_HTML" file="resources\about_credits.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_HISTORY_HTML" file="resources\history.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_DOWNLOADS_HTML" file="resources\downloads.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_LOCAL_STRINGS_JS" file="resources\local_strings.js" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_DOM_UI_CSS" file="resources\dom_ui.css" flattenhtml="true" type="BINDATA" />
<include name="IDR_EXTENSIONS_UI_HTML" file="resources\extensions_ui.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_EXTENSIONS_TOOLSTRIP_CSS" file="resources\extensions_toolstrip.css" flattenhtml="true" type="BINDATA" />
<if expr="os == 'linux2'">
diff --git a/chrome/browser/resources/dom_ui.css b/chrome/browser/resources/dom_ui.css
new file mode 100644
index 0000000..13e3756
--- /dev/null
+++ b/chrome/browser/resources/dom_ui.css
@@ -0,0 +1,32 @@
+body {
+ background-color:white;
+ color:black;
+ margin:10px;
+}
+.header {
+ overflow:auto;
+ clear:both;
+}
+.header .logo {
+ float:left;
+}
+.header .form {
+ float:left;
+ margin-top:22px;
+ margin-left:12px;
+}
+html[dir='rtl'] .logo {
+ float:right;
+}
+html[dir='rtl'] .form {
+ float:right;
+ margin-right:12px;
+}
+.page-navigation {
+ padding:8px;
+ background-color:#ebeff9;
+ margin-right:4px;
+}
+.footer {
+ height:24px;
+} \ No newline at end of file
diff --git a/chrome/browser/resources/history.html b/chrome/browser/resources/history.html
index a33b821..c9ecac7 100644
--- a/chrome/browser/resources/history.html
+++ b/chrome/browser/resources/history.html
@@ -4,6 +4,7 @@
<meta charset="utf-8">
<title jscontent="title"></title>
<link rel="icon" href="../../app/theme/history_favicon.png">
+<script src="local_strings.js"></script>
<script>
///////////////////////////////////////////////////////////////////////////////
// Globals:
@@ -37,45 +38,6 @@ var pageState;
var deleteQueue = [];
var deleteInFlight = false;
-///////////////////////////////////////////////////////////////////////////////
-// localStrings:
-/**
- * We get strings into the page by using JSTemplate to populate some elements
- * with localized content, then reading the content of those elements into
- * this global strings object.
- * @param {Node} node The DOM node containing all our strings.
- */
-function LocalStrings(node) {
- this.strings_ = {};
-
- var children = node.children;
- for (var i = 0, child; child = children[i]; i++) {
- var id = child.id;
- if (id) {
- this.strings_[id] = child.innerHTML;
- }
- }
-}
-
-/**
- * Gets a localized string by its id.
- * @param {string} s The id of the string we want
- * @return {string} The localized string
- */
-LocalStrings.prototype.getString = function(s) {
- return this.strings_[s] || '';
-}
-
-/**
- * Returns a formatted localized string (where all %s contents are replaced
- * by the second argument).
- * @param {string} s The id of the string we want
- * @param {string} d The string to include in the formatted string
- * @return {string} The formatted string.
- */
-LocalStrings.prototype.formatString = function(s, d) {
- return this.getString(s).replace(/\%s/, d);
-}
///////////////////////////////////////////////////////////////////////////////
// Page:
@@ -805,31 +767,8 @@ function historyDeleted() {
historyView.reload();
}
</script>
+<link rel="stylesheet" href="dom_ui.css">
<style>
-body {
- background-color:white;
- color:black;
- margin:10px;
-}
-.header {
- overflow:auto;
- clear:both;
-}
-.header .logo {
- float:left;
-}
-.header .form {
- float:left;
- margin-top:22px;
- margin-left:12px;
-}
-html[dir='rtl'] .logo {
- float:right;
-}
-html[dir='rtl'] .form {
- float:right;
- margin-right:12px;
-}
#results-summary {
margin-top:12px;
border-top:1px solid #9cc2ef;
@@ -909,14 +848,7 @@ html[dir='rtl'] .entry .title a {
padding-top:24px;
margin-left:18px;
}
-.page-navigation {
- padding:8px;
- background-color:#ebeff9;
- margin-right:4px;
-}
-.footer {
- height:24px;
-}
+
</style>
</head>
<body onload="load();" jsvalues=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
diff --git a/chrome/browser/resources/local_strings.js b/chrome/browser/resources/local_strings.js
new file mode 100644
index 0000000..a7ea225
--- /dev/null
+++ b/chrome/browser/resources/local_strings.js
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// localStrings:
+/**
+ * We get strings into the page by using JSTemplate to populate some elements
+ * with localized content, then reading the content of those elements into
+ * this global strings object.
+ * @param {Node} node The DOM node containing all our strings.
+ */
+function LocalStrings(node) {
+ this.strings_ = {};
+
+ var children = node.children;
+ for (var i = 0, child; child = children[i]; i++) {
+ var id = child.id;
+ if (id) {
+ this.strings_[id] = child.innerHTML;
+ }
+ }
+}
+
+/**
+ * Gets a localized string by its id.
+ * @param {string} s The id of the string we want.
+ * @return {string} The localized string.
+ */
+LocalStrings.prototype.getString = function(s) {
+ return this.strings_[s] || '';
+};
+
+/**
+ * Returns a formatted localized string (where all %s contents are replaced
+ * by the second argument).
+ * @param {string} s The id of the string we want.
+ * @param {string} d The string to include in the formatted string.
+ * @return {string} The formatted string.
+ */
+LocalStrings.prototype.formatString = function(s, d) {
+ return this.getString(s).replace(/\%s/, d);
+}; \ No newline at end of file
diff --git a/chrome/browser/resources/new_tab.html b/chrome/browser/resources/new_tab.html
index c1dab9c..586d1cf 100644
--- a/chrome/browser/resources/new_tab.html
+++ b/chrome/browser/resources/new_tab.html
@@ -15,6 +15,7 @@
If the requests for content come back before the content-rendering functions
are defined, the data is held until those functions are defined.
-->
+<script src="local_strings.js"></script>
<script>
/* Logging info for benchmarking purposes. */
var log = [];
@@ -33,7 +34,6 @@ var unprocessedData = {
var renderFunctionsDefined = false;
-// TODO(glen): Merge into common file used by this and history.
var localStrings;
// The list of URLs that have been blacklisted (so that thumbnails are not
@@ -41,46 +41,6 @@ var localStrings;
// button is pressed.
var blacklistedURLs = [];
-///////////////////////////////////////////////////////////////////////////////
-// localStrings:
-/**
- * We get strings into the page by using JSTemplate to populate some elements
- * with localized content, then reading the content of those elements into
- * this global strings object.
- * @param {Node} node The DOM node containing all our strings.
- */
-function LocalStrings(node) {
- this.strings_ = {};
-
- var children = node.children;
- for (var i = 0, child; child = children[i]; i++) {
- var id = child.id;
- if (id) {
- this.strings_[id] = child.innerHTML;
- }
- }
-}
-
-/**
- * Gets a localized string by its id.
- * @param {string} s The id of the string we want
- * @return {string} The localized string
- */
-LocalStrings.prototype.getString = function(s) {
- return this.strings_[s] || '';
-}
-
-/**
- * Returns a formatted localized string (where all %s contents are replaced
- * by the second argument).
- * @param {string} s The id of the string we want
- * @param {string} d The string to include in the formatted string
- * @return {string} The formatted string.
- */
-LocalStrings.prototype.formatString = function(s, d) {
- return this.getString(s).replace(/\%s/, d);
-}
-
function $(o) {return document.getElementById(o);}
/**