1 2 3String.prototype.isEmpty = function () { 4 return (this.length === 0 || !this.trim()); 5}; 6 7function isEmpty(obj) { 8 for (var key in obj) { 9 if (obj.hasOwnProperty(key)) 10 return false; 11 } 12 return true; 13} 14 15function UnoShare_BuildRequest(json) { 16 const obj = JSON.parse(json); 17 var result = new Object(); 18 if ('Title' in obj && !IsNullEmptyOrWhiteSpace(obj.Title)) 19 result.title = obj.Title; 20 if ('Uri' in obj && !IsNullEmptyOrWhiteSpace(obj.Uri)) 21 result.url = obj.Uri; 22 if ('Text' in obj && !IsNullEmptyOrWhiteSpace(obj.Text)) 23 result.text = obj.Text; 24 if ('File' in obj) 25 result.files = UnoFileSystem_ShareFilesToJsFiles([obj.File]); 26 else if ('Files' in obj) 27 result.files = UnoFileSystem_ShareFilesToJsFiles(obj.Files); 28 return result; 29} 30 31function UnoShare_ShareFromElement(id) { 32 const getShareRequestJsonForHtmlElement = Module.mono_bind_static_method("[P42.Uno.Xamarin.Essentials] Xamarin.Essentials.SharingExtensions:GetShareRequestJsonForHtmlElement"); 33 const json = getShareRequestJsonForHtmlElement(id);
34 var share = UnoShare_BuildRequest(json); 35 //getConfirmation(share); 36 if ('files' in share && navigator.canShare && !navigator.canShare(share)) 37 alert('Sharing of files not yet supported on this browser.'); 38 else { 39 navigator.share(share).catch((reason) => { 40 alert('Sharing may not yet be supported on this browser or sharing may not be permitted with a file. Error code: ' + reason); 41 }); 42 } 43} 44 45function UnoShare_Share(json) { 46 if (navigator.share) { 47 var share = UnoShare_BuildRequest(json); 48 navigator.share(share).catch((reason) => { 49 alert('Sharing may not yet be supported on this browser or sharing may not be permitted with a file. Error code: ' + reason); 50 }); 51 } 52 else 53 alert('Sharing not yet supported on this browser.'); 54 55} 56 57function UnoShare_CanShare(json) { 58 //getConfirmation(share); 59 if (navigator.share) { 60 var share = UnoShare_BuildRequest(json); 61 if (navigator.canShare) 62 return navigator.canShare(share); 63 else 64 return true; 65 } 66 else 67 return false; 68} 69 70function UnoShare_IsAvailable() { 71 if (navigator.share) { 72 return true; 73 } 74 return false; 75} 76
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.