Bug 525190 - Refactor the way pageInfo.js handles arguments. r=db48x

This commit is contained in:
Dão Gottwald 2009-10-31 01:50:57 +01:00
Родитель dbe5f93b5c
Коммит 276b640707
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -279,9 +279,12 @@ function onLoadPageInfo()
gStrings.mediaLink = gBundle.getString("mediaLink"); gStrings.mediaLink = gBundle.getString("mediaLink");
gStrings.mediaInput = gBundle.getString("mediaInput"); gStrings.mediaInput = gBundle.getString("mediaInput");
if ("arguments" in window && window.arguments.length >= 1 && var args = "arguments" in window &&
window.arguments[0] && window.arguments[0].doc) { window.arguments.length >= 1 &&
gDocument = window.arguments[0].doc; window.arguments[0];
if (args && args.doc) {
gDocument = args.doc;
gWindow = gDocument.defaultView; gWindow = gDocument.defaultView;
} }
else { else {
@ -297,18 +300,13 @@ function onLoadPageInfo()
imageTree.view = gImageView; imageTree.view = gImageView;
// set gImageElement if present // set gImageElement if present
if ("arguments" in window && window.arguments.length >= 1 && gImageElement = args && args.imageElement;
window.arguments[0].imageElement)
gImageElement = window.arguments[0].imageElement;
// build the content // build the content
loadPageInfo(); loadPageInfo();
/* Select the requested tab, if the name is specified */ /* Select the requested tab, if the name is specified */
var initialTab = "generalTab"; var initialTab = (args && args.initialTab) || "generalTab";
if ("arguments" in window && window.arguments.length >= 1 &&
window.arguments[0] && window.arguments[0].initialTab)
initialTab = window.arguments[0].initialTab;
var radioGroup = document.getElementById("viewGroup"); var radioGroup = document.getElementById("viewGroup");
initialTab = document.getElementById(initialTab) || document.getElementById("generalTab"); initialTab = document.getElementById(initialTab) || document.getElementById("generalTab");
radioGroup.selectedItem = initialTab; radioGroup.selectedItem = initialTab;