Lint everything (#368)
* Lint everything, including bins w/out extension
* Apply eslint --fix to all linted files
* Manually fix all remaining lint rule violations
diff --git a/bin/check_all b/bin/check_all
index 84c9c97..853051e 100644
--- a/bin/check_all
+++ b/bin/check_all
@@ -25,10 +25,10 @@
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
check_reqs.help();
} else {
- check_reqs.check_all().done(function success(result) {
- console.log('check_all', result);
- }, function (err) {
- console.error('Error: ' + err);
- process.exit(2);
- });
+ check_reqs.check_all().done(function success (result) {
+ console.log('check_all', result);
+ }, function (err) {
+ console.error('Error: ' + err);
+ process.exit(2);
+ });
}
diff --git a/bin/check_reqs b/bin/check_reqs
index 568ec8b..ddc2eaf 100755
--- a/bin/check_reqs
+++ b/bin/check_reqs
@@ -25,10 +25,10 @@
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
check_reqs.help();
} else {
- check_reqs.run().done(function success(msbuild) {
- console.log('Environment is supported; found MSBuild Tools version ' + msbuild.version + ' at ' + msbuild.path);
- }, function (err) {
- console.error('Environment is not supported: ' + err);
- process.exit(2);
- });
+ check_reqs.run().done(function success (msbuild) {
+ console.log('Environment is supported; found MSBuild Tools version ' + msbuild.version + ' at ' + msbuild.path);
+ }, function (err) {
+ console.error('Environment is not supported: ' + err);
+ process.exit(2);
+ });
}
diff --git a/bin/create b/bin/create
index fa5620b..9af5b0a 100755
--- a/bin/create
+++ b/bin/create
@@ -24,11 +24,11 @@
var Api = require('../template/cordova/Api');
var argv = require('nopt')({
- 'help' : Boolean,
+ 'help': Boolean,
'guid': String,
'silent': Boolean,
'verbose': Boolean
-}, { 'd' : '--verbose' });
+}, { 'd': '--verbose' });
if (argv.help || argv.argv.remain.length === 0) {
console.log('Usage: create PathToProject [ PackageName [ AppName [ CustomTemplate ] ] ] [--guid=<GUID string>]');
diff --git a/bin/update b/bin/update
index 98f7aa1..13e1c6e 100755
--- a/bin/update
+++ b/bin/update
@@ -21,10 +21,10 @@
var Api = require('../template/cordova/Api');
var args = require('nopt')({
- 'help' : Boolean,
+ 'help': Boolean,
'silent': Boolean,
'verbose': Boolean
-}, { 'd' : '--verbose' });
+}, { 'd': '--verbose' });
if (args.help || args.argv.remain.length === 0) {
console.log('WARNING : Make sure to back up your project before updating!');
diff --git a/cordova-js-src/.eslintrc.yml b/cordova-js-src/.eslintrc.yml
new file mode 100644
index 0000000..472e887
--- /dev/null
+++ b/cordova-js-src/.eslintrc.yml
@@ -0,0 +1,9 @@
+env:
+ node: false
+ commonjs: true
+ browser: true
+
+globals:
+ cordova: readonly
+ WinJS: readonly
+ Windows: readonly
diff --git a/cordova-js-src/confighelper.js b/cordova-js-src/confighelper.js
index c166052..0bc8c4a 100644
--- a/cordova-js-src/confighelper.js
+++ b/cordova-js-src/confighelper.js
@@ -21,13 +21,13 @@
// config.xml and AppxManifest.xml wrapper (non-node ConfigParser analogue)
var configCache = {};
-var utils = require("cordova/utils");
+var utils = require('cordova/utils');
-var isPhone = (cordova.platformId == 'windows') && WinJS.Utilities.isPhone;
+var isPhone = (cordova.platformId === 'windows') && WinJS.Utilities.isPhone;
var isWin10UWP = navigator.appVersion.indexOf('MSAppHost/3.0') !== -1;
-var splashScreenTagName = isWin10UWP ? "SplashScreen" : (isPhone ? "m3:SplashScreen" : "m2:SplashScreen");
+var splashScreenTagName = isWin10UWP ? 'SplashScreen' : (isPhone ? 'm3:SplashScreen' : 'm2:SplashScreen');
-function XmlFile(text) {
+function XmlFile (text) {
this.text = text;
}
@@ -35,19 +35,19 @@
var parser;
if (!this.doc) {
parser = new DOMParser();
- this.doc = parser.parseFromString(this.text, "application/xml");
+ this.doc = parser.parseFromString(this.text, 'application/xml');
}
var tags = this.doc.getElementsByTagName(tagName);
return Array.prototype.slice.call(tags);
-}
+};
-function Config(text) {
+function Config (text) {
XmlFile.apply(this, arguments);
- this.preferences = this.loadTags("preference");
+ this.preferences = this.loadTags('preference');
}
-function Manifest(text) {
+function Manifest (text) {
XmlFile.apply(this, arguments);
this.splashScreen = this.loadTags(splashScreenTagName)[0];
}
@@ -55,14 +55,14 @@
utils.extend(Config, XmlFile);
utils.extend(Manifest, XmlFile);
-function requestFile(filePath, success, error) {
+function requestFile (filePath, success, error) {
var xhr;
- if (typeof configCache[filePath] != 'undefined') {
+ if (typeof configCache[filePath] !== 'undefined') {
success(configCache[filePath]);
}
- function fail(msg) {
+ function fail (msg) {
console.error(msg);
if (error) {
@@ -71,36 +71,35 @@
}
var xhrStatusChangeHandler = function () {
- if (xhr.readyState == 4) {
- if (xhr.status == 200 || xhr.status == 304 || xhr.status == 0 /* file:// */) {
+ if (xhr.readyState === 4) {
+ if (xhr.status === 200 || xhr.status === 304 || xhr.status === 0 /* file:// */) {
configCache[filePath] = xhr.responseText;
success(xhr.responseText);
- }
- else {
+ } else {
fail('[Windows][cordova.js][xhrStatusChangeHandler] Could not XHR ' + filePath + ': ' + xhr.statusText);
}
}
};
xhr = new XMLHttpRequest();
- xhr.addEventListener("load", xhrStatusChangeHandler);
+ xhr.addEventListener('load', xhrStatusChangeHandler);
try {
- xhr.open("get", filePath, true);
+ xhr.open('get', filePath, true);
xhr.send();
} catch (e) {
fail('[Windows][cordova.js][xhrFile] Could not XHR ' + filePath + ': ' + JSON.stringify(e));
}
}
-function readConfig(success, error) {
- requestFile("/config.xml", function (contents) {
+function readConfig (success, error) {
+ requestFile('/config.xml', function (contents) {
success(new Config(contents));
}, error);
}
-function readManifest(success, error) {
- requestFile("/AppxManifest.xml", function (contents) {
+function readManifest (success, error) {
+ requestFile('/AppxManifest.xml', function (contents) {
success(new Manifest(contents));
}, error);
}
@@ -117,14 +116,14 @@
if (preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes['value']) {
return preferenceItem[0].attributes['value'].value;
}
-}
+};
/**
* Reads SplashScreen image path
*/
Manifest.prototype.getSplashScreenImagePath = function () {
return this.splashScreen.attributes['Image'].value;
-}
+};
exports.readConfig = readConfig;
exports.readManifest = readManifest;
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index 8e45cc2..eb41bf9 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -19,8 +19,8 @@
*
*/
-/*jslint sloppy:true, plusplus:true*/
-/*global require, module, console */
+/* jslint sloppy:true, plusplus:true */
+/* global require, module, console */
var cordova = require('cordova');
var execProxy = require('cordova/exec/proxy');
@@ -43,7 +43,7 @@
// Handle the case when we have an old version of splashscreen plugin to avoid the API calls failures
if (service === 'SplashScreen') {
- var pluginsVersions = require("cordova/plugin_list").metadata;
+ var pluginsVersions = require('cordova/plugin_list').metadata;
var splashscreenVersion = pluginsVersions['cordova-plugin-splashscreen'];
var MIN_SPLASHSCREEN_SUPPORTED_VER = 4;
if (splashscreenVersion && ((parseInt(splashscreenVersion.split('.')[0], 10) || 0) < MIN_SPLASHSCREEN_SUPPORTED_VER)) {
@@ -55,18 +55,18 @@
}
}
- var proxy = execProxy.get(service, action),
- callbackId,
- onSuccess,
- onError;
+ var proxy = execProxy.get(service, action);
+ var callbackId;
+ var onSuccess;
+ var onError;
args = args || [];
if (proxy) {
callbackId = service + cordova.callbackId++;
// console.log("EXEC:" + service + " : " + action);
- if (typeof success === "function" || typeof fail === "function") {
- cordova.callbacks[callbackId] = {success: success, fail: fail};
+ if (typeof success === 'function' || typeof fail === 'function') {
+ cordova.callbacks[callbackId] = { success: success, fail: fail };
}
try {
// callbackOptions param represents additional optional parameters command could pass back, like keepCallback or
@@ -81,8 +81,7 @@
// see CB-8996 Mobilespec app hang on windows
if (callbackOptions.status !== undefined && callbackOptions.status !== null) {
callbackStatus = callbackOptions.status;
- }
- else {
+ } else {
callbackStatus = cordova.callbackStatus.OK;
}
cordova.callbackSuccess(callbackOptions.callbackId || callbackId,
@@ -101,8 +100,7 @@
// see CB-8996 Mobilespec app hang on windows
if (callbackOptions.status !== undefined && callbackOptions.status !== null) {
callbackStatus = callbackOptions.status;
- }
- else {
+ } else {
callbackStatus = cordova.callbackStatus.OK;
}
cordova.callbackError(callbackOptions.callbackId || callbackId,
@@ -115,11 +113,11 @@
proxy(onSuccess, onError, args);
} catch (e) {
- console.log("Exception calling native with command :: " + service + " :: " + action + " ::exception=" + e);
+ console.log('Exception calling native with command :: ' + service + ' :: ' + action + ' ::exception=' + e);
}
} else {
- if (typeof fail === "function") {
- fail("Missing Command Error");
+ if (typeof fail === 'function') {
+ fail('Missing Command Error');
}
}
};
diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js
index 4bc4025..a3f2aca 100644
--- a/cordova-js-src/platform.js
+++ b/cordova-js-src/platform.js
@@ -21,36 +21,35 @@
module.exports = {
id: 'windows',
- bootstrap:function() {
- var cordova = require('cordova'),
- exec = require('cordova/exec'),
- channel = cordova.require('cordova/channel'),
- platform = require('cordova/platform'),
- modulemapper = require('cordova/modulemapper'),
- utils = require('cordova/utils');
+ bootstrap: function () {
+ var cordova = require('cordova');
+ var channel = cordova.require('cordova/channel');
+ var platform = require('cordova/platform');
+ var modulemapper = require('cordova/modulemapper');
+ var utils = require('cordova/utils');
modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
// we will make sure we get this channel
// TODO: remove this once other platforms catch up.
- if(!channel.onActivated) {
+ if (!channel.onActivated) {
channel.onActivated = cordova.addDocumentEventHandler('activated');
}
channel.onNativeReady.fire();
var onWinJSReady = function () {
- var app = WinJS.Application,
- splashscreen = require('cordova/splashscreen'),
- configHelper = require('cordova/confighelper');
+ var app = WinJS.Application;
+ var splashscreen = require('cordova/splashscreen');
+ var configHelper = require('cordova/confighelper');
modulemapper.clobbers('cordova/splashscreen', 'navigator.splashscreen');
- var checkpointHandler = function checkpointHandler() {
- cordova.fireDocumentEvent('pause',null,true);
+ var checkpointHandler = function checkpointHandler () {
+ cordova.fireDocumentEvent('pause', null, true);
};
- var resumingHandler = function resumingHandler() {
- cordova.fireDocumentEvent('resume',null,true);
+ var resumingHandler = function resumingHandler () {
+ cordova.fireDocumentEvent('resume', null, true);
};
// activation args are available via the activated event
@@ -58,15 +57,15 @@
// activationContext:{type: actType, args: args};
var activationHandler = function (e) {
// Making all the details available as activationContext
- platform.activationContext = utils.clone(e.detail); /* CB-10653 to avoid losing detail properties for some activation kinds */
- platform.activationContext.raw = e.detail; /* CB-11522 to preserve types */
- platform.activationContext.args = e.detail.arguments; /* for backwards compatibility */
+ platform.activationContext = utils.clone(e.detail); /* CB-10653 to avoid losing detail properties for some activation kinds */
+ platform.activationContext.raw = e.detail; /* CB-11522 to preserve types */
+ platform.activationContext.args = e.detail.arguments; /* for backwards compatibility */
- function makePromise(fn) {
- return new WinJS.Promise(function init(completeDispatch, errorDispatch) {
- fn(function successCb(results) {
+ function makePromise (fn) {
+ return new WinJS.Promise(function init (completeDispatch, errorDispatch) {
+ fn(function successCb (results) {
completeDispatch(results);
- }, function errorCb(error) {
+ }, function errorCb (error) {
errorDispatch(error);
});
});
@@ -84,14 +83,14 @@
manifest = manifestTmp;
return makePromise(configHelper.readConfig);
})
- .then(function (config) {
- splashscreen.firstShow(config, manifest, e);
- }).then(function () {
+ .then(function (config) {
+ splashscreen.firstShow(config, manifest, e);
+ }).then(function () {
// Avoids splashimage flicker on Windows Phone 8.1/10
- return WinJS.Promise.timeout();
- }).then(function () {
- cordova.fireDocumentEvent('activated', platform.activationContext, true);
- }));
+ return WinJS.Promise.timeout();
+ }).then(function () {
+ cordova.fireDocumentEvent('activated', platform.activationContext, true);
+ }));
};
// CB-12193 CoreWindow and some WinRT APIs are not available in webview
@@ -102,9 +101,9 @@
} catch (e) { }
if (isCoreWindowAvailable) {
- app.addEventListener("checkpoint", checkpointHandler);
- app.addEventListener("activated", activationHandler, false);
- Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);
+ app.addEventListener('checkpoint', checkpointHandler);
+ app.addEventListener('activated', activationHandler, false);
+ Windows.UI.WebUI.WebUIApplication.addEventListener('resuming', resumingHandler, false);
injectBackButtonHandler();
@@ -112,34 +111,28 @@
}
};
- function appendScript(scriptElem, loadedCb) {
- scriptElem.addEventListener("load", loadedCb);
- document.head.appendChild(scriptElem);
- }
-
if (!window.WinJS) {
- var scriptElem = document.createElement("script");
+ var scriptElem = document.createElement('script');
if (navigator.appVersion.indexOf('MSAppHost/3.0') !== -1) {
// Windows 10 UWP
scriptElem.src = '/www/WinJS/js/base.js';
- } else if (navigator.appVersion.indexOf("Windows Phone 8.1;") !== -1) {
+ } else if (navigator.appVersion.indexOf('Windows Phone 8.1;') !== -1) {
// windows phone 8.1 + Mobile IE 11
- scriptElem.src = "//Microsoft.Phone.WinJS.2.1/js/base.js";
- } else if (navigator.appVersion.indexOf("MSAppHost/2.0;") !== -1) {
+ scriptElem.src = '//Microsoft.Phone.WinJS.2.1/js/base.js';
+ } else if (navigator.appVersion.indexOf('MSAppHost/2.0;') !== -1) {
// windows 8.1 + IE 11
- scriptElem.src = "//Microsoft.WinJS.2.0/js/base.js";
+ scriptElem.src = '//Microsoft.WinJS.2.0/js/base.js';
}
- scriptElem.addEventListener("load", onWinJSReady);
+ scriptElem.addEventListener('load', onWinJSReady);
document.head.appendChild(scriptElem);
- }
- else {
+ } else {
onWinJSReady();
}
}
};
-function injectBackButtonHandler() {
+function injectBackButtonHandler () {
var app = WinJS.Application;
@@ -150,7 +143,7 @@
// `false` as a result will trigger system default behaviour
var defaultBackButtonHandler = app.onbackclick || function () { return false; };
- var backRequestedHandler = function backRequestedHandler(evt) {
+ var backRequestedHandler = function backRequestedHandler (evt) {
// check if listeners are registered, if yes use custom backbutton event
// NOTE: On Windows Phone 8.1 backbutton handlers have to throw an exception in order to exit the app
if (backButtonChannel.numHandlers >= 1) {
@@ -158,13 +151,11 @@
cordova.fireDocumentEvent('backbutton', evt, true);
evt.handled = true; // Windows Mobile requires handled to be set as well;
return true;
- }
- catch (e) {
+ } catch (e) {
return false;
}
- }
- // if not listeners are active, use default implementation (backwards compatibility)
- else {
+ } else {
+ // if no listeners are active, use default implementation (backwards compatibility)
return defaultBackButtonHandler.apply(app, arguments);
}
};
@@ -181,7 +172,7 @@
Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
};
- navigationManager.addEventListener("backrequested", backRequestedHandler, false);
+ navigationManager.addEventListener('backrequested', backRequestedHandler, false);
} else { // Windows 8.1 Phone
// inject new back button handler
app.onbackclick = backRequestedHandler;
diff --git a/cordova-js-src/splashscreen.js b/cordova-js-src/splashscreen.js
index 97fd86c..aab477f 100644
--- a/cordova-js-src/splashscreen.js
+++ b/cordova-js-src/splashscreen.js
@@ -1,4 +1,4 @@
-/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,43 +19,43 @@
*
*/
-var isWp81 = navigator.appVersion.indexOf("Windows Phone 8.1") !== -1;
-var isWp10 = navigator.appVersion.indexOf("Windows Phone 10") !== -1;
+var isWp81 = navigator.appVersion.indexOf('Windows Phone 8.1') !== -1;
+var isWp10 = navigator.appVersion.indexOf('Windows Phone 10') !== -1;
var isPhoneDevice = isWp81 || isWp10;
var isWin10UWP = navigator.appVersion.indexOf('MSAppHost/3.0') !== -1;
var isHosted = window.location.protocol.indexOf('http') === 0;
var isMsAppxWeb = window.location.protocol.indexOf('ms-appx-web') === 0;
-var schema = (isHosted || isWin10UWP && isMsAppxWeb) ? 'ms-appx-web' : 'ms-appx';
+var schema = isHosted || (isWin10UWP && isMsAppxWeb) ? 'ms-appx-web' : 'ms-appx';
var fileName = isWp81 ? 'splashscreenphone.png' : 'splashscreen.png';
var splashImageSrc = schema + ':///images/' + fileName;
-var splashElement = null,
- extendedSplashImage = null,
- extendedSplashProgress = null,
- extendedSplashImageHelper = null;
+var splashElement = null;
+var extendedSplashImage = null;
+var extendedSplashProgress = null;
+var extendedSplashImageHelper = null;
-//// <Config and initialization>
-var DEFAULT_SPLASHSCREEN_DURATION = 3000, // in milliseconds
- DEFAULT_FADE_DURATION = 500, // in milliseconds
- FPS = 60, // frames per second used by requestAnimationFrame
- PROGRESSRING_HEIGHT = 40,
- PROGRESSRING_BOTTOM_MARGIN = 10; // needed for windows 10 min height window
+/// / <Config and initialization>
+var DEFAULT_SPLASHSCREEN_DURATION = 3000; // in milliseconds
+var DEFAULT_FADE_DURATION = 500; // in milliseconds
+var FPS = 60; // frames per second used by requestAnimationFrame
+var PROGRESSRING_HEIGHT = 40;
+var PROGRESSRING_BOTTOM_MARGIN = 10; // needed for windows 10 min height window
-var bgColor = "#464646",
- isBgColorTransparent = false,
- titleInitialBgColor,
- titleBgColor,
- autoHideSplashScreen = true,
- splashScreenDelay = DEFAULT_SPLASHSCREEN_DURATION,
- fadeSplashScreen = true,
- fadeSplashScreenDuration = DEFAULT_FADE_DURATION,
- showSplashScreenSpinner = true,
- splashScreenSpinnerColor; // defaults to system accent color
+var bgColor = '#464646';
+var isBgColorTransparent = false;
+var titleInitialBgColor;
+var titleBgColor;
+var autoHideSplashScreen = true;
+var splashScreenDelay = DEFAULT_SPLASHSCREEN_DURATION;
+var fadeSplashScreen = true;
+var fadeSplashScreenDuration = DEFAULT_FADE_DURATION;
+var showSplashScreenSpinner = true;
+var splashScreenSpinnerColor; // defaults to system accent color
var effectiveSplashDuration;
-function readBoolFromCfg(preferenceName, defaultValue, cfg) {
+function readBoolFromCfg (preferenceName, defaultValue, cfg) {
var value = cfg.getPreferenceValue(preferenceName);
if (typeof value !== 'undefined') {
return value === 'true';
@@ -64,7 +64,7 @@
}
}
-function readPreferencesFromCfg(cfg, manifest) {
+function readPreferencesFromCfg (cfg, manifest) {
try {
// Update splashscreen image path to match application manifest
splashImageSrc = schema + ':///' + manifest.getSplashScreenImagePath().replace(/\\/g, '/');
@@ -103,24 +103,24 @@
}
}
-function isPortrait() {
+function isPortrait () {
return window.innerHeight > window.innerWidth;
}
-function init(config, manifest) {
+function init (config, manifest) {
readPreferencesFromCfg(config, manifest);
- var splashscreenStyles = document.createElement("link");
+ var splashscreenStyles = document.createElement('link');
splashscreenStyles.rel = 'stylesheet';
splashscreenStyles.type = 'text/css';
splashscreenStyles.href = '/www/css/splashscreen.css';
document.head.appendChild(splashscreenStyles);
// Windows 8.1 Desktop
- //<div id='extendedSplashScreen' class='extendedSplashScreen hidden'>
+ // <div id='extendedSplashScreen' class='extendedSplashScreen hidden'>
// <img id='extendedSplashImage' src='/images/SplashScreen.png' alt='Splash screen image' />
// <progress id='extendedSplashProgress' class='win-medium win-ring'></progress>
- //</div>
+ // </div>
splashElement = document.createElement('div');
splashElement.id = 'extendedSplashScreen';
splashElement.classList.add('extendedSplashScreen');
@@ -139,7 +139,7 @@
draggableAttr.value = 'false';
extendedSplashImage.attributes.setNamedItem(draggableAttr);
- // This helps prevent flickering by making the system wait until your image has been rendered
+ // This helps prevent flickering by making the system wait until your image has been rendered
// before it switches to your extended splash screen.
var onloadAttr = document.createAttribute('onload');
onloadAttr.value = '';
@@ -159,7 +159,7 @@
if (isWp81) {
extendedSplashProgress.classList.add('extended-splash-progress-phone');
- } else if (isWp10) {
+ } else if (isWp10) {
extendedSplashProgress.classList.add('extended-splash-progress-wp10');
} else {
extendedSplashProgress.classList.add('extended-splash-progress-desktop');
@@ -178,12 +178,12 @@
document.body.appendChild(splashElement);
}
-//// </Config and initialization>
+/// / </Config and initialization>
-//// <UI>
+/// / <UI>
var origOverflow, origZooming;
-function disableUserInteraction() {
+function disableUserInteraction () {
origOverflow = document.documentElement.style.overflow;
document.documentElement.style.overflow = 'hidden';
@@ -191,13 +191,13 @@
document.body.style['-ms-content-zooming'] = 'none';
}
-function enableUserInteraction() {
+function enableUserInteraction () {
document.documentElement.style.overflow = origOverflow;
document.body.style['-ms-content-zooming'] = origZooming;
}
// Enter fullscreen mode
-function enterFullScreen() {
+function enterFullScreen () {
if (Windows.UI.ViewManagement.ApplicationViewBoundsMode) { // else crash on 8.1
var view = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
view.setDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.useCoreWindow);
@@ -206,7 +206,7 @@
}
// Exit fullscreen mode
-function exitFullScreen() {
+function exitFullScreen () {
if (Windows.UI.ViewManagement.ApplicationViewBoundsMode) { // else crash on 8.1
var view = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
view.setDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.useVisible);
@@ -215,7 +215,7 @@
}
// Make title bg color match splashscreen bg color
-function colorizeTitleBar() {
+function colorizeTitleBar () {
var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
if (isWin10UWP && !isBgColorTransparent) {
titleInitialBgColor = appView.titleBar.backgroundColor;
@@ -226,7 +226,7 @@
}
// Revert title bg color
-function revertTitleBarColor() {
+function revertTitleBarColor () {
var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
if (isWin10UWP && !isBgColorTransparent) {
appView.titleBar.backgroundColor = titleInitialBgColor;
@@ -235,7 +235,7 @@
}
// Displays the extended splash screen. Pass the splash screen object retrieved during activation.
-function show() {
+function show () {
enterFullScreen();
colorizeTitleBar();
disableUserInteraction();
@@ -245,12 +245,12 @@
WinJS.Utilities.removeClass(splashElement, 'hidden');
}
-function positionControls() {
+function positionControls () {
if (isWp10) {
// Resize happens twice sometimes, ensure the image is properly positioned
if (splash.imageLocation.y !== 0) {
if (isPortrait()) {
- extendedSplashProgress.style.top = window.innerHeight * (2/3 + 1/6) - PROGRESSRING_HEIGHT / 2 + 'px';
+ extendedSplashProgress.style.top = window.innerHeight * (2 / 3 + 1 / 6) - PROGRESSRING_HEIGHT / 2 + 'px';
} else {
extendedSplashProgress.style.top = Math.min(window.innerHeight - PROGRESSRING_HEIGHT - PROGRESSRING_BOTTOM_MARGIN, splash.imageLocation.y + splash.imageLocation.height + 32) + 'px';
}
@@ -277,22 +277,22 @@
}
// Updates the location of the extended splash screen image. Should be used to respond to window size changes.
-function updateImageLocation() {
+function updateImageLocation () {
if (isVisible()) {
positionControls();
}
}
// Checks whether the extended splash screen is visible and returns a boolean.
-function isVisible() {
+function isVisible () {
return !(WinJS.Utilities.hasClass(splashElement, 'hidden'));
}
-function fadeOut(el, duration, finishCb) {
+function fadeOut (el, duration, finishCb) {
var opacityDelta = 1 / (FPS * duration / 1000);
el.style.opacity = 1;
- (function fade() {
+ (function fade () {
if ((el.style.opacity -= opacityDelta) < 0) {
finishCb();
} else {
@@ -302,14 +302,14 @@
}
// Removes the extended splash screen if it is currently visible.
-function hide() {
+function hide () {
if (isVisible()) {
var hideFinishCb = function () {
WinJS.Utilities.addClass(splashElement, 'hidden');
splashElement.style.opacity = 1;
enableUserInteraction();
exitFullScreen();
- }
+ };
// Color reversion before fading is over looks better:
revertTitleBarColor();
@@ -329,43 +329,38 @@
}
}
}
-//// </UI>
+/// / </UI>
-//// <Events>
-var splash = null; // Variable to hold the splash screen object.
-var coordinates = { x: 0, y: 0, width: 0, height: 0 }; // Object to store splash screen image coordinates. It will be initialized during activation.
+/// / <Events>
+var splash = null; // Variable to hold the splash screen object.
-function activated(eventObject) {
- // Retrieve splash screen object
+function activated (eventObject) {
+ // Retrieve splash screen object
splash = eventObject.detail.splashScreen;
- // Retrieve the window coordinates of the splash screen image.
- coordinates = splash.imageLocation;
-
- // Register an event handler to be executed when the splash screen has been dismissed.
+ // Register an event handler to be executed when the splash screen has been dismissed.
splash.addEventListener('dismissed', onSplashScreenDismissed, false);
- // Listen for window resize events to reposition the extended splash screen image accordingly.
- // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
+ // Listen for window resize events to reposition the extended splash screen image accordingly.
+ // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
window.addEventListener('resize', onResize, false);
}
-function onSplashScreenDismissed() {
- // Include code to be executed when the system has transitioned from the splash screen to the extended splash screen (application's first view).
+function onSplashScreenDismissed () {
+ // Include code to be executed when the system has transitioned from the splash screen to the extended splash screen (application's first view).
if (autoHideSplashScreen) {
window.setTimeout(hide, effectiveSplashDuration);
}
}
-function onResize() {
- // Safely update the extended splash screen image coordinates. This function will be fired in response to snapping, unsnapping, rotation, etc...
+function onResize () {
+ // Safely update the extended splash screen image coordinates. This function will be fired in response to snapping, unsnapping, rotation, etc...
if (splash) {
- // Update the coordinates of the splash screen image.
- coordinates = splash.imageLocation;
+ // Update the coordinates of the splash screen image.
updateImageLocation(splash);
}
}
-//// </Events>
+/// / </Events>
module.exports = {
firstShow: function (config, manifest, activatedEventArgs) {
diff --git a/package.json b/package.json
index d4f5a58..5fc4dd9 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"test-unit": "jasmine",
"test-e2e": "jasmine spec/e2e/endtoend.spec.js",
"cover": "nyc jasmine",
- "eslint": "eslint bin && eslint template && eslint spec"
+ "eslint": "eslint . \"+(bin|template)/**/!(*.*)\""
},
"dependencies": {
"cordova-common": "^3.2.0",
diff --git a/template/cordova/build b/template/cordova/build
index 2f8a771..5ed8a3c 100644
--- a/template/cordova/build
+++ b/template/cordova/build
@@ -24,7 +24,7 @@
var path = require('path');
// Support basic help commands
-if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
console.log('');
console.log('Usage: build [--debug | --release] [--phone | --win] [--bundle]');
console.log(' [--archs="<list of architectures...>"');
@@ -68,14 +68,14 @@
// Do some basic argument parsing
var buildOpts = nopt({
- 'silent' : Boolean,
- 'verbose' : Boolean,
- 'debug' : Boolean,
- 'release' : Boolean,
+ 'silent': Boolean,
+ 'verbose': Boolean,
+ 'debug': Boolean,
+ 'release': Boolean,
'nobuild': Boolean,
- 'buildConfig' : path,
+ 'buildConfig': path,
'buildFlag': [String, Array]
-}, { d : '--verbose', r: '--release' });
+}, { d: '--verbose', r: '--release' });
// Make buildOptions compatible with PlatformApi build method spec
buildOpts.argv = buildOpts.argv.original;
diff --git a/template/cordova/clean b/template/cordova/clean
index aae9dfb..fd283db 100644
--- a/template/cordova/clean
+++ b/template/cordova/clean
@@ -23,7 +23,7 @@
var nopt = require('nopt');
// Support basic help commands
-if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
console.log('Usage: \n clean\n');
console.log('Cleans the project directory.');
process.exit(0);
@@ -31,9 +31,9 @@
// Do some basic argument parsing
var opts = nopt({
- 'verbose' : Boolean,
- 'silent' : Boolean
-}, { 'd' : '--verbose' });
+ 'verbose': Boolean,
+ 'silent': Boolean
+}, { 'd': '--verbose' });
// Make buildOptions compatible with PlatformApi clean method spec
opts.argv = opts.argv.original;
@@ -44,7 +44,7 @@
require('./lib/loggingHelper').adjustLoggerLevel(opts);
new Api().clean(opts)
-.catch(function(err) {
- console.error(err.stack);
- process.exit(2);
-});
+ .catch(function (err) {
+ console.error(err.stack);
+ process.exit(2);
+ });
diff --git a/template/cordova/log b/template/cordova/log
index 8ccfd5b..9eefa2d 100644
--- a/template/cordova/log
+++ b/template/cordova/log
@@ -19,19 +19,18 @@
under the License.
*/
-var log = require('./lib/log'),
- Q = require('q'),
- args = process.argv;
+var log = require('./lib/log');
+var Q = require('q');
+var args = process.argv;
// Usage support for when args are given
-Q().then(function() {
+Q().then(function () {
var argsToPass = [];
if (args.length > 2) {
argsToPass = args.slice(2);
}
log.run(argsToPass);
-}, function(err) {
+}, function (err) {
console.error(err);
process.exit(2);
});
-
diff --git a/template/cordova/prepare b/template/cordova/prepare
index 2bbd0b5..d042f00 100644
--- a/template/cordova/prepare
+++ b/template/cordova/prepare
@@ -25,16 +25,16 @@
var ConfigParser = require('cordova-common').ConfigParser;
// Support basic help commands
-if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
console.log('Usage: \n prepare\n');
process.exit(0);
}
// Do some basic argument parsing
var opts = nopt({
- 'verbose' : Boolean,
- 'silent' : Boolean
-}, { 'd' : '--verbose' });
+ 'verbose': Boolean,
+ 'silent': Boolean
+}, { 'd': '--verbose' });
// Make buildOptions compatible with PlatformApi clean method spec
opts.argv = opts.argv.original;
@@ -55,7 +55,7 @@
};
new Api().prepare(project, opts)
-.catch(function(err) {
- console.error(err.stack);
- process.exit(2);
-});
+ .catch(function (err) {
+ console.error(err.stack);
+ process.exit(2);
+ });
diff --git a/template/cordova/run b/template/cordova/run
index 0c544e8..704b37f 100644
--- a/template/cordova/run
+++ b/template/cordova/run
@@ -63,16 +63,16 @@
// Do some basic argument parsing
var runOpts = nopt({
- 'silent' : Boolean,
- 'verbose' : Boolean,
- 'debug' : Boolean,
- 'release' : Boolean,
+ 'silent': Boolean,
+ 'verbose': Boolean,
+ 'debug': Boolean,
+ 'release': Boolean,
'nobuild': Boolean,
'device': Boolean,
'emulator': Boolean,
'target': String,
- 'buildConfig' : path
-}, { d : '--verbose', r: '--release' });
+ 'buildConfig': path
+}, { d: '--verbose', r: '--release' });
// Make buildOptions compatible with PlatformApi build method spec
runOpts.argv = runOpts.argv.original;
diff --git a/template/cordova/version b/template/cordova/version
index cb08f94..dfda0a7 100644
--- a/template/cordova/version
+++ b/template/cordova/version
@@ -20,7 +20,7 @@
*/
// Coho updates this line:
-var VERSION = "7.1.0-dev";
+var VERSION = '7.1.0-dev';
module.exports.version = VERSION;