mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Update noVNC v1.2.0, add support for clipboard, explicit button toolbar and resize screensize
		
			
				
	
	
		
			62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /*
 | |
|  * noVNC: HTML5 VNC client
 | |
|  * Copyright (C) 2020 The noVNC Authors
 | |
|  * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
 | |
|  */
 | |
| 
 | |
| /* Polyfills to provide new APIs in old browsers */
 | |
| 
 | |
| /* Object.assign() (taken from MDN) */
 | |
| if (typeof Object.assign != 'function') {
 | |
|     // Must be writable: true, enumerable: false, configurable: true
 | |
|     Object.defineProperty(Object, "assign", {
 | |
|         value: function assign(target, varArgs) { // .length of function is 2
 | |
|             'use strict';
 | |
|             if (target == null) { // TypeError if undefined or null
 | |
|                 throw new TypeError('Cannot convert undefined or null to object');
 | |
|             }
 | |
| 
 | |
|             const to = Object(target);
 | |
| 
 | |
|             for (let index = 1; index < arguments.length; index++) {
 | |
|                 const nextSource = arguments[index];
 | |
| 
 | |
|                 if (nextSource != null) { // Skip over if undefined or null
 | |
|                     for (let nextKey in nextSource) {
 | |
|                         // Avoid bugs when hasOwnProperty is shadowed
 | |
|                         if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
 | |
|                             to[nextKey] = nextSource[nextKey];
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             return to;
 | |
|         },
 | |
|         writable: true,
 | |
|         configurable: true
 | |
|     });
 | |
| }
 | |
| 
 | |
| /* CustomEvent constructor (taken from MDN) */
 | |
| (() => {
 | |
|     function CustomEvent(event, params) {
 | |
|         params = params || { bubbles: false, cancelable: false, detail: undefined };
 | |
|         const evt = document.createEvent( 'CustomEvent' );
 | |
|         evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
 | |
|         return evt;
 | |
|     }
 | |
| 
 | |
|     CustomEvent.prototype = window.Event.prototype;
 | |
| 
 | |
|     if (typeof window.CustomEvent !== "function") {
 | |
|         window.CustomEvent = CustomEvent;
 | |
|     }
 | |
| })();
 | |
| 
 | |
| /* Number.isInteger() (taken from MDN) */
 | |
| Number.isInteger = Number.isInteger || function isInteger(value) {
 | |
|     return typeof value === 'number' &&
 | |
|       isFinite(value) &&
 | |
|       Math.floor(value) === value;
 | |
| };
 |