diff options
15 files changed, 112 insertions, 28 deletions
diff --git a/StoneIsland/config.xml b/StoneIsland/config.xml index 4b1baad3..0d747972 100755 --- a/StoneIsland/config.xml +++ b/StoneIsland/config.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<widget id="us.okfoc.stoneisland" version="0.4.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget id="us.okfoc.stoneisland" version="0.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Stone Island</name> <description> Stone Island @@ -28,6 +28,7 @@ <preference name="StatusBarOverlaysWebView" value="false" /> <preference name="StatusBarBackgroundColor" value="#000000" /> <preference name="StatusBarStyle" value="lightcontent" /> + <preference name="SplashMaintainAspectRatio" value="true" /> <platform name="android"> <allow-intent href="market:*" /> diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 92f36f53..67b972ba 100755 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate +++ b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist index 203752b1..fc7c7cd3 100755 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist @@ -57,7 +57,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>0.4.1</string> + <string>0.5.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleURLTypes</key> @@ -70,7 +70,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>0.4.1</string> + <string>0.5.0</string> <key>LSApplicationQueriesSchemes</key> <array> <string>youtube</string> diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index 9af7f246..c52b46e5 100755 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<widget id="us.okfoc.stoneisland" version="0.4.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget id="us.okfoc.stoneisland" version="0.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <preference name="AllowInlineMediaPlayback" value="false" /> <preference name="BackupWebStorage" value="cloud" /> <preference name="DisallowOverscroll" value="false" /> @@ -77,4 +77,5 @@ <preference name="StatusBarOverlaysWebView" value="false" /> <preference name="StatusBarBackgroundColor" value="#000000" /> <preference name="StatusBarStyle" value="lightcontent" /> + <preference name="SplashMaintainAspectRatio" value="true" /> </widget> diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js index 050a729c..73af443a 100755 --- a/StoneIsland/platforms/ios/www/js/index.js +++ b/StoneIsland/platforms/ios/www/js/index.js @@ -3,7 +3,7 @@ var app = (function(){ app.init = function(){ - sdk.init({ env: "production" }) + sdk.init({ env: "test" }) app.bind() app.build() diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js index 5a036930..e7211036 100755 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js @@ -36,6 +36,7 @@ var ArchiveView = ScrollableView.extend({ var index = $(e.currentTarget).data("index") this.$subtitle.html( $(e.currentTarget).text() ) this.populateDecade(index) + this.deferScrollToTop() }, show: function(){ diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js index dae7f98d..4ed05bb8 100755 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js @@ -25,13 +25,22 @@ var HubView = ScrollableView.extend({ galleries: {}, populate: function(data){ - this.data = data + // sort posts by date, reversed + this.data = data.map(function(s){ + return [ +moment(s.date), s ] + }).sort(function(a,b){ + return a[0] > b[0] ? -1 : a[0] == b[0] ? 0 : 1 + }).map(function(pair){ + console.log(pair[1]) + return pair[1] + }) this.$loader.hide() this.$content.empty() this.galleries = {} // id date subtitle body link store image[uri caption] this.data.forEach(function(row){ // console.log(row) + console.log(moment(row.date)) var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/geo.js b/StoneIsland/platforms/ios/www/js/lib/etc/geo.js index fac34c1e..88521bb1 100755 --- a/StoneIsland/platforms/ios/www/js/lib/etc/geo.js +++ b/StoneIsland/platforms/ios/www/js/lib/etc/geo.js @@ -1,23 +1,49 @@ var geo = (function(){ var geo = {} + var polling = false, fetching = false, poll_timeout = null + geo.fetch = function(){ + fetching = true navigator.geolocation.getCurrentPosition(geo.success, geo.error, {timeout: 15000}) } geo.success = function(position){ - var lat_str = as_degrees( position.coords.latitude || 40.99167 ) - var lng_str = as_degrees( position.coords.longitude || -74.07944 ) + var lat_str = as_degrees( position.coords.latitude || 40.99167, "N", "S" ) + var lng_str = as_degrees( position.coords.longitude || -74.07944, "W", "E" ) $(".latlng").html( lat_str + " " + lng_str ) + geo.done() } geo.error = function(error){ - $(".latlng").html( "+40° 58' 90\" -74° 04' 46\"" ) + $(".latlng").html( "+40° 58' 90.9\" N 74° 04' 46.3\" W" ) + geo.done() + } + + geo.done = function(){ + fetching = false + if (polling) { + clearTimeout( poll_timeout ) + poll_timeout = setTimeout(geo.fetch, 15000) + } + } + + geo.start_polling = function(){ + polling = true + if (! fetching) { + geo.fetch() + } + } + + geo.stop_polling = function(){ + polling = false + clearTimeout(poll_timeout) } - function as_degrees (n) { + function as_degrees (n, pos, neg) { var s = "" - if (n >= 0) s += "+" + var sig = n >= 0 ? pos : neg + s += Math.floor(n) + "° " n = Math.abs(n) @@ -31,7 +57,13 @@ var geo = (function(){ n *= 60 nn = Math.floor(n) if (nn < 10) nn = "0" + nn - s += nn + '"' + s += nn + + n %= 1 + n *= 10 + nn = Math.floor(n) + s += "." + nn + '\" ' + sig + return s } diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js b/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js index 5e5ea908..c075619a 100755 --- a/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js +++ b/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js @@ -21,14 +21,13 @@ var IntroView = View.extend({ window.addEventListener("deviceorientation", this.orient) app.footer.hide() this.orient({ alpha: 0 }) - // get location.. }, - + hide: function(){ window.removeEventListener("deviceorientation", this.orient) this.$alert.hide() }, - + deviceorientation: function(e){ var heading if ('webkitCompassHeading' in e) { @@ -61,5 +60,5 @@ var IntroView = View.extend({ e.stopPropagation() app.router.go("archive") }, - + }) diff --git a/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js b/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js index e732f80d..e732f80d 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js +++ b/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 050a729c..73af443a 100755 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -3,7 +3,7 @@ var app = (function(){ app.init = function(){ - sdk.init({ env: "production" }) + sdk.init({ env: "test" }) app.bind() app.build() diff --git a/StoneIsland/www/js/lib/blogs/ArchiveView.js b/StoneIsland/www/js/lib/blogs/ArchiveView.js index 5a036930..e7211036 100755 --- a/StoneIsland/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/www/js/lib/blogs/ArchiveView.js @@ -36,6 +36,7 @@ var ArchiveView = ScrollableView.extend({ var index = $(e.currentTarget).data("index") this.$subtitle.html( $(e.currentTarget).text() ) this.populateDecade(index) + this.deferScrollToTop() }, show: function(){ diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js index dae7f98d..4ed05bb8 100755 --- a/StoneIsland/www/js/lib/blogs/HubView.js +++ b/StoneIsland/www/js/lib/blogs/HubView.js @@ -25,13 +25,22 @@ var HubView = ScrollableView.extend({ galleries: {}, populate: function(data){ - this.data = data + // sort posts by date, reversed + this.data = data.map(function(s){ + return [ +moment(s.date), s ] + }).sort(function(a,b){ + return a[0] > b[0] ? -1 : a[0] == b[0] ? 0 : 1 + }).map(function(pair){ + console.log(pair[1]) + return pair[1] + }) this.$loader.hide() this.$content.empty() this.galleries = {} // id date subtitle body link store image[uri caption] this.data.forEach(function(row){ // console.log(row) + console.log(moment(row.date)) var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) diff --git a/StoneIsland/www/js/lib/etc/geo.js b/StoneIsland/www/js/lib/etc/geo.js index fac34c1e..88521bb1 100755 --- a/StoneIsland/www/js/lib/etc/geo.js +++ b/StoneIsland/www/js/lib/etc/geo.js @@ -1,23 +1,49 @@ var geo = (function(){ var geo = {} + var polling = false, fetching = false, poll_timeout = null + geo.fetch = function(){ + fetching = true navigator.geolocation.getCurrentPosition(geo.success, geo.error, {timeout: 15000}) } geo.success = function(position){ - var lat_str = as_degrees( position.coords.latitude || 40.99167 ) - var lng_str = as_degrees( position.coords.longitude || -74.07944 ) + var lat_str = as_degrees( position.coords.latitude || 40.99167, "N", "S" ) + var lng_str = as_degrees( position.coords.longitude || -74.07944, "W", "E" ) $(".latlng").html( lat_str + " " + lng_str ) + geo.done() } geo.error = function(error){ - $(".latlng").html( "+40° 58' 90\" -74° 04' 46\"" ) + $(".latlng").html( "+40° 58' 90.9\" N 74° 04' 46.3\" W" ) + geo.done() + } + + geo.done = function(){ + fetching = false + if (polling) { + clearTimeout( poll_timeout ) + poll_timeout = setTimeout(geo.fetch, 15000) + } + } + + geo.start_polling = function(){ + polling = true + if (! fetching) { + geo.fetch() + } + } + + geo.stop_polling = function(){ + polling = false + clearTimeout(poll_timeout) } - function as_degrees (n) { + function as_degrees (n, pos, neg) { var s = "" - if (n >= 0) s += "+" + var sig = n >= 0 ? pos : neg + s += Math.floor(n) + "° " n = Math.abs(n) @@ -31,7 +57,13 @@ var geo = (function(){ n *= 60 nn = Math.floor(n) if (nn < 10) nn = "0" + nn - s += nn + '"' + s += nn + + n %= 1 + n *= 10 + nn = Math.floor(n) + s += "." + nn + '\" ' + sig + return s } diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js index 5e5ea908..c075619a 100755 --- a/StoneIsland/www/js/lib/nav/IntroView.js +++ b/StoneIsland/www/js/lib/nav/IntroView.js @@ -21,14 +21,13 @@ var IntroView = View.extend({ window.addEventListener("deviceorientation", this.orient) app.footer.hide() this.orient({ alpha: 0 }) - // get location.. }, - + hide: function(){ window.removeEventListener("deviceorientation", this.orient) this.$alert.hide() }, - + deviceorientation: function(e){ var heading if ('webkitCompassHeading' in e) { @@ -61,5 +60,5 @@ var IntroView = View.extend({ e.stopPropagation() app.router.go("archive") }, - + }) |
