mirror of
https://github.com/allankoechke/pywebview.git
synced 2026-11-30 17:18:35 +00:00
* Update change_url.md * Update api.md * Update installation.md * Add Google Analytics * Fix installation * 2.4 info * [Docs] add information about window.pywebview availability * Update debuggig info about QTWebEngine * [Docs] Add information about app architecture * Update cef.md * [CEF] Fix JS logic not persisting after navigating to another page * #169 Frameless window (#313) * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * [GTK] partial implementation of frameless window * [QT] Partial implementation of frameless window * [QT] implement easy drag * [Cocoa] Hide standard buttons and make the entire window draggable * [GTK] implement easy move * Add frameless tests * Remove unused parameter * [Cocoa] Implement free drag * Revert WebBrowserInterops * Code cleanup * Update interop DLLs * Fix interop dll * Update docs; Fix tests * Add example * Update examples * [CEF]: Implement support for pyinstaller one-file mode * [CEF] Fix typo * [All] Change api_call timeout to 15 seconds * Update setup.py * [QT] Simplify QT installation * New API Cocoa implementation Revamped tests and examples * Fix web engine force setting * Rename destroy_window to destroy * Update documentation * Add documentation for 2.4 * Refactor project structure * [GTK] New API support * Rename confirm_quit to confirm_close Split lifecycle events to shown and loaded * [GTK] Implement new API Fix tests * [QT] New API implementation * Remove multiprocessing * [Windows/CEF] New API implementation * Implement CSRF token [All] Implement get_element * Update Flask app example * Rename get_element to get_elements. Bug fixes. * [GTK] Implement propert JS-Python bridge for WebKit2 >2.2 * Update documentation * [Windows/CEF] New API implementation * Add token test * [Winforms] Fix js api initialization * [Cocoa] Fix events * Debug: print webkit version * [GTK] Check for old webkit * [GTK] Fix event issues * Catch notimlementederror in tests * Update travis conf with qt from pip * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * [Windows] Preliminary implementation of EdgeHTML based on PR from @HeavenVolkoff * [docs] Add information about EdgeHTML * EdgeHTML WIP * Remove windows.web import * EdgeHTML improvements. Fix MSHTML evaluate_js * [Docs] Add information about renderer limitations * [EdgeHTML] Fix bugs and tests * Remove window from windows list after it is destroyed * Fix window object deletion after window is closed via GUI * [Docs] Add information about renderer codes * Refactor and fix JS API Remove multiprocessing example [MSHTML] Add console.log debug support * [Travis] Change conf * [WinForms] Fix fullscreen * Fix dll installation * [Windows] Fix DLL bundling * Update changelog * [CEF]: Fix JS API * Update changelog * Built-in HTTP server implementation * Add http server test * Add http server testcd * Add http server testcd * [EdgeHTML] allow localhost urls * Add video example * Bug fixing * [Cocoa] Remove media prefs * Update .travis.yml * Update .travis.yml * Update .travis.yml * [Travis] Disable QT 5.12 builds * Update html_load.md
140 lines
3.8 KiB
HTML
140 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head lang="en">
|
|
<meta charset="UTF-8">
|
|
<style type="text/css">
|
|
body {
|
|
color: #333;
|
|
font-size: 14pt;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 24pt;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>My first pywebview application</h1>
|
|
|
|
<button onclick="openFolder()">Open folder</button>
|
|
<button onclick="toggleFullscreen()">Toggle fullscreen</button>
|
|
<button onclick="doStuff()">Do stuff</button>
|
|
<div id="open-folder-container"></div>
|
|
<div id="stuff-container"></div>
|
|
<div id="json-container"></div>
|
|
|
|
<div style="text-align: center; margin-top: 50px;">
|
|
<a href="http://mbsy.co/gHVfC" target="_blank" style="outline:none;border:none;" onclick="openLink(event)">
|
|
<img src="https://ambassador-api.s3.amazonaws.com/uploads/marketing/11948/2016_11_29_21_53_43.png" alt="DreamHost" border="0" />
|
|
</a>
|
|
</div>
|
|
|
|
<script>
|
|
window.token = '{{ token }}';
|
|
// Perform background initialization
|
|
doAjax("/init", "POST");
|
|
|
|
function getMethods(obj) {
|
|
var result = [];
|
|
for (var id in obj) {
|
|
try {
|
|
if (typeof(obj[id]) == "function") {
|
|
result.push(id + ": " + obj[id].toString());
|
|
}
|
|
} catch (err) {
|
|
result.push(id + ": inaccessible");
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function openFolderHandler() {
|
|
if (this.responseText) {
|
|
var response = JSON.parse(this.responseText);
|
|
document.getElementById("open-folder-container").innerHTML = 'Selected directory: ' + response.directory;
|
|
}
|
|
}
|
|
|
|
function doStuffHandler(response) {
|
|
if (this.responseText) {
|
|
var response = JSON.parse(this.responseText);
|
|
document.getElementById("stuff-container").innerHTML = response.result;
|
|
}
|
|
|
|
}
|
|
|
|
function openFolder() {
|
|
doAjax("/choose/path", "POST", openFolderHandler);
|
|
}
|
|
|
|
function doStuff() {
|
|
doAjax("/do/stuff", "POST", doStuffHandler);
|
|
}
|
|
|
|
function toggleFullscreen() {
|
|
doAjax("/fullscreen", "POST", doStuffHandler);
|
|
}
|
|
|
|
function openLink(e) {
|
|
e.preventDefault()
|
|
var request = {url: e.currentTarget.href}
|
|
doAjax("/open-url", "POST", false, request)
|
|
}
|
|
|
|
// From https://gist.github.com/dharmavir/936328
|
|
function getHttpRequestObject()
|
|
{
|
|
// Define and initialize as false
|
|
var xmlHttpRequst = false;
|
|
|
|
// Mozilla/Safari/Non-IE
|
|
if (window.XMLHttpRequest)
|
|
{
|
|
xmlHttpRequst = new XMLHttpRequest();
|
|
}
|
|
// IE
|
|
else if (window.ActiveXObject)
|
|
{
|
|
xmlHttpRequst = new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
return xmlHttpRequst;
|
|
}
|
|
|
|
// Does the AJAX call to URL specific with rest of the parameters
|
|
function doAjax(url, method, responseHandler, data)
|
|
{
|
|
// Set the variables
|
|
url = url || "";
|
|
method = method || "GET";
|
|
async = true;
|
|
data = data || {};
|
|
data.token = window.token;
|
|
|
|
if(url == "") {
|
|
alert("URL can not be null/blank");
|
|
return false;
|
|
}
|
|
var xmlHttpRequest = getHttpRequestObject();
|
|
|
|
// If AJAX supported
|
|
if(xmlHttpRequest != false) {
|
|
xmlHttpRequest.open(method, url, async);
|
|
// Set request header (optional if GET method is used)
|
|
if(method == "POST") {
|
|
xmlHttpRequest.setRequestHeader("Content-Type", "application/json");
|
|
}
|
|
// Assign (or define) response-handler/callback when ReadyState is changed.
|
|
xmlHttpRequest.onreadystatechange = responseHandler;
|
|
// Send data
|
|
xmlHttpRequest.send(JSON.stringify(data));
|
|
}
|
|
else
|
|
{
|
|
alert("Please use browser with Ajax support.!");
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |