New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gitbook-plugin-adsense

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-adsense - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

25

book/plugin.js
require(["gitbook"], function(gitbook) {
var config = config.adsense
, adInsertPoint = document.querySelector('.page-inner section')
, adsByGoogleScript
var adInsertPoint = '.page-inner section'
, ad
;
gitbook.events.bind("start", function(e, config) {
gitbook.events.bind("start", function(e, cnf) {
var config = cnf.adsense
, adsByGoogleScript
;
// Use custom insert point if defined
if (config.element) {
adInsertPoint = config.element;
}
// Inject script to head.

@@ -15,4 +22,3 @@ adsByGoogleScript = document.createElement('script');

// Generate <ins>
// Generate <ins> (ad)
ad = document.createElement('ins');

@@ -24,12 +30,15 @@ ad.style = 'display: block';

ad.setAttribute('data-ad-format', config.format);
adInsertPoint.appendChild(ad);
// Add the ad to the DOM
document.querySelector(adInsertPoint).appendChild(ad);
(adsbygoogle = window.adsbygoogle || []).push({});
});
// I insert ad again when switching pages
gitbook.events.bind("page.change", function() {
if (ad) {
adInsertPoint.appendChild(ad);
document.querySelector(adInsertPoint).appendChild(ad);
}
});
});

@@ -5,3 +5,3 @@ {

"main": "index.js",
"version": "0.0.4",
"version": "0.0.5",
"engines": {

@@ -35,2 +35,7 @@ "gitbook": ">=2.5.1"

"required": true
},
"element": {
"type": "string",
"title": "Element to append the ad to",
"required": false
}

@@ -37,0 +42,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc