From 7b443e42d66f231661d4789c43fa25caae56a1f3 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 16 Aug 2015 23:55:29 -0400 Subject: [PATCH] Generalize box option construction code. --- tfdclerk.js | 62 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/tfdclerk.js b/tfdclerk.js index be67605..30cea03 100644 --- a/tfdclerk.js +++ b/tfdclerk.js @@ -35,7 +35,8 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { return; TFDClerk = { - sysop: $.inArray("sysop", mw.config.get("wgUserGroups")) >= 0 + sysop: $.inArray("sysop", mw.config.get("wgUserGroups")) >= 0, + counter: 1 }; TFDClerk._get_today = function() { @@ -61,7 +62,7 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { TFDClerk._add_option_box = function(head, verb, title, callback, options) { var box = $("
", { - id: "tfdclerk-" + verb + "-box-" + head.uniqueId().prop("id"), + id: "tfdclerk-" + verb + "-box-" + TFDClerk.counter++, addClass: "tfdclerk-" + verb + "-box" }) .css("border", "1px solid #AAA") @@ -69,7 +70,7 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { .css("margin", "0.5em 0") .css("padding", "1em") .append($("
", {text: title, style: "padding-top: 0;"})); - options(box); + options(box, box.prop("id") + "-"); box.append($("