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: HTML5 Video Player with jQuery

Post by JHPJHP »

Updated:
- TurnJSBook.pb, TurnJSBook_Create.pb

The update brings dynamic resizing to the page turning effect. Taking into consideration aspect ratios to maximize the fit of the book to your screen.
- create a new "Book" folder using the file TurnJSBook_Create.pb, pointing it to the folder TestFiles\FuturesEnd\
- next run the example TurnJSBook.pb pointing it at the newly created file TestFiles\Book1\FlipBook.div

It's worth noting for best results the first and last pages should have an orientation type of portrait, otherwise those images may be cropped or pressed.

Image

----------------------------------------------------------

Updated:
- VideoPlayer.pb, videoplayer.pbi

The update combines a JavaScript listener-event with the PureBasic Maximize / Restore events to remember a videos last position when switch between full-screen and normal view.

Remove window borders (excluding title bar) with the video players "Full screen" button. Optionally the "Zoom in" button will remove the black video borders.

Image
Last edited by JHPJHP on Wed Oct 14, 2015 10:27 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: JavaScript Frameworks from PureBasic

Post by Fred »

This is really great work !
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hi Fred,

Thank you for finding the time in your busy schedule to comment, it means a lot.

------------------------------------------------

Updated:
- added another framework: Flot Charts
- added 2 examples
-- FlotPieChart.pb, flotpiechart.pbi
-- FlotThresholdChart.pb, flotthresholdchart.pbi
- renamed the video player examples to better reflect their origin (includes minor improvements)

The new examples FlotPieChart.pb and FlotThresholdChart.pb demonstrate only a couple of the many charts available (see website for details).

Image
Last edited by JHPJHP on Sat Jan 23, 2016 6:50 pm, edited 2 times in total.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Embed JS Framework into PureBasic

Post by IdeasVacuum »

Hi JHPJHP

...working late but couldn't resist trying out your latest and greatest. I'm doing something wrong though:

1) Run TurnJSBook_Create.pb, Select the folder 'FuturesEnd' - success
2) Run TurnJSBook.pb, Select newly created book FlipBook.div - displays book, but only blank pages.

I'm using Win7 x86, PB5.31 32bit.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hi IdeasVacuum,

First let me say thank you for posting your results.

blueb also reported this same problem, but I thought I had it worked out. Can you provide me a link to a compressed copy of the Book1 (TestFiles/Book1/) folder created after running TurnJSBook_Create.pb.

Thank you again.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Embed JS Framework into PureBasic

Post by IdeasVacuum »

Here we go:
Book1.zip
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hi IdeasVacuum,

Thank you for the upload, I now know what the problem was.
- needed quotes when the image path included spaces

Thank you again, without your feedback it would not have been resolved.

----------------------------------------------------

Updated:
- fixed the problem posted by IdeasVacuum
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Embed JS Framework into PureBasic

Post by IdeasVacuum »

.... I should have thought of that myself Image
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Updated:
- renamed all the examples and includes
- added 2 examples
-- Flot_RealTime.pb, flot_realtime.pbi
-- Flot_Stacking.pb, flot_stacking.pbi

Unlike the other Flot examples Flot_RealTime.pb isn't linked to a PureBasic dataset, it's receiving random data from a JavaScript file.

Image
Last edited by JHPJHP on Wed Oct 28, 2015 1:00 am, edited 2 times 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:
- added 1 example
-- Flot_Selection.pb, flot_selection.pbi

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 1 example
-- AS3_Webcam.pb, as3_webcam.pbi

An example that brings your webcam to the WebGagdget.
- includes a snapshot option

NB*: Currently the getUserMedia function is not supported in IE, so the only way to host a webcam in a WebGadget is using adobe flash.

Image
Last edited by JHPJHP on Wed Oct 21, 2015 2:30 pm, edited 3 times 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 Flot chart examples.
- added a button to each example to save the charts to a JPEG file

Updated the example AS3_Webcam.pb, as3_webcam.pbi.
- set width / height (no error checking against available settings)
-- BuildCam(WebcamFolder, 320, 240)
- take a snapshot (previous image is replaced)
- save snapshot to a JPEG file
- save snapshot to a base64 encoded file

NB*: Keeping inline with the other examples, the new options are a mix of PureBasic and JavaScript working together.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hadrianus wrote:Hi JHPJHP,

I love your JS-magic for Purebasic. Please take a look at ViewerJS.org, it's a fully independent PDF-viewer and free to use. I tried to connect this with PB. Perhaps you will bring this viewer to PB one day.
Hi Hadrianus,

Thank you, I'm glad you liked it.

While I'm not usually one for taking requests, the PDF viewer demonstrates the extensibility of this project in a new way.

I looked at ViewerJS.org, but it was a bit bloated so I decided to go straight to the source: PDF.js.

----------------------------------------------------------------------

Updated:
- added 1 example
-- PDFJS_Viewer.pb

An embedded PDF viewer with a nice interface in a resizable PureBasic Window / WebGadget: PDF.js Demo

Image.
Hadrianus
User
User
Posts: 34
Joined: Wed Mar 27, 2013 11:31 pm

Re: Embed JS Framework into PureBasic

Post by Hadrianus »

Thanks a lot JHPJHP !
Also with window api stuff, I have to study this.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Embed JS Framework into PureBasic

Post by JHPJHP »

Hi Hadrianus,

You're very much welcome, I hope it proves useful.

-------------------------------------------

Applied small updates and improvements.
- I noticed when running the examples consecutively, at various times the HTML5 registry update failed

I don't believe this to be more than a locked process due to the examples using the same temp executable; this should not occur in a production environment.
- added a trap to confirm whether or not the registry update was successful

-------------------------------------------

Applied some minor updates to the existing examples, nothing worth documenting.
Locked