iui: less tweaks

This commit is contained in:
Andrew Dolgov 2009-12-18 11:59:40 +03:00
parent b1bd222cd5
commit 74357409fa
1 changed files with 9 additions and 12 deletions

View File

@ -66,7 +66,7 @@ window.iui =
} }
}, },
showPageByHref: function(href, args, method, replace, cb, backwards) showPageByHref: function(href, args, method, replace, cb, bw)
{ {
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.onerror = function() req.onerror = function()
@ -85,7 +85,7 @@ window.iui =
{ {
var frag = document.createElement("div"); var frag = document.createElement("div");
frag.innerHTML = req.responseText; frag.innerHTML = req.responseText;
iui.insertPages(frag.childNodes, backwards); iui.insertPages(frag.childNodes, bw);
} }
if (cb) if (cb)
setTimeout(cb, 1000, true); setTimeout(cb, 1000, true);
@ -106,7 +106,7 @@ window.iui =
} }
}, },
insertPages: function(nodes, backwards) insertPages: function(nodes, bw)
{ {
var targetPage; var targetPage;
for (var i = 0; i < nodes.length; ++i) for (var i = 0; i < nodes.length; ++i)
@ -131,7 +131,7 @@ window.iui =
} }
if (targetPage) if (targetPage)
iui.showPage(targetPage, backwards); iui.showPage(targetPage, bw);
}, },
getSelectedPage: function() getSelectedPage: function()
@ -203,9 +203,9 @@ addEventListener("click", function(event)
iui.showPage($(link.hash.substr(1))); iui.showPage($(link.hash.substr(1)));
setTimeout(unselect, 500); setTimeout(unselect, 500);
} }
if (link == $("backButton")) { else if (link == $("backButton"))
history.back(); history.back();
} else if (link.getAttribute("type") == "submit") else if (link.getAttribute("type") == "submit")
{ {
var form = findParent(link, "form"); var form = findParent(link, "form");
if (form.target == "_self") if (form.target == "_self")
@ -233,10 +233,8 @@ addEventListener("click", function(event)
else if (!link.target) else if (!link.target)
{ {
link.setAttribute("selected", "progress"); link.setAttribute("selected", "progress");
var bw = link.getAttribute("backwards");
var backwards = link.getAttribute("backwards"); iui.showPageByHref(link.href, null, null, null, unselect, bw);
iui.showPageByHref(link.href, null, null, null, unselect, backwards);
} }
else else
return; return;
@ -365,7 +363,6 @@ function updatePage(page, fromPage)
backButton.style.display = "none"; backButton.style.display = "none";
} }
var backButton = $("myBackButton"); var backButton = $("myBackButton");
if (backButton) if (backButton)
{ {