From 6c37aafae9fce8ed0a64bea39145317e9e50de07 Mon Sep 17 00:00:00 2001 From: hexeth <7627137+hexeth@users.noreply.github.com> Date: Fri, 11 Jan 2019 13:05:22 -0800 Subject: [PATCH] Update caliBlur.js --- cps/static/js/caliBlur.js | 106 ++------------------------------------ 1 file changed, 5 insertions(+), 101 deletions(-) diff --git a/cps/static/js/caliBlur.js b/cps/static/js/caliBlur.js index 997bd270..6162d34d 100644 --- a/cps/static/js/caliBlur.js +++ b/cps/static/js/caliBlur.js @@ -1,6 +1,9 @@ // Move advanced search to side-menu $( 'a[href*="advanced"]' ).parent().insertAfter( '#nav_new' ); $( 'body' ).addClass('blur'); +$( 'body.stat' ).addClass( 'stats' ); +$( 'body.config' ).addClass( 'admin'); +$( 'body.viewconfig' ).addClass( 'admin'); // Back button curHref = window.location.href.split('/'); @@ -34,99 +37,7 @@ $( 'a.navbar-brand' ).clone().appendTo( '.home-btn' ).empty().removeClass('navba // Wrap book description in div container 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( '
' ); - $( 'h3:contains("Description:")' ).after( '
' ); - $( '.languages' ).appendTo( '.bookinfo' ); - $('.hr').detach(); - if ( $( '.identifiers ').length > 0 ) { - console.log(".identifiers length " + $( '.identifiers ').length ); - $( '.identifiers' ).before( '
' ); - } else { - if ( $( '.bookinfo > p:first-child' ).length > 0 ) { - console.log(".bookinfo > p:first-child length " + $( '.bookinfo > p' ).length ); - $( '.bookinfo > p:first-child' ).first().after( '
' ); - } else{ - if ( $( '.bookinfo a[href*="/series/"]' ).length > 0 ) { - console.log( 'series text found; placing hr below series' ); - $( '.bookinfo a[href*="/series/"]' ).parent().after( '
' ); - } else { - console.log("prepending hr div to top of .bookinfo"); - $( '.bookinfo' ).prepend( '
' ); - } - } - } - $( '.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( '

' + newdesc[i] + '

' ); - }); - $( '.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'; - }); - $( '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' ); bookInfo = $( '.author' ).nextUntil( 'h3:contains("Description")'); $( 'h3:contains("Description")' ).detach(); @@ -240,7 +151,6 @@ return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, ""); $( '.book-meta h2:first' ).clone() .prependTo( '.book-meta > .btn-toolbar:first' ); - // If only one download type exists still put the items into a drop-drown list. downloads = $( 'a[id^=btnGroupDrop]' ).get(); if ( $( downloads ).length === 1 ) { @@ -422,13 +332,7 @@ $( 'input#query' ).focusout(function() { $( 'form[role="search"]' ).removeClass( 'search-focus' ); }, 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 $(document).on('click','.dropdown-toggle',function() {