Time for prototype.js to retire

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
peebee
AppGini Super Hero
AppGini Super Hero
Posts: 209
Joined: 2013-03-21 04:37

Time for prototype.js to retire

Post by peebee » 2018-12-19 01:31

I see current version of Appgini is still loading prototype.js (resources/lightbox/js - Prototype V1.7.1)

Prototype is know to have several conflicts with both Bootstrap and select2 (I see some fixes have been added to common.js.php & dynamic.css.php in the current Appgini to remedy some conflicts)

prototype.js V1.7.1 was released in 2014. Last update to the Prototype JS project was Sept 2015.

Native Bootstrap tabs/pils and other functions still conflict with Prototype and a manual fix is required. There are plenty of other current (and maintained) lightbox js functions out there.

Whilst I am a great fan of Appgini, I do think it is time to get rid of Prototype JS completely. Just my 2c worth

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 209
Joined: 2013-03-21 04:37

Re: Time for prototype.js to retire

Post by peebee » 2018-12-19 01:50

Just to add to the my own post above.

You can fix some (if not all?) Prototype conflicts by adding the following to your hooks/header-extras.php I've tested and fixes my bootstrap issues at least. No apparent negative effects at this stage. Not tested in all browsers however......

Code: Select all

<script>
jQuery.noConflict();
if (Prototype.BrowserFeatures.ElementExtensions) {
    var disablePrototypeJS = function (method, pluginsToDisable) {
            var handler = function (event) {
                event.target[method] = undefined;
                setTimeout(function () {
                    delete event.target[method];
                }, 0);
            };
            pluginsToDisable.each(function (plugin) { 
                jQuery(window).on(method + '.bs.' + plugin, handler);
            });
        },
        pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover', 'tab', 'pill'];
    disablePrototypeJS('show', pluginsToDisable);
    disablePrototypeJS('hide', pluginsToDisable);
}
jQuery(document).ready(function ($) {
    $('.bs-example-tooltips').children().each(function () {
        $(this).tooltip();
    });
    $('.bs-example-popovers').children().each(function () {
            $(this).popover();
    });
});
</script>
All credit goes here: https://jsfiddle.net/dgervalle/hhBc6/

User avatar
a.gneady
Site Admin
Posts: 1021
Joined: 2012-09-27 14:46
Contact:

Re: Time for prototype.js to retire

Post by a.gneady » 2019-01-03 14:36

Thanks for sharing this code snippet. We're gradually migrating Prototype code to jQuery with each new release of AppGini, and plan to remove it altogether in AppGini 5.80.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Mass Update plugin: Update multiple records at once and improve your workflow efficiency.

:arrow: Summary Reports plugin: Build powerful reports and charts for your AppGini apps.

:arrow: Search Page Maker: Compose user-friendly yet powerful search pages for your AppGini apps.

Post Reply