Guest User

Untitled

a guest
Dec 10th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. // Listen for any attempts to call changePage().
  2. $(document).bind( "pagebeforechange", function(e, data) {
  3. // We only want to handle changePage() calls where the caller is asking us to load a page by URL.
  4. if (typeof data.toPage === "string") {
  5. // We only want to handle a subset of URLs.
  6. var u = $.mobile.path.parseUrl(data.toPage);
  7. var home = /^#home/;
  8. var qrcode = /^#qrcode/;
  9. if (u.hash.search(home) !== -1) {
  10. // Display a list of URLs.
  11. showUrlList(u, data.options);
  12. e.preventDefault();
  13. }
  14. else if (u.hash.search(qrcode) !== -1) {
  15. // Display QR code for the selected URL.
  16. showQRCode(u, data.options);
  17. e.preventDefault();
  18. }
  19. }
  20. });
Add Comment
Please, Sign In to add comment