Skip to content

Commit

Permalink
Externe Links
Browse files Browse the repository at this point in the history
Externe Links korrekt öffnen, externe Links auch im Navi-Bereich, Links per CSS gestyled, T-Rex, kleinere Textanpassungen
  • Loading branch information
aeberhard committed Dec 5, 2017
1 parent 9e2b28f commit b7c37c1
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 19 deletions.
10 changes: 10 additions & 0 deletions plugins/documentation/assets/documentation.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,13 @@ font-family: FontAwesome;
content: '\f0a9';
margin-right: 10px;
}

/* externe Links */
.addon_documentation a.extern {
margin-right: 5px;
}
.addon_documentation a.extern:after {
font-family: FontAwesome;
content: '\f08e';
margin-left: 5px;
}
46 changes: 29 additions & 17 deletions plugins/documentation/assets/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function getUrlParameter(sParam, url)
{
var sPageURL = window.location.search.substring(1);
if (url) sPageURL = url;
if (url) sPageURL = url;
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
Expand All @@ -12,7 +12,7 @@ function getUrlParameter(sParam, url)
return sParameterName[1];
}
}
return '';
return '';
}

// Dokument per Ajax laden
Expand All @@ -23,9 +23,9 @@ function load_doc(elem) {

$url = $(elem).attr('href') + '&ajax=true';
$target = $('div.addon_documentation-content').find('div.panel-body');
$doctitle = $('div.addon_documentation-content').find('#doc-file-name');
$document = getUrlParameter('document_file', $url);
$($doctitle).html($document);
$doctitle = $('div.addon_documentation-content').find('#doc-file-name');
$document = getUrlParameter('document_file', $url);
$($doctitle).html($document);

$($target).html('<div style="text-align:center;"><i class="fa fa-cog fa-spin fa-2x fa-fw"></i></div>');

Expand All @@ -38,15 +38,22 @@ function load_doc(elem) {
{
$($target).html(response);
// Externe Links in neuem Fenster
$('div.addon_documentation-content').find('a[href^="http"]').each(function(){
if ($(this).html() != '') {
$html = $(this).html() + ' <sup><i class="fa fa-external-link"></i></sup>';
$(this).html($html).attr('target','_blank');
$('section.addon_documentation').find('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href) && this.href) {
$(this).addClass('extern');
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});
}
});
// Bei internen Links Dokument laden
$('div.addon_documentation-content a.doclink').on('click', function(event, container){
load_doc($(this));
if (!$(this).hasClass('extern')) {
load_doc($(this));
}
event.preventDefault();
return false;
});
Expand All @@ -66,19 +73,24 @@ function load_doc(elem) {
};

$(document).on('rex:ready', function (event, container) {

// Externe Links in neuem Fenster
$('div.addon_documentation-content').find('a[href^="http"]').each(function(){
if ($(this).html() != '') {
$html = $(this).html() + ' <sup><i class="fa fa-external-link"></i></sup>';
$(this).html($html).attr('target','_blank');
$('section.addon_documentation').find('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href) && this.href) {
$(this).addClass('extern');
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});
}
});

// Links in der Navigation, interne Links in Dokumenten
$('div.addon_documentation-navi a, div.addon_documentation-content a.doclink').on('click', function(event, container){
load_doc($(this));

if (!$(this).hasClass('extern')) {
load_doc($(this));
}
event.preventDefault();
return false;
});
Expand Down
Binary file added plugins/documentation/docs/de_de/for_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions plugins/documentation/docs/de_de/help_where.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ oder im [REDAXO-Channel auf Slack](https://friendsofredaxo.slack.com/) gestellt
---

`documentation` Plugin auf Github<br>
[https://github.com/FriendsOfREDAXO/demo_addon](https://github.com/FriendsOfREDAXO/demo_addon)
`documentation` Plugin auf Github

[github.com/FriendsOfREDAXO/demo_addon](https://github.com/FriendsOfREDAXO/demo_addon)

---

Expand Down
2 changes: 2 additions & 0 deletions plugins/documentation/docs/de_de/main_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ und erfunden hat's der @dergel (Jan Kristinus) für die [Dokumentation](https://

&raquo; Weiter zur **[Ordner-Struktur](main_folder.md)**

<p style="text-align:center">
![FriendsOfREDAXO](for.png)
</p>
6 changes: 6 additions & 0 deletions plugins/documentation/docs/de_de/main_navi.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@
@alexplusde (Alexander Walther)
@aeberhard (Andreas Eberhard)
@FriendsOfREDAXO

<p style="text-align:center">
![demo_addon @FriendsOfREDAXO](for_small.png)
</p>

[demo_addon @FriendsOfREDAXO](https://github.com/FriendsOfREDAXO/demo_addon)

0 comments on commit b7c37c1

Please sign in to comment.