[OzzModz] Rules

[OzzModz] Rules 2.0.0 Patch Level 1

No permission to download

Ozzy47

Well-known member
Ozzy47 submitted a new resource:

[OzzModz] Rules - Easily create rules and group them into categories. Bring the power of law to your community!

Description
This is a replacement for the CMTV Rules Addon

This addon allows you to create rules (title + description) and group them into categories (title + icon). These rules are displaying in a fancy and readable way on a new rules help page.

Users can easily share links to specific rules. When entering the rules page by such a link, a linked rule will be highlighted.

You can also import/export rules...

Read more about this resource...
 
Great (y)

I'm using Rules 1.0.2 right now and I'm wondering if anything changed in Version 2.0? Do I need to upgrade right now? Thanks!
 
If you are not experiencing any issues with the old addon, no. There was a code clean up and a error fixed in my version of the addon.
 
In XenForo 2.2, the clipboard.js library was removed, so this code in js/ozzmodz/rules/rule-highlighter.js:
JavaScript:
    OzzModz_Rules.Rule_Copy = new Clipboard('.rule .rule-link', {
        text: function (a)
        {
            return window.location.href.split("#")[0] + $(a).attr('href');
        }
    });

    OzzModz_Rules.Rule_Copy.on('success', function (a)
    {
        a.clearSelection();
        XF.flashMessage(XF.phrase('ozzmodz_rules_rule_link_copied_to_clipboard'), 1500);
    });

May be replaced with something like this:
JavaScript:
    OzzModz_Rules.Rule_Copy = $('.rule a.rule-link').on('click', function (e)
    {
        e.preventDefault();

        navigator.clipboard.writeText(
            window.location.href.split("#")[0] + $(e.currentTarget).attr('href')
        ).then(function ()
        {
            XF.flashMessage(XF.phrase('ozzmodz_rules_rule_link_copied_to_clipboard'), 1500);
        });
    });
 
XF 2.2.7+ compatibility
The clipboard.js library was removed in XenForo 2.2.0, if you used a solution like mine, then the compatibility should be for the older version as well. By the way, any solution should have such compatibility, it seems to me.
 
I think I found a bug. When you click the link for a rule, you can't get the selection unhighlighted even with a page re-fresh. Tried a hard re-fresh too.
 
I think I found a bug. When you click the link for a rule, you can't get the selection unhighlighted even with a page re-fresh. Tried a hard re-fresh too.

It's not a bug.

The add-on adds "#rule-{ID}" anchor to URL which it triggers the rule highlight.
 
I really like this add-on. I can consolidate many of the sticky threads in one place and can just link to the new page. Also just updating one page vs a bunch of stickies.
 
Last edited:
I wanted to have the rules page look similar to the other default XF help pages so I added this to the extra.less template.

CSS:
.rules-block .rule ul {
    list-style-type: disc;
}
.rules-block .contentRow-minor {
    font: 15px / 1.4 sans-serif;
    font-family: 'Segoe UI','Helvetica Neue',Helvetica,Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans',sans-serif;
    font-weight: 400;
    color: #141414;
    word-wrap: break-word;
}
.rules-block .contentRow-title {
    margin: 0;
    padding: 0;
    font-weight: 600;
    font-size: 17px;
}
 
Last edited:
Back
Top Bottom