Skip to content

Commit

Permalink
fixed document.title changing in some webview like wechat etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoda committed May 6, 2014
1 parent 71642b8 commit 9ad67f5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
26 changes: 11 additions & 15 deletions dist/spa.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* SPA v1.0.3
* SPA v1.0.4
* A webapp framework for routing control and view transitions
* Copyright 2014 zhaoda <http://zhaoda.net>
* Licensed under MIT https://raw.github.com/zhaoda/spa/master/LICENSE
Expand Down Expand Up @@ -93,6 +93,9 @@
return $curPage
}

// 设置版本号
$.spa.version = '1.0.4'

/*
* 插入样式
*/
Expand Down Expand Up @@ -1887,6 +1890,13 @@
url = options.url || ''

title && (document.title = title)
// hack在微信等webview中无法修改document.title的情况
var $iframe = $('<iframe src="/favicon.ico"></iframe>').on('load', function() {
setTimeout(function() {
$iframe.off('load').remove()
}, 0)
}).appendTo($body)

hash = url + '#' + hash

if(replace) {
Expand Down Expand Up @@ -1923,16 +1933,6 @@
event.preventDefault()
}

// 显示遮罩层
// $doc.on('spa:opencover', function(event) {
// $cover.show()
// })

// 隐藏遮罩层
// $doc.on('spa:closecover', function(event) {
// $cover.hide()
// })


/*
* 数据加载动画
Expand Down Expand Up @@ -1986,10 +1986,6 @@
$fullscreen = $('.spa-fullscreen')
$doc.trigger('spa:adjustfullscreen')

// 初始化$cover
// $cover = $('.spa-cover')
// $cover.on('click select mousedown mousemove mouseup touchstart touchmove touchend', preventEventHandle)

// 初始化loading层
$loader = $('.spa-loader')
$loader.on('click select mousedown mousemove mouseup touchstart touchmove touchend', preventEventHandle)
Expand Down
Loading

0 comments on commit 9ad67f5

Please sign in to comment.