* fix tutorial mode not work as expected sometimes.
This commit is contained in:
@@ -414,14 +414,20 @@ $(function()
|
||||
|
||||
var checkTutorialState = function()
|
||||
{
|
||||
var iWindow = getAppWindow();
|
||||
iWindow = window.frames['iframePage'];
|
||||
tryCheckTask();
|
||||
var iWindow = getAppWindow();
|
||||
var title = (iWindow.$ ? iWindow.$('head > title').text() : '') + $('head > title').text();
|
||||
var url = createLink('tutorial', 'index', 'referer=' + Base64.encode(iWindow.location.href) + '&task=' + current);
|
||||
try{window.history.replaceState({}, title, url);}catch(e){}
|
||||
};
|
||||
|
||||
var checkTimer = 0;
|
||||
var tryCheckTutorialState = function(delay)
|
||||
{
|
||||
clearTimeout(checkTimer);
|
||||
checkTimer = setTimeout(checkTutorialState, delay || 200);
|
||||
};
|
||||
|
||||
var showTask = function(taskName)
|
||||
{
|
||||
clearTips();
|
||||
@@ -472,7 +478,6 @@ $(function()
|
||||
var progress = Math.round(100*finishCount/totalCount);
|
||||
$progress.toggleClass('finish', isFinishAll).find('.progress-bar').css('width', (100*finishCount/totalCount) + '%');
|
||||
$progress.find('.progress-text').text(progress + '%');
|
||||
if(progress == 100) $.getJSON(createLink('tutorial', 'ajaxFinish'));
|
||||
showTask(current);
|
||||
};
|
||||
|
||||
@@ -482,7 +487,10 @@ $(function()
|
||||
var appsIframe = $('#iframePage').get(0);
|
||||
appsIframe.onload = appsIframe.onreadystatechange = function()
|
||||
{
|
||||
appsWindow.$(appsWindow.document).on('show.zentaoapp close.zentaoapp hide.zentaoapp', checkTutorialState);
|
||||
appsWindow.$(appsWindow.document).on('reloadapp loadapp showapp closeapp hideapp', function()
|
||||
{
|
||||
tryCheckTutorialState(1000);
|
||||
});
|
||||
|
||||
/* Open referer page in app tab */
|
||||
if(tutorialReferer) appsWindow.$.apps.open(tutorialReferer);
|
||||
|
||||
Reference in New Issue
Block a user