Avatar

About opening of links in new tabs or browser windows (Features)

by Auge ⌂, Saturday, October 24, 2020, 20:56 (1242 days ago) @ Micha

Hello,

Why not add a new section user_settings (or another meaningful name) instead adding a new file?


Yes, we can also extend the existing file by a new section and adding an option like:

user_settings['open_links_in_new_window'] = 'EXTERNAL';  // EXTERNAL, ALL, NON

This would need a non boolean setting (your proposal contains three states). Otherwise it looks like it's pointing into the right direction.

Should we also extend the main.js, too, or is it better to create a new script e.g. entry.js. If we use a new file, we can save resources by adding something like:

{if $mode=='entry' || $mode=='thread'}
<script src="{$FORUM_ADDRESS}/js/entry.min.js" type="text/javascript" charset="utf-8"></script>
{/if}

Every way begins with a first step. But creating a new script file for only this one function looks a bit to much for me. Do we have further functions that are only tied to the entry views that we can transfer to this new script or would we trench the existing code on to many places with this idea?

A further problem is HTML structure. Whereas each entry provides a header and a body class in thread mode, such elements are not presented in the single entry view. Is it possible to add such classes, too? It would be helpful to restrict the scope of modifying the target-attribute.

Of course sir, that's possible and it's IMHO important regard to a meaningful document structure.

In my theme every entry in every view is an article, has a header for the metadata of the entry, a div for the content of the entry and a footer for the tag list and the entry dependent function links. Even we are still on XHTML 1 in the default theme, we should at least provide a similar structure in all of the views.

My test script looks like that:

I did only a skim read (querlesen) but it looks o.k. to me in a first sight. I will implement the code in a new PR.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread