2019-01-20 18:37:45 +00:00
|
|
|
/* This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
|
|
|
* Copyright (C) 2018-2019 hexeth
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-12-27 09:53:19 +00:00
|
|
|
// Move advanced search to side-menu
|
2020-05-10 12:57:19 +00:00
|
|
|
$("a[href*='advanced']" ).parent().insertAfter("#nav_new");
|
|
|
|
$("body").addClass("blur");
|
|
|
|
$("body.stat").addClass("stats" );
|
|
|
|
$("body.config").addClass("admin");
|
|
|
|
$("body.uiconfig").addClass("admin");
|
|
|
|
$("body.advsearch").addClass("advanced_search");
|
|
|
|
$("body.newuser").addClass("admin");
|
|
|
|
$("body.mailset").addClass("admin");
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Back button
|
2020-05-10 12:57:19 +00:00
|
|
|
curHref = window.location.href.split("/");
|
|
|
|
prevHref = document.referrer.split("/");
|
|
|
|
$(".navbar-form.navbar-left")
|
|
|
|
.before('<div class="plexBack"><a href="' + encodeURI(document.referrer) + '"></a></div>');
|
2018-12-27 09:53:19 +00:00
|
|
|
if ( history.length === 1 ||
|
|
|
|
curHref[0] +
|
|
|
|
curHref[1] +
|
|
|
|
curHref[2] !=
|
|
|
|
prevHref[0] +
|
|
|
|
prevHref[1] +
|
|
|
|
prevHref[2] ||
|
2020-05-10 12:57:19 +00:00
|
|
|
$("body.root")>length > 0 ) {
|
|
|
|
$(".plexBack").addClass("noBack");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Weird missing a after pressing back from edit.
|
|
|
|
setTimeout(function() {
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(".plexBack a").length < 1 ) {
|
|
|
|
$(".plexBack").append('<a href="' + encodeURI(document.referrer) + '"></a>');
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
},10);
|
|
|
|
|
|
|
|
// Home button
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".plexBack").before( '<div class="home-btn"></div>' );
|
|
|
|
$("a.navbar-brand").clone().appendTo(".home-btn").empty().removeClass("navbar-brand");
|
2018-12-27 09:53:19 +00:00
|
|
|
/////////////////////////////////
|
|
|
|
// Start of Book Details Work //
|
|
|
|
///////////////////////////////
|
|
|
|
|
|
|
|
// Wrap book description in div container
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $("body.book").length > 0 ) {
|
2019-01-14 19:27:53 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
description = $(".comments");
|
|
|
|
bookInfo = $(".author").nextUntil("#decription");
|
2019-05-30 07:19:37 +00:00
|
|
|
$("#decription").detach();
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".comments" ).detach();
|
2018-12-27 09:53:19 +00:00
|
|
|
$( bookInfo ).wrapAll( '<div class="bookinfo"></div>' );
|
|
|
|
// $( 'h3:contains("Description:")' ).after( '<div class="description"></div>' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".languages").appendTo(".bookinfo");
|
|
|
|
$(".hr").detach();
|
|
|
|
if ( $(".identifiers ").length > 0 ) {
|
|
|
|
console.log(".identifiers length " + $(".identifiers").length );
|
2018-12-27 09:53:19 +00:00
|
|
|
$( '.identifiers' ).before( '<div class="hr"></div>' );
|
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
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>' );
|
2018-12-27 09:53:19 +00:00
|
|
|
} else{
|
|
|
|
if ( $( '.bookinfo a[href*="/series/"]' ).length > 0 ) {
|
2020-05-10 12:57:19 +00:00
|
|
|
console.log( "series text found; placing hr below series" );
|
2018-12-27 09:53:19 +00:00
|
|
|
$( '.bookinfo a[href*="/series/"]' ).parent().after( '<div class="hr"></div>' );
|
|
|
|
} else {
|
|
|
|
console.log("prepending hr div to top of .bookinfo");
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".bookinfo" ).prepend( '<div class="hr"></div>' );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".rating" ).insertBefore( ".hr" );
|
|
|
|
$( "#remove-from-shelves" ).insertAfter( ".hr" );
|
|
|
|
$( description ).appendTo(".bookinfo")
|
2018-12-27 09:53:19 +00:00
|
|
|
/* 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
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(".comments:has(p)" ).length === 0 ) {
|
2018-12-27 09:53:19 +00:00
|
|
|
newdesc = description.text()
|
|
|
|
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".comments" ).empty();
|
2018-12-27 09:53:19 +00:00
|
|
|
$.each(newdesc, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "div.comments" ).append( "<p>" + newdesc[i] + "</p>" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".comments" ).fadeIn(100);
|
2018-12-27 09:53:19 +00:00
|
|
|
} //If still a wall of text create 3 sentence paragraphs.
|
2020-05-10 12:57:19 +00:00
|
|
|
if( $( ".comments p" ).length === 1 ) {
|
2018-12-27 09:53:19 +00:00
|
|
|
if ( description.context != undefined ) {
|
|
|
|
newdesc = description.text()
|
|
|
|
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
|
|
|
|
}
|
|
|
|
else {
|
2019-02-19 21:44:40 +00:00
|
|
|
newdesc = description.text();
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
doc = nlp ( newdesc.toString() );
|
2020-05-10 12:57:19 +00:00
|
|
|
sentences = doc.map((m)=> m.out( "text" ));
|
2018-12-27 09:53:19 +00:00
|
|
|
sentences[0] = sentences[0].replace(",","");
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".comments p" ).remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
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;
|
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
output += "<p>" + preOutput + "</p>";
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "div.comments" ).append( output );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$.each(description, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
// $( description[i].outerHTML ).appendTo( ".comments" );
|
|
|
|
$( "div.comments :empty" ).remove();
|
|
|
|
$( "div.comments ").attr( "style", "" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "div.comments" ).fadeIn( 100 );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sexy blurred backgrounds
|
2020-05-10 12:57:19 +00:00
|
|
|
cover = $( ".cover img" ).attr( "src" );
|
|
|
|
$( "#loader + .container-fluid" )
|
|
|
|
.prepend( "<div class='blur-wrapper'></div>" );
|
|
|
|
$( ".blur-wrapper" )
|
2020-05-09 15:07:22 +00:00
|
|
|
.prepend( '<div><img alt="Blurred cover" class="bg-blur" src="' + cover + '"></div>' );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Fix-up book detail headings
|
2020-05-10 12:57:19 +00:00
|
|
|
publisher = $( ".publishers p span" ).text().split( ":" );
|
|
|
|
$( ".publishers p span" ).remove();
|
2019-05-30 07:19:37 +00:00
|
|
|
$.each(publisher, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".publishers" ).append( "<span>" + publisher[i] + "</span>" );
|
2019-05-30 07:19:37 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".publishers span:nth-child(3)" ).text(function() {
|
2019-05-30 07:19:37 +00:00
|
|
|
return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2019-05-30 07:19:37 +00:00
|
|
|
|
|
|
|
// Fix-up book custom colums headings
|
|
|
|
// real_custom_column = $( '.real_custom_columns' ).text().split( ':' );
|
2020-05-10 12:57:19 +00:00
|
|
|
real_custom_column = $( ".real_custom_columns" );
|
|
|
|
// $( ".real_custom_columns" ).remove();
|
2019-05-30 07:19:37 +00:00
|
|
|
$.each(real_custom_column, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
var split = $(this).text().split( ":" );
|
2020-01-11 07:27:57 +00:00
|
|
|
real_cc_key = split.shift();
|
2020-05-10 12:57:19 +00:00
|
|
|
real_cc_value = split.join(":");
|
2019-05-30 07:19:37 +00:00
|
|
|
$( this ).text("");
|
2020-01-11 07:27:57 +00:00
|
|
|
if (real_cc_value != "") {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( this ).append( "<span>" + real_cc_key + "</span><span>" + real_cc_value + "</span>" );
|
2019-05-30 07:19:37 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
//$( '.real_custom_columns:nth-child(3)' ).text(function() {
|
|
|
|
//return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
|
|
|
|
//});
|
2019-01-04 19:39:11 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
published = $( ".publishing-date p" )
|
|
|
|
.text().split(": ");
|
|
|
|
$( ".publishing-date p" ).remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
$.each(published, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".publishing-date" ).append( "<span>" + published[i] + "</span>" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2019-01-14 19:27:53 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
languages = $( ".languages p span" ).text().split( ": " );
|
|
|
|
$( ".languages p span" ).remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
$.each(languages, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".languages" ).append( "<span>" + languages[i] + "</span>" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".book-meta h2:first" ).clone()
|
|
|
|
.prependTo( ".book-meta > .btn-toolbar:first" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// If only one download type exists still put the items into a drop-drown list.
|
2020-05-10 12:57:19 +00:00
|
|
|
downloads = $( "a[id^=btnGroupDrop]" ).get();
|
2018-12-27 09:53:19 +00:00
|
|
|
if ( $( downloads ).length === 1 ) {
|
|
|
|
$( '<button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-download"></span>Download :<span class="caret"></span></button><ul class="dropdown-menu leramslist aria-labelledby="btnGroupDrop1"></ul>' ).insertBefore( downloads[downloads.length-1] );
|
|
|
|
$( downloads ).detach();
|
|
|
|
$.each(downloads, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "<li>" + downloads[i].outerHTML + "</li>" ).appendTo( ".leramslist" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".leramslist" ).find( "span" ).remove();
|
|
|
|
$( ".leramslist a" ).removeClass( "btn btn-primary" ).removeAttr( "role" );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add classes to buttons
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#sendbtn" ).parent().addClass( "sendBtn" );
|
|
|
|
$( "[id*=btnGroupDrop]" ).parent().addClass( "downloadBtn" );
|
|
|
|
$( "read-in-browser" ).parent().addClass( "readBtn" );
|
|
|
|
$( ".downloadBtn button:first" ).addClass( "download-text" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Move all options in book details page to the same group
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "[aria-label*='Delete book']" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.prependTo( '[aria-label^="Download, send"]' )
|
2020-05-10 12:57:19 +00:00
|
|
|
.children().removeClass( "btn-sm" );
|
|
|
|
$( ".custom_columns" )
|
|
|
|
.addClass(" btn-group" )
|
|
|
|
.attr("role", "group" )
|
|
|
|
.removeClass( "custom_columns" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.prependTo( '[aria-label^="Download, send"]' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#have_read_cb" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.after( '<label class="block-label readLbl" for="#have_read_cb"></label>' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#archived_cb" )
|
2020-01-25 23:29:17 +00:00
|
|
|
.after( '<label class="block-label readLbl" for="#archived_cb"></label>' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#shelf-actions" ).prependTo( '[aria-label^="Download, send"]' );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Move dropdown lists higher in dom, replace bootstrap toggle with own toggle.
|
2020-05-10 12:57:19 +00:00
|
|
|
$( 'ul[aria-labelledby="read-in-browser"]' ).insertBefore( ".blur-wrapper" ).addClass("readinbrowser-drop");
|
|
|
|
$( 'ul[aria-labelledby="send-to-kindle"]' ).insertBefore( ".blur-wrapper" ).addClass("sendtokindle-drop");
|
|
|
|
$( ".leramslist" ).insertBefore( ".blur-wrapper" );
|
|
|
|
$( 'ul[aria-labelledby="btnGroupDrop1"]' ).insertBefore( ".blur-wrapper" ).addClass("leramslist");
|
|
|
|
$( "#add-to-shelves" ).insertBefore( ".blur-wrapper" );
|
|
|
|
|
|
|
|
$( "#read-in-browser" ).click( function() {
|
|
|
|
$( ".readinbrowser-drop" ).toggle();
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".downloadBtn" ).click( function() {
|
|
|
|
$( ".leramslist" ).toggle();
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2019-01-20 18:37:45 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#sendbtn2" ).click( function() {
|
|
|
|
$( ".sendtokindle-drop" ).toggle();
|
2019-01-18 19:00:55 +00:00
|
|
|
});
|
|
|
|
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
$('div[aria-label="Add to shelves"]' ).click( function() {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#add-to-shelves" ).toggle();
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Fix formatting error on book detail languages
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( !$( ".book-meta > .bookinfo > .languages > span:last-of-type" ).text().startsWith(" ") ) {
|
|
|
|
$( ".book-meta > .bookinfo > .languages > span:last-of-type" ).prepend(" ");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Work to reposition dropdowns. Does not currently solve for
|
|
|
|
//screen resizing
|
|
|
|
function dropdownToggle() {
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
topPos = $( ".book-meta > .btn-toolbar:first" ).offset().top
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $( "#read-in-browser" ).length > 0 ) {
|
|
|
|
position = $( "#read-in-browser" ).offset().left
|
|
|
|
if ( position + $( ".readinbrowser-drop" ).width() > $( window ).width() ) {
|
|
|
|
positionOff = position + $( ".readinbrowser-drop" ).width() - $( window ).width();
|
2018-12-27 09:53:19 +00:00
|
|
|
ribPosition = position - positionOff - 5
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".readinbrowser-drop" ).attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".readinbrowser-drop" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
2019-01-20 18:37:45 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $( "#sendbtn2" ).length > 0 ) {
|
|
|
|
position = $( "#sendbtn2" ).offset().left
|
|
|
|
if ( position + $( ".sendtokindle-drop" ).width() > $( window ).width() ) {
|
|
|
|
positionOff = position + $( ".sendtokindle-drop" ).width() - $( window ).width();
|
2019-01-18 18:57:42 +00:00
|
|
|
ribPosition = position - positionOff - 5
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".sendtokindle-drop" ).attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
|
2019-01-18 18:57:42 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".sendtokindle-drop" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
|
2019-01-18 18:57:42 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $( ".downloadBtn" ).length > 0 ) {
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
position = $( "#btnGroupDrop1" ).offset().left
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( position + $( ".leramslist" ).width() > $( window ).width() ) {
|
|
|
|
positionOff = position + $( ".leramslist" ).width() - $( window ).width();
|
2018-12-27 09:53:19 +00:00
|
|
|
dlPosition = position - positionOff - 5
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".leramslist" ).attr("style", "left: " + dlPosition + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".leramslist" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $( 'div[aria-label="Add to shelves"]' ).length > 0 ) {
|
|
|
|
|
|
|
|
position = $( 'div[aria-label="Add to shelves"]' ).offset().left
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( position + $( "#add-to-shelves" ).width() > $( window ).width() ) {
|
|
|
|
positionOff = position + $( "#add-to-shelves" ).width() - $( window ).width();
|
2018-12-27 09:53:19 +00:00
|
|
|
adsPosition = position - positionOff - 5
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#add-to-shelves" ).attr("style", "left: " + adsPosition + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#add-to-shelves" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dropdownToggle();
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$( window ).on( "resize", function() {
|
2018-12-27 09:53:19 +00:00
|
|
|
dropdownToggle();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Clone book rating for mobile view.
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".book-meta > .bookinfo > .rating" ).clone().insertBefore( ".book-meta > .description" ).addClass("rating-mobile");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
// End of Book Details Work //
|
|
|
|
/////////////////////////////
|
|
|
|
|
|
|
|
/////////////////////////////////
|
|
|
|
// Start of Global Work //
|
|
|
|
///////////////////////////////
|
|
|
|
|
|
|
|
// Hide dropdown and collapse menus on click-off
|
|
|
|
$(document).mouseup(function (e) {
|
|
|
|
var container = new Array();
|
|
|
|
container.push($('ul[aria-labelledby="read-in-browser"]'));
|
2020-05-10 12:57:19 +00:00
|
|
|
container.push($(".sendtokindle-drop"));
|
|
|
|
container.push($(".leramslist"));
|
|
|
|
container.push($("#add-to-shelves"));
|
|
|
|
container.push($(".navbar-collapse.collapse.in"));
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
$.each(container, function(key, value) {
|
|
|
|
if (!$(value).is(e.target) // if the target of the click isn't the container...
|
|
|
|
&& $(value).has(e.target).length === 0) // ... nor a descendant of the container
|
|
|
|
{
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(value).hasClass("dropdown-menu") )
|
2018-12-27 09:53:19 +00:00
|
|
|
{
|
|
|
|
$(value).hide();
|
|
|
|
} else
|
|
|
|
{
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(value).hasClass("collapse") )
|
2018-12-27 09:53:19 +00:00
|
|
|
{
|
2020-05-10 12:57:19 +00:00
|
|
|
$(value).collapse("toggle");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Split path name to array and remove blanks
|
|
|
|
url = window.location.pathname
|
|
|
|
|
|
|
|
// Move create shelf
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#nav_createshelf" ).prependTo( ".your-shelves" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Create drop-down for profile and move elements to it
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#main-nav" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.prepend( '<li class="dropdown"><a href="#" class="dropdown-toggle profileDrop" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span></a><ul class="dropdown-menu profileDropli"></ul></li>' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#top_user" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" );
|
|
|
|
$( "#nav_about" ).addClass( "dropdown" ).appendTo( ".profileDropli" );
|
|
|
|
$( "#register" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" );
|
|
|
|
$( "#logout" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Remove the modals except from some areas where they are needed
|
2020-05-10 12:57:19 +00:00
|
|
|
bodyClass = $( "body" ).attr( "class" ).split(" ");
|
|
|
|
modalWanted = ["admin", "editbook", "config", "uiconfig", "me", "edituser"];
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
if ( $.inArray( bodyClass[0], modalWanted) != -1 ) {
|
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$(" a:not(.dropdown-toggle) ")
|
|
|
|
.removeAttr( "data-toggle", "data-target", "data-remote" );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add classes to global buttons
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "#top_tasks" ).parent().addClass( "top_tasks" );
|
|
|
|
$( "#top_admin" ).parent().addClass( "top_admin" );
|
|
|
|
$( "#form-upload" ).parent().addClass( "form-upload" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Search button work
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "input#query" ).focus(function() {
|
|
|
|
$( 'form[role="search"]' ).addClass( "search-focus" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "input#query" ).focusout(function() {
|
2018-12-27 09:53:19 +00:00
|
|
|
setTimeout(function() {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( 'form[role="search"]' ).removeClass( "search-focus" );
|
2018-12-27 09:53:19 +00:00
|
|
|
}, 100);
|
|
|
|
});
|
2019-01-14 19:27:53 +00:00
|
|
|
|
2018-12-27 09:53:19 +00:00
|
|
|
// Check if dropdown goes out of viewport and add class
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$(document).on("click",".dropdown-toggle",function() {
|
2018-12-27 09:53:19 +00:00
|
|
|
// Add .offscreen if part of container not visible
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".dropdown-menu:visible").filter(function(){
|
2018-12-27 09:53:19 +00:00
|
|
|
return $(this).visible() === false;
|
|
|
|
}).each(function(){
|
2020-05-10 12:57:19 +00:00
|
|
|
$(this).addClass("offscreen");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Fade out content on page unload
|
|
|
|
// delegate all clicks on "a" tag (links)
|
2019-01-11 22:13:09 +00:00
|
|
|
/*$(document).on("click", "a:not(.btn-toolbar a, a[href*='shelf/remove'], .identifiers a, .bookinfo , .btn-group > a, #add-to-shelves a, #book-list a, .stat.blur a )", function () {
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// get the href attribute
|
|
|
|
var newUrl = $(this).attr("href");
|
|
|
|
|
|
|
|
// veryfy if the new url exists or is a hash
|
|
|
|
if (!newUrl || newUrl[0] === "#") {
|
|
|
|
// set that hash
|
|
|
|
location.hash = newUrl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-11 22:13:09 +00:00
|
|
|
now, fadeout the html (whole page)
|
2018-12-27 09:53:19 +00:00
|
|
|
$( '.blur-wrapper' ).fadeOut(250);
|
|
|
|
$(".row-fluid .col-sm-10").fadeOut(500,function () {
|
|
|
|
// when the animation is complete, set the new location
|
|
|
|
location = newUrl;
|
|
|
|
});
|
|
|
|
|
|
|
|
// prevent the default browser behavior.
|
|
|
|
return false;
|
2019-01-11 22:13:09 +00:00
|
|
|
});*/
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Collapse long text into read-more
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "div.comments" ).readmore( {
|
2018-12-27 09:53:19 +00:00
|
|
|
collapsedHeight: 134,
|
|
|
|
heightMargin: 45,
|
|
|
|
speed: 300,
|
2019-03-09 19:02:17 +00:00
|
|
|
moreLink: '<a href="#">READ MORE</a>', // ToDo: make translateable
|
|
|
|
lessLink: '<a href="#">READ LESS</a>', // ToDo: make translateable
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
/////////////////////////////////
|
|
|
|
// End of Global Work //
|
|
|
|
///////////////////////////////
|
|
|
|
|
|
|
|
// Author Page Background Blur
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $( "body.author" ).length >0 ) {
|
|
|
|
cover = $( ".author-bio img" ).attr( "src" );
|
|
|
|
$( "#loader + .container-fluid" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.prepend( '<div class="blur-wrapper"></div>' );
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".blur-wrapper" ).prepend( '<img alt="Blurred author bio" class="bg-blur" src="' + cover + '">' );
|
2018-12-27 09:53:19 +00:00
|
|
|
// Place undefined cover images inside container
|
|
|
|
if ( $( '.bg-blur[src="undefined"]' ).length > 0 ) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( ".bg-blur" ).before( '<div class="bg-blur undefined-img"></div>' );
|
|
|
|
$( "img.bg-blur" ).appendTo( '.undefined-img' );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ereader Page - add class to iframe body on ereader page after it loads.
|
2020-05-10 12:57:19 +00:00
|
|
|
backurl = "../../book/" + url[2]
|
|
|
|
$( "body.epub #title-controls" )
|
2018-12-27 09:53:19 +00:00
|
|
|
.append('<div class="epub-back"><input action="action" onclick="location.href=backurl; return false;" type="button" value="Back" /></div>')
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "body.stat .col-sm-10 p:first" ).insertAfter( "#libs" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Check if link is external and force _blank attribute
|
|
|
|
$(function(){ // document ready
|
2020-05-10 12:57:19 +00:00
|
|
|
$( "a" ).filter(function () {
|
2018-12-27 09:53:19 +00:00
|
|
|
return this.hostname && this.hostname !== location.hostname;
|
|
|
|
}).each(function () {
|
2020-05-10 12:57:19 +00:00
|
|
|
$(this).addClass("external").attr( "target", "_blank" );
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Check if lists are empty and add class to buttons
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $.trim( $("#add-to-shelves").html() ).length === 0 ) {
|
|
|
|
$( "#add-to-shelf" ).addClass( "empty-ul" );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
shelfLength = $("#add-to-shelves li").length
|
2018-12-27 09:53:19 +00:00
|
|
|
emptyLength = 0
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#add-to-shelves").on("click","li a",function(){
|
|
|
|
console.log("#remove-from-shelves change registered" );
|
2018-12-27 09:53:19 +00:00
|
|
|
emptyLength++
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
if ( emptyLength >= shelfLength ) {
|
2020-05-10 12:57:19 +00:00
|
|
|
console.log("list is empty; adding empty-ul class" );
|
|
|
|
$( "#add-to-shelf" ).addClass( "empty-ul" );
|
2018-12-27 09:53:19 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
console.log("list is not empty; removing empty-ul class" );
|
|
|
|
$( "#add-to-shelf" ).removeClass( "empty-ul" );
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
},100);
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( $.trim( $( 'ul[aria-labelledby="read-in-browser"] li' ).html() ).length === 0 ) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#read-in-browser").addClass("empty-ul");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Shelf Buttons and Tooltips
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $( "body.shelf" ).length > 0 ) {
|
2018-12-27 09:53:19 +00:00
|
|
|
$( 'div[data-target="#DeleteShelfDialog"]' )
|
|
|
|
.before( '<div class=".btn-group shelf-btn-group"></div>' )
|
2020-05-10 12:57:19 +00:00
|
|
|
.appendTo( ".shelf-btn-group" )
|
|
|
|
.addClass( "delete-shelf-btn" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
$( 'a[href*="edit"]' )
|
2020-05-10 12:57:19 +00:00
|
|
|
.appendTo( ".shelf-btn-group" )
|
|
|
|
.addClass( "edit-shelf-btn" );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
$( 'a[href*="order"]' )
|
2020-05-10 12:57:19 +00:00
|
|
|
.appendTo( ".shelf-btn-group" )
|
|
|
|
.addClass( "order-shelf-btn" );
|
|
|
|
$(".delete-shelf-btn").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $( ".delete-shelf-btn" ).text(), // "Delete Shelf"
|
|
|
|
"data-placement": "bottom" })
|
|
|
|
.addClass("delete-btn-tooltip");
|
|
|
|
|
|
|
|
$(".edit-shelf-btn").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $(".edit-shelf-btn").text(), // "Edit Shelf"
|
|
|
|
"data-placement": "bottom" })
|
|
|
|
.addClass("edit-btn-tooltip");
|
|
|
|
|
|
|
|
$(".order-shelf-btn").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $(".order-shelf-btn").text(), //"Reorder Shelf"
|
|
|
|
"data-placement": "bottom" })
|
|
|
|
.addClass("order-btn-tooltip");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rest of Tooltips
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".home-btn > a").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $(document.body).attr("data-text"), // Home
|
|
|
|
"data-placement": "bottom" })
|
|
|
|
.addClass("home-btn-tooltip");
|
|
|
|
|
|
|
|
$(".plexBack > a").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $(document.body).attr("data-textback"), // Back
|
|
|
|
"data-placement": "bottom" })
|
|
|
|
.addClass("back-btn-tooltip");
|
|
|
|
|
|
|
|
$("#top_tasks").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#top_tasks").text(), // "Tasks"
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": "#main-nav" })
|
|
|
|
.addClass("tasks-btn-tooltip");
|
|
|
|
|
|
|
|
$( "#top_admin" ).attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $( "#top_admin" ).attr("data-text"), // Settings
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": "#main-nav" })
|
|
|
|
.addClass("admin-btn-tooltip");
|
|
|
|
|
|
|
|
$(".profileDrop").attr({
|
|
|
|
"title": $("#top_user").attr("data-text"), //Account
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"data-viewport": "#main-nav" })
|
|
|
|
.addClass("send-btn-tooltip dropdown");
|
|
|
|
|
|
|
|
$("#btn-upload").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#btn-upload").parent().text() , // "Upload"
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": "#main-nav" })
|
|
|
|
.addClass("upload-btn-tooltip");
|
|
|
|
|
|
|
|
$("#add-to-shelf").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $("#add-to-shelf").text() , // "Add to Shelf"
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("addtoshelf-btn-tooltip");
|
|
|
|
|
|
|
|
$("#have_read_cb").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#have_read_cb").attr("data-unchecked"),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("readunread-btn-tooltip");
|
|
|
|
|
|
|
|
$("#have_read_cb:checked").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $( "#have_read_cb").attr("data-checked"),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("readunread-btn-tooltip");
|
|
|
|
|
|
|
|
$("#archived_cb").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#archived_cb").attr("data-unchecked"),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("readunread-btn-tooltip");
|
|
|
|
|
|
|
|
$("#archived_cb:checked").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#archived_cb").attr("data-checked"),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("readunread-btn-tooltip");
|
|
|
|
|
|
|
|
$("button#delete").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $( "button#delete" ).text(), //"Delete"
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("delete-book-btn-tooltip");
|
|
|
|
|
|
|
|
$("#have_read_cb").click(function() {
|
|
|
|
if ( $( "#have_read_cb:checked" ).length > 0 ) {
|
|
|
|
$( this ).attr("data-original-title", $("#have_read_cb").attr("data-checked"));
|
2018-12-27 09:53:19 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( this).attr("data-original-title", $("#have_read_cb").attr("data-unchecked"));
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#archived_cb").click(function() {
|
|
|
|
if ( $( "#archived_cb:checked" ).length > 0 ) {
|
|
|
|
$( this ).attr("data-original-title", $("#archived_cb").attr("data-checked"));
|
2020-01-25 23:29:17 +00:00
|
|
|
} else {
|
2020-05-10 12:57:19 +00:00
|
|
|
$( this).attr("data-original-title", $("#archived_cb").attr("data-unchecked"));
|
2020-01-25 23:29:17 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$('.btn-group[aria-label="Edit/Delete book"] a').attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $( "#edit_book" ).text(), // "Edit"
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("edit-btn-tooltip");
|
|
|
|
|
|
|
|
$("#sendbtn").attr({
|
|
|
|
"data-toggle": "tooltip",
|
|
|
|
"title": $("#sendbtn").attr("data-text"),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("send-btn-tooltip");
|
|
|
|
|
|
|
|
$("#sendbtn2").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $( "#sendbtn2" ).text(), // "Send to Kindle",
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" })
|
|
|
|
.addClass("send-btn-tooltip");
|
|
|
|
|
|
|
|
$("#read-in-browser").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $("#read-in-browser").text(),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar"})
|
|
|
|
.addClass("send-btn-tooltip");
|
|
|
|
|
|
|
|
$("#btnGroupDrop1").attr({
|
|
|
|
"data-toggle-two": "tooltip",
|
|
|
|
"title": $( "#btnGroupDrop1" ).text(),
|
|
|
|
"data-placement": "bottom",
|
|
|
|
"data-viewport": ".btn-toolbar" });
|
|
|
|
|
|
|
|
if ( $( "body.epub").length === 0 ) {
|
2018-12-27 09:53:19 +00:00
|
|
|
$(document).ready(function(){
|
2020-05-10 12:57:19 +00:00
|
|
|
$("[data-toggle='tooltip']").tooltip({container: "body", trigger: "hover"});
|
|
|
|
$("[data-toggle-two='tooltip']").tooltip({container: "body", trigger: "hover"});
|
|
|
|
$( "#btn-upload" ).attr("title", " ");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$( '[data-toggle-two="tooltip"]' ).click(function(){
|
2020-05-10 12:57:19 +00:00
|
|
|
$('[data-toggle-two="tooltip"]').tooltip("hide");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$( '[data-toggle="tooltip"]' ).click(function(){
|
2020-05-10 12:57:19 +00:00
|
|
|
$('[data-toggle="tooltip"]').tooltip("hide");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#read-in-browser a").attr("target","");
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(".edit-shelf-btn").length > 1 ) {
|
|
|
|
$(".edit-shelf-btn:first").remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
2020-05-10 12:57:19 +00:00
|
|
|
if ( $(".order-shelf-btn").length > 1 ) {
|
|
|
|
$(".order-shelf-btn:first").remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$("#top_user > span.hidden-sm" ).clone().insertBefore(".profileDropli");
|
|
|
|
$(".navbar-collapse.collapse.in").before('<div class="sidebar-backdrop"></div>');
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
// Get rid of leading white space
|
2020-05-10 12:57:19 +00:00
|
|
|
recentlyAdded = $("#nav_new a:contains('Recently')").text().trim();
|
|
|
|
$("#nav_new a:contains('Recently')").contents().filter(function() {
|
2018-12-27 09:53:19 +00:00
|
|
|
return this.nodeType == 3
|
|
|
|
}).each(function(){
|
2020-05-10 12:57:19 +00:00
|
|
|
this.textContent = this.textContent.replace(" Recently Added",recentlyAdded);
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Change shelf textValue
|
2020-05-10 12:57:19 +00:00
|
|
|
shelfText = $( ".shelf .discover h2:first" ).text().replace(":"," —").replace(/\'/g,"");
|
|
|
|
$(".shelf .discover h2:first").text(shelfText);
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
shelfText = $(".shelforder .col-sm-10 .col-sm-6.col-lg-6.col-xs-6 h2:first").text().replace(':',' —').replace(/\'/g,"");
|
|
|
|
$(".shelforder .col-sm-10 .col-sm-6.col-lg-6.col-xs-6 h2:first").text(shelfText);
|
2018-12-27 09:53:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
function mobileSupport() {
|
|
|
|
if ( $( window ).width() <= 768 ) {
|
|
|
|
//Move menu to collapse
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".row-fluid > .col-sm-2:first").appendTo(".navbar-collapse.collapse:first");
|
|
|
|
if ($( ".sidebar-backdrop").length < 1 ) {
|
|
|
|
$(".navbar-collapse.collapse:first" ).after("<div class='sidebar-backdrop'></div>");
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//Move menu out of collapse
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".col-sm-2:first").insertBefore(".col-sm-10:first");
|
|
|
|
$(".sidebar-backdrop").remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LayerCake plug
|
2020-05-10 12:57:19 +00:00
|
|
|
if ($(" body.stat p").length > 0 ) {
|
|
|
|
$(" body.stat p").append(" and <a href='https://github.com/leram84/layer.Cake/tree/master/caliBlur' target='_blank'>layer.Cake</a>");
|
|
|
|
str = $(" body.stat p").html().replace("</a>.","</a>");
|
|
|
|
$(" body.stat p").html(str);
|
2018-12-27 09:53:19 +00:00
|
|
|
}
|
|
|
|
// Collect delete buttons in editbook to single dropdown
|
2020-05-10 12:57:19 +00:00
|
|
|
$(".editbook .text-center.more-stuff").prepend('<button id="deleteButton" type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-remove"></span>Delete Format<span class="caret"></span></button><ul class="dropdown-menu delete-dropdown"></ul>' );
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
deleteButtons = $(".editbook .text-center.more-stuff a").removeClass("btn btn-danger").attr("type", "").get();
|
2018-12-27 09:53:19 +00:00
|
|
|
|
2020-05-10 12:57:19 +00:00
|
|
|
$(deleteButtons).detach();
|
|
|
|
$(".editbook .text-center.more-stuff h4").remove();
|
2018-12-27 09:53:19 +00:00
|
|
|
$.each(deleteButtons, function(i, val) {
|
2020-05-10 12:57:19 +00:00
|
|
|
$("<li>" + deleteButtons[i].outerHTML + "</li>").appendTo(".delete-dropdown");
|
2018-12-27 09:53:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Turn off bootstrap animations
|
|
|
|
$(function() { $.support.transition = false; })
|
|
|
|
|
|
|
|
mobileSupport();
|
|
|
|
|
|
|
|
// Only call function once resize is complete
|
|
|
|
//var id;
|
2020-05-10 12:57:19 +00:00
|
|
|
$(window).on("resize",function() {
|
2018-12-27 09:53:19 +00:00
|
|
|
// clearTimeout(id);
|
|
|
|
// id = setTimeout(mobileSupport, 500);
|
|
|
|
mobileSupport();
|
|
|
|
});
|