Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version='1.0' encoding='utf-8'?>
- <widget id="foo" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>foo</name>
- <description>
- foo
- </description>
- <author email="dev@cordova.apache.org" href="http://cordova.io">
- </author>
- <content src="index.html" />
- <plugin name="cordova-plugin-whitelist"/>
- <access origin="*" />
- <allow-intent href="*" />
- <allow-navigation href="*" />
- <access origin="*" />
- <platform name="android">
- <allow-intent href="market:*" />
- <access origin="*" />
- <allow-intent href="*" />
- <allow-navigation href="*" />
- </platform>
- <platform name="ios">
- <allow-intent href="itms:*" />
- <allow-intent href="itms-apps:*" />
- </platform>
- <engine name="android"/>
- <plugin name="cordova-plugin-inappbrowser"/>
- <!DOCTYPE html>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- 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.
- -->
- <html>
- <head>
- <!--
- Customize this policy to fit your own app's needs. For more guidance, see:
- https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
- Some notes:
- * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
- * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
- * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
- * Enable inline JS: add 'unsafe-inline' to default-src
- -->
- <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> -->
- <meta http-equiv="Content-Security-Policy" content="default-src 'self' * ws://localhost:35729 data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' localhost:35729 'unsafe-eval' 'unsafe-inline';">
- <meta name="format-detection" content="telephone=no">
- <meta name="msapplication-tap-highlight" content="no">
- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
- <link rel="stylesheet" type="text/css" href="css/index.css">
- <title>Hello World</title>
- </head>
- <body>
- <center><div class="">
- <div id="deviceready" class="row col s12">
- <h1>foo</h1>
- <div class="input-field col s8">
- <input type="text" id="addr" name="addr" placeholder="Adresse">
- </div>
- <div class="input-field col s4">
- <input type="text" id="port" placeholder="port">
- </div>
- <div class="input-field col s12">
- <input type="text" id="name" placeholder="Nom d'utilisateur">
- </div>
- <div class="input-field col s12">
- <input type="password" id="pswd" placeholder="Mot de passe">
- </div>
- <button id="button_test" class="waves-effect waves-light btn blue lighten-1" value="tester">tester</button>
- <button id="button_start" class="waves-effect waves-light btn blue lighten-1" value="commencer">commencer</button>
- </div>
- <div id="result"></div>
- <div id="window-iframe"></div>
- </div></center>
- <script type="text/javascript" src="cordova.js"></script>
- <script type="text/javascript" src="js/jquery.min.js"></script>
- <script type="text/javascript" src="js/index.js"></script>
- </body>
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
- var app = {
- // Application Constructor
- initialize: function() {
- this.bindEvents();
- },
- // Bind Event Listeners
- //
- // Bind any events that are required on startup. Common events are:
- // 'load', 'deviceready', 'offline', and 'online'.
- bindEvents: function() {
- document.addEventListener('deviceready', this.onDeviceReady, false);
- },
- // deviceready Event Handler
- //
- // The scope of 'this' is the event. In order to call the 'receivedEvent'
- // function, we must explicitly call 'app.receivedEvent(...);'
- onDeviceReady: function() {
- app.receivedEvent('deviceready');
- },
- // Update DOM on a Received Event
- receivedEvent: function(id) {
- var parentElement = document.getElementById(id);
- var listeningElement = parentElement.querySelector('.listening');
- var receivedElement = parentElement.querySelector('.received');
- listeningElement.setAttribute('style', 'display:none;');
- receivedElement.setAttribute('style', 'display:block;');
- console.log('Received Event: ' + id);
- }
- };
- function debug(string){
- $("#result").html($("#result").html()+"</br>"+string);
- }
- debug("ready");
- document.getElementById("button_test").addEventListener("click", test);
- document.getElementById("button_start").addEventListener("click", start);
- document.getElementById("addr").value = localStorage.getItem("address");
- document.getElementById("port").value = localStorage.getItem("port");
- document.getElementById("name").value = localStorage.getItem("username");
- document.getElementById("pswd").value = localStorage.getItem("password");
- function test(){
- debug("connecting...");
- console.log("connecting...");
- addr = document.getElementById("addr").value;
- port = document.getElementById("port").value;
- username = document.getElementById("name").value;
- password = document.getElementById("pswd").value;
- url_req = "http://www.lemonde.fr/";
- // url_req = 'http://'+addr+':'+port;//'/actions.php?do=auth&login='+username+'&password='+password;
- debug("connecting...to->"+url_req)
- $.ajax({
- url: url_req,
- timeout: 30000,
- success: function(data, status, xhr) {
- debug("ajax sucess");
- console.log(data);
- data = JSON.parse(data);
- if(data.return == "success"){
- $("#result").html("OK");
- } else {
- debug("page return fail");
- $("#result").html(data.error);
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- debug("error->"+thrownError);
- }
- });
- localStorage.setItem("address", addr);
- localStorage.setItem("port", port);
- localStorage.setItem("username", username);
- localStorage.setItem("password", password);
- }
- function start(){
- addr = document.getElementById("addr").value;
- port = document.getElementById("port").value;
- username = document.getElementById("name").value;
- password = document.getElementById("pswd").value;
- $("#window-iframe").html("<iframe src='http://www.lemonde.fr/' width='800px' height='600px'></iframe>");
- //var ref = window.open('http://www.lemonde.fr/', '_blank', 'location=yes');
- }
- app.initialize();
- <?xml version='1.0' encoding='utf-8'?>
- <manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="foo" xmlns:android="http://schemas.android.com/apk/res/android">
- <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
- <uses-permission android:name="android.permission.INTERNET" />
- <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
- <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
- <intent-filter android:label="@string/launcher_name">
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
- </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement