From c64f2542332ddbfc90c43a0bf5400ec0eb76b516 Mon Sep 17 00:00:00 2001 From: Wesley Hales Date: Sat, 2 Jun 2012 14:40:29 -0400 Subject: [PATCH] improvements to geolocation demo and other cleanup --- example/Example.iml | 10 ---------- example/demo.css | 23 ++++++++++++++++++++++- example/geo/index.html | 20 +++++++------------- example/orientation/index.html | 6 +++--- example/workers/index.html | 9 ++++----- slidfast.js | 7 ++++--- 6 files changed, 40 insertions(+), 35 deletions(-) delete mode 100644 example/Example.iml diff --git a/example/Example.iml b/example/Example.iml deleted file mode 100644 index db1e84c..0000000 --- a/example/Example.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/example/demo.css b/example/demo.css index e69586a..d924a06 100644 --- a/example/demo.css +++ b/example/demo.css @@ -37,4 +37,25 @@ nav.primary > ul li a { background-color: #ff1493; width: 100%; height: 100%; -} \ No newline at end of file +} + +.worker-table { + border: 1px solid black; +} + +.worker-table tr td { + border: 1px solid black +} + +.worker-table tr td.a6 { + background-color: white; +} + +.worker-table tr td.a7 { + background-color: green; +} + +.worker-table tr td.a8 { + background-color: yellow; +} + diff --git a/example/geo/index.html b/example/geo/index.html index 15ea3ba..2b8d336 100644 --- a/example/geo/index.html +++ b/example/geo/index.html @@ -17,9 +17,12 @@ slidfast({ defaultPageID:'home-page', touchEnabled: true, - geo: {on:true,track:true,interval:10000} + geo: {on:true,track:true,interval:10000,callback:geoCallback} }); +function geoCallback(e){ + document.querySelector("#log").innerHTML += e + "
"; +} @@ -31,7 +34,6 @@
  • Home
  • Products
  • About
  • -
  • Contact
  • @@ -41,27 +43,19 @@

    Home Page

    - Find out more about the home page! +

    Products Page

    - We got some product listings fer ya! + We got some product listings fer ya!

    About Page

    - You know you want to know more about us! + You know you want to know more about us!
    -
    - -
    -

    Contact Page

    - Check out our map! -
    - -
    diff --git a/example/orientation/index.html b/example/orientation/index.html index 529d264..72a79cb 100644 --- a/example/orientation/index.html +++ b/example/orientation/index.html @@ -43,17 +43,17 @@

    Home Page

    - Find out more about the home page! + Find out more about the home page!

    Products Page

    - We got some product listings fer ya! + We got some product listings fer ya!

    About Page

    - You know you want to know more about us! + You know you want to know more about us!
    diff --git a/example/workers/index.html b/example/workers/index.html index 90e6ae3..23a00e7 100644 --- a/example/workers/index.html +++ b/example/workers/index.html @@ -17,14 +17,13 @@ slidfast({ defaultPageID:'home-page', - touchEnabled: true, workers: {script:'worker1.js', threads:9, mycallback:workerCallback} }); slidfast.worker.obj().foo = 1; function workerCallback(e){ - document.querySelector("#log tbody").innerHTML += "" + e.data.foo + "" + e.data.index + ""; + document.querySelector("#log tbody").innerHTML += "" + e.data.foo + "" + e.data.index + ""; } @@ -45,7 +44,7 @@

    Home Page

    - +
    @@ -60,12 +59,12 @@

    Home Page

    diff --git a/slidfast.js b/slidfast.js index 5a18922..5d34567 100644 --- a/slidfast.js +++ b/slidfast.js @@ -368,7 +368,6 @@ focusPage.className = 'page transition stage-center'; //6. make this transition bookmarkable - //console.log(focusPage.id); slidfast.core.locationChange(focusPage.id); if (touchEnabled) { @@ -636,7 +635,7 @@ }; - var geolocationID, currentPosition, interval; + var geolocationID, currentPosition, interval, callback; slidfast.location = slidfast.prototype = { init:function (geo) { @@ -644,6 +643,7 @@ if (geo.track) { slidfast.location.track(); interval = geo.interval ? geo.interval : 10000; + callback = geo.callback; } else { if (currentPosition === undefined) { navigator.geolocation.getCurrentPosition(function (position) { @@ -676,6 +676,7 @@ setPosition:function (position) { currentPosition = position; console.log('position ' + position.coords.latitude + ' ' + position.coords.longitude); + callback('position ' + position.coords.latitude + ' ' + position.coords.longitude); }, currentPosition:function () { @@ -958,7 +959,7 @@ return false; } }, - + //geolocation cannot be accessed with dot notation in iOS5... will prevent page caching supports_geolocation:function () { try { return 'geolocation' in navigator && navigator['geolocation'] !== null;
    Data