Embed JS into PureBasic

Share your advanced PureBasic knowledge/code with the community.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated:
- added 1 Flot Chart example
-- Flot_Series.pb

Image
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated:
- added another framework: Data-Driven Documents
-- Includes\d3js_stackedbars.pbi
-- Includes\D3JS\d3.v3.min.js, d3.stackedbars.js, stackedbars.css
- added 1 example
-- D3JS_StackedBars.pb

This framework was added based on a question asked here.

In order for this example to be useful the JavaScript "test data generator" function (bumpLayer) in the file Includes\D3JS\d3.stackedbars.js would need to be replaced with user-defined data.
Last edited by JHPJHP on Fri Sep 02, 2016 6:32 am, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated the example D3JS_StackedBars.pb, merging the JS file d3.stackedbars.js (removed) for better control over the various parameters.
- various changes were made to more easily replace the "test data generator" function (previously bumpLayer now getValues) with a user-defined array

NB*: After modifying the "Layers / Samples" SpinGadget values press the "Generate Random Data" ButtonGadget to reflect the new settings.

Image
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Embed JS Framework into PureBasic

Post by djes »

Hi JHPJHP, the download link seems broken...
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Embed JS Framework into PureBasic

Post by RSBasic »

Image
Image
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Embed JS Framework into PureBasic

Post by djes »

Thank you ^^
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hi djes,

Sorry for the inconvenience, it seems that all my links are corrupted; I think it happened when I tried reorganizing my Dropbox account.

Until I have time to correct the problem RSBasic is generously providing a backup location to many PureBasic downloads.
Last edited by JHPJHP on Wed Sep 14, 2016 10:58 am, edited 1 time in total.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Embed JS Framework into PureBasic

Post by djes »

No problem, thank you for all your good job !
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated:
- removed 1 example: Geolocation.pb (geolocation.pbi)
- updated 3 examples: VideoJS_Player.pb, VideoPlayer.pb, VideoPlayer_Custom.pb

NB*: All download links have now been fixed.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated:
- added a Linux version of the download
- added an OSX version of the download

All downloads are available from the first post.

Problems with the following Linux and OSX examples:
- Pending/AS3_Webcam.pb: Missing Plug-in [ Linux & OSX ]
- Pending/PDFJS_Viewer.pb: Open File (icon) not working [ OSX ]
- Pending/TurnJS_Double.pb: Unknown issue, only 1 page returned [ Linux & OSX ]
- Pending/VideoJS_Player.pb: Problem with videoPlayer element from Includes/videojs_player.pbi [ OSX ]
- Pending/Video_Player.pb: Problem with videoPlayer element from Includes/videoplayer.pbi [ OSX ]
- Pending/VideoPlayer_Custom.pb: Problem with videoPlayer element from Includes/videoplayer_custom.pbi [ OSX ]

NB*: Various OSX examples display a flashing screen when redrawn; see D3JS_StackedBars.pb.

NOTE:
1. Move the "Pending" examples to the main folder before executing.
2. Enabled Debug mode before executing the video examples to more easily cancel the process.
3. Helpful sites with various webkit preferences:
-- https://developer.android.com/reference ... tings.html
-- https://github.com/adobe/webkit/blob/ma ... ferences.h
-- https://opensource.apple.com/source/Web ... c/WebView/

Code: Select all

WebkitSettings = webkit_web_settings_new()
g_object_set(WebkitSettings, "enable-developer-extras", #True, #Null)
g_object_set(WebkitSettings, "enable-java-applet", #True, #Null)
g_object_set(WebkitSettings, "enable-plugins", #True, #Null)
g_object_set(WebkitSettings, "enable-scripts", #True, #Null)
g_object_set(WebkitSettings, "enable-file-access-from-file-uris", #True, #Null)
g_object_set(WebkitSettings, "enable-private-browsing", #True, #Null)
g_object_set(WebkitSettings, "enable-spell-checking", #True, #Null)
g_object_set(WebkitSettings, "enable-universal-access-from-file-uris", #True, #Null)
g_object_set(WebkitSettings, "enable-dns-prefetching", #True, #Null)
g_object_set(WebkitSettings, "enable-webaudio", #True, #Null)
g_object_set(WebkitSettings, "enable-webgl", #True, #Null)
g_object_set(WebkitSettings, "enable-fullscreen", #True, #Null)
g_object_set(WebkitSettings, "enable-xss-auditor", #True, #Null)
g_object_set(WebkitSettings, "javascript-can-access-clipboard", #True, #Null)
g_object_set(WebkitSettings, "javascript-can-open-windows-automatically", #True, #Null)
webkit_web_view_set_settings(GadgetID(0), WebkitSettings)
kinglestat
Enthusiast
Enthusiast
Posts: 732
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: Embed JS Framework into PureBasic

Post by kinglestat »

do these links actually work? I get content unavailable when I click those links
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
acreis
Enthusiast
Enthusiast
Posts: 182
Joined: Fri Jun 01, 2012 12:20 am

Re: Embed JS Framework into PureBasic

Post by acreis »

It seems jhpjhp is on vacations and his onedrive is down

Does anyone have backup of their marvels?
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Embed JS into PureBasic

Post by Little John »

Hi JHPJHP,

I am interested in this project, and I tried to download the ZIP archive for Windows from the download link in the first post of this thread, but to no avail. I've tried several times, last week and today.

The start always is promising: Firefox (on Windows 10) opens a URL https://onedrive.live.com/?authkey=... and I see a symbol of a ZIP folder with the caption "Embed_JS.zip". Up to about 60% of the download, it seems to work fine, then suddenly the download ends with Firefox' error message "Embed_JS.zip - Failed". It's always the same.

Since there is no general problem with my internet connection, I don't know what the problem is. Any idea how I can get your file? I am rather curious about looking into it. :-)

//Edit: People told me via PM (thank you!) that they can download the file. So there seems to be a problem on my side. :-(
BTW, when using MS Edge (on Windows 10) instead of Firefox, I encounter exactly the same problem.
Finally, the download was successful with Chrome on my Android tablet. :-)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS into PureBasic

Post by JHPJHP »

Hi kinglestat, acreis, Little John,

Sorry about the problems with downloading, I am not sure what the issues might have been; first Drop Box now OneDrive :?:

I have started a website. When I can put more time into completing it, I will probably move all my download links there.

Thank you for the letting me know about the problems.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS into PureBasic

Post by JHPJHP »

Updated (Windows package):
- PDFJS to the latest version
- some minor code changes

See a demo of the PDF viewer here; works just the same in a PureBasic window, from full screen to presentation mode, etc.

PDFJS
Due to the restrictions with Internet Explorer 11 and Cross-Origin Resource Sharing (CORS), this example can only be executed through a proxy server.
Install Internet Information Services, then copy the folder includes\PDFJS to C:\inetpub\wwwroot\PDFJS; no configuration required.

Having a PDF load on open can be accomplished by adding a default value in the file /web/viewer.js @ LINE 4353.

Code: Select all

defaultUrl: {
  value: '',
  kind: OptionKind.VIEWER
}
Last edited by JHPJHP on Sun Jun 25, 2023 7:51 pm, edited 1 time in total.
Locked