[TikiWiki-commits] [Git][tikiwiki/tiki][master] [REM] Remove unused legacy JS (HeaderLib includes & jQuery plugins) and dead code

"Alvin Bauma \(@alvinBM\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6991ce7b1efeb_3b1858946197e@gitlab-sidekiq-low-urgency-cpu-bound-v2-7b68dd745d-4fzh8.mail>

Alvin Bauma pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
935ccea4 by Alvin Bauma at 2026-02-15T14:47:22+01:00
[REM] Remove unused legacy JS (HeaderLib includes & jQuery plugins) and dead code
---
* [REM] Remove unused showBusy function from tiki-jquery.js

* [REM] Remove unused moveToWithinWindow function from tiki-jquery.js

* [REM] Remove unused finalMapRefresh function and outdated TODO comments from tiki-maps-ol3.js

* [REM] Remove unused legacy JS (HeaderLib includes & jQuery plugins) and dead code

See merge request tikiwiki/tiki!8289

- - - - -


3 changed files:

- lib/jquery_tiki/tiki-jquery.js
- src/js/jquery-tiki/tiki-maps-ol3.js
- src/js/jquery-tiki/tiki-svgedit_draw.js


Changes:

=====================================
lib/jquery_tiki/tiki-jquery.js
=====================================
@@ -2477,35 +2477,6 @@ $.fn.tiki = function(func) {
         }
     });
 
-    /**
-     * Show a loading spinner on top of a button (or whatever)
-     *
-     * @param $spinner empty or jq object $spinner        if empty, spinner is added and returned and element "disabled"
-     *                                             if spinner then spinner is removed and element returned to normal
-     *
-     * @return jq object $spinner being shown or null when removing
-     */
-
-    $.fn.showBusy = function( $spinner ) {
-        if (!$spinner) {
-            var pos = $(this).position();
-            $spinner = $("<i alt='" + tr("Wait") + "' class='ajax-spinner icon icon-spinner fas fa-spinner fa-spin'></i>").
-                    css({
-                        "position": "absolute",
-                        "top": pos.top + ($(this).height() / 2),
-                        "left": pos.left + ($(this).width() / 2) - 8
-                    }).data("target", this);
-            $(this).parent().find(".ajax-spinner").remove();
-            $(this).parent().append($spinner);
-            $(this).attr("disabled", true).css("opacity", 0.5);
-            return $spinner;
-        } else {
-            $($spinner.data("target")).attr("disabled", false).css("opacity", 1);
-            $spinner.remove();
-            return null;
-        }
-    };
-
     //    copy tracker action column to 1st row if table has horizontal scrolling
     //  exclude tables where tablesorter is being applied
     $('.table-responsive:not(.article-types):not(.ts-wrapperdiv)').each(function () {
@@ -2896,28 +2867,6 @@ $(function () {
     });
 });
 
-// try and reposition the menu ul within the browser window
-$.fn.moveToWithinWindow = function() {
-    var $el = $(this);
-    var h = $el.height(),
-    w = $el.width(),
-    o = $el.offset(),
-    po = $el.parent().offset(),
-    st = $window.scrollTop(),
-    sl = $window.scrollLeft(),
-    wh = $window.height(),
-    ww = $window.width();
-
-    if (w + o.left > sl + ww) {
-        $el.animate({'left': sl + ww - w - po.left}, 'fast');
-    }
-    if (h + o.top > st + wh) {
-        $el.animate({'top': st + wh - (h > wh ? wh : h) - po.top}, 'fast');
-    } else if (o.top < st) {
-        $el.animate({'top': st - po.top}, 'fast');
-    }
-};
-
 $.fn.scaleImg = function (max) {
     $(this).each(function() {
         //Here we want to make sure that the displayed contents is the right size


=====================================
src/js/jquery-tiki/tiki-maps-ol3.js
=====================================
@@ -2299,201 +2299,4 @@ import { defaults as defaultControls } from "ol/control";
             return false;
         }
     };
-
-    $.fn.finalMapRefresh = function (collector) {
-        this.each(function () {
-            var container = this;
-
-            $(container).trigger("unregister");
-            $(container).on("add", function (e, data, feature) {
-                collector(data, $.extend({}, feature));
-            });
-            $(container).trigger("changed");
-        });
-
-        return this;
-    };
 })();
