Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
6c37aafa
Unverified
Commit
6c37aafa
authored
Jan 11, 2019
by
hexeth
Committed by
GitHub
Jan 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update caliBlur.js
parent
550262e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
101 deletions
+5
-101
caliBlur.js
cps/static/js/caliBlur.js
+5
-101
No files found.
cps/static/js/caliBlur.js
View file @
6c37aafa
// Move advanced search to side-menu
// Move advanced search to side-menu
$
(
'a[href*="advanced"]'
).
parent
().
insertAfter
(
'#nav_new'
);
$
(
'a[href*="advanced"]'
).
parent
().
insertAfter
(
'#nav_new'
);
$
(
'body'
).
addClass
(
'blur'
);
$
(
'body'
).
addClass
(
'blur'
);
$
(
'body.stat'
).
addClass
(
'stats'
);
$
(
'body.config'
).
addClass
(
'admin'
);
$
(
'body.viewconfig'
).
addClass
(
'admin'
);
// Back button
// Back button
curHref
=
window
.
location
.
href
.
split
(
'/'
);
curHref
=
window
.
location
.
href
.
split
(
'/'
);
...
@@ -34,99 +37,7 @@ $( 'a.navbar-brand' ).clone().appendTo( '.home-btn' ).empty().removeClass('navba
...
@@ -34,99 +37,7 @@ $( 'a.navbar-brand' ).clone().appendTo( '.home-btn' ).empty().removeClass('navba
// Wrap book description in div container
// Wrap book description in div container
if
(
$
(
'body.book'
).
length
>
0
)
{
if
(
$
(
'body.book'
).
length
>
0
)
{
/* description = $( 'h3:contains("Description:")' ).nextUntil( '.morestuff' ).slice(0,-1);
bookInfo = $( '.author' ).nextUntil( 'h3:contains("Description:")');
$( 'h3:contains("Description:")' ).hide();
$( description ).detach();
$( bookInfo ).wrapAll( '<div class="bookinfo"></div>' );
$( 'h3:contains("Description:")' ).after( '<div class="description"></div>' );
$( '.languages' ).appendTo( '.bookinfo' );
$('.hr').detach();
if ( $( '.identifiers ').length > 0 ) {
console.log(".identifiers length " + $( '.identifiers ').length );
$( '.identifiers' ).before( '<div class="hr"></div>' );
} else {
if ( $( '.bookinfo > p:first-child' ).length > 0 ) {
console.log(".bookinfo > p:first-child length " + $( '.bookinfo > p' ).length );
$( '.bookinfo > p:first-child' ).first().after( '<div class="hr"></div>' );
} else{
if ( $( '.bookinfo a[href*="/series/"]' ).length > 0 ) {
console.log( 'series text found; placing hr below series' );
$( '.bookinfo a[href*="/series/"]' ).parent().after( '<div class="hr"></div>' );
} else {
console.log("prepending hr div to top of .bookinfo");
$( '.bookinfo' ).prepend( '<div class="hr"></div>' );
}
}
}
$( '.rating' ).insertBefore( '.hr' );
$( 'div.description' ).hide();
$( '#remove-from-shelves' ).insertAfter( '.hr' );
/* if book description is not in html format, Remove extra line breaks
Remove blank lines/unnecessary spaces, split by line break to array
Push array into .description div. If there is still a wall of text,
find sentences and split wall into groups of three sentence paragraphs.
If the book format is in html format, Keep html, but strip away inline
styles and empty elements */
/*
// If text is sitting in div as text node
if ( description[0] === undefined ) {
textValue = $( '.book-meta' )
.contents()
.filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).text();
description = $.makeArray(
textValue.replace(/(?:(?:\r\n|\r|\n)\s*){2}/gm, "")
);
$( '.book-meta' ).contents().filter(function() {
return this.nodeType === 3;
}).remove();
}
if ( description[1] === undefined ) {
newdesc = description.toString()
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
$.each(newdesc, function(i, val) {
$( 'div.description' ).append( '<p>' + newdesc[i] + '</p>' );
});
$( '.description' ).fadeIn(100);
//If still a wall of text create 3 sentence paragraphs.
if( $( '.description p' ).length === 1 ) {
if ( description.context != undefined ) {
newdesc = description.text()
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
}
else {
newdesc = description.toString();
}
doc = nlp ( newdesc.toString() );
sentences = doc.map((m)=> m.out( 'text' ));
$( '.description p' ).remove();
let size = 3; let sentenceChunks = [];
for (var i=0; i<sentences.length; i+=size) {
sentenceChunks.push(sentences.slice(i,i+size));
}
let output = '';
$.each(sentenceChunks, function(i, val) {
let preOutput = '';
$.each(val, function(i, val) {
preOutput += val;
});
output += '<p>' + preOutput + '</p>';
});
$( 'div.description' ).append( output );
}
} else {
$.each(description, function(i, val) {
$( description[i].outerHTML ).appendTo( '.description' );
$( 'div.description :empty' ).remove();
$( 'div.description ').attr( 'style', '' );
});
$( 'div.description' ).fadeIn( 100 );
}*/
description
=
$
(
'.comments'
);
description
=
$
(
'.comments'
);
bookInfo
=
$
(
'.author'
).
nextUntil
(
'h3:contains("Description")'
);
bookInfo
=
$
(
'.author'
).
nextUntil
(
'h3:contains("Description")'
);
$
(
'h3:contains("Description")'
).
detach
();
$
(
'h3:contains("Description")'
).
detach
();
...
@@ -240,7 +151,6 @@ return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
...
@@ -240,7 +151,6 @@ return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
$
(
'.book-meta h2:first'
).
clone
()
$
(
'.book-meta h2:first'
).
clone
()
.
prependTo
(
'.book-meta > .btn-toolbar:first'
);
.
prependTo
(
'.book-meta > .btn-toolbar:first'
);
// If only one download type exists still put the items into a drop-drown list.
// If only one download type exists still put the items into a drop-drown list.
downloads
=
$
(
'a[id^=btnGroupDrop]'
).
get
();
downloads
=
$
(
'a[id^=btnGroupDrop]'
).
get
();
if
(
$
(
downloads
).
length
===
1
)
{
if
(
$
(
downloads
).
length
===
1
)
{
...
@@ -422,13 +332,7 @@ $( 'input#query' ).focusout(function() {
...
@@ -422,13 +332,7 @@ $( 'input#query' ).focusout(function() {
$
(
'form[role="search"]'
).
removeClass
(
'search-focus'
);
$
(
'form[role="search"]'
).
removeClass
(
'search-focus'
);
},
100
);
},
100
);
});
});
// Add class to random book discover
// ToDo: done
$
(
'h2:contains("Discover (Random Books")'
)
.
parent
()
.
addClass
(
'random-books'
);
// Check if dropdown goes out of viewport and add class
// Check if dropdown goes out of viewport and add class
$
(
document
).
on
(
'click'
,
'.dropdown-toggle'
,
function
()
{
$
(
document
).
on
(
'click'
,
'.dropdown-toggle'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment