@markbattistella/docsify-sidebarfooter 3.2.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -70
- package/dist/docsify-sidebar.js +220 -0
- package/dist/docsify-sidebar.min.js +2 -0
- package/package.json +7 -3
- package/dist/docsify-sidebarFooter.js +0 -181
- package/dist/docsify-sidebarFooter.min.js +0 -6
package/README.md
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# docsify.js sidebar footer
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
   
|
|
6
|
-
|
|
7
|
-
[](https://www.paypal.me/markbattistella/6AUD) [](https://www.buymeacoffee.com/markbattistella)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
:sparkles: [](https://markbattistella.github.io/docsify-sidebarFooter/) :sparkles:
|
|
12
|
-
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
This plugin is designed to create a footer area at the base of your sidebar where you can list a copyright year (range), your name or company with a URL, and links to a privacy policy, terms of service, and a cookies policy.
|
|
18
|
-
|
|
19
|
-
---
|
|
3
|
+
This plugin enhances your website's sidebar or page by creating a footer area where you can display important information. It automatically updates the copyright year or range, allows you to include your name or company with a URL, and provides links to a privacy policy, terms of service, and cookies policy pages. By utilising this plugin, you can easily showcase relevant legal information, personalise your website, and promote transparency and compliance.
|
|
20
4
|
|
|
21
5
|
## Installation
|
|
22
6
|
|
|
@@ -24,7 +8,7 @@ This plugin is designed to create a footer area at the base of your sidebar wher
|
|
|
24
8
|
|
|
25
9
|
Assuming you have a working [docsify](https://docsify.js.org/) framework set up, it is easy to use the plugin.
|
|
26
10
|
|
|
27
|
-
1. Add the following script
|
|
11
|
+
1. Add one of the following script tags to your `index.html` via either CDN or downloading it and using it locally:
|
|
28
12
|
|
|
29
13
|
```html
|
|
30
14
|
<!-- unpkg.com -->
|
|
@@ -34,7 +18,7 @@ Assuming you have a working [docsify](https://docsify.js.org/) framework set up,
|
|
|
34
18
|
<script src="https://cdn.jsdelivr.net/npm/@markbattistella/docsify-sidebarfooter@latest"></script>
|
|
35
19
|
|
|
36
20
|
<!-- locally -->
|
|
37
|
-
<script src="docsify-
|
|
21
|
+
<script src="docsify-sidebar.min.js"></script>
|
|
38
22
|
```
|
|
39
23
|
|
|
40
24
|
1. In docsify setup configure the plugin:
|
|
@@ -43,88 +27,153 @@ Assuming you have a working [docsify](https://docsify.js.org/) framework set up,
|
|
|
43
27
|
<script>
|
|
44
28
|
window.$docsify = {
|
|
45
29
|
autoFooter: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
|
|
31
|
+
// the name you wish to display as the copyright holder
|
|
32
|
+
name: String,
|
|
33
|
+
|
|
34
|
+
// the URL (personal or company) which clicking the `name` goes to
|
|
35
|
+
url: String,
|
|
36
|
+
|
|
37
|
+
// the start year of copyright
|
|
38
|
+
copyYear: String,
|
|
39
|
+
|
|
40
|
+
// show the privacy policy link
|
|
41
|
+
policy: Bool | String,
|
|
42
|
+
|
|
43
|
+
// show the terms of service link
|
|
44
|
+
terms: Bool | String,
|
|
45
|
+
|
|
46
|
+
// show the cookies policy link
|
|
47
|
+
cookies: Bool | String,
|
|
48
|
+
|
|
49
|
+
// use your own css styles or the built in ones
|
|
50
|
+
customStyle: Bool | String
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
53
|
</script>
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
Or if you're using `npm` to manage your dependencies:
|
|
56
|
+
### Additional files
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
npm install @markbattistella/docsify-sidebarfooter
|
|
63
|
-
```
|
|
58
|
+
#### Default
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
If you set the `policy`, `terms`, or `cookies` options to `true` the URL links for those pages will look for the markdown files directly next to the `index.html` file:
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
```js
|
|
63
|
+
// ... other config
|
|
64
|
+
policy: true,
|
|
65
|
+
terms: true,
|
|
66
|
+
cookies: true,
|
|
67
|
+
// ... other config
|
|
68
|
+
```
|
|
68
69
|
|
|
69
70
|
```md
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|-- _cookies.md
|
|
71
|
+
- index.html --> https://your-awesome-site.com/#/
|
|
72
|
+
- _policy.md --> https://your-awesome-site.com/#/_policy
|
|
73
|
+
- _terms.md --> https://your-awesome-site.com/#/_terms
|
|
74
|
+
- _cookies.md --> https://your-awesome-site.com/#/_cookies
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
#### Sub-folder
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
However, if you enter a string it will append that to the base URL of your website:
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
| cookies | N | Bool or String | path to `cookies` |
|
|
81
|
+
```js
|
|
82
|
+
// ... other config
|
|
83
|
+
policy: 'site/policy',
|
|
84
|
+
terms: 'site/terms',
|
|
85
|
+
cookies: 'site/cookies',
|
|
86
|
+
// ... other config
|
|
87
|
+
```
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
```md
|
|
90
|
+
- index.html --> https://your-awesome-site.com/#/
|
|
91
|
+
- site/
|
|
92
|
+
\__ policy.md --> https://your-awesome-site.com/#/site/policy
|
|
93
|
+
\__ terms.md --> https://your-awesome-site.com/#/site/terms
|
|
94
|
+
\__ cookies.md --> https://your-awesome-site.com/#/site/cookies
|
|
95
|
+
```
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
#### External links
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
<div id="mb-footer"></div>
|
|
96
|
-
```
|
|
99
|
+
If you host your policy, terms, or cookies messages on an external website (or need to link to a parent company policy) you can add them in as the full URL:
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
```js
|
|
102
|
+
// ... other config
|
|
103
|
+
policy: "https://my-other-website.com/policy",
|
|
104
|
+
terms: "https://my-other-website.com/terms",
|
|
105
|
+
cookies: "https://my-other-website.com/cookies",
|
|
106
|
+
// ... other config
|
|
107
|
+
```
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
These will open those pages in a new tab directly.
|
|
101
110
|
|
|
102
|
-
|
|
111
|
+
## Configuration
|
|
103
112
|
|
|
104
|
-
|
|
113
|
+
There are some options available for the `docsify-sidebarfooter`:
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
| Setting | Type | Options |
|
|
116
|
+
|---------------|----------------|------------------------------------|
|
|
117
|
+
| `name` | String | your name or company |
|
|
118
|
+
| `url` | String | url you want the `name` to link to |
|
|
119
|
+
| `copyYear` | String | first year of copyright |
|
|
120
|
+
| `policy` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_policy.md`<br/>- a custom string will direct to that |
|
|
121
|
+
| `terms` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_terms.md`<br/>- a custom string will direct to that |
|
|
122
|
+
| `cookies` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_cookies.md`<br/>- a custom string will direct to that |
|
|
123
|
+
| `customStyle` | Bool or String | - `false` uses in-built css (sidebar styled)<br/>- `true` applies no styles, you can create your own<br/>- `sidebar` uses the in-built css designed for the sidebar<br/>- `body` uses the in-built css designed for the body |
|
|
107
124
|
|
|
108
|
-
|
|
125
|
+
## Usage
|
|
109
126
|
|
|
110
|
-
|
|
127
|
+
### Sidebar
|
|
111
128
|
|
|
112
|
-
|
|
129
|
+
At the bottom of your `_sidebar.md` file add the following code:
|
|
113
130
|
|
|
114
|
-
|
|
131
|
+
```html
|
|
132
|
+
<footer id="mb-footer"></footer>
|
|
133
|
+
```
|
|
115
134
|
|
|
116
|
-
|
|
135
|
+
### Body
|
|
117
136
|
|
|
118
|
-
|
|
137
|
+
Under the `<div id="app"></div>` in your `index.html` file, add the following code:
|
|
119
138
|
|
|
120
|
-
|
|
139
|
+
```html
|
|
140
|
+
<footer id="mb-footer"></footer>
|
|
141
|
+
```
|
|
121
142
|
|
|
122
|
-
|
|
143
|
+
## Styling
|
|
123
144
|
|
|
124
|
-
|
|
145
|
+
The links container is sectioned into different classes for you to customise as much (or little) as you wish.
|
|
125
146
|
|
|
126
|
-
|
|
147
|
+
```html
|
|
148
|
+
<footer id="mb-footer">
|
|
149
|
+
<div class="footer-container">
|
|
150
|
+
<div class="footer-text">
|
|
151
|
+
<span class="footer-text-copyright">
|
|
152
|
+
Copyright © YYYY-YYYY
|
|
153
|
+
</span>
|
|
154
|
+
<span class="footer-text-author">
|
|
155
|
+
<a target="_blank" href="">Your website name</a>
|
|
156
|
+
</span>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="footer-link">
|
|
159
|
+
<span class="footer-links-policy">
|
|
160
|
+
<a href="">Policy</a>
|
|
161
|
+
</span>
|
|
162
|
+
<span class="footer-links-terms">
|
|
163
|
+
<a href="">Terms</a>
|
|
164
|
+
</span>
|
|
165
|
+
<span class="footer-links-cookies">
|
|
166
|
+
<a href="">Cookies</a>
|
|
167
|
+
</span>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</footer>
|
|
171
|
+
```
|
|
127
172
|
|
|
128
|
-
|
|
173
|
+
## Contributing
|
|
129
174
|
|
|
175
|
+
1. Clone the repo:<br>`git clone https://github.com/markbattistella/docsify-sidebarFooter.git`
|
|
176
|
+
2. Create your feature branch:<br>`git checkout -b my-feature`
|
|
177
|
+
3. Commit your changes:<br>`git commit -am 'Add some feature'`
|
|
178
|
+
4. `Push` to the branch:<br>`git push origin my-new-feature`
|
|
130
179
|
5. Submit the `pull` request
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/*! docsify-sidebarFooter.js v5.0.0 | (c) Mark Battistella */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// MARK: - check if object exists and is not empty
|
|
5
|
+
function doesObjectExists(obj) {
|
|
6
|
+
return (
|
|
7
|
+
obj !== undefined &&
|
|
8
|
+
obj !== null &&
|
|
9
|
+
obj.constructor === Object &&
|
|
10
|
+
Object.keys(obj).length > 0
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// MARK: - update the `options` object
|
|
16
|
+
function getFooter(options) {
|
|
17
|
+
|
|
18
|
+
// -- get this year
|
|
19
|
+
let date = new Date().getFullYear();
|
|
20
|
+
|
|
21
|
+
// -- update the variables
|
|
22
|
+
options.name ? options.name : null;
|
|
23
|
+
options.url ? options.url : null;
|
|
24
|
+
options.copyYear ? options.copyYear : date;
|
|
25
|
+
options.policy ? options.policy : false;
|
|
26
|
+
options.terms ? options.terms : false;
|
|
27
|
+
options.cookies ? options.cookies : false;
|
|
28
|
+
options.customStyle ? options.customStyle : false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// defaults - and setup
|
|
33
|
+
const options = {
|
|
34
|
+
name: '',
|
|
35
|
+
url: '',
|
|
36
|
+
copyYear: '',
|
|
37
|
+
policy: true,
|
|
38
|
+
terms: true,
|
|
39
|
+
cookies: true,
|
|
40
|
+
customStyle: false
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// -- run the function
|
|
45
|
+
function autoFooter(hook, vm) {
|
|
46
|
+
|
|
47
|
+
// MARK: run with docsify init
|
|
48
|
+
hook.init(function () {
|
|
49
|
+
|
|
50
|
+
// -- initialise the options
|
|
51
|
+
getFooter(options);
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// -- check the options for bool or string
|
|
55
|
+
if (typeof options.customStyle === "boolean" || typeof options.customStyle === "string") {
|
|
56
|
+
|
|
57
|
+
// -- dont continue if using custom styles
|
|
58
|
+
if ((typeof options.customStyle === "boolean" && options.customStyle === true)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// -- global style
|
|
63
|
+
let style = `#mb-footer { border-top: 1px solid; font-size: 0.8em; line-height: 1.5; transition: all var(--sidebar-transition-duration) ease-out; }`;
|
|
64
|
+
|
|
65
|
+
// -- custom style for sidebar
|
|
66
|
+
if ((typeof options.customStyle === "boolean" && options.customStyle === false) ||
|
|
67
|
+
(options.customStyle === "sidebar")
|
|
68
|
+
) {
|
|
69
|
+
style += `#mb-footer { padding-top: 1.5rem; margin-top: 1.5rem; } #mb-footer .footer-text, #mb-footer .footer-text a { font-weight: bold; }`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// -- custom style for sidebar
|
|
73
|
+
if (options.customStyle === "body") {
|
|
74
|
+
|
|
75
|
+
// --> if there is a sidebar
|
|
76
|
+
if( $docsify.loadSidebar || $docsify.loadSidebar === null || !$docsify.hideSidebar ) {
|
|
77
|
+
style += `body #mb-footer { margin-left: var(--sidebar-width); } body.close #mb-footer { margin-left: 0; }`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// --> standard
|
|
81
|
+
style += `#mb-footer { padding: 1.5rem; } #mb-footer .footer-container { max-width: var(--content-max-width); margin: 0 auto; } #mb-footer .footer-container { display: grid; grid-template-columns: auto auto; } #mb-footer .footer-container a { margin-left: 2em; } #mb-footer .footer-link { text-align: right; }`;
|
|
82
|
+
|
|
83
|
+
// --> media queries
|
|
84
|
+
style += `@media (max-width: 680px) { #mb-footer .footer-container { grid-template-columns: auto; }#mb-footer .footer-text, #mb-footer .footer-link { text-align: center; } } @media (max-width: 400px) { #mb-footer .footer-text, #mb-footer .footer-link { text-align: left; } #mb-footer span { display: block; } #mb-footer .footer-container a { margin: 0; } }`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// create the variables
|
|
88
|
+
const head = document.querySelector("head"),
|
|
89
|
+
sheet = document.createElement("style");
|
|
90
|
+
|
|
91
|
+
// add to the page
|
|
92
|
+
head.appendChild(sheet);
|
|
93
|
+
sheet.appendChild(document.createTextNode(style));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// MARK: after the HTML appended to DOM
|
|
99
|
+
hook.doneEach(function () {
|
|
100
|
+
|
|
101
|
+
// set the scope
|
|
102
|
+
const contentScope = document.getElementById("mb-footer");
|
|
103
|
+
|
|
104
|
+
// if the scope is empty
|
|
105
|
+
if (!contentScope) { return; }
|
|
106
|
+
|
|
107
|
+
//
|
|
108
|
+
// MARK: - add the info
|
|
109
|
+
//
|
|
110
|
+
|
|
111
|
+
// get the date
|
|
112
|
+
const date = new Date().getFullYear(),
|
|
113
|
+
|
|
114
|
+
// -- url building
|
|
115
|
+
baseUrl = window.location.origin + window.location.pathname + "#/",
|
|
116
|
+
|
|
117
|
+
// -- check if link is internal or external
|
|
118
|
+
isExternalLink = (url) => {
|
|
119
|
+
const tmp = document.createElement('a');
|
|
120
|
+
tmp.href = url;
|
|
121
|
+
return tmp.host !== window.location.host;
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// -- link generator
|
|
125
|
+
createLink = (option, linkText, defaultLink, className) => {
|
|
126
|
+
let result = "";
|
|
127
|
+
|
|
128
|
+
// --> only accept bool and string
|
|
129
|
+
if (typeof option === "boolean" || typeof option === "string") {
|
|
130
|
+
|
|
131
|
+
// --> if bool, and true
|
|
132
|
+
if (typeof option === "boolean" && option) {
|
|
133
|
+
|
|
134
|
+
// --> use the default options
|
|
135
|
+
result = `<a href="${baseUrl + defaultLink}">${linkText}</a>`;
|
|
136
|
+
|
|
137
|
+
// --> if it is a string url
|
|
138
|
+
} else if (typeof option === "string") {
|
|
139
|
+
|
|
140
|
+
// --> is the link external
|
|
141
|
+
result = isExternalLink(option)
|
|
142
|
+
|
|
143
|
+
// --> if external, add the _blank
|
|
144
|
+
? `<a target="_blank" href="${option}">${linkText}</a>`
|
|
145
|
+
|
|
146
|
+
// --> if internal, then add the page name
|
|
147
|
+
: `<a href="${baseUrl + option}">${linkText}</a>`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// --> if the result is not empty
|
|
152
|
+
if (result) {
|
|
153
|
+
|
|
154
|
+
// --> create the class name
|
|
155
|
+
const classname = `${className.toLowerCase().replace(/\s+/g, '-')}`;
|
|
156
|
+
|
|
157
|
+
// -- compile the elements
|
|
158
|
+
result = `<span class="${classname}">${result}</span>`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return result;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// MARK: - html elements
|
|
165
|
+
|
|
166
|
+
divclose = `</div>`,
|
|
167
|
+
|
|
168
|
+
// -- divs
|
|
169
|
+
div1open = `<div class="footer-container">`,
|
|
170
|
+
div2open = `<div class="footer-text">`,
|
|
171
|
+
div3open = `<div class="footer-link">`,
|
|
172
|
+
|
|
173
|
+
// -- text
|
|
174
|
+
copyright = (
|
|
175
|
+
`<span class="footer-text-copyright">Copyright © ${
|
|
176
|
+
options.copyYear && options.copyYear <= date
|
|
177
|
+
? `${options.copyYear}${options.copyYear < date ? "-" + date : ""}`
|
|
178
|
+
: date
|
|
179
|
+
}</span>`
|
|
180
|
+
),
|
|
181
|
+
author = createLink( options.url, options.name, '', 'footer-text-author'),
|
|
182
|
+
|
|
183
|
+
// -- links
|
|
184
|
+
policyURL = createLink(options.policy, 'Policy', '_policy', 'footer-links-policy'),
|
|
185
|
+
termsURL = createLink(options.terms, 'Terms', '_terms', 'footer-links-terms' ),
|
|
186
|
+
cookiesURL = createLink(options.cookies, 'Cookies', '_cookies', 'footer-links-cookies'),
|
|
187
|
+
|
|
188
|
+
// output
|
|
189
|
+
output = (
|
|
190
|
+
div1open +
|
|
191
|
+
div2open + copyright + author + divclose +
|
|
192
|
+
div3open + policyURL + termsURL + cookiesURL + divclose +
|
|
193
|
+
divclose
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
contentScope.innerHTML = output;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
// MARK: - check options is defined and not empty
|
|
202
|
+
if (typeof options !== 'undefined' && doesObjectExists(options)) {
|
|
203
|
+
|
|
204
|
+
// -- find footer plugin options
|
|
205
|
+
window.$docsify.autoFooter = Object.assign(
|
|
206
|
+
options,
|
|
207
|
+
window.$docsify.autoFooter
|
|
208
|
+
);
|
|
209
|
+
window.$docsify.plugins = [].concat(autoFooter, window.$docsify.plugins);
|
|
210
|
+
|
|
211
|
+
} else {
|
|
212
|
+
|
|
213
|
+
// -- log the error
|
|
214
|
+
console.error(
|
|
215
|
+
"ERROR: sidebar-footer configuration not set" + "\n" +
|
|
216
|
+
"This error appears when:" + "\n" +
|
|
217
|
+
" - the `autoSidebar` not found index.html file" + "\n" +
|
|
218
|
+
" - the `autoSidebar` is empty"
|
|
219
|
+
);
|
|
220
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* docsify-sidebarFooter.js v5.0.0 | (c) Mark Battistella */
|
|
2
|
+
"use strict";function doesObjectExists(o){return null!=o&&o.constructor===Object&&0<Object.keys(o).length}function getFooter(o){(new Date).getFullYear();o.name,o.url,o.copyYear,o.policy,o.terms,o.cookies,o.customStyle}var options={name:"",url:"",copyYear:"",policy:!0,terms:!0,cookies:!0,customStyle:!1};function autoFooter(o,t){o.init(function(){var o,t,e;getFooter(options),"boolean"!=typeof options.customStyle&&"string"!=typeof options.customStyle||"boolean"==typeof options.customStyle&&!0===options.customStyle||(o="#mb-footer { border-top: 1px solid; font-size: 0.8em; line-height: 1.5; transition: all var(--sidebar-transition-duration) ease-out; }",("boolean"==typeof options.customStyle&&!1===options.customStyle||"sidebar"===options.customStyle)&&(o+="#mb-footer { padding-top: 1.5rem; margin-top: 1.5rem; } #mb-footer .footer-text, #mb-footer .footer-text a { font-weight: bold; }"),"body"===options.customStyle&&(!$docsify.loadSidebar&&null!==$docsify.loadSidebar&&$docsify.hideSidebar||(o+="body #mb-footer { margin-left: var(--sidebar-width); } body.close #mb-footer { margin-left: 0; }"),o+="#mb-footer { padding: 1.5rem; } #mb-footer .footer-container { max-width: var(--content-max-width); margin: 0 auto; } #mb-footer .footer-container { display: grid; grid-template-columns: auto auto; } #mb-footer .footer-container a { margin-left: 2em; } #mb-footer .footer-link { text-align: right; }@media (max-width: 680px) { #mb-footer .footer-container { grid-template-columns: auto; }#mb-footer .footer-text, #mb-footer .footer-link { text-align: center; } } @media (max-width: 400px) { #mb-footer .footer-text, #mb-footer .footer-link { text-align: left; } #mb-footer span { display: block; } #mb-footer .footer-container a { margin: 0; } }"),t=document.querySelector("head"),e=document.createElement("style"),t.appendChild(e),e.appendChild(document.createTextNode(o)))}),o.doneEach(function(){var r,a,o,t,e,n,i,s,c=document.getElementById("mb-footer");c&&(t=(new Date).getFullYear(),r=window.location.origin+window.location.pathname+"#/",a=function(o){var t=document.createElement("a");return t.href=o,t.host!==window.location.host},s=function(o,t,e,n){var i="";return"boolean"!=typeof o&&"string"!=typeof o||("boolean"==typeof o&&o?i='<a href="'.concat(r+e,'">').concat(t,"</a>"):"string"==typeof o&&(i=(a(o)?'<a target="_blank" href="'.concat(o,'">'):'<a href="'.concat(r+o,'">')).concat(t,"</a>"))),i&&(e="".concat(n.toLowerCase().replace(/\s+/g,"-")),i='<span class="'.concat(e,'">').concat(i,"</span>")),i},o="</div>",t='<span class="footer-text-copyright">Copyright © '.concat(options.copyYear&&options.copyYear<=t?"".concat(options.copyYear).concat(options.copyYear<t?"-"+t:""):t,"</span>"),e=s(options.url,options.name,"","footer-text-author"),n=s(options.policy,"Policy","_policy","footer-links-policy"),i=s(options.terms,"Terms","_terms","footer-links-terms"),s=s(options.cookies,"Cookies","_cookies","footer-links-cookies"),c.innerHTML='<div class="footer-container"><div class="footer-text">'+t+e+o+'<div class="footer-link">'+n+i+s+o+o)})}void 0!==options&&doesObjectExists(options)?(window.$docsify.autoFooter=Object.assign(options,window.$docsify.autoFooter),window.$docsify.plugins=[].concat(autoFooter,window.$docsify.plugins)):console.error("ERROR: sidebar-footer configuration not set\nThis error appears when:\n - the `autoSidebar` not found index.html file\n - the `autoSidebar` is empty");
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markbattistella/docsify-sidebarfooter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Add a footer notice for Docsify.js",
|
|
5
|
-
"main": "dist/docsify-
|
|
5
|
+
"main": "dist/docsify-sidebar.min.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/markbattistella/docsify-sidebarFooter.git"
|
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/markbattistella/docsify-sidebarFooter/issues"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://footer.docsify.markbattistella.com",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"footer",
|
|
18
18
|
"copyright",
|
|
19
19
|
"privacy policy",
|
|
20
20
|
"terms of service",
|
|
21
|
+
"terms and conditions",
|
|
22
|
+
"terms",
|
|
23
|
+
"policy",
|
|
24
|
+
"cookie",
|
|
21
25
|
"cookie policy",
|
|
22
26
|
"docsify",
|
|
23
27
|
"docsify plugin"
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/*! docsify-sidebarFooter.js v3.2.1 | (c) Mark Battistella */
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
function getFooter( footerOptions ) {
|
|
5
|
-
|
|
6
|
-
// if it is empty
|
|
7
|
-
if(
|
|
8
|
-
!footerOptions.name ||
|
|
9
|
-
!footerOptions.copyYear
|
|
10
|
-
) {
|
|
11
|
-
return 'No config set'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// get this year
|
|
15
|
-
let date = new Date().getFullYear();
|
|
16
|
-
|
|
17
|
-
// create the array variables
|
|
18
|
-
let name = footerOptions.name ?
|
|
19
|
-
footerOptions.name : null;
|
|
20
|
-
let url = footerOptions.url ?
|
|
21
|
-
footerOptions.url : null;
|
|
22
|
-
let copyYear = footerOptions.copyYear ?
|
|
23
|
-
footerOptions.copyYear : date;
|
|
24
|
-
let policy = footerOptions.policy ?
|
|
25
|
-
footerOptions.policy : null;
|
|
26
|
-
let terms = footerOptions.terms ?
|
|
27
|
-
footerOptions.terms : null;
|
|
28
|
-
let cookies = footerOptions.cookies ?
|
|
29
|
-
footerOptions.cookies : null;
|
|
30
|
-
|
|
31
|
-
// build the array
|
|
32
|
-
var outputArray = [ name, url, copyYear, policy, terms, cookies ];
|
|
33
|
-
|
|
34
|
-
return outputArray;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// defaults - and setup
|
|
38
|
-
const footerOptions = {
|
|
39
|
-
name: '', // required
|
|
40
|
-
url: '', // optional
|
|
41
|
-
copyYear: '', // required
|
|
42
|
-
policy: '', // optional
|
|
43
|
-
terms: '', // optional
|
|
44
|
-
cookies: '' // optional
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// the function
|
|
49
|
-
function autoFooter( hook, vm ) {
|
|
50
|
-
|
|
51
|
-
// after initial completion
|
|
52
|
-
hook.doneEach(function() {
|
|
53
|
-
|
|
54
|
-
// get the variables from the cofig
|
|
55
|
-
const footerOptionsArray = getFooter( footerOptions ),
|
|
56
|
-
|
|
57
|
-
// create them easier to read
|
|
58
|
-
arrayName = footerOptionsArray[0],
|
|
59
|
-
arrayUrl = footerOptionsArray[1],
|
|
60
|
-
arrayCopyYear = footerOptionsArray[2],
|
|
61
|
-
arrayPolicy = footerOptionsArray[3],
|
|
62
|
-
arrayTerms = footerOptionsArray[4],
|
|
63
|
-
arrayCookies = footerOptionsArray[5];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
// MARK: - set the scope of the autoFooter
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
// set the scope
|
|
71
|
-
const contentScope = document.getElementById("mb-footer");
|
|
72
|
-
|
|
73
|
-
// if the scope is empty
|
|
74
|
-
if( !contentScope ) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// if the array doesnt have the minimum entries
|
|
79
|
-
if( footerOptionsArray === "No config set" ) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
// MARK: - add the info
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
// get the date
|
|
89
|
-
var date = new Date().getFullYear(),
|
|
90
|
-
|
|
91
|
-
// url building
|
|
92
|
-
baseUrl = window.location.origin + window.location.pathname + "#/",
|
|
93
|
-
|
|
94
|
-
// divider
|
|
95
|
-
a = "<hr/>",
|
|
96
|
-
|
|
97
|
-
// create the footer
|
|
98
|
-
b = "<div style='font-size:70%;'>",
|
|
99
|
-
|
|
100
|
-
// copyright data
|
|
101
|
-
c = "<div>",
|
|
102
|
-
|
|
103
|
-
d = "© ",
|
|
104
|
-
|
|
105
|
-
// get the start copy year
|
|
106
|
-
// --> if is empty OR greater than current year
|
|
107
|
-
e = ( (arrayCopyYear == null) || (arrayCopyYear > date) ? date : arrayCopyYear ),
|
|
108
|
-
|
|
109
|
-
// get the current year
|
|
110
|
-
// --> do we add the "-YYYY" range or not
|
|
111
|
-
f = ( (arrayCopyYear != null) && (arrayCopyYear < date) ? "—" + date : ""),
|
|
112
|
-
|
|
113
|
-
g = "</div>",
|
|
114
|
-
|
|
115
|
-
// company details
|
|
116
|
-
h = ( arrayUrl == null ? "<div>" :
|
|
117
|
-
"<a target='_blank' href='" + arrayUrl + "'>" ),
|
|
118
|
-
|
|
119
|
-
i = arrayName,
|
|
120
|
-
|
|
121
|
-
j = ( arrayUrl === "" ? "</div>" : "</a>" ),
|
|
122
|
-
|
|
123
|
-
// policy details
|
|
124
|
-
k = ( typeof arrayPolicy === "boolean" ||
|
|
125
|
-
typeof arrayPolicy === "string"
|
|
126
|
-
) ?
|
|
127
|
-
( typeof arrayPolicy === "boolean" ?
|
|
128
|
-
"<a href='" + baseUrl + "_policy'>Policy</a>"
|
|
129
|
-
:
|
|
130
|
-
"<a href='" + baseUrl + arrayPolicy + "'>Policy</a>"
|
|
131
|
-
) : "",
|
|
132
|
-
|
|
133
|
-
// terms details
|
|
134
|
-
l = ( typeof arrayTerms === "boolean" ||
|
|
135
|
-
typeof arrayTerms === "string"
|
|
136
|
-
) ?
|
|
137
|
-
( typeof arrayTerms === "boolean" ?
|
|
138
|
-
"<a href='" + baseUrl + "_terms'>Terms</a>"
|
|
139
|
-
:
|
|
140
|
-
"<a href='" + baseUrl + arrayTerms + "'>Terms</a>"
|
|
141
|
-
) : "",
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// cookies details
|
|
145
|
-
m = ( typeof arrayCookies === "boolean" ||
|
|
146
|
-
typeof arrayCookies === "string"
|
|
147
|
-
) ?
|
|
148
|
-
( typeof arrayTerms === "boolean" ?
|
|
149
|
-
"<a href='" + baseUrl + "_cookies'>Cookies</a>"
|
|
150
|
-
:
|
|
151
|
-
"<a href='" + baseUrl + arrayCookies + "'>Cookies</a>"
|
|
152
|
-
) : "",
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
n = "</div>";
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const output =
|
|
160
|
-
a + // ------------------
|
|
161
|
-
b + c + //
|
|
162
|
-
d + e + f + // (c) 1990-2020
|
|
163
|
-
g + //
|
|
164
|
-
h + i + j + // Company Name
|
|
165
|
-
k + // Policy
|
|
166
|
-
l + // Terms
|
|
167
|
-
m + // Cookies
|
|
168
|
-
n; //
|
|
169
|
-
|
|
170
|
-
contentScope.innerHTML = output;
|
|
171
|
-
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// find footer plugin options
|
|
177
|
-
window.$docsify.autoFooter = Object.assign(
|
|
178
|
-
footerOptions,
|
|
179
|
-
window.$docsify.autoFooter
|
|
180
|
-
);
|
|
181
|
-
window.$docsify.plugins = [].concat(autoFooter, window.$docsify.plugins);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
docsify-sidebarFooter.js v3.2.1 | (c) Mark Battistella */
|
|
3
|
-
function getFooter(a){if(!a.name||!a.copyYear)return"No config set";var k=(new Date).getFullYear();return[a.name?a.name:null,a.url?a.url:null,a.copyYear?a.copyYear:k,a.policy?a.policy:null,a.terms?a.terms:null,a.cookies?a.cookies:null]}var footerOptions={name:"",url:"",copyYear:"",policy:"",terms:"",cookies:""};
|
|
4
|
-
function autoFooter(a,k){a.doneEach(function(){var b=getFooter(footerOptions),m=b[0],g=b[1],d=b[2],f=b[3],e=b[4],h=b[5],l=document.getElementById("mb-footer");if(l&&"No config set"!==b){b=(new Date).getFullYear();var c=window.location.origin+window.location.pathname+"#/";l.innerHTML="<hr/><div style='font-size:70%;'><div>© "+(null==d||d>b?b:d)+(null!=d&&d<b?"—"+b:"")+"</div>"+(null==g?"<div>":"<a target='_blank' href='"+g+"'>")+m+(""===g?"</div>":"</a>")+("boolean"===typeof f||"string"===
|
|
5
|
-
typeof f?"boolean"===typeof f?"<a href='"+c+"_policy'>Policy</a>":"<a href='"+c+f+"'>Policy</a>":"")+("boolean"===typeof e||"string"===typeof e?"boolean"===typeof e?"<a href='"+c+"_terms'>Terms</a>":"<a href='"+c+e+"'>Terms</a>":"")+("boolean"===typeof h||"string"===typeof h?"boolean"===typeof e?"<a href='"+c+"_cookies'>Cookies</a>":"<a href='"+c+h+"'>Cookies</a>":"")+"</div>"}})}window.$docsify.autoFooter=Object.assign(footerOptions,window.$docsify.autoFooter);
|
|
6
|
-
window.$docsify.plugins=[].concat(autoFooter,window.$docsify.plugins);
|