Even better fix for IOS11 bug!
This commit is contained in:
parent
131a6f53ee
commit
adc4ee2d74
6 changed files with 63 additions and 39 deletions
|
@ -3,18 +3,18 @@ const h = require('snabbdom/h')
|
||||||
const branding = require('../../components/nonprofit-branding')
|
const branding = require('../../components/nonprofit-branding')
|
||||||
const format = require('../../common/format')
|
const format = require('../../common/format')
|
||||||
const soldOut = require('./is-sold-out')
|
const soldOut = require('./is-sold-out')
|
||||||
const on_ios11 = require('../../common/on-ios11')
|
|
||||||
function prepareForIOS11()
|
|
||||||
{
|
|
||||||
bad_elements = $('.ff-modalBackdrop')
|
|
||||||
for(var i = 0; i < bad_elements.length; i++)
|
|
||||||
{
|
|
||||||
bad_elements[i].classList.add('ios-force-absolute-positioning')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// function prepareForIOS11()
|
||||||
$('body').scrollTop(195) // so incredibly hacky
|
// {
|
||||||
}
|
// bad_elements = $('.ff-modalBackdrop')
|
||||||
|
// for(var i = 0; i < bad_elements.length; i++)
|
||||||
|
// {
|
||||||
|
// bad_elements[i].classList.add('ios-force-absolute-positioning')
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// $('body').scrollTop(195) // so incredibly hacky
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
module.exports = (state, gift) => {
|
module.exports = (state, gift) => {
|
||||||
|
@ -26,10 +26,7 @@ module.exports = (state, gift) => {
|
||||||
gift.amount_one_time
|
gift.amount_one_time
|
||||||
? h('td', [
|
? h('td', [
|
||||||
h('button.button--small.button--gift', {
|
h('button.button--small.button--gift', {
|
||||||
on: {click: ev => { if (on_ios11()) {
|
on: {click: ev => {
|
||||||
prepareForIOS11()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
state.clickOption$([gift, gift.amount_one_time, 'one-time'])}
|
state.clickOption$([gift, gift.amount_one_time, 'one-time'])}
|
||||||
|
@ -45,9 +42,7 @@ module.exports = (state, gift) => {
|
||||||
, gift.amount_recurring
|
, gift.amount_recurring
|
||||||
? h('td', [
|
? h('td', [
|
||||||
h('button.button--small.button--gift', {
|
h('button.button--small.button--gift', {
|
||||||
on: {click: ev => { if (on_ios11()) {
|
on: {click: ev => {
|
||||||
prepareForIOS11()
|
|
||||||
}
|
|
||||||
|
|
||||||
state.clickOption$([gift, gift.amount_recurring, 'recurring'])}
|
state.clickOption$([gift, gift.amount_recurring, 'recurring'])}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,16 +25,11 @@ require('../../common/fundraiser_metrics')
|
||||||
require('../../components/fundraising/add_header_image')
|
require('../../components/fundraising/add_header_image')
|
||||||
require('../../common/restful_resource')
|
require('../../common/restful_resource')
|
||||||
require('../../gift_options/index')
|
require('../../gift_options/index')
|
||||||
|
const on_ios11 = require('../../common/on-ios11')
|
||||||
|
const noScroll = require('no-scroll')
|
||||||
appl.ajax_gift_options.index()
|
appl.ajax_gift_options.index()
|
||||||
|
|
||||||
function calculateIOS()
|
|
||||||
{
|
|
||||||
var userAgent = window.navigator.userAgent;
|
|
||||||
var hasVersion11 = userAgent.search("Version/11.0") > 0
|
|
||||||
var has11_or_later = userAgent.search("OS 11_0_\d{1,2} like Mac OS X") > 0
|
|
||||||
|
|
||||||
return hasVersion11 && has11_or_later;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Campaign editor only functionality
|
// Campaign editor only functionality
|
||||||
if(app.current_campaign_editor) {
|
if(app.current_campaign_editor) {
|
||||||
|
@ -50,7 +45,6 @@ if(app.current_campaign_editor) {
|
||||||
function init() {
|
function init() {
|
||||||
var state = {
|
var state = {
|
||||||
timeRemaining$: timeRemaining(app.end_date_time, app.timezone),
|
timeRemaining$: timeRemaining(app.end_date_time, app.timezone),
|
||||||
onIOS11: calculateIOS()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(window.navigator.userAgent)
|
console.error(window.navigator.userAgent)
|
||||||
|
@ -97,6 +91,18 @@ function init() {
|
||||||
flyd.map(R.always('chooseGiftOptionsModal'), clickContributeGifts$)
|
flyd.map(R.always('chooseGiftOptionsModal'), clickContributeGifts$)
|
||||||
, flyd.map(R.always('donationModal'), startWiz$))
|
, flyd.map(R.always('donationModal'), startWiz$))
|
||||||
|
|
||||||
|
flyd.on((id) => {
|
||||||
|
if (on_ios11() && id === null) {
|
||||||
|
noScroll.off()
|
||||||
|
}
|
||||||
|
}, state.modalID$)
|
||||||
|
|
||||||
|
flyd.on((id) => {
|
||||||
|
if (on_ios11() && id !== null) {
|
||||||
|
noScroll.on()
|
||||||
|
}
|
||||||
|
}, state.modalID$)
|
||||||
|
|
||||||
// Stream of which gift option you have selected
|
// Stream of which gift option you have selected
|
||||||
const giftOption$ = flyd.map(setGiftParams, state.giftOptions.clickOption$)
|
const giftOption$ = flyd.map(setGiftParams, state.giftOptions.clickOption$)
|
||||||
const donateParam$ = flyd.scanMerge([
|
const donateParam$ = flyd.scanMerge([
|
||||||
|
|
|
@ -6,17 +6,7 @@ var moment = require('moment-timezone')
|
||||||
var client = require('./client')
|
var client = require('./client')
|
||||||
var appl = require('view-script')
|
var appl = require('view-script')
|
||||||
const on_ios11 = require('./on-ios11')
|
const on_ios11 = require('./on-ios11')
|
||||||
function prepareForIOS11(id)
|
const noScroll = require('no-scroll')
|
||||||
{
|
|
||||||
let bad_elements = $("#" + id)
|
|
||||||
for(var i = 0; i < bad_elements.length; i++)
|
|
||||||
{
|
|
||||||
bad_elements[i].classList.add('ios-force-absolute-positioning')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
document.body.scrollTop = 0 // so incredibly hacky
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = appl
|
module.exports = appl
|
||||||
|
|
||||||
|
@ -42,7 +32,7 @@ appl.def('open_modal', function(modalId) {
|
||||||
|
|
||||||
$('body').addClass('is-showingModal')
|
$('body').addClass('is-showingModal')
|
||||||
if (on_ios11()){
|
if (on_ios11()){
|
||||||
prepareForIOS11(modalId)
|
noScroll.on()
|
||||||
}
|
}
|
||||||
return appl
|
return appl
|
||||||
})
|
})
|
||||||
|
@ -51,6 +41,9 @@ appl.def('open_modal', function(modalId) {
|
||||||
appl.def('close_modal', function() {
|
appl.def('close_modal', function() {
|
||||||
$('.modal').removeClass('inView')
|
$('.modal').removeClass('inView')
|
||||||
$('body').removeClass('is-showingModal')
|
$('body').removeClass('is-showingModal')
|
||||||
|
if (on_ios11()) {
|
||||||
|
noScroll.off()
|
||||||
|
}
|
||||||
return appl
|
return appl
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,37 @@ const flyd = require('flyd')
|
||||||
const R = require('ramda')
|
const R = require('ramda')
|
||||||
const render = require('ff-core/render')
|
const render = require('ff-core/render')
|
||||||
const modal = require('ff-core/modal')
|
const modal = require('ff-core/modal')
|
||||||
|
const noScroll = require('no-scroll')
|
||||||
|
|
||||||
|
const on_ios11 = require('../../common/on-ios11')
|
||||||
|
|
||||||
|
function createClickListener(startWiz$){
|
||||||
|
return (...props) => {
|
||||||
|
if (on_ios11())
|
||||||
|
{
|
||||||
|
noScroll.on()
|
||||||
|
}
|
||||||
|
startWiz$(...props)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// -- Flim flam root component for event pages
|
// -- Flim flam root component for event pages
|
||||||
function init() {
|
function init() {
|
||||||
var state = { }
|
var state = { }
|
||||||
const startWiz$ = flyd.stream()
|
const startWiz$ = flyd.stream()
|
||||||
const donateButtons = document.querySelectorAll('.js-openDonationModal')
|
const donateButtons = document.querySelectorAll('.js-openDonationModal')
|
||||||
R.map(x => x.addEventListener('click', startWiz$), donateButtons)
|
R.map(x => x.addEventListener('click', createClickListener(startWiz$)), donateButtons)
|
||||||
state.modalID$ = flyd.map(R.always('donationModal'), startWiz$)
|
state.modalID$ = flyd.map(R.always('donationModal'), startWiz$)
|
||||||
|
flyd.on((id) => {
|
||||||
|
if (on_ios11() && id ===null ){
|
||||||
|
noScroll.off()
|
||||||
|
}}, state.modalID$)
|
||||||
|
flyd.on((id) => {
|
||||||
|
if (on_ios11() && id !==null){
|
||||||
|
noScroll.on()
|
||||||
|
}}, state.modalID$)
|
||||||
state.donateWiz = donateWiz.init(flyd.stream({event_id: app.event_id}))
|
state.donateWiz = donateWiz.init(flyd.stream({event_id: app.event_id}))
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -10811,6 +10811,12 @@
|
||||||
"lower-case": "1.1.4"
|
"lower-case": "1.1.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"no-scroll": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/no-scroll/-/no-scroll-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-YTzGAJOo/B6hkodeT5SKKHpOhAzjMfkUCCXjLJwjWk2F4/InIg+HbdH9kmT7bKpleDuqLZDTRy2OdNtAj0IVyQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "1.7.3",
|
"version": "1.7.3",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"mobx-react": "^5.0.0",
|
"mobx-react": "^5.0.0",
|
||||||
"mobx-react-devtools": "^5.0.1",
|
"mobx-react-devtools": "^5.0.1",
|
||||||
"mobx-react-form": "^1.34.0",
|
"mobx-react-form": "^1.34.0",
|
||||||
|
"no-scroll": "^2.1.0",
|
||||||
"phantomjs-prebuilt": "2.1.12",
|
"phantomjs-prebuilt": "2.1.12",
|
||||||
"postcss-cssnext": "^2.9.0",
|
"postcss-cssnext": "^2.9.0",
|
||||||
"postcss-import": "^9.1.0",
|
"postcss-import": "^9.1.0",
|
||||||
|
|
Loading…
Reference in a new issue