- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Changes
Jump to navigation
Jump to search
Line 156:
Line 156:
+
− +
+
− multi_update(multi_toggle_element); +
+
Line 168:
Line 171:
+
+
+
Optimization to try to enable multiple multi toggles on page without startup lag
//Activate multi toggles.
//Activate multi toggles.
var targets = {};
$(".multi-toggle").each(function() {
$(".multi-toggle").each(function() {
var multi_toggle_element = $(this),
var multi_toggle_element = $(this),
multi_toggle_buttons = multi_toggle_element.children(".multi-toggle-button");
multi_toggle_buttons = multi_toggle_element.children(".multi-toggle-button"),
target = multi_toggle_element.data("target") || "default";
multi_toggle_element.show();
multi_toggle_element.show();
if (!targets.hasOwnProperty(target))
targets[target] = multi_toggle_element;
//Remove click event handlers from all multi toggle buttons
//Remove click event handlers from all multi toggle buttons
multi_toggle_buttons.off("click");
multi_toggle_buttons.off("click");
});
});
});
});
//call multi-update once for each target to allow multiple controls
//without horrible lag
Object.keys(targets).forEach(function (key) {multi_update(targets[key])});
// .mw-collapsible togglers
// .mw-collapsible togglers