Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <meta name="mobile-web-app-capable" content="yes">
  5. <meta name="apple-mobile-web-app-status-bar-style" content="default">
  6. <meta name="apple-mobile-web-app-title" content="Full Screen">
  7.  
  8. <!-- CSS Global -->
  9. <link href="js/bootstrap.min.css" rel="stylesheet">
  10. <link rel="stylesheet" href="js/style.css" type="text/css" />
  11. <script src="/MODELO/JQM/JQ_1113min.js"></script>
  12.  
  13.  
  14.  
  15.  
  16. <script type="text/javascript">
  17. if(window.location.hash.substr(1,2) == "zx"){
  18. var bc = window.location.hash.substr(3);
  19. localStorage["barcode"] = decodeURI(window.location.hash.substr(3));
  20. window.close();
  21. self.close();
  22.  
  23. // window.location.href = "about:blank";//In case self.close isn't allowed
  24. }
  25. </script>
  26.  
  27. <script type="text/javascript" >
  28. var changingHash = false;
  29. function onbarcode(event){
  30. switch(event.type){
  31. case "hashchange":{
  32. if(changingHash == true){
  33. return;
  34. }
  35. var hash = window.location.hash;
  36. if(hash.substr(0,3) == "#zx"){
  37. hash = window.location.hash.substr(3);
  38. changingHash = true;
  39. window.location.hash = event.oldURL.split("#")[1] || ""
  40. changingHash = false;
  41. processBarcode(hash);
  42. }
  43.  
  44. break;
  45. }
  46. case "storage":{
  47. window.focus();
  48. if(event.key == "barcode"){
  49. window.removeEventListener("storage", onbarcode, false);
  50. processBarcode(event.newValue);
  51. }
  52. break;
  53. }
  54. default:{
  55. console.log(event)
  56. break;
  57. }
  58. }
  59. }
  60. window.addEventListener("hashchange", onbarcode, false);
  61.  
  62. function getScan(){
  63. var href = window.location.href;
  64. var ptr = href.lastIndexOf("#");
  65. if(ptr>0){
  66. href = href.substr(0,ptr);
  67. }
  68. window.addEventListener("storage", onbarcode, false);
  69. setTimeout('window.removeEventListener("storage", onbarcode, false)', 15000);
  70. localStorage.removeItem("barcode");
  71. //window.open (href + "#zx" + new Date().toString());
  72.  
  73. if(navigator.userAgent.match(/Firefox/i)){
  74. //Used for Firefox. If Chrome uses this, it raises the "hashchanged" event only.
  75. window.location.href = ("zxing://scan/?ret=" + encodeURIComponent(href + "#zx{CODE}"));
  76. }else{
  77. window.open ("zxing://scan/?ret=" + encodeURIComponent(href + "#zx{CODE}"));
  78. }
  79. }
  80.  
  81. function processBarcode(bc){
  82. document.getElementById("scans").innerHTML += "<div>" + bc + "</div>";
  83. //put your code in place of the line above.
  84. }
  85.  
  86. </script>
  87.  
  88. </head>
  89.  
  90. <body class="wide">
  91. <!-- Wrap all content -->
  92. <div class="wrapper">
  93. <!-- Content area-->
  94. <div class="content-area">
  95. <section class="page-section with-sidebar sidebar-right light">
  96. <INPUT id=barcode type=text >
  97. <button id="scanner" style="width:50px;height:50px" type=button value="Scan" onclick="getScan();" ></button>
  98. <div id="scans"></div>
  99. <!-- <a href="http://zxing.appspot.com/scan?ret={CODE}" target=""> scan </a> -->
  100. <!-- <a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end"> Take a QR code </a> -->
  101. </section>
  102. </div>
  103. </div>
  104. </body>
  105.  
  106. </html>
Add Comment
Please, Sign In to add comment