Page 1 of 1

WebGadget for App-Developers... (now at GitHub.org)

Posted: Sun Apr 28, 2013 9:16 am
by jamirokwai
Hi there,

this currently works on Mac OS only (tested with Mountain Lion, hope it will work on Lion or earlier, too - Feedback Appreciated 8)

JS-Esprit (w.i.p., also the name) is a Wrapper, which adds PB-Functions to the integrated WebGadget. You may put some links in a certain format to call PB-functions, like PlaySound, and such. Currently doing more research, but functions are coming along quite nicely. Have a look :-)

In a nutshell: Code your HTML-Pages, including JavaScript, CSS, jQuery, what you like. Add some calls to OS X-functions, e.g. playing sounds, which are served by PureBasic, either embedded or added by external libraries. The example will give you a first look, at what Development would be like. I will probably change the mycall: to reflect libraries, e.g. window:, sound:, etc.

Edit for 0.0.4: Changed the calling to JS_Caller(thelibrary,thefunction,thetarget,theorder) which would be e.g. JS_Caller('Test','Add2Values','add1','a=20&b=10'); from within HTML.

Download: http://pb.quadworks.de/JS-Esprit-0.0.4.app.zip

Feedback appreciated!

Code: Select all

<html>
<head>

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<META NAME="GetViewPort" CONTENT="10,10,400,400">
<META NAME="PreLoadLibraries" CONTENT="Sound">
<META NAME="BackGroundLoop." CONTENT="loop.ogg">

<link type="text/css" rel="stylesheet" href="css/uibase/jquery-ui.min.css" />
<script src='js/jquery-2.0.0.min.js'></script>
<script src='js/ui/jquery-ui.min.js'></script>

