Skip to content

Commit

Permalink
upgrade masseuse to work on android browser better
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mapper committed Aug 22, 2012
1 parent 26b0e0c commit e5f2428
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
18 changes: 14 additions & 4 deletions build/vk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2515,24 +2515,34 @@ require.define("masseuse",function(require,module,exports,__dirname,__filename,p
var modal = catchModals(e)
if (modal && modalCallback) modalCallback(modal)
})

$(scope + 'input').live('tap', function(e) {
e.preventDefault()
var el = $(e.target)
var type = e.target.type
if (type === "checkbox") {
if (e.target.type === "checkbox") {
el[0].checked = !el[0].checked
el.attr('checked', el[0].checked)
// hack around webkit bug
var toggler = el.parent().find('.toggler')
redraw(toggler)
} else {
if (el.hasClass('disabled')) return false
var type = e.target.type
// hack around mobile safari bug
if (type === "datetime") return setTimeout(function() { el.focus() }, 0)
// if (type === "datetime") return setTimeout(function() { el.focus() }, 0)
el.focus()
}
return false
})
}

// mobile browsers ughhhhhhhhh
function redraw(obj) {
obj.hide()
obj.each(function() { this.offsetHeight })
obj.show()
}

function turnOffClick(elems) {
elems.forEach(function(el) {
$(el).live('click', function(e) {
Expand Down
18 changes: 14 additions & 4 deletions lib/browserify/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2515,24 +2515,34 @@ require.define("masseuse",function(require,module,exports,__dirname,__filename,p
var modal = catchModals(e)
if (modal && modalCallback) modalCallback(modal)
})

$(scope + 'input').live('tap', function(e) {
e.preventDefault()
var el = $(e.target)
var type = e.target.type
if (type === "checkbox") {
if (e.target.type === "checkbox") {
el[0].checked = !el[0].checked
el.attr('checked', el[0].checked)
// hack around webkit bug
var toggler = el.parent().find('.toggler')
redraw(toggler)
} else {
if (el.hasClass('disabled')) return false
var type = e.target.type
// hack around mobile safari bug
if (type === "datetime") return setTimeout(function() { el.focus() }, 0)
// if (type === "datetime") return setTimeout(function() { el.focus() }, 0)
el.focus()
}
return false
})
}

// mobile browsers ughhhhhhhhh
function redraw(obj) {
obj.hide()
obj.each(function() { this.offsetHeight })
obj.show()
}

function turnOffClick(elems) {
elems.forEach(function(el) {
$(el).live('click', function(e) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"dependencies": {
"underscore": "1.3.3",
"mustache": "0.4.0",
"masseuse": "0.0.1"
"masseuse": "0.0.2"
}
}

0 comments on commit e5f2428

Please sign in to comment.