Improve barcode scanning
This commit is contained in:
parent
b1bf598c86
commit
513e97f525
@ -9,7 +9,8 @@
|
||||
# For more information about plugins see http://cordova.apache.org/blog/releases/2013/07/23/cordova-3.html
|
||||
#
|
||||
|
||||
phonegap-plugin-barcodescanner=https://github.com/phonegap/phonegap-plugin-barcodescanner.git
|
||||
com.phonegap.plugins.barcodescanner=https://github.com/Telerik-Verified-Plugins/BarcodeScanner
|
||||
#phonegap-plugin-barcodescanner=https://github.com/phonegap/phonegap-plugin-barcodescanner.git
|
||||
cordova-plugin-whitelist=https://github.com/apache/cordova-plugin-whitelist.git
|
||||
cordova-plugin-splashscreen=https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
|
||||
cordova-plugin-dialogs=https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -120,6 +120,11 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"res/values/strings.xml": {
|
||||
"parents": {
|
||||
"/resources": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -160,7 +165,7 @@
|
||||
"cordova-plugin-whitelist": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
},
|
||||
"phonegap-plugin-barcodescanner": {
|
||||
"com.phonegap.plugins.barcodescanner": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
}
|
||||
},
|
||||
@ -469,9 +474,9 @@
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
@ -490,6 +495,6 @@
|
||||
"cordova-plugin-network-information": "1.2.1-dev",
|
||||
"cordova-plugin-splashscreen": "3.2.2-dev",
|
||||
"cordova-plugin-whitelist": "1.2.1",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
}
|
||||
}
|
@ -303,9 +303,9 @@ module.exports = [
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
@ -326,7 +326,7 @@ module.exports.metadata =
|
||||
"cordova-plugin-network-information": "1.2.1-dev",
|
||||
"cordova-plugin-splashscreen": "3.2.2-dev",
|
||||
"cordova-plugin-whitelist": "1.2.1",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
};
|
||||
// BOTTOM OF METADATA
|
||||
});
|
@ -99,6 +99,10 @@ function scanCode() {
|
||||
},
|
||||
function (error) {
|
||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||
},
|
||||
{
|
||||
"showFlipCameraButton": true,
|
||||
"prompt": "Scan a barcode to discover an item!"
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) {
|
||||
/**
|
||||
* cordova is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
@ -9,8 +10,6 @@
|
||||
|
||||
var exec = require("cordova/exec");
|
||||
|
||||
var scanInProgress = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -99,26 +98,7 @@ BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config
|
||||
return;
|
||||
}
|
||||
|
||||
if (scanInProgress) {
|
||||
errorCallback('Scan is already in progress');
|
||||
return;
|
||||
}
|
||||
|
||||
scanInProgress = true;
|
||||
|
||||
exec(
|
||||
function(result) {
|
||||
scanInProgress = false;
|
||||
successCallback(result);
|
||||
},
|
||||
function(error) {
|
||||
scanInProgress = false;
|
||||
errorCallback(error);
|
||||
},
|
||||
'BarcodeScanner',
|
||||
'scan',
|
||||
config
|
||||
);
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', config);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -145,3 +125,5 @@ BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config
|
||||
|
||||
var barcodeScanner = new BarcodeScanner();
|
||||
module.exports = barcodeScanner;
|
||||
|
||||
});
|
@ -88,7 +88,7 @@ ext {
|
||||
}
|
||||
|
||||
// PLUGIN GRADLE EXTENSIONS START
|
||||
apply from: "phonegap-plugin-barcodescanner/TerranQuest-barcodescanner.gradle"
|
||||
apply from: "com.phonegap.plugins.barcodescanner/TerranQuest-barcodescanner.gradle"
|
||||
// PLUGIN GRADLE EXTENSIONS END
|
||||
|
||||
def hasBuildExtras = file('build-extras.gradle').exists()
|
||||
|
@ -303,9 +303,9 @@ module.exports = [
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
@ -326,7 +326,7 @@ module.exports.metadata =
|
||||
"cordova-plugin-network-information": "1.2.1-dev",
|
||||
"cordova-plugin-splashscreen": "3.2.2-dev",
|
||||
"cordova-plugin-whitelist": "1.2.1",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
};
|
||||
// BOTTOM OF METADATA
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require, exports, module) {
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) {
|
||||
/**
|
||||
* cordova is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
@ -10,8 +10,6 @@ cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require
|
||||
|
||||
var exec = require("cordova/exec");
|
||||
|
||||
var scanInProgress = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -100,26 +98,7 @@ BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config
|
||||
return;
|
||||
}
|
||||
|
||||
if (scanInProgress) {
|
||||
errorCallback('Scan is already in progress');
|
||||
return;
|
||||
}
|
||||
|
||||
scanInProgress = true;
|
||||
|
||||
exec(
|
||||
function(result) {
|
||||
scanInProgress = false;
|
||||
successCallback(result);
|
||||
},
|
||||
function(error) {
|
||||
scanInProgress = false;
|
||||
errorCallback(error);
|
||||
},
|
||||
'BarcodeScanner',
|
||||
'scan',
|
||||
config
|
||||
);
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', config);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
@ -12,4 +12,4 @@
|
||||
# Project target.
|
||||
target=android-24
|
||||
android.library.reference.1=CordovaLib
|
||||
cordova.gradle.include.1=phonegap-plugin-barcodescanner/TerranQuest-barcodescanner.gradle
|
||||
cordova.gradle.include.1=com.phonegap.plugins.barcodescanner/TerranQuest-barcodescanner.gradle
|
@ -62,7 +62,7 @@
|
||||
"cordova-plugin-geolocation": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
},
|
||||
"phonegap-plugin-barcodescanner": {
|
||||
"com.phonegap.plugins.barcodescanner": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
}
|
||||
},
|
||||
@ -431,17 +431,17 @@
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"runs": true
|
||||
}
|
||||
],
|
||||
@ -458,6 +458,6 @@
|
||||
"cordova-plugin-media": "2.2.1-dev",
|
||||
"cordova-plugin-media-capture": "1.2.1-dev",
|
||||
"cordova-plugin-geolocation": "2.1.1-dev",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget android-versionCode="103000" id="com.netsyms.terranquest.TerranQuest" version="1.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
|
||||
<widget android-versionCode="104000" id="com.netsyms.terranquest.TerranQuest" version="1.4.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
|
||||
<feature name="Device">
|
||||
<param name="browser-package" value="Device" />
|
||||
</feature>
|
||||
|
@ -363,17 +363,17 @@ module.exports = [
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"runs": true
|
||||
}
|
||||
];
|
||||
@ -392,7 +392,7 @@ module.exports.metadata =
|
||||
"cordova-plugin-media": "2.2.1-dev",
|
||||
"cordova-plugin-media-capture": "1.2.1-dev",
|
||||
"cordova-plugin-geolocation": "2.1.1-dev",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
}
|
||||
// BOTTOM OF METADATA
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
cordova.define("phonegap-plugin-barcodescanner.BarcodeScannerProxy", function(require, exports, module) { function scan(success, error) {
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScannerProxy", function(require, exports, module) { function scan(success, error) {
|
||||
var code = window.prompt("Enter barcode value (empty value will fire the error handler):");
|
||||
if(code) {
|
||||
var result = {
|
@ -1,5 +1,4 @@
|
||||
cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require, exports, module) {
|
||||
/**
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) { /**
|
||||
* cordova is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
*
|
||||
@ -10,8 +9,6 @@ cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require
|
||||
|
||||
var exec = require("cordova/exec");
|
||||
|
||||
var scanInProgress = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -100,26 +97,7 @@ BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config
|
||||
return;
|
||||
}
|
||||
|
||||
if (scanInProgress) {
|
||||
errorCallback('Scan is already in progress');
|
||||
return;
|
||||
}
|
||||
|
||||
scanInProgress = true;
|
||||
|
||||
exec(
|
||||
function(result) {
|
||||
scanInProgress = false;
|
||||
successCallback(result);
|
||||
},
|
||||
function(error) {
|
||||
scanInProgress = false;
|
||||
errorCallback(error);
|
||||
},
|
||||
'BarcodeScanner',
|
||||
'scan',
|
||||
config
|
||||
);
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', config);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget android-versionCode="103000" id="com.netsyms.terranquest.TerranQuest" version="1.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
|
||||
<widget android-versionCode="104000" id="com.netsyms.terranquest.TerranQuest" version="1.4.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
|
||||
<feature name="Device">
|
||||
<param name="browser-package" value="Device" />
|
||||
</feature>
|
||||
|
14
platforms/browser/www/cordova_plugins.js
vendored
14
platforms/browser/www/cordova_plugins.js
vendored
@ -363,17 +363,17 @@ module.exports = [
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScanner",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/phonegap-plugin-barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "phonegap-plugin-barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "phonegap-plugin-barcodescanner",
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/src/browser/BarcodeScannerProxy.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScannerProxy",
|
||||
"pluginId": "com.phonegap.plugins.barcodescanner",
|
||||
"runs": true
|
||||
}
|
||||
];
|
||||
@ -392,7 +392,7 @@ module.exports.metadata =
|
||||
"cordova-plugin-media": "2.2.1-dev",
|
||||
"cordova-plugin-media-capture": "1.2.1-dev",
|
||||
"cordova-plugin-geolocation": "2.1.1-dev",
|
||||
"phonegap-plugin-barcodescanner": "6.0.1"
|
||||
"com.phonegap.plugins.barcodescanner": "5.0.1"
|
||||
}
|
||||
// BOTTOM OF METADATA
|
||||
});
|
52
platforms/browser/www/css/MarkerCluster.css
Normal file
52
platforms/browser/www/css/MarkerCluster.css
Normal file
@ -0,0 +1,52 @@
|
||||
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
|
||||
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
}
|
||||
|
||||
.leaflet-cluster-spider-leg {
|
||||
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
|
||||
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
|
||||
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
|
||||
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
|
||||
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
|
||||
}
|
||||
|
||||
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
|
||||
background-color: rgba(181, 226, 140, 0.6);
|
||||
}
|
||||
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
|
||||
background-color: rgba(110, 204, 57, 0.6);
|
||||
}
|
||||
/*
|
||||
.marker-cluster-medium {
|
||||
background-color: rgba(241, 211, 87, 0.6);
|
||||
}
|
||||
.marker-cluster-medium div {
|
||||
background-color: rgba(240, 194, 12, 0.6);
|
||||
}
|
||||
|
||||
.marker-cluster-large {
|
||||
background-color: rgba(253, 156, 115, 0.6);
|
||||
}
|
||||
.marker-cluster-large div {
|
||||
background-color: rgba(241, 128, 23, 0.6);
|
||||
}*/
|
||||
|
||||
.marker-cluster {
|
||||
background-clip: padding-box;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.marker-cluster div {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
}
|
||||
.marker-cluster span {
|
||||
line-height: 30px;
|
||||
}
|
@ -295,4 +295,37 @@ body {
|
||||
#team-choice-list {
|
||||
color: #000;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#place-log {
|
||||
padding: 5px;
|
||||
border-left: 1px solid white;
|
||||
border-bottom: 1px solid white;
|
||||
border-right: 0px;
|
||||
border-top: 0px;
|
||||
border-radius: 0px;
|
||||
height: 100px;
|
||||
max-height: 100px;
|
||||
min-height: 100px;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
#user-health-place-bar {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
#user-health-place {
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
#place-health-place-bar {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#place-health-place {
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
#capturebtn {
|
||||
color: black;
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
<link href="css/font-awesome.css" rel="stylesheet">
|
||||
|
||||
<link href="css/L.Control.Locate.css" rel="stylesheet">
|
||||
<link href="css/MarkerCluster.css" rel="stylesheet">
|
||||
|
||||
<!-- jQuery Version 1.11.1 -->
|
||||
<script src="js/jquery.js"></script>
|
||||
@ -46,6 +47,7 @@
|
||||
|
||||
<script src="js/leaflet.js"></script>
|
||||
<script src="js/L.Control.Locate.min.js"></script>
|
||||
<script src="js/leaflet.markercluster.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -26,10 +26,10 @@ function logout() {
|
||||
password = null;
|
||||
$('#content-zone').load("screens/login.html");
|
||||
} else {
|
||||
alert("Error: Server did not properly acknowledge logout. You might have problems for the next few hours if you switch accounts.");
|
||||
navigator.notification.alert("Server did not properly acknowledge logout. You might have problems for the next few hours if you switch accounts.", null, "Error", 'Dismiss');
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("Error: Cannot connect to authentication server. Check your Internet connection and try again. If that fails, clear the app data or reinstall TerranQuest.");
|
||||
navigator.notification.alert("Cannot connect to authentication server. Check your Internet connection and try again. If that fails, clear the app data or reinstall TerranQuest.", null, "Error", 'Dismiss');
|
||||
});
|
||||
}
|
||||
|
||||
@ -81,11 +81,22 @@ function dosignup() {
|
||||
},
|
||||
function (data) {
|
||||
if (data === 'OK') {
|
||||
username = $('#usernameBox').val().toLowerCase();
|
||||
password = $('#passwordBox').val();
|
||||
localStorage.setItem("username", username);
|
||||
localStorage.setItem("password", password);
|
||||
checkUserHasTeamOpenChooserIfNot(username);
|
||||
$.getJSON(mkApiUrl('pinglogin') + "?user=" + $('#usernameBox').val(), function (out) {
|
||||
if (out.status === 'OK') {
|
||||
username = $('#usernameBox').val().toLowerCase();
|
||||
password = $('#passwordBox').val();
|
||||
localStorage.setItem("username", username);
|
||||
localStorage.setItem("password", password);
|
||||
navigator.splashscreen.hide();
|
||||
checkUserHasTeamOpenChooserIfNot(username);
|
||||
} else {
|
||||
navigator.notification.alert("You've signed up successfully, but we can't log you in. Restart the app and try again.", null, "Error", 'Dismiss');
|
||||
authOpInProgress = false;
|
||||
}
|
||||
}).fail(function (err) {
|
||||
navigator.notification.alert("You've signed up successfully, but we can't log you in. Restart the app and try again.", null, "Error", 'Dismiss');
|
||||
authOpInProgress = false;
|
||||
});
|
||||
} else {
|
||||
$('#signupBtn').html('<i class="fa fa-user-plus"></i> Sign Up');
|
||||
$('#signupBtn').attr('disabled', false);
|
||||
|
2380
platforms/browser/www/js/leaflet.markercluster.js
Normal file
2380
platforms/browser/www/js/leaflet.markercluster.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,15 @@ var placeLayer = L.geoJson(
|
||||
fillOpacity: 0.6
|
||||
});
|
||||
}
|
||||
}).addTo(map);
|
||||
});//.addTo(map);
|
||||
|
||||
var placemarkers = L.markerClusterGroup({
|
||||
spiderfyDistanceMultiplier: 2,
|
||||
showCoverageOnHover: false,
|
||||
zoomToBoundsOnClick: false
|
||||
});
|
||||
placemarkers.addLayer(placeLayer);
|
||||
map.addLayer(placemarkers);
|
||||
|
||||
var lc = L.control.locate({
|
||||
position: 'topleft', // set the location of the control
|
||||
@ -65,7 +73,7 @@ var lc = L.control.locate({
|
||||
remainActive: true, // if true locate control remains active on click even if the user's location is in view.
|
||||
markerClass: L.circleMarker, // L.circleMarker or L.marker
|
||||
circleStyle: {}, // change the style of the circle around the user's location
|
||||
markerStyle: {},
|
||||
markerStyle: {color: '#008000', fillColor: '#32CD32'},
|
||||
followCircleStyle: {}, // set difference for the style of the circle around the user's location while following
|
||||
followMarkerStyle: {},
|
||||
icon: 'fa fa-map-marker', // class for icon, fa-location-arrow or fa-map-marker
|
||||
@ -126,10 +134,12 @@ function loadPlaces(lat, long) {
|
||||
function (data) {
|
||||
if (data.type === 'FeatureCollection') {
|
||||
placeLayer.clearLayers();
|
||||
placemarkers.clearLayers();
|
||||
data.features.forEach(function (item) {
|
||||
item.properties.popupContent = "<span class='marker-popup-text' onclick='openPlace(" + item.properties.osm_id + ")'>" + item.properties.name + "</span>";
|
||||
placeLayer.addData(item);
|
||||
});
|
||||
placemarkers.addLayer(placeLayer);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -83,7 +83,18 @@ function scanCode() {
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function (result) {
|
||||
if (!result.cancelled) {
|
||||
navigator.notification.alert("Scanned code: " + result.text, null, "OK", 'Dismiss');
|
||||
$.getJSON(mkApiUrl('code2item', 'gs'), {
|
||||
code: result.text
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
navigator.notification.alert("Found one " + data.message, null, "Found an item!", 'OK');
|
||||
} else {
|
||||
navigator.notification.alert(data.message, null, "Huh?", 'OK');
|
||||
}
|
||||
}).fail(function () {
|
||||
navigator.notification.alert("Nothing happened!", null, "Huh?", 'OK');
|
||||
});
|
||||
//navigator.notification.alert("Scanned code: " + result.text, null, "OK", 'Dismiss');
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
@ -91,7 +102,7 @@ function scanCode() {
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
alert(ex.message);
|
||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Syncs the user's stats with the server and calls refreshStats().
|
||||
*/
|
||||
function syncStats() {
|
||||
$.getJSON(mkApiUrl('getstats'), {
|
||||
$.getJSON(mkApiUrl('getstats', 'gs'), {
|
||||
user: username
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
@ -58,7 +58,7 @@ setInterval(function () {
|
||||
}, 10 * 1000);
|
||||
setInterval(function () {
|
||||
getChat();
|
||||
}, 2000);
|
||||
}, 3000);
|
||||
// Send chat messages
|
||||
$("#chatsendform").submit(function (event) {
|
||||
message = $('#chatbox-input').val();
|
||||
|
@ -1,4 +1,4 @@
|
||||
cordova.define("phonegap-plugin-barcodescanner.BarcodeScannerProxy", function(require, exports, module) { function scan(success, error) {
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScannerProxy", function(require, exports, module) { function scan(success, error) {
|
||||
var code = window.prompt("Enter barcode value (empty value will fire the error handler):");
|
||||
if(code) {
|
||||
var result = {
|
@ -1,4 +1,4 @@
|
||||
cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require, exports, module) { /**
|
||||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) { /**
|
||||
* cordova is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
*
|
||||
@ -9,8 +9,6 @@ cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require
|
||||
|
||||
var exec = require("cordova/exec");
|
||||
|
||||
var scanInProgress = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -99,26 +97,7 @@ BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config
|
||||
return;
|
||||
}
|
||||
|
||||
if (scanInProgress) {
|
||||
errorCallback('Scan is already in progress');
|
||||
return;
|
||||
}
|
||||
|
||||
scanInProgress = true;
|
||||
|
||||
exec(
|
||||
function(result) {
|
||||
scanInProgress = false;
|
||||
successCallback(result);
|
||||
},
|
||||
function(error) {
|
||||
scanInProgress = false;
|
||||
errorCallback(error);
|
||||
},
|
||||
'BarcodeScanner',
|
||||
'scan',
|
||||
config
|
||||
);
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', config);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
@ -32,7 +32,7 @@
|
||||
function setTeam() {
|
||||
//alert($('input[name=teamChooser]:checked').val());
|
||||
var team = $('input[name=teamChooser]:checked').val();
|
||||
$.getJSON(mkApiUrl('setteam', 'gs'), {
|
||||
$.getJSON(mkApiUrl('setteam', 'gs'), {
|
||||
teamid: team
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
@ -40,10 +40,10 @@
|
||||
openscreen("home");
|
||||
} else {
|
||||
// Error?
|
||||
alert("Error: " + data.message);
|
||||
navigator.notification.alert(data.message, null, "Error", 'OK');
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("Something bad happened, try again later.");
|
||||
navigator.notification.alert("Something went wrong, try again later.", null, "Error", 'OK');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,36 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function useitem(uuid) {
|
||||
$.getJSON(mkApiUrl('useitem', 'gs'), {
|
||||
itemuuid: uuid
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
loadinventory();
|
||||
syncStats();
|
||||
} else {
|
||||
navigator.notification.alert(data.message, null, "Error", 'OK');
|
||||
}
|
||||
}).fail(function () {
|
||||
navigator.notification.alert("Cannot use item. Try again.", null, "Error", 'OK');
|
||||
});
|
||||
}
|
||||
|
||||
function getitemhtmlfromjson(item) {
|
||||
return "\
|
||||
var itemhtml = "\
|
||||
<div class='list-group-item inventory-item' id='item-" + item.itemuuid + "'>\
|
||||
<h4 class='itemname'>" + item.itemname + "</h4>\
|
||||
<p class='itemdesc'>" + item.itemdesc + "</p>\
|
||||
<span class='itemid' style='display: none;'>" + item.itemid + "</span>\
|
||||
<p class='itemdesc'>" + item.itemdesc + "</p>";
|
||||
if (item.classname == "healmagic") {
|
||||
itemhtml += "<span class='btn btn-success' onclick=\"useitem('" + item.itemuuid + "')\">\
|
||||
Use Item\
|
||||
</span>";
|
||||
}
|
||||
itemhtml += "<span class='itemid' style='display: none;'>" + item.itemid + "</span>\
|
||||
<span class='itemclassid' style='display: none;'>" + item.classid + "</span>\
|
||||
<span class='itemjson' style='display: none;'>" + item.itemjson + "</span>\
|
||||
</div>";
|
||||
return itemhtml;
|
||||
}
|
||||
|
||||
function loadinventory() {
|
||||
@ -34,6 +55,6 @@
|
||||
$('#inventory-list').html(content);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
loadinventory();
|
||||
</script>
|
@ -2,9 +2,14 @@
|
||||
<div class="h4" id="place-name"></div>
|
||||
<div id="place-info-div">
|
||||
Type: <span id="team-label"></span><br />
|
||||
Life: <span id="life-label"></span>
|
||||
<!-- Life: <span id="life-label"></span><br /> -->
|
||||
Place life: <div class="progress" id="place-health-place"><div id="place-health-place-bar" class="progress-bar" role="progressbar" ></div></div>
|
||||
<div class="btn btn-success btn-wide" id="capturebtn" onclick="attempttake()"></div>
|
||||
My life: <div class="progress" id="user-health-place"><div id="user-health-place-bar" class="progress-bar" role="progressbar" ></div></div>
|
||||
</div>
|
||||
<div class="well well-sm place-log" id="place-log">
|
||||
|
||||
</div>
|
||||
<div class="btn btn-primary btn-wide" id="capturebtn" onclick="attempttake()"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -21,7 +26,7 @@
|
||||
if (placeteam == 0) {
|
||||
$('#capturebtn').text("Claim");
|
||||
} else if (placeteam == userteamid) {
|
||||
$('#capturebtn').css('display', 'none');
|
||||
$('#capturebtn').css('visibility', 'hidden');
|
||||
} else {
|
||||
$('#capturebtn').text("Challenge");
|
||||
}
|
||||
@ -29,12 +34,30 @@
|
||||
}
|
||||
|
||||
function resyncstats() {
|
||||
$.getJSON(mkApiUrl('getstats', 'gs'), {
|
||||
user: username
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
maxenergy = data.stats.maxenergy;
|
||||
energy = data.stats.energy;
|
||||
level = data.stats.level;
|
||||
energypercent = (energy * 1.0 / maxenergy * 1.0) * 100.0;
|
||||
$('#user-health-place-bar').css('width', String(energypercent) + '%');
|
||||
refreshStats();
|
||||
}
|
||||
});
|
||||
$.getJSON(mkApiUrl('placestats', 'gs'), {
|
||||
locationid: thisplace.properties.gameinfo.locationid
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
placeteam = data.stats.teamid;
|
||||
$("#life-label").text(Math.round(data.stats.currentlife) + " / " + Math.round(data.stats.maxlife));
|
||||
var placepercent;
|
||||
if (data.stats.currentlife > 0) {
|
||||
placepercent = (Math.round(data.stats.currentlife) * 1.0 / Math.round(data.stats.maxlife) * 1.0) * 100.0;
|
||||
} else {
|
||||
placepercent = 0;
|
||||
}
|
||||
$('#place-health-place-bar').css('width', String(placepercent) + '%');
|
||||
loadTeamSwag();
|
||||
} else {
|
||||
//
|
||||
@ -45,12 +68,19 @@
|
||||
|
||||
function resetafteraction() {
|
||||
resyncstats();
|
||||
setTimeout(resetcapturebtn, 3 * 1000);
|
||||
setTimeout(resetcapturebtn, 2 * 1000);
|
||||
}
|
||||
|
||||
function loadTeamSwag() {
|
||||
$("#place-name").css("border-color", "#" + getTeamColorFromId(placeteam));
|
||||
$("#place-info-div").css("border-color", "#" + getTeamColorFromId(placeteam));
|
||||
$("#place-log").css("border-color", "#" + getTeamColorFromId(placeteam));
|
||||
if (placeteam == 0) {
|
||||
$("#capturebtn").css("background-color", "#" + getTeamColorFromId(userteamid));
|
||||
} else {
|
||||
$("#capturebtn").css("background-color", "#" + getTeamColorFromId(placeteam));
|
||||
}
|
||||
$("#place-health-place-bar").css("background-color", "#" + getTeamColorFromId(placeteam));
|
||||
$("#team-label").css("color", "#" + getTeamColorFromId(placeteam));
|
||||
$("#team-label").text(getTeamNameFromId(placeteam));
|
||||
}
|
||||
@ -74,11 +104,22 @@
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
$('#capturebtn').text(data.message);
|
||||
switch (Math.round(Math.random() * (3 - 1) + 1)) {
|
||||
case 1:
|
||||
$('#place-log').prepend("Attacking...<br />");
|
||||
break;
|
||||
case 2:
|
||||
$('#place-log').prepend("Attacking..<br />");
|
||||
break;
|
||||
case 3:
|
||||
$('#place-log').prepend("Attacking....<br />");
|
||||
}
|
||||
resetafteraction();
|
||||
} else {
|
||||
$('#capturebtn').text(data.message);
|
||||
$('#capturebtn').removeClass('btn-primary');
|
||||
$('#capturebtn').addClass('btn-warning');
|
||||
$('#place-log').prepend(data.message + "<br />");
|
||||
resetafteraction();
|
||||
}
|
||||
//alert(data.message);
|
||||
@ -99,11 +140,13 @@
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
$('#capturebtn').text(data.message);
|
||||
$('#place-log').prepend("Claimed!<br />");
|
||||
resetafteraction();
|
||||
} else {
|
||||
$('#capturebtn').text(data.message);
|
||||
$('#capturebtn').removeClass('btn-primary');
|
||||
$('#capturebtn').addClass('btn-warning');
|
||||
$('#place-log').prepend(data.message + "<br />");
|
||||
resetafteraction();
|
||||
}
|
||||
//alert(data.message);
|
||||
|
@ -37,7 +37,7 @@
|
||||
"cordova-plugin-whitelist": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
},
|
||||
"phonegap-plugin-barcodescanner": {
|
||||
"com.phonegap.plugins.barcodescanner": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
}
|
||||
},
|
||||
|
@ -37,7 +37,7 @@
|
||||
"cordova-plugin-geolocation": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
},
|
||||
"phonegap-plugin-barcodescanner": {
|
||||
"com.phonegap.plugins.barcodescanner": {
|
||||
"PACKAGE_NAME": "com.netsyms.terranquest.TerranQuest"
|
||||
}
|
||||
},
|
||||
|
@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "phonegap-plugin-barcodescanner",
|
||||
"version": "6.0.1",
|
||||
"version": "5.0.1",
|
||||
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.",
|
||||
"cordova": {
|
||||
"id": "phonegap-plugin-barcodescanner",
|
||||
"platforms": [
|
||||
"ios",
|
||||
"android",
|
||||
"windows8",
|
||||
"windows",
|
||||
"wp8",
|
||||
"blackberry10",
|
||||
@ -22,6 +23,7 @@
|
||||
"ecosystem:phonegap",
|
||||
"cordova-ios",
|
||||
"cordova-android",
|
||||
"cordova-windows8",
|
||||
"cordova-windows",
|
||||
"cordova-wp8",
|
||||
"cordova-blackberry10",
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
id="phonegap-plugin-barcodescanner"
|
||||
version="6.0.1">
|
||||
id="com.phonegap.plugins.barcodescanner"
|
||||
version="5.0.1">
|
||||
|
||||
<name>BarcodeScanner</name>
|
||||
<description>You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.</description>
|
||||
@ -97,6 +97,21 @@
|
||||
<dependency id="cordova-plugin-compat" version="^1.0.0" />
|
||||
</platform>
|
||||
|
||||
<platform name="windows8">
|
||||
<js-module src="src/windows/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
|
||||
<merges target="" />
|
||||
</js-module>
|
||||
|
||||
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
|
||||
<DeviceCapability Name="webcam" />
|
||||
</config-file>
|
||||
|
||||
<framework src="src/windows/lib/WinRTBarcodeReader.csproj" custom="true" type="projectReference" versions="<=8.1"/>
|
||||
<framework src="src/windows/lib.UW/WinRTBarcodeReader.UW.csproj" custom="true" type="projectReference" versions=">8.1"/>
|
||||
|
||||
<asset src="src/windows/assets/plugin-barcodeScanner.css" target="css/plugin-barcodeScanner.css" />
|
||||
</platform>
|
||||
|
||||
<platform name="windows">
|
||||
<js-module src="src/windows/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
|
||||
<merges target="" />
|
||||
@ -112,8 +127,6 @@
|
||||
<framework src="src/windows/lib/WinRTBarcodeReader.csproj" custom="true" type="projectReference" versions="<=8.1"/>
|
||||
|
||||
<asset src="src/windows/assets/plugin-barcodeScanner.css" target="css/plugin-barcodeScanner.css" />
|
||||
<hook src="hooks/windows/check-arch.js" type="before_compile" />
|
||||
<hook src="hooks/windows/check-arch.js" type="before_run" />
|
||||
</platform>
|
||||
|
||||
<!-- Windows Phone 8 -->
|
@ -336,11 +336,11 @@ parentViewController:(UIViewController*)parentViewController
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
- (void)barcodeScanDone:(void (^)(void))callbackBlock {
|
||||
- (void)barcodeScanDone {
|
||||
self.capturing = NO;
|
||||
[self.captureSession stopRunning];
|
||||
[self.parentViewController dismissViewControllerAnimated:YES completion:callbackBlock];
|
||||
|
||||
[self.parentViewController dismissViewControllerAnimated: YES completion:nil];
|
||||
|
||||
// viewcontroller holding onto a reference to us, release them so they
|
||||
// will release us
|
||||
self.viewController = nil;
|
||||
@ -380,25 +380,22 @@ parentViewController:(UIViewController*)parentViewController
|
||||
//--------------------------------------------------------------------------
|
||||
- (void)barcodeScanSucceeded:(NSString*)text format:(NSString*)format {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self barcodeScanDone:^{
|
||||
[self.plugin returnSuccess:text format:format cancelled:FALSE flipped:FALSE callback:self.callback];
|
||||
}];
|
||||
[self barcodeScanDone];
|
||||
AudioServicesPlaySystemSound(_soundFileObject);
|
||||
[self.plugin returnSuccess:text format:format cancelled:FALSE flipped:FALSE callback:self.callback];
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
- (void)barcodeScanFailed:(NSString*)message {
|
||||
[self barcodeScanDone:^{
|
||||
[self.plugin returnError:message callback:self.callback];
|
||||
}];
|
||||
[self barcodeScanDone];
|
||||
[self.plugin returnError:message callback:self.callback];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
- (void)barcodeScanCancelled {
|
||||
[self barcodeScanDone:^{
|
||||
[self.plugin returnSuccess:@"" format:@"" cancelled:TRUE flipped:self.isFlipped callback:self.callback];
|
||||
}];
|
||||
[self barcodeScanDone];
|
||||
[self.plugin returnSuccess:@"" format:@"" cancelled:TRUE flipped:self.isFlipped callback:self.callback];
|
||||
if (self.isFlipped) {
|
||||
self.isFlipped = NO;
|
||||
}
|
@ -250,13 +250,6 @@ module.exports = {
|
||||
capture,
|
||||
reader;
|
||||
|
||||
// Save call state for suspend/resume
|
||||
BarcodeReader.scanCallArgs = {
|
||||
success: success,
|
||||
fail: fail,
|
||||
args: args
|
||||
};
|
||||
|
||||
function updatePreviewForRotation(evt) {
|
||||
if (!capture) {
|
||||
return;
|
||||
@ -351,16 +344,7 @@ module.exports = {
|
||||
return WinJS.Promise.timeout(INITIAL_FOCUS_DELAY)
|
||||
.then(function () {
|
||||
try {
|
||||
return controller.focusControl.focusAsync().then(function () {
|
||||
return result;
|
||||
}, function (e) {
|
||||
// This happens on mutliple taps
|
||||
if (e.number !== OPERATION_IS_IN_PROGRESS) {
|
||||
console.error('focusAsync failed: ' + e);
|
||||
return WinJS.Promise.wrapError(e);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
return controller.focusControl.focusAsync();
|
||||
} catch (e) {
|
||||
// This happens on mutliple taps
|
||||
if (e.number !== OPERATION_IS_IN_PROGRESS) {
|
||||
@ -515,7 +499,6 @@ module.exports = {
|
||||
* Removes preview frame and corresponding objects from window
|
||||
*/
|
||||
function destroyPreview() {
|
||||
var promise = WinJS.Promise.as();
|
||||
|
||||
Windows.Graphics.Display.DisplayInformation.getForCurrentView().removeEventListener("orientationchanged", updatePreviewForRotation, false);
|
||||
document.removeEventListener('backbutton', cancelPreview);
|
||||
@ -526,19 +509,14 @@ module.exports = {
|
||||
if (capturePreviewFrame) {
|
||||
document.body.removeChild(capturePreviewFrame);
|
||||
}
|
||||
capturePreviewFrame = null;
|
||||
|
||||
reader && reader.stop();
|
||||
reader = null;
|
||||
|
||||
if (capture) {
|
||||
promise = capture.stopRecordAsync();
|
||||
}
|
||||
capture && capture.stopRecordAsync();
|
||||
capture = null;
|
||||
|
||||
enableZoomAndScroll();
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -551,12 +529,12 @@ module.exports = {
|
||||
}
|
||||
|
||||
function checkCancelled() {
|
||||
if (BarcodeReader.scanCancelled || BarcodeReader.suspended) {
|
||||
if (BarcodeReader.scanCancelled) {
|
||||
throw new Error('Canceled');
|
||||
}
|
||||
}
|
||||
|
||||
BarcodeReader.scanPromise = WinJS.Promise.wrap(createPreview())
|
||||
WinJS.Promise.wrap(createPreview())
|
||||
.then(function () {
|
||||
checkCancelled();
|
||||
return startPreview();
|
||||
@ -574,12 +552,7 @@ module.exports = {
|
||||
return reader.readCode();
|
||||
});
|
||||
})
|
||||
.then(function (result) {
|
||||
// Suppress null result (cancel) on suspending
|
||||
if (BarcodeReader.suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
.done(function (result) {
|
||||
destroyPreview();
|
||||
success({
|
||||
text: result && result.text,
|
||||
@ -587,12 +560,8 @@ module.exports = {
|
||||
cancelled: !result
|
||||
});
|
||||
}, function (error) {
|
||||
// Suppress null result (cancel) on suspending
|
||||
if (BarcodeReader.suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroyPreview();
|
||||
|
||||
if (error.message == 'Canceled') {
|
||||
success({
|
||||
cancelled: true
|
||||
@ -601,12 +570,6 @@ module.exports = {
|
||||
fail(error);
|
||||
}
|
||||
});
|
||||
|
||||
BarcodeReader.videoPreviewIsVisible = function () {
|
||||
return capturePreviewFrame !== null;
|
||||
}
|
||||
|
||||
BarcodeReader.destroyPreview = destroyPreview;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -620,53 +583,4 @@ module.exports = {
|
||||
}
|
||||
};
|
||||
|
||||
var app = WinJS.Application;
|
||||
|
||||
function waitForScanEnd() {
|
||||
return BarcodeReader.scanPromise || WinJS.Promise.as();
|
||||
}
|
||||
|
||||
function suspend(args) {
|
||||
BarcodeReader.suspended = true;
|
||||
if (args) {
|
||||
args.setPromise(BarcodeReader.destroyPreview()
|
||||
.then(waitForScanEnd, waitForScanEnd));
|
||||
} else {
|
||||
BarcodeReader.destroyPreview();
|
||||
}
|
||||
}
|
||||
|
||||
function resume() {
|
||||
BarcodeReader.suspended = false;
|
||||
module.exports.scan(BarcodeReader.scanCallArgs.success, BarcodeReader.scanCallArgs.fail, BarcodeReader.scanCallArgs.args);
|
||||
}
|
||||
|
||||
function onVisibilityChanged() {
|
||||
if (document.visibilityState === 'hidden'
|
||||
&& BarcodeReader.videoPreviewIsVisible && BarcodeReader.videoPreviewIsVisible() && BarcodeReader.destroyPreview) {
|
||||
suspend();
|
||||
} else if (BarcodeReader.suspended) {
|
||||
resume();
|
||||
}
|
||||
}
|
||||
|
||||
// Windows 8.1 projects
|
||||
document.addEventListener('msvisibilitychange', onVisibilityChanged);
|
||||
// Windows 10 projects
|
||||
document.addEventListener('visibilitychange', onVisibilityChanged);
|
||||
|
||||
// About to be suspended
|
||||
app.addEventListener('checkpoint', function (args) {
|
||||
if (BarcodeReader.videoPreviewIsVisible && BarcodeReader.videoPreviewIsVisible() && BarcodeReader.destroyPreview) {
|
||||
suspend(args);
|
||||
}
|
||||
});
|
||||
|
||||
// Resuming from a user suspension
|
||||
Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", function () {
|
||||
if (BarcodeReader.suspended) {
|
||||
resume();
|
||||
}
|
||||
}, false);
|
||||
|
||||
require("cordova/exec/proxy").add("BarcodeScanner", module.exports);
|
@ -7,7 +7,7 @@
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
||||
-->
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@ -23,9 +23,6 @@
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<TargetFrameworkVersion />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -123,8 +120,8 @@
|
||||
<HintPath>ZXing.winmd</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0' ">
|
||||
<VisualStudioVersion>11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
@ -134,4 +131,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user