************* Cordova ***************
332263
function(title, message, cb, okText) {
    cb = cb || function() {};
    title = title || '';
    okText = okText || gettextCatalog.getString('OK');
    $window.top.navigator.notification.alert(message, cb, title, okText);
  }
489934
function (framework) {
                var targetDir = framework.targetDir || '';
                var dest = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummyPluginInfo.id, targetDir, path.basename(framework.src));
                var copiedSuccessfully = fs.existsSync(path.resolve(dest));
                expect(copiedSuccessfully).toBe(true);
            }
1081010
function() {
    firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
    app.registerPending(component.executePromiseRequest(
        /** @type {function (): !goog.Promise} */ (
            goog.bind(app.startSignInWithRedirect, app)),
        [provider],
        function() {
          // Only run below logic if the environment is potentially a Cordova
          // environment. This check is not required but will minimize the
          // need to change existing tests that assertSignInWithRedirect.
          if (firebaseui.auth.util.getScheme() !== 'file:') {
            return;
          }
          // This will resolve in a Cordova environment. Result should be
          // obtained from getRedirectResult and then treated like a
          // signInWithPopup operation.
          return app.registerPending(app.getRedirectResult()
              .then(function(result) {
                // Pass result in promise to callback handler.
                component.dispose();
                // Removes pending redirect status if sign-in with redirect
                // resolves in Cordova environment.
                firebaseui.auth.storage.removePendingRedirectStatus(
                    app.getAppId());
                firebaseui.auth.widget.handler.handle(
                    firebaseui.auth.widget.HandlerName.CALLBACK,
                    app,
                    container,
                    goog.Promise.resolve(result));
              }, signInResultErrorCallback));
        },
        providerSigninFailedCallback));
  }
1089434
function runMain () {
    setTitle('Apache Cordova Plugin Tests');

    createActionButton('Auto Tests', setMode.bind(null, 'auto'));
    createActionButton('Manual Tests', setMode.bind(null, 'manual'));
    createActionButton('Reset App', location.reload.bind(location));
    if (/showBack/.exec(location.hash)) {
        createActionButton('Back', function () {
            history.go(-1);
        });
    }

    if (isWin && typeof WinJS !== 'undefined') {
        var app = WinJS.Application;
        app.addEventListener('error', function (err) { // eslint-disable-line handle-callback-err
            // We do not want an unhandled exception to crash the test app
            // Returning true marks it as being handled
            return true;
        });
    }
}
354861
function showPrompt () {
    return new Promise(function (resolve, reject) {
        var msg = 'May Cordova anonymously report usage statistics to improve the tool over time?';
        insight._permissionTimeout = module.exports.timeoutInSecs || 30;
        insight.askPermission(msg, function (unused, optIn) {
            var EOL = require('os').EOL;
            if (optIn) {
                console.log(EOL + 'Thanks for opting into telemetry to help us improve cordova.');
                module.exports.track('telemetry', 'on', 'via-cli-prompt-choice', 'successful');
            } else {
                console.log(EOL + 'You have been opted out of telemetry. To change this, run: cordova telemetry on.');
                // Always track telemetry opt-outs! (whether opted-in or opted-out)
                module.exports.track('telemetry', 'off', 'via-cli-prompt-choice', 'successful');
            }
            resolve(optIn);
        });
    });
}
1217791
function cordovaCreateLegacyAdapter (dir, id, name, cfg, extEvents) {
    // Unwrap and shallow-clone that nasty nested config object
    const opts = Object.assign({}, ((cfg || {}).lib || {}).www);

    if (id) opts.id = id;
    if (name) opts.name = name;
    if (extEvents) opts.extEvents = extEvents;

    return cordovaCreate(dir, opts);
}
109682
function checkCliDependency(ctx) {
  var result = spawnSync('cordova-hcp', [], { cwd: './plugins/' + ctx.opts.plugin.id });
  if (!result.error) {
    return;
  }

  suggestCliInstallation();
}
581912
public static function get_plugins_supporting_mobile() {
        global $CFG;
        require_once($CFG->libdir . '/adminlib.php');

        $cachekey = 'mobileplugins';
        if (!isloggedin()) {
            $cachekey = 'authmobileplugins';    // Use a different cache for not logged users.
        }

        // Check if we can return this from cache.
        $cache = \cache::make('tool_mobile', 'plugininfo');
        $pluginsinfo = $cache->get($cachekey);
        if ($pluginsinfo !== false) {
            return (array)$pluginsinfo;
        }

        $pluginsinfo = [];
        // For not logged users return only auth plugins.
        // This is to avoid anyone (not being a registered user) to obtain and download all the site remote add-ons.
        if (!isloggedin()) {
            $plugintypes = array('auth' => $CFG->dirroot.'/auth');
        } else {
            $plugintypes = core_component::get_plugin_types();
        }

        foreach ($plugintypes as $plugintype => $unused) {
            // We need to include files here.
            $pluginswithfile = core_component::get_plugin_list_with_file($plugintype, 'db' . DIRECTORY_SEPARATOR . 'mobile.php');
            foreach ($pluginswithfile as $plugin => $notused) {
                $path = core_component::get_plugin_directory($plugintype, $plugin);
                $component = $plugintype . '_' . $plugin;
                $version = get_component_version($component);

                require("$path/db/mobile.php");
                foreach ($addons as $addonname => $addoninfo) {

                    // Add handlers (for site add-ons).
                    $handlers = !empty($addoninfo['handlers']) ? $addoninfo['handlers'] : array();
                    $handlers = json_encode($handlers); // JSON formatted, since it is a complex structure that may vary over time.

                    // Now language strings used by the app.
                    $lang = array();
                    if (!empty($addoninfo['lang'])) {
                        $stringmanager = get_string_manager();
                        $langs = $stringmanager->get_list_of_translations();
                        foreach ($langs as $langid => $langname) {
                            foreach ($addoninfo['lang'] as $stringinfo) {
                                $lang[$langid][$stringinfo[0]] =
                                    $stringmanager->get_string($stringinfo[0], $stringinfo[1], null, $langid);
                            }
                        }
                    }
                    $lang = json_encode($lang);

                    $plugininfo = array(
                        'component' => $component,
                        'version' => $version,
                        'addon' => $addonname,
                        'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : array(),
                        'fileurl' => '',
                        'filehash' => '',
                        'filesize' => 0,
                        'handlers' => $handlers,
                        'lang' => $lang,
                    );

                    // All the mobile packages must be under the plugin mobile directory.
                    $package = $path . '/mobile/' . $addonname . '.zip';
                    if (file_exists($package)) {
                        $plugininfo['fileurl'] = $CFG->wwwroot . '' . str_replace($CFG->dirroot, '', $package);
                        $plugininfo['filehash'] = sha1_file($package);
                        $plugininfo['filesize'] = filesize($package);
                    }
                    $pluginsinfo[] = $plugininfo;
                }
            }
        }

        $cache->set($cachekey, $pluginsinfo);

        return $pluginsinfo;
    }
