[solved] minifier and input text form...

0 favourites
  • 8 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • OK I've got the most annoying issue with the minifier option.

    When it's checked, all input text form in my Iscroll plugins don't work correctly, you can't select the text inside.

    I tried to export without and it works perfectly.

    I've obviously read the manual part about minifier.

    If you need to see the code, you can download the iscroll plugin.

  • I had a quick look - I think the problem might be because you use a separate external script. The minifier does not parse or look at other scripts at all, so it does not know what 'iScroll' means and will rename it. So the line 'new iScroll(...' will turn to something like 'new mv(...' and break. To avoid this you must always reference anything from external scripts with string syntax, e.g.

    new window["iScroll"](...)

    because the minifier never changes anything using that syntax.

  • Ashley

    Thanks, I'll try this, but I wonder why it didn't break whole plugin because the 'new iscroll...' established all the functions of the plugin. It creates the scrolling system. Any ideas why it breaks only the input form?

  • I'm not sure, there was a lot of code in your plugin so I didn't have time to look all the way through it. You should just know that anything at all not defined in runtime.js will be renamed by the minifier, unless you use the ["property"] syntax. You should look through for any references at all to iScroll, other scripts, or anything not defined in the javascript itself, and make sure you switch them to ["property"] syntax.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • OK I'll do that, hopefully it'll work.

    Thanks

  • Ashley I tried this and unfortunately it doesn't work... It's still impossible to select text when the minifier option is checked...

  • Ashley

    Damn, I just saw that's the same thing for my style Border-radius & shadow properties. It's broken when it is exported with the minifier.

    So, how do I have to write the e.g. elem.style.borderRadius ?

    [edit]

    OK about style properties, I get it.

    elem["style"]["borderRadius"]

    But do I have to do this for ALL my style properties ??? I don't really understand why it breaks some style properties, some others not... ?

  • OK It was a known issue (that I was aware) from the original plugin.

    In fact, I added this :

    new window["iScroll"] (...,
    onBeforeScrollStart: function (e) {
    var target = e.target;
    while (target.nodeType != 1) target = target.parentNode;
    if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
    e.preventDefault();

    but this is apparently broken with the minifier and I didn't figure out to write it correctly.

    I've finally added an addEventListener directly to the input form which makes a stopPropagation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)