-
-// TODO from OpenLayers2 tiki-maps.js still to be updated
-/* style stuff later
-                // these functions attempt to retrieve values for the style attributes,
-                // falling back to others if not all options are specified
-                // e.g. if "select-fill-color" is not provided it will use "fill-color", or just "color" attributes
-
-                var getColor = function (feature, intent, type) {
-                    return feature.attributes[intent + "-" + type + "-color"] ||
-                        feature.attributes[intent + "-color"] ||
-                        feature.attributes[type + "-color"] ||
-                        feature.attributes["color"] ||
-                        "#6699cc";
-                };
-
-                var getStyleAttribute = function (feature, intent, type, def) {
-                    return feature.attributes[intent + "-" + type] ||
-                        feature.attributes[type] ||
-                        def;
-                };
-
-                container.defaultStyleMap = new ol.StyleMap({
-                    "default": new ol.Style(ol.Util.applyDefaults({
-                        cursor: "pointer"
-                    }, ol.Feature.Vector.style["default"]), {
-                        context: {
-                            getFillColor: function (feature) {
-                                return getColor(feature, "default", "fill");
-                            },
-                            getStrokeColor: function (feature) {
-                                return getColor(feature, "default", "stroke");
-                            },
-                            getStrokeWidth: function (feature) {
-                                return getStyleAttribute(feature, "default", "stroke-width", 3);
-                            },
-                            getStrokeDashstyle: function (feature) {
-                                return getStyleAttribute(feature, "default", "stroke-dashstyle", "solid");
-                            },
-                            getPointRadius: function (feature) {
-                                return getStyleAttribute(feature, "default", "point-radius", 5);
-                            },
-                            getFillOpacity: function (feature) {
-                                return getStyleAttribute(feature, "default", "fill-opacity", 0.5);
-                            },
-                            getStrokeOpacity: function (feature) {
-                                return getStyleAttribute(feature, "default", "stroke-opacity", 0.9);
-                            }
-                        }
-                    }),
-                    "select": new ol.Style(ol.Util.applyDefaults({
-                        cursor: "pointer"
-                    }, ol.Feature.Vector.style["select"]), {
-                        context: {
-                            getFillColor: function (feature) {
-                                return getColor(feature, "select", "fill");
-                            },
-                            getStrokeColor: function (feature) {
-                                return getColor(feature, "select", "stroke");
-                            },
-                            getStrokeWidth: function (feature) {
-                                return getStyleAttribute(feature, "select", "stroke-width", 3);
-                            },
-                            getStrokeDashstyle: function (feature) {
-                                return getStyleAttribute(feature, "select", "stroke-dashstyle", "solid");
-                            },
-                            getPointRadius: function (feature) {
-                                return getStyleAttribute(feature, "select", "point-radius", 5);
-                            },
-                            getFillOpacity: function (feature) {
-                                return getStyleAttribute(feature, "select", "fill-opacity", 0.9);
-                            },
-                            getStrokeOpacity: function (feature) {
-                                return getStyleAttribute(feature, "select", "stroke-opacity", 0.9);
-                            }
-                        }
-                    }),
-                    "temporary": new ol.Style(ol.Util.applyDefaults({
-                        cursor: "pointer"
-                    }, ol.Feature.Vector.style["temporary"]), {
-                        context: {
-                            getFillColor: function (feature) {
-                                return getColor(feature, "temporary", "fill");
-                            },
-                            getStrokeColor: function (feature) {
-                                return getColor(feature, "temporary", "stroke");
-                            },
-                            getStrokeWidth: function (feature) {
-                                return getStyleAttribute(feature, "temporary", "stroke-width", 4);
-                            },
-                            getStrokeDashstyle: function (feature) {
-                                return getStyleAttribute(feature, "temporary", "stroke-dashstyle", "solid");
-                            },
-                            getPointRadius: function (feature) {
-                                return getStyleAttribute(feature, "temporary", "point-radius", 5);
-                            },
-                            getFillOpacity: function (feature) {
-                                return getStyleAttribute(feature, "temporary", "fill-opacity", 0.3);
-                            },
-                            getStrokeOpacity: function (feature) {
-                                return getStyleAttribute(feature, "temporary", "stroke-opacity", 0.9);
-                            }
-                        }
-                    }),
-                    "vertex": new ol.Style(ol.Util.applyDefaults({
-                        fillColor: "#6699cc",
-                        strokeColor: "#6699cc",
-                        pointRadius: 5,
-                        fillOpacity: ".7",
-                        strokeDashstyle: "solid"
-                    }, ol.Feature.Vector.style["temporary"]))
-                });
-
-                var markerStyle = {
-                    externalGraphic: "${url}",
-                    graphicWidth: "${width}",
-                    graphicHeight: "${height}",
-                    graphicXOffset: "${offsetx}",
-                    graphicYOffset: "${offsety}",
-                    graphicOpacity: typeof window.chrome === "undefined" ? 0.9 : 1
-                    // Google Chrome v34 makes some markers invisible if not 100% opaque
-                }, vectorStyle = {
-                    fillColor: "${getFillColor}",
-                    strokeColor: "${getStrokeColor}",
-                    strokeDashstyle: "${getStrokeDashstyle}",
-                    strokeWidth: "${getStrokeWidth}",
-                    pointRadius: "${getPointRadius}",
-                    fillOpacity: "${getFillOpacity}",
-                    strokeOpacity: "${getStrokeOpacity}"
-                };
-
-                container.defaultStyleMap.addUniqueValueRules("default", "intent", {
-                    "marker": markerStyle, "vectors": vectorStyle
-                });
-
-                container.defaultStyleMap.addUniqueValueRules("select", "intent", {
-                    "marker": markerStyle, "vectors": vectorStyle
-                });
-
-                container.defaultStyleMap.addUniqueValueRules("temporary", "intent", {
-                    "marker": markerStyle, "vectors": vectorStyle
-                });
-*/
-/*
-                var ClickHandler = ol.Class(ol.control, {
-                    defaultHandlerOptions: {
-                        "single": true,
-                        "double": false,
-                        "pixelTolerance": 0,
-                        "stopSingle": false,
-                        "stopDouble": false
-                    },
-                    initialize: function(options) {
-                        this.handlerOptions = ol.Util.extend({}, this.defaultHandlerOptions);
-                        ol.control.prototype.initialize.apply(this, arguments);
-                        this.handler = new ol.Handler.Click(
-                            this,
-                            {
-                                "click": this.trigger
-                            },
-                            this.handlerOptions
-                        );
-                    },
-                    trigger: function(e) {
-                        var lonlat = map.getLonLatFromViewPortPx(e.xy).transform(
-                            map.getProjectionObject(),
-                            new ol.proj.Projection("EPSG:4326")
-                        );
-                        $(container).addMapMarker({
-                            lat: lonlat.lat,
-                            lon: lonlat.lon,
-                            unique: "selection"
-                        });
-
-                        if (options.click) {
-                            options.trigger("click");
-                        }
-                    }
-                });
-
-                control = new ClickHandler();
-                map.addControl(control);
-                control.activate();
-*/


