docsify-plugin-google-adsense 0.0.1
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/.idea/checkstyle-idea.xml +16 -0
- package/.idea/misc.xml +9 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +29 -0
- package/docsify-plugin-adsense.iml +9 -0
- package/index.js +105 -0
- package/package.json +25 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
|
4
|
+
<checkstyleVersion>13.0.0</checkstyleVersion>
|
|
5
|
+
<scanScope>JavaOnly</scanScope>
|
|
6
|
+
<copyLibs>true</copyLibs>
|
|
7
|
+
<option name="thirdPartyClasspath" />
|
|
8
|
+
<option name="activeLocationIds" />
|
|
9
|
+
<option name="locations">
|
|
10
|
+
<list>
|
|
11
|
+
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
|
12
|
+
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
|
13
|
+
</list>
|
|
14
|
+
</option>
|
|
15
|
+
</component>
|
|
16
|
+
</project>
|
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/docsify-plugin-adsense.iml" filepath="$PROJECT_DIR$/docsify-plugin-adsense.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# docsify-plugin-adsense
|
|
2
|
+
|
|
3
|
+
[docsify](https://docsify.js.org/) plugin to make you easy to join up [google adsense](https://www.google.com/adsense)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/iscod/docsify-plugin-adsense/releases)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-adsense@1/index.min.js"></script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
window.$docsify = {
|
|
15
|
+
plugins: [
|
|
16
|
+
// Change to your adsense ca-pub-xxxx
|
|
17
|
+
DocsifyAds.create('ca-pub-xxxx')
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
See example site: [iscod.github.io](http://iscod.github.io)
|
|
25
|
+
|
|
26
|
+
## ☕️ Donate
|
|
27
|
+
|
|
28
|
+
[](https://iscod.github.io/images/donate/webchat.png)
|
|
29
|
+
[](https://iscod.github.io/images/donate/alipay.png)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
package/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
(function(window) {
|
|
2
|
+
window.DocsifyAds = {
|
|
3
|
+
create(caPub) {
|
|
4
|
+
return function(hook, vm) {
|
|
5
|
+
hook.ready(function() {
|
|
6
|
+
window.DocsifyAds.injectStyle();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
hook.doneEach(function() {
|
|
10
|
+
window.DocsifyAds.injectScript(caPub);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
injectScript(caPub) {
|
|
16
|
+
const adEl = document.querySelector("#adsense");
|
|
17
|
+
const scriptID = "_adsense_js";
|
|
18
|
+
const sidebarEl = document.querySelector(".sidebar-nav");
|
|
19
|
+
|
|
20
|
+
if (!adEl && sidebarEl) {
|
|
21
|
+
let scriptEl = document.querySelector(`#${scriptID}`);
|
|
22
|
+
|
|
23
|
+
if (scriptEl) {
|
|
24
|
+
scriptEl = scriptEl.parentNode.removeChild(scriptEl);
|
|
25
|
+
} else {
|
|
26
|
+
scriptEl = document.createElement("script");
|
|
27
|
+
scriptEl.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${caPub}`;
|
|
28
|
+
scriptEl.async = "async";
|
|
29
|
+
scriptEl.id = scriptID;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
sidebarEl.insertBefore(scriptEl, sidebarEl.firstChild);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
injectStyle() {
|
|
37
|
+
const styleEl = document.createElement("style");
|
|
38
|
+
|
|
39
|
+
styleEl.textContent = `
|
|
40
|
+
#adsense * {
|
|
41
|
+
margin: initial;
|
|
42
|
+
padding: initial;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#adsense {
|
|
46
|
+
max-width: 330px;
|
|
47
|
+
background-color: #fafafa;
|
|
48
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
49
|
+
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial,
|
|
50
|
+
sans-serif;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#adsense a {
|
|
54
|
+
color: inherit;
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#adsense a:hover {
|
|
59
|
+
color: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#adsense span {
|
|
63
|
+
display: block;
|
|
64
|
+
position: relative;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#adsense .adsense-wrap {
|
|
69
|
+
display: flex;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#adsense .adsense-img img {
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#adsense .adsense-text {
|
|
77
|
+
align-self: center;
|
|
78
|
+
margin-bottom: 20px;
|
|
79
|
+
padding: 8px 10px;
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
line-height: 1.5;
|
|
82
|
+
text-align: left;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#adsense .adsense-poweredby {
|
|
86
|
+
display: block;
|
|
87
|
+
position: absolute;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
right: 0;
|
|
90
|
+
padding: 6px 8px;
|
|
91
|
+
border-top-left-radius: 3px;
|
|
92
|
+
background-color: #f1f1f1;
|
|
93
|
+
font-size: 8px;
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
line-height: 1;
|
|
96
|
+
letter-spacing: 0.5px;
|
|
97
|
+
text-align: center;
|
|
98
|
+
text-transform: uppercase;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
document.head.insertBefore(styleEl, document.querySelector("head style, head link[rel*='stylesheet']"));
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
})(window);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docsify-plugin-google-adsense ",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "[docsify](https://docsify.js.org/) plugin to make you easy to join up [google adsense](https://www.google.com/adsense)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://src.isharkfly.com/iSharkFly-Open/docsify-plugin-adsense.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"google adsense",
|
|
15
|
+
"adsense",
|
|
16
|
+
"docsify",
|
|
17
|
+
"plugin"
|
|
18
|
+
],
|
|
19
|
+
"author": "iSharkFly",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://src.isharkfly.com/iSharkFly-Open/docsify-plugin-adsense"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://src.isharkfly.com/iSharkFly-Open/docsify-plugin-adsense#readme"
|
|
25
|
+
}
|