Instantly share code, notes, and snippets.
rtekie
/ shareqr3.2.2.html
Created
August 26, 2012 19:56
jQuery Mobile Tutorial 3.2.2 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#addurl" data-icon="plus">Add URL</a> |
rtekie
/ shareqr3.2.1.html
Created
August 26, 2012 19:55
jQuery Mobile Tutorial 3.2.1 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="page" id="addurl"> | |
<div data-role="header" data-theme="b" data-position="fixed"> | |
<a href="#home" data-icon="home" data-iconpos="notext">Home</a> | |
<h1>Add URL</h1> | |
<a href="#home" data-icon="arrow-l" data-rel="back">Back</a> | |
</div> | |
<div data-role="content"> | |
<form action="#home" method="POST" name="addurl" id="addurl"> | |
<div data-role="fieldcontain"> | |
<label for="url">URL:</label> |
rtekie
/ shareqr3.1.4.js
Created
August 26, 2012 19:53
jQuery Mobile Tutorial 3.1.4 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Refresh home page using dynamic url list. | |
$(document).ready(function() { | |
$.mobile.changePage("#home"); | |
}); |
rtekie
/ shareqr3.1.3.js
Created
August 26, 2012 19:52
jQuery Mobile Tutorial 3.1.3 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Listen for any attempts to call changePage(). | |
$(document).bind( "pagebeforechange", function(e, data) { | |
// We only want to handle changePage() calls where the caller is asking us to load a page by URL. | |
if (typeof data.toPage === "string") { | |
// We only want to handle a subset of URLs. | |
var u = $.mobile.path.parseUrl(data.toPage); | |
var home = /^#home/; | |
var qrcode = /^#qrcode/; | |
if (u.hash.search(home) !== -1) { | |
// Display a list of URLs. |
rtekie
/ shareqr3.1.2.js
Created
August 26, 2012 19:49
jQuery Mobile Tutorial 3.1.2 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display a list of urls you want to share. | |
function showUrlList(urlObj, options) { | |
// Get list of urls | |
var myUrls = getMyUrls(); | |
// Get the page we are going to write our content into. | |
var $page = $("#home"); | |
// Get the content area element for the page. | |
var $content = $page.children(":jqmData(role=content)"); |
rtekie
/ shareqr3.1.1.js
Created
August 26, 2012 19:47
jQuery Mobile Tutorial 3.1.1 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve a list of URLs from the local storage. | |
// Use defaults if storage has not been initialized yet. | |
// URLs are serialized using JSON for storage. | |
function getMyUrls() { | |
var myUrls; | |
var storedUrls = localStorage.getItem("myUrls"); | |
if (storedUrls) { | |
// Deserialize URLs | |
myUrls = JSON.parse(storedUrls); | |
} |
rtekie
/ shareqr2.2.css
Created
August 26, 2012 19:15
jQuery Mobile Tutorial 2.2 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img.center { | |
display: block; | |
margin-left: auto; | |
margin-right: auto; | |
} |
rtekie
/ shareqr2.2.html
Last active
October 9, 2015 09:47
jQuery Mobile Tutorial 2.2 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Share QR</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> | |
<link rel="stylesheet" href="shareqr2.2.css" /> | |
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> | |
<script src="shareqr2.2.js"></script> |
rtekie
/ shareqr2.2.js
Created
August 26, 2012 19:12
jQuery Mobile Tutorial 2.2 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Listen for any attempts to call changePage(). | |
$(document).bind("pagebeforechange", function(e, data) { | |
// We only want to handle changePage() calls where the caller is asking to load a page by URL. | |
if (typeof data.toPage === "string") { | |
// We only want to handle #qrcode url. | |
var u = $.mobile.path.parseUrl(data.toPage); | |
var qrcode = /^#qrcode/; | |
if (u.hash.search(qrcode) !== -1) { | |
// Display QR code for the selected URL. | |
showQRCode(u, data.options); |
rtekie
/ shareqr2.2.1.html
Created
August 26, 2012 19:10
jQuery Mobile Tutorial 2.2.1 - http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="content"> | |
<ul data-role="listview"> | |
<li><a href="#qrcode?url=http%3A%2F%2Fctoinsights.wordpress.com">ctoinsights.wordpress.com</a></li> | |
<li><a href="#qrcode?url=http%3A%2F%2Fwww.book-current.com">www.book-current.com</a></li> | |
</ul> | |
</div> |