=====================================
src/js/jquery-tiki/tiki-svgedit_draw.js
=====================================
@@ -1,39 +1,6 @@
 import Editor from "svgedit/dist/editor/Editor.js";
 import "svgedit/dist/editor/svgedit.css";
 
-$.fn.drawFullscreen = function () {
-    var win = $(window);
-    var me = $(this);
-    me.trigger("saveDraw");
-
-    let fullscreen = $("#svg-fullscreen");
-
-    if (fullscreen.length === 0) {
-        me.data("origParent", me.parent());
-
-        var menuHeight = $("#drawMenu").height();
-        $("body").addClass("full_screen_body");
-        $("body,html").scrollTop(0);
-
-        fullscreen = $('<div id="svg-fullscreen" />').html(me).prependTo("body");
-
-        var fullscreenSvgEdit = fullscreen.find("#svgedit");
-
-        win.on("resize", function () {
-            fullscreen.height(win.height()).width(win.width());
-
-            fullscreenSvgEdit.height(fullscreen.height() - menuHeight);
-        }).trigger("resize");
-    } else {
-        me.data("origParent").append(me);
-        win.off("resize");
-        fullscreen.remove();
-        $("body").removeClass("full_screen_body");
-    }
-
-    return this;
-};
-
 $.fn.replaceDraw = function (o) {
     var me = $(this);
     if (o.error) {
@@ -96,14 +63,6 @@ $.fn.saveDraw = function () {
     return this;
 };
 
-$.fn.saveAndBackDraw = function () {
-    $(this)
-        .saveDraw()
-        .one("savedDraw", function () {
-            window.history.back();
-        });
-};
-
 $.fn.renameDraw = function () {
     var me = $(this);
     var name = me.data("name");



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/935ccea4e01b3dd0b0254698d9261ae05c571178

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/935ccea4e01b3dd0b0254698d9261ae05c571178
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.