<style>
	a:link,a:visited,a:active,a:hover {cursor:pointer;color:#000000;text-decoration:none;text-underline:none;}
	div#hideprogressbar { position:fixed;top:0;left:0;right:0;bottom:0;visibility:hidden;opacity:0.8;background:-webkit-linear-gradient(-45deg,rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);}
    .ui-dialog {font-size: 80%;}
</style>

<script>
function getMetaContents(mn)   { var m = document.getElementsByTagName('meta');for(var i in m) { if(m[i].name == mn) { return m[i].content; } } }
function getHTMLContents(name) { return document.getElementsByTagName('head')[0].innerHTML; }
function getURLOfContent(id)   { return document.getElementById(id).src; }
function JS_Caller(thelibrary,thefunction,thetarget,theorder) { window.location=thelibrary + ':' + thefunction + "?" + theorder + '&target=' + thetarget; }

function getImageData(id) {
  var canvas    = document.createElement('canvas');
  var ctx       = canvas.getContext('2d');
  var img       = document.getElementById(id);
  ctx.drawImage(img,0,0);
  var imageData = ctx.getImageData(0,0,img.width,img.height);
  return imageData;
}

</script>

</head>
<body>

<h3>Tests</h3>
	<div id="check">What does Simon Say?</div><br>
	<a id="add1" onmouseup="JS_Caller('Test','Add2Values','add1','a=20&b=10');">20*10</a><br>
    <a id="add2" onmouseup="JS_Caller('Test','Add2Values','add2','a=100&b=50');">100*50</a><br>
    <a id="checker" onmouseup="JS_Caller('Test','SimonSays','check','Answer=Giddy up, hands in the air!');">Simon Says!</a><br>

<h3>Links, Mail, etc.</h3>
    <a id="wechsel" href="http://www.purebasic.com">PureBasic-Home</a><br>
    <a id="mail" href="mailto:test@domain.com">Send Mail</a><br>

<h3>Sound</h3>
    <a onmouseup="JS_Caller('Sound','PlayFile','','File=click.wav');" "Play external Sound (wav)">Play click.wav</a><br>
    <a onmouseup="JS_Caller('Sound','PlayFile','','File=click.mp3');" "Play external Sound (mp3)">Play click.mp3</a><br>
    <a onmouseup="JS_Caller('Sound','PlayFile','','File=click.ogg');" "Play external Sound (ogg)">Play click.ogg</a><br>
<!-- <a href="Sound:PlaySound?Type=URL&File=http://pb.quadworks.de/click.mp3" "Play Internet Sound (mp3)">Play click.mp3 (from Internet)</a><br>-->
	See more under Internal->Sound

<h3>Image</h3>
    <img id="spaceimage" src=""><br>
    <a onmouseup="JS_Caller('Image','LoadImage','spaceimage','File=space-icon.jpg');" "Load Image">Load Image</a><br>
    <a onmouseup="JS_Caller('Image','CallImageLib','spaceimage','file=spaceimage');" "Create Image from Library">Create Image from Library</a><br>

</body>
</html>
PureBasic will intercept mycall: to get the function, and parameters. This one will bring up an OS X MessageRequester (inside PureBasic, that is):

Code: Select all

<a href='mycall:ShowAlert?Title=Title&Message=Jo, show me the way to HTML!&Icon=Note' title="Javascript-Alert with Note-Icon">Show Alert with Note-Icon</a>
Current Features - many thanks to Shardik, Wilbert, WilliamL - http://www.purebasic.fr/english/viewtop ... 95#p386829

Code: Select all

; 0.0.4
; - new internal library (Window, Requester, Systemsounds)
; - load libraries when a function is needed (can be preloaded, when needed)
; - downloads of (zipped) Libraries are processed automatically, when Library is missing
; - CTRL-Q to Quit
; - added quite of few Apple-Icons to OK-Requester
; - added Apple-system-sounds
; - added Background-Sound/Musik, looped
; - Added jQuery/jQuery.ui
; - Added "internal" jQuery-UI-Example - thanks to Shardik

; 0.0.3
; - renamed mycall: to 
;   - window (everything regarding windows)
;   - sound (sound, and music)
;   - system (system-calls, alerts, etc)
;   - test (funny things, for testing)
; - setWindowAlpha, DoResizeWindow (animated), fadeWindow (optional to.f) (window-library)
; - setAppIcon,setAppBadge,ProgressIndicator (system)
; - Message-Requester (custom Image, uses CoreImage)
; - ProgressIndicator has optional an Fullscreen-Mode with TimeOut of 20 seconds (can be set)
; - uses CoreAudio (all formats of OS X), PB (for ogg and flac)
; - added error-checking for Plugin-System - if not functional, it will be ignored
; - added meta to header: <META NAME="Library" CONTENT="Sound,SQLite"> to load Libraries
;                         <META NAME="WindowSize" CONTENT="10,10,400,400"> to load Set Window-Size (x,y,w,h)
; - fetch info from header, see above
; - new HTML5-Example: jQuery-UI, thanks to Shardik - http://www.purebasic.fr/german/viewtopic.php?f=11&t=25816&start=60
; - Logfiles: in contents/logs, creates ZIPs of current Logfile every 128kb
; - Load Libraries on start from HTML
; - Set myViewPort-Size on start from HTML
; - Image-Library-Test, returns path to created image

Version 0.0.2
- fullscreen-support on Mountain Lion (from WebView)
- Message-Requester (from WebView, including 4 Icons)
- Set red dot (from WebView)
- Live-Window-Resize
- added 3 HTML5-Examples

Version 0.0.1
- gave this a "name": JS-Esprit (JavaScript-Esprit) - don't take the name for real 
- Plugin-System, currently only for Sound-Support (uses PB-Functions to play wav, ogg, flac) to play Default-sounds, and sounds loaded from hard disk - the WebGadget is not used to play the Sound or Music
- moved index.html to its own directory (have a look at the .app-bundle, contents/resources)

Re: WebGadget for App-Developers...

Posted: Sun Apr 28, 2013 7:54 pm
by jamirokwai
Hi there,

while going through the great examples of using Cocoa (http://www.purebasic.fr/english/viewtop ... 19&t=50795), I came up with a Proof-of-Concept.
This works like PhoneGap (http://phonegap.com), but is based on PBs WebGadget, and some portions of Cocoa.

You will code in HTML, CSS, Javascript. Set up URLs in the form of

Code: Select all

mycall:Add2Values?a=10&b=20&target=DIVid
PureBasic will watch for the URL-Call, and put the result of your command into the innerHTML of HTML-Element 'DIVid'. That's it.
For testing, I use this small HTML-Snippet:

Code: Select all

<html><head>
<style>a:link,a:visited,a:active,a:hover {cursor:pointer;color:#000000;text-decoration:none;text-underline:none;}</style>
</head><body>
<a id='add1' href='mycall:Add2Values?a=20&b=10&target=add1'>20*10</a><br>
<a id='add2' href='mycall:Add2Values?a=100&b=50&target=add2'>100*50</a><br>
<a id='string' href='mycall:SimonSays?a=Hold your hands up in the air!&target=string'>Simon Says!</a>
</body></html>
The line

Code: Select all

<a id='add1' href='mycall:Add2Values?a=20&b=10&target=add1'>20*10</a><br>
will call the PureBasic-function Add2Values to (ha!) add the values a and b. The result will be put into add1, replacing 20*10 with 200.

Please download the test here: http://pb.quadworks.de/PhoneGapProof.app.zip
It's compiled in PB 5.11 x64 on Mountain Lion with latest Safari installed.

Comments and suggestions, as well as error-reports welcome :-)

Re: WebGadget for App-Developers...

Posted: Sun Apr 28, 2013 9:06 pm
by jamirokwai
Hi again,

had some more time to add some more features...

Features of 0.0.1
- gave this a "name": JS-Esprit (JavaScript-Esprit) - don't take the name for real ;-)
- Plugin for Sound-Support (uses PB-Functions to play wav, ogg, flac) to play default-sounds, and sound from hard disk - the WebGadget is not used to play the Sound or Music
- moved index.html to its own directory (have a look at the .app-bundle, contents/resources)

Download: http://pb.quadworks.deJS-Esprit-0.0.1.app.zip

Re: WebGadget for App-Developers...

Posted: Sun Apr 28, 2013 10:36 pm
by Fred
Interesting concept !

Re: WebGadget for App-Developers...

Posted: Mon Apr 29, 2013 12:24 pm
by jamirokwai
Fred wrote:Interesting concept !
Thanks.
Works very good for version 0.0.3 :-)

Re: WebGadget for App-Developers...

Posted: Mon May 06, 2013 9:13 am
by jamirokwai
New for 0.0.4: Changed the calling to JS_Caller(thelibrary,thefunction,thetarget,theorder) which would be e.g. JS_Caller('Test','Add2Values','add1','a=20&b=10'); from within HTML.

Try to remove the sound.library.so from /Contents/Resources/Library, and restart.
The sound.library.so is fetched from the internet, installed, and used.
Please also have a look in /Contents/Resources/Log for some more information.

This is the source-code for a small test-library. Compile as test.library.so, and replace in /Contents/Resources/Library to see, what happens.

Code: Select all

EnableExplicit

Global NewMap Settings.s()

; this function gets called whenever index.html calls the Library
ProcedureCDLL.s DoMagic(Command.s,Order.s)
  Protected NewMap Variables.s()
  Protected Result.s,i,Value.s,VarName.s,VarValue.s
  Protected a,b,c
  
  ; Check Order, split into Associative Array
  For i = 0 To CountString(Order,"&")
    Value    = StringField(Order,i+1,"&")
    VarName  = LCase(StringField(Value,1,"="))
    VarValue = StringField(Value,2,"=")
    Variables(VarName) = VarValue
  Next i

  Select Command
    Case "add2values"
      a = ValD(Variables("a"))
      b = ValD(Variables("b"))
      c = a + b
      Result = StrD(c)
      
    Case "simonsays"
      Result = Variables("answer")
      
  EndSelect
  
  FreeMap(Variables())
  
  ProcedureReturn Result
  
EndProcedure

; change Parameters
ProcedureCDLL.q DoSettings(args.s,value.s)
  Settings(args) = value
EndProcedure

ProcedureCDLL.s GetSettings(args.s)
  ProcedureReturn Settings(args)
EndProcedure

; Metadata

ProcedureCDLL.q GetIcon()
 ProcedureReturn ?Icon
EndProcedure

ProcedureCDLL.s GetName()
 ProcedureReturn PeekS(?Name)
EndProcedure

ProcedureCDLL.s GetCopyright()
 ProcedureReturn PeekS(?Copy)
EndProcedure

ProcedureCDLL.s GetDesc()
 ProcedureReturn PeekS(?Desc)
EndProcedure

ProcedureCDLL.s GetCreator()
 ProcedureReturn PeekS(?Crea)
EndProcedure

ProcedureCDLL.s GetVersion()
 ProcedureReturn PeekS(?Vers)
EndProcedure

ProcedureCDLL.q Init()
EndProcedure

ProcedureCDLL   DeInit()
EndProcedure

DataSection
  
  Name: Data.s "Test-Plugin"
  Vers: Data.s "1.0.0"
  Desc: Data.s "Test-Plugin"
  Copy: Data.s "(c,p) 2010-2013 quadWorks"  
  Crea: Data.s "quadWorks"
  Icon: ; size : 2781 bytes
    Data.q $0A1A0A0D474E5089,$524448490D000000,$8000000080000000,$613EC30000000608,$414449A40A0000CB
    Data.q $55480B9DECDA7854,$B43DDFBF7DC716E9,$CC6CB5D6A6A6A6BC,$D5DBB271A4CCB30A,$E329CB254332D2B0
    Data.q $E9ACCB270DD69A18,$9B284CD297593041,$646612ECA9C2A4C6,$CCA41CF62E997350,$390991064B31752E
    Data.q $3445081BFFEE7089,$DBEBD9CFBDEDF8F5,$EB5EF677CF484FF0,$44CFAD6B1EFEF7B7,$500379161109D3A7
    Data.q $5003791750037917,$5003791750037917,$5003791750037917,$5003791750037917,$5003791750037917
    Data.q $5003791750037917,$5003791750037917,$5003791750037917,$836A753A9C8B8917,$A909090AA4752E09
    Data.q $775FAFD744A80017,$E7BBDDEEAD1D4E65,$34E2E2E28150002A,$0011A090909000FA,$666E64BA5D2EB918
    Data.q $7373730007D5A666,$9B9588C000BCFB2D,$EE76AFA99CCE1B9B,$B9B96230002E19DC,$0179F600058E35B9
    Data.q $CC6E3399CCEA9180,$846000476B156389,$684001E3CB0B0B0A,$E774C8C000BE6868,$71D207AF380B1DCE
    Data.q $00052D0F87C3EF50,$F399AF949494A446,$79C7813131312978,$C6A6A6A759D5D5D5,$0727E80025617461
    Data.q $7A186FF430198707,$0346311F1F1F18FD,$0004F1B75B5B5999,$96121EF57685D5E7,$FBEB359ACFBB9797
    Data.q $FA7AFC585859EDCF,$6A674E80014B69F4,$7D7DD1983F9F6F6F,$FECDEFDFEFF74B7D,$72C49494966D3466
    Data.q $4168CA6121C0FC72,$BFCECECEE13468D4,$AABD85F8201ED60C,$9FFCE05926C002C8,$7273559595BC3386
    Data.q $537681DE11E2F272,$E3F1800296E94CA6,$B861C1F0F87EF7C7,$2592EB82E170B873,$136B863F99F0B24B
    Data.q $8E60022808323410,$606D04E946BFFEC7,$0D4363B1D8E6A060,$F66FFE3F1F8EACCB,$CEEC5BA44F0952B7
    Data.q $7BF6EDEDEDDDF81E,$FDF2793C998DEEF7,$719C941A0809B6D1,$1FAA727277CEE454,$33A05E6C6C6C238B
    Data.q $BDDEAF83C1E0F595,$5EC97DBEDF7D377B,$D3CB5277EC9D5E5E,$4E1838B8B8BAB3D3,$AB559CEDF6FB779F
    Data.q $3E26D4C71380BD56,$DE3E776408294B7F,$CA6A6A621D3C7589,$60DC1017BFE51DA1,$2E2E2E66003351F6
    Data.q $2D41090D0AC5D957,$357ABCC0012A93B3,$A2A29A82108F0775,$FB6B6B6001D53322,$69EA30891DCEEA4F
    Data.q $96969001D55F4363,$52525123B9DD43E6,$81714C01F6B56AD2,$FEFF74E1E0EEA5FF,$16B2B0028ED55B7D
    Data.q $5F9F9F925FC1DD4F,$50D8DCE88187AAA5,$7F41E0F07497F277,$0674481261044FD5,$5656400F29FCEB95
    Data.q $06F1FCE8720CE896,$7C3BA8FFE0CEEE40,$28316640E428B0A0,$6BFBC3BA99222222,$AB0356A40D69B4DA
    Data.q $0EBFBD3BA89CAAAA,$EB001E2E451C3E1F,$97A2133C7751BFEB,$C763B001C8EC3874,$3A42191A1A728D8E
    Data.q $275D858585747ABC,$A9C9A9A9A8AC9E4F,$4A5AED76BA4FAFAF,$972D96CB66995959,$AC829C45A0582C17
    Data.q $446485AEB75BAC00,$94B1C8672F97CBD0,$6B47A3D1DD27C98B,$99A7704722DADADA,$5BA50903D1F8FC7E
    Data.q $E7E4A02C45A81B90,$8131AA3CDDEEF777,$08EDDD92313131EE,$47BE23646022D0D4,$12CF67B3C5B5DEDF
    Data.q $83F39523DA5D2E97,$C00553E638748282,$DE6F3A8DDC7BF10B,$BED18A8F47A3DD3C,$FCFE7F39B4F3A735
    Data.q $6F6F573F7032C449,$54D0A0D53780066F,$293F6DA07FA7DE09,$89311A25A5A5B7CE,$452846E371B821DC
    Data.q $69E5AB9DCEE71C00,$DC7BE8BF67B3D9C8,$CC61FBDFEFF7A34B,$4668D7D1BCF3CBDE,$B9FCFE78006496DB
    Data.q $DDDC37135CDC7A07,$ABD5A5B642FB3BDD,$26795D5D5C02AF57,$3E9F9BD3D3D2E89D,$AB78E0006AAEEA7D
    Data.q $C3F9EEF2E797CBE5,$6ED1A725ED27AC80,$860C118A52B9BCDE,$001E2BAA357845A9,$4B0D60E0E0876E63
    Data.q $EEF77BBD27A294B2,$EB75BAD8CF5894EF,$451E1E1E0746A92D,$B74C006635761A58,$C495739E8FEEDF6F
    Data.q $90DD3FBE0A3D1401,$D5EADD7112F52208,$969DE5120CA443AB,$565970E30380936D,$41EC940BABABAAFB
    Data.q $9D0BB0C66990E197,$0443470A8A8A8CDC,$67335EB3D9ECF4C0,$8E1D3415E641FCCE,$89EDDDDDD0024AF1
    Data.q $16AF407463A9D643,$0083054F60CC1414,$4458942F71B8DC60,$E94F831748E47239,$FD712BB42DAC66EC
    Data.q $001C57EFB276CA78,$188F5B5B5AD156A5,$94F38FC7E3FD7E42,$29B000927EFB01B2,$4F4F400086D11C64
    Data.q $8BAAB202F37D57CF,$300800C9FEA8002C,$2548C8C8B7200004,$064646400B266800,$E56359B7CA50C003
    Data.q $79B002C81A000951,$6000818D800666F3,$89F800255AED76BE,$5800626D369B002C,$800256E908000A1A
    Data.q $B390A50C013FA81F,$AC00B242804F42A5,$8D8A700090C6B359,$B000B26C8002558D,$00400206161C3F38
    Data.q $00B2148002512476,$868E1D1D1D4CA2B0,$089A155244820000,$1E6EB09800591BFA,$0A3FE68160000862
    Data.q $7EF59709324B80D9,$393F1D596FFF7F7F,$784332B2D96CB00D,$63B7C76E409723FF,$4B5C9302AF2569E2
    Data.q $148B0A22B158ADC0,$726A6A6B699572CD,$CB96C8F354001251,$39999997588DA8F1,$79642B249802F783
    Data.q $6A51FF1F98BE7979,$4115C156ACC420A3,$8D7C4AF6170B85AB,$CA8EABEAEE60E8BD,$81764AA28127925F
    Data.q $CBB5B5B54C60E154,$C244B2B2B2A00095,$E46FD898D89BDBA7,$7C9D58B18B2E28A8,$0EE4B4B4B46D96CC
    Data.q $926088D91389C4C2,$14BFADF6FB7FCE9C,$6766BF8E8E8E2289,$EBD31C4CB2A88767,$3A53D9ECF66DAFD7
    Data.q $68B45B86AE24D269,$3F68586B908E0B11,$DA6229CE2E9CCE67,$862251222C4E2713,$BDE5CEE1C6D5AB49
    Data.q $EE7C4B3B6D06F842,$8245C9DAE4D208B6,$861A97236D0B0F4C,$1FD4508FDE7CB698,$676F9C52BE61A962
    Data.q $D7B9EBF5FACBA767,$B9927AD4EA753C39,$8F7F70DA18A0CC81,$3C99D1DE1D06B362,$F70702302F232E8B
    Data.q $4B021D3B3B3B612C,$06F312D83B3542FF,$8D058E8A51A2F492,$7C63AFE9F4FA7EB6,$D9D8B500DEC38EAF
    Data.q $3C38489364F39244,$469693D7DF6002A9,$B1CEE773BA3E3E3E,$398B0CA28F5F1C0A,$25BE420D73478414
    Data.q $0124B9D6E0825AAF,$E843459AE5826380,$E5BAB05061E59FFA,$CAE572B8FF0381C0,$31F0C1093C9E4F37
    Data.q $CD89198B30833F10,$7F3B50D86C36D2A6,$19B13C83395EFCFE,$A42BF8F000492155,$7D0984C2698A205E
    Data.q $77C5C3300084FDF1,$7178BC5D67FE7753,$75107BADB0002932,$00A4F93B5E17F7A7,$4807D3BA8AB93BC0
    Data.q $3E5D4000248A9ECB,$675D02C1F0E1133B,$752D6A2A2A200091,$014CFC35CC260F67,$87B3BA83BC295600
    Data.q $400D551C8743A1D2,$497F2775307E7E7E,$E630006AAE974328,$1593A8C3C9DD4CBD,$3471DC880025507E
    Data.q $01898989561E0E11,$77523777350004AA,$02554CA9A88448EE,$14C8EC75B10F8580,$8B8E634910004AAF
    Data.q $5D6A4BF83844D9FB,$0DC800DC85B178BC,$40EA60F47089AD41,$97AC4C8187BA9B58,$17A3E821CABD8B8B
    Data.q $A0835F33101B3AD5,$5858585674E5DFCA,$DDA08476E9696941,$25252DB368F079C2,$35041F405AC689C5
    Data.q $DCBCBCB6FC4C167A,$597FB629AA12C07D,$A283052B369A7528,$C0472090060673CE,$68F4FCECB906F107
    Data.q $50629ED5353525B7,$F55169847AA08328,$0CE22A64B618E608,$755B6554BD4DB143,$346935DC3C5E48A8
    Data.q $DDB08C55762C409A,$090CD359B6DB6DA6,$8080B214C86083EB,$D3215467EFD87D80,$9D4EE6D122531F28
    Data.q $4B637EAAC049A9A3,$DDF5350CF964249C,$C7FB0DCCBC557380,$81DFFB97EAA82010,$CDCF5E5E564AE2CE
    Data.q $C6DE08F70ED1ACA8,$DAEC7FAEFA05C6C6,$FCEFF74B0A3A6BB5,$00F27BF6621D665E,$97100B1FC500867C
    Data.q $7474746854C79337,$7313720EA3E74F06,$FEB424676A0C8724,$45CC24000A35F3FD,$0A39F79D31BC9CE4
    Data.q $94E42AE476162400,$3230002FDDE7F063,$A37F60001E7A9CB1,$AAC508C0009ED650,$17EEEC3780118C6A
    Data.q $B1F4D71BB0A91800,$008ED652DC618000,$A2DDF4D042C578C0,$B91800123DD59BAE,$1790001F4127C750
    Data.q $E17230002F3EC698,$6DD58C0007D2B62E,$C9579797912A0004,$00273EC77E912B28,$58A50ECB6D508950
    Data.q $50E9E1E1E1094096,$FFE1D509543DF42E,$27298E90EFE7E31F,$EC6657400045C727,$00242000484000A7
    Data.q $0484000908001210,$00498E976FFF4200,$1CBD6FF506000000,$00200200281B0F03,$F002002002002002
    Data.q $7755ED76615E5316,$4E45490000000078
    Data.b $44,$AE,$42,$60,$82
    Icon_End:    
EndDataSection
The HTML-Part in index.html is this:

Code: Select all

<div id="check">What does Simon Say?</div><br>
	<a id="add1" onmouseup="JS_Caller('Test','Add2Values','add1','a=20&b=10');">20*10</a><br>
    <a id="add2" onmouseup="JS_Caller('Test','Add2Values','add2','a=100&b=50');">100*50</a><br>
    <a id="checker" onmouseup="JS_Caller('Test','SimonSays','check','Answer=Giddy up, hands in the air!');">Simon Says!</a><br>
The calling-convention of JS_Caller is:

JS_Caller(thelibrary,thefunction,thetarget,theorder)

With
thelibrary 'Test' = test.library.so
thefunction 'Add2Values' = Function to call, see DoMagic in Library-Example above
thetarget '' = the ID of any DOM-Element, which innerHTML gets replaced with the result of your call
theorder ""a=100&b=50", in HTML-URL-style. See source. The a and b get added, and the result is returned, converted to a string.

Download from first post.

Re: WebGadget for App-Developers... (now at GitHub.org)

Posted: Wed May 08, 2013 10:40 am
by jamirokwai
Hi, again.

as version 0.0.4 is somewhat stable, I committed the Code to GitHub. Have a look at
https://github.com/quadworks/MiddleMan