TOC BB code add-on implementation

The whole thing is working quite fine now. But there are still some rough edges:
  • Copy/Paste in wysiwyg will loose headers formatting. I'm assuming this would require further Redactor customisation. Are there standard ways to customise Redactor for XenForo?
  • I got in page #links working somehow but the code would be so much simpler if there were no <base> or a reliable way to find the document name that's currently being served, including for inline saves. In my case I believe I could simplify the code if I could get rid of the base, since my base is the domain root that should not break anything else.
The base is apparently injected using JavaScript for some reason:

HTML:
<base href="https://xenforo.com/community/" />
 <script>
            var _b = document.getElementsByTagName('base')[0], _bH = "https://xenforo.com/community/";
            if (_b && _b.href != _bH) _b.href = _bH;
</script>
 
I got in page #links working somehow but the code would be so much simpler if there were no <base> or a reliable way to find the document name that's currently being served, including for inline saves. In my case I believe I could simplify the code if I could get rid of the base, since my base is the domain root that should not break anything else.

Just found out the following JavaScript possible solution to that problem. The downside obviously is that you need JavaScript.
 
I could customize the look of my headers from the following templates:
  • EXTRA.css for page view.
  • editor_contents.css for the redactor editor.
 
I could customize the look of my headers from the following templates:
  • EXTRA.css for page view.
  • editor_contents.css for the redactor editor.

That did it until now but to be able to publish that add-on I guess I'll need to use template modifications.
Moreover it looks like further customization of the redactor editor, possibly to get copy and paste to preserve header, could be done through template modifications too.
 
I've created a new template for my TOC css and then created a template modification for message.css to include my CSS template at the end of message.css but for some reason my CSS gets included twice. I can see the Apply Count is showing 2 for the relevant style but I have no idea why that would be.
Anyone care to help me on that one?
 
You can click the counts and you'll get a summary. Is it applying to the same template in the same style twice? Or are two different styles listed?
 
Here are the template modifications I have for now, message.css is needed for threads and message_simple.css is used by resources.

upload_2017-4-20_11-30-28.webp

Here are the details for message.css:

upload_2017-4-20_11-46-37.webp

My message.css modification is included twice whereas the one for message_simple.css is included once.
It's possibly an issue with the third party styles I'm using.

I'm considering using template modifications for thread_view.css and resource_view.css instead. Though the former has the same apply count issue.
 
 
Top Bottom