259023
function updateSplashScreenImageExtensions (cordovaProject, locations) {

    // Saving all extensions used for targets to verify them later
    var extensionsUsed = {};

    function checkThatExtensionsAreNotMixed () {
        for (var target in extensionsUsed) {
            if (extensionsUsed.hasOwnProperty(target)) {
                var extensionsUsedForTarget = extensionsUsed[target];

                // Check that extensions are not mixed:
                if (extensionsUsedForTarget.length > 1 && extensionsUsedForTarget.some(function (item) {
                    return item !== extensionsUsedForTarget[0];
                })) {
                    events.emit('warn', '"' + target + '" splash screens have mixed file extensions which is not supported. Some of the images will not be used.');
                }
            }
        }
    }

    function checkTargetMatchAndUpdateUsedExtensions (img, target) {
        var matchesTarget = getTargetForImage(img) === target;

        if (matchesTarget === true) {
            extensionsUsed[target] = extensionsUsed[target] || [];
            extensionsUsed[target].push(path.extname(img.src.toLowerCase()));
        }

        return matchesTarget;
    }

    function updateSplashExtensionInManifest (manifestFileName, splashScreen) {
        var manifest = AppxManifest.get(path.join(locations.root, manifestFileName));
        var newExtension = path.extname(splashScreen.src);

        if (manifest.getVisualElements().getSplashScreenExtension() !== newExtension) {
            events.emit('verbose', 'Set ' + manifestFileName + ' SplashScreen image extension to "' + newExtension + '"');
            manifest.getVisualElements().setSplashScreenExtension(newExtension);
            manifest.write();
        }
    }

    var splashScreens = cordovaProject.projectConfig.getSplashScreens('windows');

    var desktopSplashScreen = splashScreens.filter(function (img) {
        return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_DESKTOP_TARGET_NAME);
    })[0];

    var phoneSplashScreen = splashScreens.filter(function (img) {
        return checkTargetMatchAndUpdateUsedExtensions(img, SPLASH_SCREEN_PHONE_TARGET_NAME);
    })[0];

    checkThatExtensionsAreNotMixed();

    var manifestSplashScreenMap = {};
    manifestSplashScreenMap[MANIFEST_WINDOWS] = desktopSplashScreen;
    manifestSplashScreenMap[MANIFEST_WINDOWS10] = desktopSplashScreen;
    manifestSplashScreenMap[MANIFEST_PHONE] = phoneSplashScreen;

    for (var manifest in manifestSplashScreenMap) {
        if (manifestSplashScreenMap.hasOwnProperty(manifest)) {
            var splashScreen = manifestSplashScreenMap[manifest];
            if (!splashScreen) {
                return;
            }

            updateSplashExtensionInManifest(manifest, splashScreen);
        }
    }
}
621166
function () {

        if( R.isEventsInit ) return;

        var domElement = document.body;

        R.isMobile = R.testMobile();

        if( R.isMobile ){
            domElement.addEventListener( 'touchstart', R, false );
            domElement.addEventListener( 'touchend', R, false );
            domElement.addEventListener( 'touchmove', R, false );
        }else{
            domElement.addEventListener( 'mousedown', R, false );
            domElement.addEventListener( 'contextmenu', R, false );
            domElement.addEventListener( 'wheel', R, false );
            document.addEventListener( 'mousemove', R, false );
            document.addEventListener( 'mouseup', R, false );
        }

        window.addEventListener( 'keydown', R, false );
        window.addEventListener( 'resize', R.resize , false );

        R.isEventsInit = true;

    }
