1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Update static dependencies

This commit is contained in:
Jeremy Stretch
2020-07-16 15:22:31 -04:00
parent a4829198ff
commit 16f44305e4
702 changed files with 662 additions and 165 deletions

View File

@ -0,0 +1,36 @@
# v1.5.1
## 07/14/2016
1. [](#improved)
* Translate some blueprint options
# v1.5.0
## 01/06/2016
1. [](#improved)
* Disable anchors in Admin
# v1.4.0
## 08/25/2015
1. [](#improved)
* Added blueprints for Grav Admin plugin
# v1.3.0
## 07/20/2015
1. [](#new)
* Updated `anchors.js` to version 1.2.1
* Added new options such as 'placement', 'visible', 'icon' and 'class'
# v1.2.0
## 03/01/2015
1. [](#new)
* Updated `anchors.js` to version 0.3.0
# v1.1.0
## 11/30/2014
1. [](#new)
* ChangeLog started...

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Grav
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,84 @@
# Grav Anchors Plugin
`anchors` is a [Grav](http://github.com/getgrav/grav) plugin that provides automatic header anchors via the [anchorjs](http://bryanbraun.github.io/anchorjs) jQuery plugin.
# Installation
## GPM Installation (Preferred)
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm). From the root of your Grav install type:
bin/gpm install anchors
## Manual Installation
If for some reason you can't use GPM you can manually install this plugin. Download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `anchors`.
You should now have all the plugin files under
/your/site/grav/user/plugins/anchors
# Usage
To best understand how Anchors works, you should read through the original [project documentation](https://github.com/bryanbraun/anchorjs).
## Configuration:
Simply copy the `user/plugins/breadcrumbs/anchors.yaml` into `user/config/plugins/anchors.yaml` and make your modifications.
enabled: true # enable or disable the plugin
active: true # active by default, if false then you must activate per-page
selectors: 'h1,h2,h3,h4' # css elements to activate on. Uses jQuery style selectors
placement: right # either "left" or "right"
visible: hover # Active on "hover" or "always" visible
icon: # default link or a specific character like: #, ¶, ❡, and §.
class: # adds the provided class to the anchor html
truncate: 64 # truncates the generated ID to the specified character length
You can override any default settings from the page headers:
eg:
---
title: Sample Code With Custom Theme
anchors:
active: true
selectors: .blog h1, .blog h2
---
# Header
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas accumsan porta diam,
nec sagittis odio euismod nec. Etiam eu rutrum eros.
## Sub Header
Proin commodo lobortis elementum.
Integer vel ultrices massa, nec ornare urna. Phasellus tincidunt rutrum dolor, vestibulum
faucibus ligula laoreet id. Donec hendrerit arcu vitae lacus mattis facilisis. Praesent
tortor nibh, pulvinar nec orci ac, rhoncus pharetra nunc.
You can also disable anchors for a particular page if causes issues:
---
title: Sample Code with Highlight disabled
anchors:
active: false
---
# Header
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas accumsan porta diam,
nec sagittis odio euismod nec. Etiam eu rutrum eros.
## Sub Header
Proin commodo lobortis elementum.
Integer vel ultrices massa, nec ornare urna. Phasellus tincidunt rutrum dolor, vestibulum
faucibus ligula laoreet id. Donec hendrerit arcu vitae lacus mattis facilisis. Praesent
tortor nibh, pulvinar nec orci ac, rhoncus pharetra nunc.
> Note: If you want to see this plugin in action, have a look at [Grav Learn Site](http://learn.getgrav.org)

View File

@ -0,0 +1,80 @@
<?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
use \Grav\Common\Grav;
use \Grav\Common\Page\Page;
class AnchorsPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized', 0]
];
}
/**
* Initialize configuration
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
$this->active = false;
} else {
$this->enable([
'onPageInitialized' => ['onPageInitialized', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
}
/**
* Initialize configuration
*/
public function onPageInitialized()
{
$defaults = (array) $this->config->get('plugins.anchors');
/** @var Page $page */
$page = $this->grav['page'];
if (isset($page->header()->anchors)) {
$this->config->set('plugins.anchors', array_merge($defaults, $page->header()->anchors));
}
}
/**
* if enabled on this page, load the JS + CSS and set the selectors.
*/
public function onTwigSiteVariables()
{
if ($this->config->get('plugins.anchors.active')) {
$selectors = $this->config->get('plugins.anchors.selectors', 'h1,h2,h3,h4');
$visible = "visible: '{$this->config->get('plugins.anchors.visible', 'hover')}',";
$placement = "placement: '{$this->config->get('plugins.anchors.placement', 'right')}',";
$icon = $this->config->get('plugins.anchors.icon') ? "icon: '{$this->config->get('plugins.anchors.icon')}'," : '';
$class = $this->config->get('plugins.anchors.class') ? "class: '{$this->config->get('plugins.anchors.class')}'," : '';
$truncate = "truncate: {$this->config->get('plugins.anchors.truncate', 64)}";
$this->grav['assets']->addJs('plugin://anchors/js/anchor.min.js');
$anchors_init = "$(document).ready(function() {
anchors.options = {
$visible
$placement
$icon
$class
$truncate
};
anchors.add('$selectors');
});";
$this->grav['assets']->addInlineJs($anchors_init);
}
}
}

View File

@ -0,0 +1,8 @@
enabled: true # enable or disable the plugin
active: true # active by default, if false then you must activate per-page
selectors: 'h1,h2,h3,h4' # css elements to activate on. Uses jQuery style selectors
placement: right # either "left" or "right"
visible: hover # Active on "hover" or "always" visible
icon: # default link or a specific character like: #, ¶, ❡, and §.
class: # adds the provided class to the anchor html
truncate: 64 # truncates the generated ID to the specified character length

View File

@ -0,0 +1,91 @@
name: Anchors
version: 1.5.1
description: "This plugin provides automatic header anchors via the [anchorjs](http://bryanbraun.github.io/anchorjs) jQuery plugin."
icon: anchor
author:
name: Team Grav
email: devs@getgrav.org
url: http://getgrav.org
homepage: https://github.com/getgrav/grav-plugin-anchors
demo: http://learn.getgrav.org
keywords: anchor, header, plugin, code
bugs: https://github.com/getgrav/grav-plugin-anchors/issues
license: MIT
form:
validation: strict
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
highlight: 1
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
active:
type: toggle
label: Active
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
help: Activate for all pages. If disabled then you must activate per-page
selectors:
type: text
label: Selectors
size: large
default: 'h1,h2,h3,h4'
placeholder: "Anchor Selectors"
help: Comma separated list of header selectors to activate on
placement:
type: select
label: Placement
classes: fancy
help: "Either `left` or `right`"
default: 'right'
options:
'left': 'left'
'right': 'right'
visible:
type: select
label: Visible
classes: fancy
help: "Hover activates on `hover` else will always display"
default: 'hover'
options:
'hover': 'hover'
'always': 'always'
icon:
type: text
label: Icon
size: medium
default: ''
help: "Replace the default link icon with the character(s) provided, e.g. #, ¶, ❡ or §"
class:
type: text
label: Class
size: medium
default: ''
help: "Adds the provided class to the anchor html"
truncate:
type: text
size: x-small
label: Truncate
help: "Truncates the generated ID to the specified character length"
default: 64
validate:
type: number
min: 0

File diff suppressed because one or more lines are too long