R
ragtek
Guest
This is my current code:
As you see, there are many similar things happening (ugly DRY
)
Now the challange:
Who can do this stuff with less lines as me? (i think everybody
)
1. prize: my respect
terms: if you post in this thread, you allow the threadstarter (ragtek) to use your code in his NUNS add-on
Code:
<script type="text/javascript">
!function($, window, document, _undefined) {
XenForo.NUNS =
{
Init: function() {
$conversationcb = $('#ctrl_optionsragtek_NUNS_welcomeConversationActive_1');
$('#ctrl_optionsragtek_NUNS_welcomeConversationSender').addClass('AutoComplete AcSingle');
$('#ctrl_optionsragtek_NUNS_newUserThreadCreater').addClass('AutoComplete AcSingle');
$('#ctrl_optionsragtek_NUNS_teamNotification').addClass('AutoComplete');
$conversationSender = $('#ctrl_optionsragtek_NUNS_welcomeConversationSender').parent().parent();
$conversationClosed = $('#ctrl_optionsragtek_NUNS_welcomeConversationClosed_1').parent().parent().parent().parent().parent()
$newUserThreadCb = $('#ctrl_optionsragtek_NUNS_newUserThreadActive_1');
$newUserThreadForum = $('#ctrl_optionsragtek_NUNS_newUserThreadForum').parent().parent();
$newUserThreadCreater = $('#ctrl_optionsragtek_NUNS_newUserThreadCreater').parent().parent();
$cb2 = $('#ctrl_optionsragtek_NUNS_TeamNotificationActive_1');
$cb2Childs = $('#ctrl_optionsragtek_NUNS_teamNotification').parent().parent();
if (!$conversationcb.is(":checked")) {
$conversationSender.hide();
$conversationClosed.hide();
}
if (!$newUserThreadCb.is(":checked")) {
$newUserThreadForum.hide();
$newUserThreadCreater.hide();
}
if (!$cb2.is(":checked")) {
$cb2Childs.hide();
}
$conversationcb.click(function() {
$conversationSender.toggle();
$conversationClosed.toggle();
});
$newUserThreadCb.click(function() {
$newUserThreadForum.toggle();
$newUserThreadCreater.toggle();
});
$cb2.click(function() {
$cb2Childs.toggle();
});
}
};
}
(jQuery, this, document);
XenForo.NUNS.Init();

Now the challange:
Who can do this stuff with less lines as me? (i think everybody

1. prize: my respect

terms: if you post in this thread, you allow the threadstarter (ragtek) to use your code in his NUNS add-on