1203191
function InitDeviceScan()
   {
        //Save these properties to speed processing
        global $isWebkit, $isIphone, $isAndroid, $isAndroidPhone;
        $this->isWebkit = $this->DetectWebkit();
        $this->isIphone = $this->DetectIphone();
        $this->isAndroid = $this->DetectAndroid();
        $this->isAndroidPhone = $this->DetectAndroidPhone();
        
        //These tiers are the most useful for web development
        global $isMobilePhone, $isTierTablet, $isTierIphone;
        $this->isMobilePhone = $this->DetectMobileQuick();
        $this->isTierIphone = $this->DetectTierIphone();
        $this->isTierTablet = $this->DetectTierTablet();
        
        //Optional: Comment these out if you NEVER use them.
        global $isTierRichCss, $isTierGenericMobile;
        $this->isTierRichCss = $this->DetectTierRichCss();
        $this->isTierGenericMobile = $this->DetectTierOtherPhones();
        
        $this->initCompleted = $this->true;
   }
360591
function DetectGoogleTV()
   {
      if (stripos($this->useragent, $this->deviceGoogleTV) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
1332646
function () {
    return [CORDOVA_PATH]
        .concat(Array.prototype.map.call(arguments || [], function (arg) {
            return '\'' + arg.replace("'", "\\'") + '\'';
        })).join(' ');
}
971778
function () {
  var deferred = Q.defer();
  getPlatforms().then(function (platforms) {
    var activePlatforms = _(platforms).where({ isAdded : true });
    if (activePlatforms.length > 0) {
      display.success('platforms found: ' + _(activePlatforms).pluck('name').join(', '));
      deferred.resolve();
    } else {
      display.error(
        'No cordova platforms found. ' +
        'Make sure you are in the root folder of your Cordova project ' +
        'and add platforms with \'cordova platform add\''
      );
      deferred.reject();
    }
  });
  return deferred.promise;
}
787239
function(pointerType, ev) {
      if(!ev.pointerType) {
        return false;
      }

      var types = {};
      types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);
      types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);
      types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);
      return types[pointerType];
    }
559307
function downloadPlatform(projectRoot, platform, version, opts) {
    var target = version ? (platform + '@' + version) : platform;
    return Q().then(function() {
        if (opts.fetch) {
            //append cordova to platform
            if(platform in platforms) {
                target = 'judpack-'+target;
            }

            //gitURLs don't supply a platform, it equals null
            if(!platform) {
                target = version;
            }

            events.emit('log', 'Using cordova-fetch for '+ target);
            return fetch(target, projectRoot, opts);
        }

        if (cordova_util.isUrl(version)) {
            events.emit('log', 'git cloning: ' + version);
            var parts = version.split('#');
            var git_url = parts[0];
            var branchToCheckout = parts[1];
            return lazy_load.git_clone(git_url, branchToCheckout).fail(function(err) {
                // If it looks like a url, but cannot be cloned, try handling it differently.
                // it's because it's a tarball of the form:
                //     - wp8@https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git;a=snapshot;h=3.7.0;sf=tgz
                //     - https://api.github.com/repos/msopenTech/cordova-browser/tarball/my-branch
                events.emit('verbose', err.message);
                events.emit('verbose', 'Cloning failed. Let\'s try handling it as a tarball');
                return lazy_load.based_on_config(projectRoot, target, opts);
            });
        }
        return lazy_load.based_on_config(projectRoot, target, opts);
    }).fail(function (error) {
        var message = 'Failed to fetch platform ' + target +
            '\nProbably this is either a connection problem, or platform spec is incorrect.' +
            '\nCheck your connection and platform name/version/URL.' +
            '\n' + error;
        return Q.reject(new CordovaError(message));
    }).then(function(libDir) {
        return getPlatformDetailsFromDir(libDir, platform);
    });
}
299780
function processConsoleOptions(ctx) {
  var consoleOptions = ctx.opts.options;

  // If we are using Cordova 5.3.3 or lower - arguments are array of strings.
  // Will be removed after some time.
  if (consoleOptions instanceof Array) {
    return processConsoleOptions_cordova_53(consoleOptions);
  }

  // for newer version of Cordova - they are an object of properties
  return processConsoleOptions_cordova_54(consoleOptions);
}