gitbook-plugin-lock
Advanced tools
Comparing version 0.0.51 to 0.0.52
@@ -6,11 +6,11 @@ require(['gitbook', 'jQuery'], function(gitbook, $) { | ||
let verificationCode; | ||
let thisCode; | ||
let thisValue; | ||
function insertPageLock() { | ||
let authToken= localStorage.getItem("auth-token") | ||
console.log(authToken) | ||
let authToken= localStorage.getItem("lock-token") | ||
if (authToken!==isNaN(0)||authToken!==""||authToken!==undefined) { | ||
for (let i in verificationCode) { | ||
console.log(authToken,verificationCode[i]) | ||
if (i === authToken) { | ||
for (let i in verificationCode) { | ||
if (verificationCode[i]["value"] === authToken) { | ||
return true; | ||
@@ -22,10 +22,10 @@ } | ||
const cla = document.getElementById("book-search-results"); | ||
console.log(cla,"看看cla是啥") | ||
// console.log(cla,"看看cla是啥") | ||
// 文章的实际高度 | ||
const article = cla, height = article.scrollHeight; | ||
console.log(article,"看看",height) | ||
// console.log(article,"看看",height) | ||
// 文章隐藏后的高度 | ||
const halfHeight = height * 0.5; | ||
console.log("看看---->",halfHeight) | ||
// console.log("看看---->",halfHeight) | ||
@@ -41,3 +41,3 @@ cla.style.height= halfHeight + 'px'; | ||
' <div>\n' + | ||
' <span>发送 </span><span class="token" style="color: #e9415a; font-weight: bold; font-size: 17px; margin-bottom: 45px;">1024</span>\n' + | ||
' <span>发送 </span><span class="token" style="color: #e9415a; font-weight: bold; font-size: 17px; margin-bottom: 45px;">'+thisCode+'</span>\n' + | ||
' </div>\n' + | ||
@@ -65,4 +65,4 @@ ' <div>\n' + | ||
const val = document.getElementById('btw-modal-input').value | ||
alert(val+typeof val) | ||
if ( val===1024 || val === '1024') { | ||
alert(val+typeof val+thisValue) | ||
if (val === thisValue) { | ||
cla.style.height= height + 'px'; | ||
@@ -83,2 +83,6 @@ cla.style.overflow= 'visible'; | ||
const rand = Math.floor(Math.random() * verificationCode.length) | ||
thisCode = verificationCode[rand]["key"] | ||
thisValue = verificationCode[rand]["value"] | ||
console.log(rand,"+",thisCode,"+",thisValue) | ||
insertPageLock(); | ||
@@ -85,0 +89,0 @@ }); |
{ | ||
"name": "gitbook-plugin-lock", | ||
"version": "0.0.51", | ||
"version": "0.0.52", | ||
"description": "Gitbook 页面加锁", | ||
@@ -46,3 +46,3 @@ "main": "index.js", | ||
"required": true, | ||
"type": "object" | ||
"type": ["object"] | ||
} | ||
@@ -49,0 +49,0 @@ } |
7201
111