Creating plugins - Forum

Forum Navigation
You need to log in to create posts and topics.

Creating plugins

Hi,

I'm new to creating plugins for VisualNeo Web... so testing them but stuck midway as I'm relatively new to Javascript.

I managed to find a Lunar Calendar js script (https://jsfiddle.net/DerekL/mGXKX/) and wanted to create a plugin to call the below function...

function getLunarDate(date) {
  var y = +Intl.DateTimeFormat("zh-TW-u-ca-chinese", {
      year: "numeric"
    }).format(date).match(/\d+/)[0],
    m = +Intl.DateTimeFormat("zh-TW-u-ca-chinese", {
      month: "numeric"
    }).format(date).match(/\d+/)[0],
    d = +Intl.DateTimeFormat("zh-TW-u-ca-chinese", {
      day: "numeric"
    }).format(date).match(/\d+/)[0],
....

In the plugin, the action for getLunarDateE is

result = getLunarDate(d1);

On VisualNeo Web, I tried executing but got either wrong answer of invalid results

GetLunarDateE "2019-06-07" "[Result]"

How do I pass the date variable "2019-06-07" to the JS script?

Any advice is appreciated... thanks

Hi @ronnie,

Please download the attached file with a compiled plugin, plugin source code and a sample app.
Note that I have modified the original function to convert a string to a JavaScript date format.
Let me know if you have any doubt.
It's great to see you interested in VisualNEO Web plugins development!
Best regards.

Uploaded files:
  • You need to login to have access to uploads.

Hi @luishp
Thanks for providing the sample code - will check it out. It'll help to understand the interfacing syntax properly. Yes, am exploring on plugins and learning VisualNeo Web concurrently. Do appreciate the time taken on the sample code.

Rgds
Ronnie

Hi @luishp

While there is no error in the attached sample code, the result was wrong.

When "2019-06-07" is entered, the sample code shows result as "壬寅年六月初七"

The correct result should be "己亥年五月初五"

to try out, add the "2019-06-07" date to below string in https://jsfiddle.net/DerekL/mGXKX/ and then click Run on the top left menu... to update/recalculate

document.body.innerHTML = getLunarDate(new Date("2019-06-07"));

 

Hi @ronnie,

That's not my fault. Please don't use the "Run" button to test the app and use one of the installed Web Browsers instead (except Internet Explorer). The Run button uses Internet Explorer to run the program and it has it's own way to parse dates and probably the function you are using is not compatible with it.
A plugin like this one takes about 10 minutes or less to be ready :)

Regards.

Hi @luishp

Yeah... you're right. Trying out using other browsers like Chrome and FireFox are OK, and the correct results are displayed. Using both Chrome and Safari on iPhone is OK, and as well as Chrome on Android is OK. As you've said, it's IE related  issues which also affected the compiled EXE as well.  Alternative is to relook at other source and try them out to ensure all browsers and compiled EXE produce identical results.

Meanwhile, a feedback... when compiled with 'minify source' ticked for Web Application, and 'Compress and encrypt app content' ticked for EXE, the screen is blank when run/launched. For the Web, whether it's in local system or run from URL, the page is blank. But when I unticked the minify or compress option, it works fine.

Rgds

Ronnie

 

Hi @ronnie,

Meanwhile, a feedback... when compiled with 'minify source' ticked for Web Application, and 'Compress and encrypt app content' ticked for EXE, the screen is blank when run/launched. For the Web, whether it's in local system or run from URL, the page is blank. But when I unticked the minify or compress option, it works fine.

You are right. The "minify" algorithm has a problem when trying to compress certain characters combinations. I have also observed it. Will try to take a look at it.

Thanks!

Hi @luishp

Thanks. Am getting excited about creating plugins. Managed to resolve the inconsistencies of the Lunar Calendar script on various browsers, by using a different source scripts.

Rgds

Ronnie

 

@luishp

Just one question - are the 'compiled' plug-in encrypted or obfuscated? I've been checking out and found it much easier (and faster) to add function-like codes in plugin than direct in VisualNeo Web. Still far to go for me to release any plugin but need to know its status whether the plugin is protected.

Thanks...

Regards, Ronnie

Hi @ronnie,

Plugins code will be added minimized and mixed with the one present in other plugins (only when needed)
Additional libraries, added as files in the plugin, will be copied as they are. There is not obfuscation of any kind by default but it is possible to obfuscate it, if you want, previously to plugin deployment. Right now there is not a tool to facilitate the process.
Anyway, in my opinion, client side obfuscate source code is really easy to unobfuscate.

Regards.