Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
MediaWiki:DetailToggle.js
(view source)
Revision as of 19:00, 21 December 2018
425 bytes added
,
5 years ago
allow toggles to add .toggle-class-* classes to targets, which can be used for more general behavior than show/hide, such as blur filter, for example
Line 29:
Line 29:
property_anti = toggle_element.data("anti-target"),
property_anti = toggle_element.data("anti-target"),
property_default = toggle_element.data("default") || "show",
property_default = toggle_element.data("default") || "show",
+
property_classes = toggle_element.data("classes") && toggle_element.data("classes").split(' ').map(function (e) { return "toggle-class-" + e.trim() }).join(' '),
target = "toggle-target-" + property,
target = "toggle-target-" + property,
target_class = "." + target,
target_class = "." + target,
Line 47:
Line 48:
if (anti_target_class) {
if (anti_target_class) {
$(anti_target_class).hide();
$(anti_target_class).hide();
+
}
+
if (property_classes) {
+
$(target_class).addClass(property_classes);
}
}
} else {
} else {
Line 54:
Line 58:
if (anti_target_class) {
if (anti_target_class) {
$(anti_target_class).show();
$(anti_target_class).show();
+
}
+
if (property_classes) {
+
$(target_class).removeClass(property_classes);
}
}
}
}
がか
cssedit, gkautomate
7,064
edits