AI 150370: Add localized content infrastructure in droiddoc templates, javascript, and css. DocFile.java - instead of FileReader, use InputStreamReader with UTF-8 encoding. ClearPage.java - add UTF-8 output encoding to FileOutputStreamWriter. Note: this change also up-integrates gerrit 2146 (smain).
BUG=1910893 Automated import of CL 150370
This commit is contained in:
committed by
Dirk Dougherty
parent
9e202af99c
commit
233bc0b84a
@@ -31,15 +31,6 @@ if ((agent.indexOf("Mobile") != -1) ||
|
||||
addLoadEvent(mobileSetup);
|
||||
}
|
||||
|
||||
/* loads the lists.js file to the page.
|
||||
Loading this in the head was slowing page load time */
|
||||
addLoadEvent( function() {
|
||||
var lists = document.createElement("script");
|
||||
lists.setAttribute("type","text/javascript");
|
||||
lists.setAttribute("src", toRoot+"reference/lists.js");
|
||||
$("head").append($(lists));
|
||||
} );
|
||||
|
||||
window.onresize = resizeAll;
|
||||
|
||||
function mobileSetup() {
|
||||
@@ -214,6 +205,19 @@ function resizeAll() {
|
||||
}
|
||||
}
|
||||
|
||||
function getBaseUri(uri) {
|
||||
intlUrl = uri.substring(0,6) == "/intl/";
|
||||
if (intlUrl) {
|
||||
base = uri.substring(uri.indexOf('intl/')+5,uri.length);
|
||||
base = base.substring(base.indexOf('/')+1, base.length);
|
||||
//alert("intl, returning base url: /" + base);
|
||||
return ("/" + base);
|
||||
} else {
|
||||
//alert("not intl, returning uri as found.");
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
function loadLast(cookiePath) {
|
||||
var location = window.location.href;
|
||||
if (location.indexOf("/"+cookiePath+"/") != -1) {
|
||||
@@ -228,7 +232,7 @@ function loadLast(cookiePath) {
|
||||
}
|
||||
|
||||
$(window).unload(function(){
|
||||
var path = location.pathname;
|
||||
var path = getBaseUri(location.pathname);
|
||||
if (path.indexOf("/reference/") != -1) {
|
||||
writeCookie("lastpage", path, "reference", null);
|
||||
} else if (path.indexOf("/guide/") != -1) {
|
||||
@@ -236,8 +240,6 @@ $(window).unload(function(){
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function toggle(obj, slide) {
|
||||
var ul = $("ul", obj);
|
||||
var li = ul.parent();
|
||||
@@ -258,8 +260,6 @@ function toggle(obj, slide) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function buildToggleLists() {
|
||||
$(".toggle-list").each(
|
||||
function(i) {
|
||||
@@ -291,11 +291,11 @@ function swapNav() {
|
||||
nav_pref = NAV_PREF_PANELS;
|
||||
} else {
|
||||
nav_pref = NAV_PREF_TREE;
|
||||
init_default_navtree(toRoot);
|
||||
init_navtree("nav-tree", toRoot, NAVTREE_DATA);
|
||||
}
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
|
||||
writeCookie("nav", nav_pref, null, date.toGMTString());
|
||||
writeCookie("nav", nav_pref, "reference", date.toGMTString());
|
||||
|
||||
$("#nav-panels").toggle();
|
||||
$("#panel-link").toggle();
|
||||
@@ -396,12 +396,16 @@ function changeDocLang(lang) {
|
||||
changeNavLang(lang);
|
||||
}
|
||||
|
||||
function changeLangPref(lang) {
|
||||
function changeLangPref(lang, refresh) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years
|
||||
writeCookie("pref_lang", lang, null, date);
|
||||
|
||||
changeDocLang(lang);
|
||||
expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); // keep this for 50 years
|
||||
//alert("expires: " + expires)
|
||||
writeCookie("pref_lang", lang, null, expires);
|
||||
//changeDocLang(lang);
|
||||
if (refresh) {
|
||||
l = getBaseUri(location.pathname);
|
||||
window.location = l;
|
||||
}
|
||||
}
|
||||
|
||||
function loadLangPref() {
|
||||
@@ -414,4 +418,3 @@ function loadLangPref() {
|
||||
function getLangPref() {
|
||||
return $("#language").find(":selected").attr("value");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user