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

gitbook-plugin-lock

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-lock - npm Package Compare versions

Comparing version 0.0.65 to 0.0.66

182

assets/lock.js

@@ -1,91 +0,91 @@

require(['gitbook', 'jQuery'], function(gitbook, $) {
let tokenValue;
let wechatName;
let wechatQr;
let verificationCode;
let thisCode;
let thisValue;
const lockTokenKey = "lock-token"
function insertPageLock(e) {
// console.log(e.context)
// let s = e.context.("%pageLock%")
// console.log(s,e.context)
let authToken= localStorage.getItem(lockTokenKey)
if (authToken!==isNaN(0)||authToken!==""||authToken!==undefined) {
for (let i in verificationCode) {
if (verificationCode[i]["value"] === authToken) {
return true;
}
}
}
const cla = document.getElementById("book-search-results");
const article = cla, height = article.scrollHeight;
// 文章隐藏后的高度
const halfHeight = height * 0.5;
cla.style.height= halfHeight + 'px';
cla.style.overflow = 'hidden'
const html = '<div id="read-more-wrap" style="position: absolute; bottom: 0; z-index: 9999; width: 100%; margin-top: -100px; font-family: PingFangSC-Regular, sans-serif;">' +
'<div id="read-more-mask" style="position: relative; height: 200px; background: -webkit-gradient(linear, 0 0%, 0 100%, from(rgba(255, 255, 255, 0)), to(rgb(255, 255, 255)));"></div>' +
'<div class="info" style="position: absolute;left: 50%;top: 70%;bottom: 30px;transform: translate(-50%, -50%);font-size: 15px;text-align: center;background: -webkit-gradient(linear, 0 0%, 0 100%, from(rgba(255, 255, 255, 0)), to(rgb(255, 255, 255)));">\n' +
' <div>扫码或搜索:<span style="color: #E9405A; font-weight: bold;">'+wechatName+'</span></div>\n' +
' <div>\n' +
' <span>发送 </span><span class="token" style="color: #e9415a; font-weight: bold; font-size: 17px; margin-bottom: 45px;">'+thisCode+'</span>\n' +
' </div>\n' +
' <div>\n' +
' 即可<span style="color: #e9415a; font-weight: bold;">立即永久</span>解锁本站全部文章\n' +
' </div>\n' +
' <div id="btw-modal-input-code" style="margin-top: 20px; background: rgb(255, 255, 255);"><input '+
' id="btw-modal-input" type="text" maxLength="10" placeholder="请输入验证码" '+
' style="width: 160px; height: 32px; line-height: 32px; padding: 0 10px; margin: 0 10px; font-size: 13px; text-rendering: auto; text-transform: none; cursor: text; outline: none; box-sizing: border-box; border: 1px solid rgb(221, 221, 221); appearance: textfield; background-color: white; -webkit-rtl-ordering: logical;">'+
' <button onclick="bc()" id="btw-submit-btn" '+
' style="padding: 0 20px; height: 32px; font-size: 14px; outline: none; border: none; color: rgb(255, 255, 255); background: rgb(222, 104, 109); cursor: pointer;">提 '+
' 交'+
' </button></div>\n '+
' <div>\n' +
' <img class="code-img" style="width: 300px;display:unset" src="'+wechatQr+'">\n' +
' </div>\n' +
'</div>' +
'</div>';
const child = document.createElement('div')
child.innerHTML = html
cla.appendChild(child)
bc = function () {
const val = document.getElementById('btw-modal-input').value
// alert(val+typeof val+thisValue)
if (val === thisValue) {
cla.style.height= height + 'px';
cla.style.overflow= 'visible';
const rm = document.getElementById("read-more-wrap")
rm.parentNode.removeChild(rm)
localStorage.setItem(lockTokenKey,thisValue)
} else {
alert("验证码不正确!")
}
}
}
gitbook.events.bind('start', function(e, config) {
tokenValue = config.lock.tokenValue || 'lockName';
wechatName = config.lock.wechatName || '';
wechatQr = config.lock.wechatQr || '';
verificationCode = config.lock.verificationCode || '';
const rand = Math.floor(Math.random() * verificationCode.length)
thisCode = verificationCode[rand]["key"]
thisValue = verificationCode[rand]["value"]
// console.log(rand,"+",thisCode,"+",thisValue)
// insertPageLock();
});
gitbook.events.bind('page.change', function(e) {
console.log(e,"----->",e.content)
insertPageLock(e);
});
});
// require(['gitbook', 'jQuery'], function(gitbook, $) {
// let tokenValue;
// let wechatName;
// let wechatQr;
// let verificationCode;
// let thisCode;
// let thisValue;
//
// const lockTokenKey = "lock-token"
//
// function insertPageLock(e) {
// // console.log(e.context)
// // let s = e.context.("%pageLock%")
// // console.log(s,e.context)
// let authToken= localStorage.getItem(lockTokenKey)
// if (authToken!==isNaN(0)||authToken!==""||authToken!==undefined) {
// for (let i in verificationCode) {
// if (verificationCode[i]["value"] === authToken) {
// return true;
// }
// }
// }
//
// const cla = document.getElementById("book-search-results");
// const article = cla, height = article.scrollHeight;
// // 文章隐藏后的高度
// const halfHeight = height * 0.5;
// cla.style.height= halfHeight + 'px';
// cla.style.overflow = 'hidden'
//
//
// const html = '<div id="read-more-wrap" style="position: absolute; bottom: 0; z-index: 9999; width: 100%; margin-top: -100px; font-family: PingFangSC-Regular, sans-serif;">' +
// '<div id="read-more-mask" style="position: relative; height: 200px; background: -webkit-gradient(linear, 0 0%, 0 100%, from(rgba(255, 255, 255, 0)), to(rgb(255, 255, 255)));"></div>' +
// '<div class="info" style="position: absolute;left: 50%;top: 70%;bottom: 30px;transform: translate(-50%, -50%);font-size: 15px;text-align: center;background: -webkit-gradient(linear, 0 0%, 0 100%, from(rgba(255, 255, 255, 0)), to(rgb(255, 255, 255)));">\n' +
// ' <div>扫码或搜索:<span style="color: #E9405A; font-weight: bold;">'+wechatName+'</span></div>\n' +
// ' <div>\n' +
// ' <span>发送 </span><span class="token" style="color: #e9415a; font-weight: bold; font-size: 17px; margin-bottom: 45px;">'+thisCode+'</span>\n' +
// ' </div>\n' +
// ' <div>\n' +
// ' 即可<span style="color: #e9415a; font-weight: bold;">立即永久</span>解锁本站全部文章\n' +
// ' </div>\n' +
// ' <div id="btw-modal-input-code" style="margin-top: 20px; background: rgb(255, 255, 255);"><input '+
// ' id="btw-modal-input" type="text" maxLength="10" placeholder="请输入验证码" '+
// ' style="width: 160px; height: 32px; line-height: 32px; padding: 0 10px; margin: 0 10px; font-size: 13px; text-rendering: auto; text-transform: none; cursor: text; outline: none; box-sizing: border-box; border: 1px solid rgb(221, 221, 221); appearance: textfield; background-color: white; -webkit-rtl-ordering: logical;">'+
// ' <button onclick="bc()" id="btw-submit-btn" '+
// ' style="padding: 0 20px; height: 32px; font-size: 14px; outline: none; border: none; color: rgb(255, 255, 255); background: rgb(222, 104, 109); cursor: pointer;">提 '+
// ' 交'+
// ' </button></div>\n '+
// ' <div>\n' +
// ' <img class="code-img" style="width: 300px;display:unset" src="'+wechatQr+'">\n' +
// ' </div>\n' +
// '</div>' +
// '</div>';
//
// const child = document.createElement('div')
// child.innerHTML = html
// cla.appendChild(child)
// bc = function () {
// const val = document.getElementById('btw-modal-input').value
// // alert(val+typeof val+thisValue)
// if (val === thisValue) {
// cla.style.height= height + 'px';
// cla.style.overflow= 'visible';
// const rm = document.getElementById("read-more-wrap")
// rm.parentNode.removeChild(rm)
// localStorage.setItem(lockTokenKey,thisValue)
// } else {
// alert("验证码不正确!")
// }
// }
//
// }
//
// gitbook.events.bind('start', function(e, config) {
// tokenValue = config.lock.tokenValue || 'lockName';
// wechatName = config.lock.wechatName || '';
// wechatQr = config.lock.wechatQr || '';
// verificationCode = config.lock.verificationCode || '';
//
// const rand = Math.floor(Math.random() * verificationCode.length)
// thisCode = verificationCode[rand]["key"]
// thisValue = verificationCode[rand]["value"]
// // console.log(rand,"+",thisCode,"+",thisValue)
// // insertPageLock();
// });
//
// gitbook.events.bind('page.change', function(e) {
// console.log(e,"----->",e.content)
// insertPageLock(e);
// });
// });

@@ -36,2 +36,6 @@

if (page.content.search("%pageLock%") === -1) {
return page;
}
let authToken= localStorage.getItem(lockTokenKey)

@@ -38,0 +42,0 @@ if (authToken!==isNaN(0)||authToken!==""||authToken!==undefined) {

{
"name": "gitbook-plugin-lock",
"version": "0.0.65",
"version": "0.0.66",
"description": "Gitbook 页面加锁",

@@ -5,0 +5,0 @@ "main": "index.js",

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