Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c7611a753 | |||
| aad88a6546 | |||
| 423e6345e2 | |||
| 46641f5afe | |||
| 3b772d46d4 | |||
| 7ef9862456 |
12
.idea/.gitignore
generated
vendored
12
.idea/.gitignore
generated
vendored
@ -1,12 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Zeppelin ignored files
|
||||
/ZeppelinRemoteNotebooks/
|
||||
16
.idea/checkstyle-idea.xml
generated
16
.idea/checkstyle-idea.xml
generated
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||
<checkstyleVersion>13.0.0</checkstyleVersion>
|
||||
<scanScope>JavaOnly</scanScope>
|
||||
<copyLibs>true</copyLibs>
|
||||
<option name="thirdPartyClasspath" />
|
||||
<option name="activeLocationIds" />
|
||||
<option name="locations">
|
||||
<list>
|
||||
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 iSharkFly.Com
|
||||
|
||||
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.
|
||||
@ -7,7 +7,7 @@
|
||||
## Usage
|
||||
|
||||
```html
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-google-adsense@0.0.1/index.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-google-adsense@latest/index.min.js"></script>
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
31
index.js
31
index.js
@ -1,24 +1,27 @@
|
||||
(function (window) {
|
||||
window.DocsifyAds = {
|
||||
create(caPub) {
|
||||
create(caPub, slot) {
|
||||
return function (hook, vm) {
|
||||
hook.ready(function () {
|
||||
window.DocsifyAds.injectStyle();
|
||||
window.DocsifyAds.injectCarbonStyle();
|
||||
});
|
||||
|
||||
hook.doneEach(function () {
|
||||
window.DocsifyAds.injectScript(caPub);
|
||||
window.DocsifyAds.injectScript(caPub, slot);
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
injectScript(caPub) {
|
||||
injectScript(caPub, slot) {
|
||||
const adEl = document.querySelector("#adsense");
|
||||
const scriptID = "_adsense_js";
|
||||
const sidebarEl = document.querySelector(".sidebar-nav");
|
||||
|
||||
|
||||
if (!adEl && sidebarEl) {
|
||||
let scriptEl = document.querySelector(`#${scriptID}`);
|
||||
let scriptIns = document.querySelector(`#${scriptID}`);
|
||||
let scriptAdPush = document.querySelector(`#${scriptID}`);
|
||||
|
||||
if (scriptEl) {
|
||||
scriptEl = scriptEl.parentNode.removeChild(scriptEl);
|
||||
@ -27,24 +30,36 @@
|
||||
scriptEl.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${caPub}`;
|
||||
scriptEl.async = "async";
|
||||
scriptEl.id = scriptID;
|
||||
scriptEl.crossOrigin = "anonymous";
|
||||
|
||||
scriptIns = document.createElement("ins");
|
||||
scriptIns.className = `adsbygoogle`;
|
||||
scriptIns.style = 'display:inline-block;width:300px;height:150px';
|
||||
scriptIns.setAttribute("data-ad-client", `${caPub}`);
|
||||
scriptIns.setAttribute("data-ad-slot", `${slot}`);
|
||||
|
||||
scriptAdPush = document.createElement("script");
|
||||
scriptAdPush.text = "(adsbygoogle = window.adsbygoogle || []).push({});";
|
||||
|
||||
}
|
||||
|
||||
sidebarEl.insertBefore(scriptEl, sidebarEl.firstChild);
|
||||
sidebarEl.insertBefore(scriptIns, sidebarEl.lastChild);
|
||||
sidebarEl.insertBefore(scriptAdPush, sidebarEl.lastChild);
|
||||
}
|
||||
},
|
||||
|
||||
injectStyle() {
|
||||
injectCarbonStyle() {
|
||||
const styleEl = document.createElement("style");
|
||||
|
||||
styleEl.textContent = `
|
||||
#adsense * {
|
||||
#carbonads * {
|
||||
margin: initial;
|
||||
padding: initial;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
document.head.insertBefore(styleEl, document.querySelector("head style, head link[rel*='stylesheet']"));
|
||||
},
|
||||
};
|
||||
})(window);
|
||||
})(window);
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-plugin-google-adsense ",
|
||||
"version": "0.0.2",
|
||||
"name": "docsify-plugin-google-adsense",
|
||||
"version": "0.0.5",
|
||||
"description": "[docsify](https://docsify.js.org/) plugin to make you easy to join up [google adsense](https://www.google.com/adsense)",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -8,7 +8,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://src.isharkfly.com/iSharkFly-Open/docsify-plugin-adsense.git"
|
||||
"url": "https://github.com/honeymoose/docsify-plugin-google-adsense.git"
|
||||
},
|
||||
"keywords": [
|
||||
"google adsense",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user