Commit 8e9b5d7e authored by Ozzieisaacs's avatar Ozzieisaacs

Merge remote-tracking branch 'caliblur/master'

parents a33515d9 e325c3db
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -15,303 +15,305 @@ ...@@ -15,303 +15,305 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// 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.stat").addClass("stats");
$("body.config").addClass("admin"); $("body.config").addClass("admin");
$("body.uiconfig").addClass("admin"); $("body.uiconfig").addClass("admin");
$("body.advsearch").addClass("advanced_search"); $("body.advsearch").addClass("advanced_search");
$("body.newuser").addClass("admin"); $("body.newuser").addClass("admin");
$("body.mailset").addClass("admin"); $("body.mailset").addClass("admin");
$("body > div.container-fluid > div > div.col-sm-10 > div.filterheader").attr("style","margin: 40px 0 !important; padding: 0 10px 0 40px !important;");
// Back button // Back button
curHref = window.location.href.split("/"); curHref = window.location.href.split("/");
prevHref = document.referrer.split("/"); prevHref = document.referrer.split("/");
$(".navbar-form.navbar-left") $(".navbar-form.navbar-left")
.before('<div class="plexBack"><a href="' + encodeURI(document.referrer) + '"></a></div>'); .before('<div class="plexBack"><a href="' + encodeURI(document.referrer) + '"></a></div>');
if ( history.length === 1 || if (history.length === 1 ||
curHref[0] + curHref[0] +
curHref[1] + curHref[1] +
curHref[2] != curHref[2] !=
prevHref[0] + prevHref[0] +
prevHref[1] + prevHref[1] +
prevHref[2] || prevHref[2] ||
$("body.root")>length > 0 ) { $("body.root") > length > 0) {
$(".plexBack").addClass("noBack"); $(".plexBack").addClass("noBack");
} }
//Weird missing a after pressing back from edit. //Weird missing a after pressing back from edit.
setTimeout(function() { setTimeout(function () {
if ( $(".plexBack a").length < 1 ) { if ($(".plexBack a").length < 1) {
$(".plexBack").append('<a href="' + encodeURI(document.referrer) + '"></a>'); $(".plexBack").append('<a href="' + encodeURI(document.referrer) + '"></a>');
} }
},10); }, 10);
// Home button // Home button
$(".plexBack").before( '<div class="home-btn"></div>' ); $(".plexBack").before('<div class="home-btn"></div>');
$("a.navbar-brand").clone().appendTo(".home-btn").empty().removeClass("navbar-brand"); $("a.navbar-brand").clone().appendTo(".home-btn").empty().removeClass("navbar-brand");
///////////////////////////////// /////////////////////////////////
// Start of Book Details Work // // Start of Book Details Work //
/////////////////////////////// ///////////////////////////////
// Wrap book description in div container // Wrap book description in div container
if ( $("body.book").length > 0 ) { if ($("body.book").length > 0) {
description = $(".comments"); description = $(".comments");
bookInfo = $(".author").nextUntil("#decription"); bookInfo = $(".author").nextUntil("#decription");
$("#decription").detach(); $("#decription").detach();
$( ".comments" ).detach(); $(".comments").detach();
$( bookInfo ).wrapAll( '<div class="bookinfo"></div>' ); $(bookInfo).wrapAll('<div class="bookinfo"></div>');
// $( 'h3:contains("Description:")' ).after( '<div class="description"></div>' ); // $( 'h3:contains("Description:")' ).after( '<div class="description"></div>' );
$(".languages").appendTo(".bookinfo"); $(".languages").appendTo(".bookinfo");
$(".hr").detach(); $(".hr").detach();
if ( $(".identifiers ").length > 0 ) { if ($(".identifiers ").length > 0) {
console.log(".identifiers length " + $(".identifiers").length ); console.log(".identifiers length " + $(".identifiers").length);
$( '.identifiers' ).before( '<div class="hr"></div>' ); $('.identifiers').before('<div class="hr"></div>');
} else { } else {
if ( $( ".bookinfo > p:first-child" ).length > 0 ) { if ($(".bookinfo > p:first-child").length > 0) {
console.log(".bookinfo > p:first-child length " + $( ".bookinfo > p" ).length ); console.log(".bookinfo > p:first-child length " + $(".bookinfo > p").length);
$( ".bookinfo > p:first-child" ).first().after( '<div class="hr"></div>' ); $(".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 { } else {
console.log("prepending hr div to top of .bookinfo"); if ($('.bookinfo a[href*="/series/"]').length > 0) {
$( ".bookinfo" ).prepend( '<div class="hr"></div>' ); 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");
$( ".rating" ).insertBefore( ".hr" ); $("#remove-from-shelves").insertAfter(".hr");
$( "#remove-from-shelves" ).insertAfter( ".hr" ); $(description).appendTo(".bookinfo")
$( description ).appendTo(".bookinfo") /* if book description is not in html format, Remove extra line breaks
/* if book description is not in html format, Remove extra line breaks Remove blank lines/unnecessary spaces, split by line break to array
Remove blank lines/unnecessary spaces, split by line break to array Push array into .description div. If there is still a wall of text,
Push array into .description div. If there is still a wall of text, find sentences and split wall into groups of three sentence paragraphs.
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
If the book format is in html format, Keep html, but strip away inline styles and empty elements */
styles and empty elements */
// If text is sitting in div as text node
// If text is sitting in div as text node if ($(".comments:has(p)").length === 0) {
if ( $(".comments:has(p)" ).length === 0 ) { newdesc = description.text()
newdesc = description.text() .replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "").split(/\n/);
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/); $(".comments").empty();
$(".comments" ).empty(); $.each(newdesc, function (i, val) {
$.each(newdesc, function(i, val) { $("div.comments").append("<p>" + newdesc[i] + "</p>");
$( "div.comments" ).append( "<p>" + newdesc[i] + "</p>" ); });
}); $(".comments").fadeIn(100);
$( ".comments" ).fadeIn(100); } //If still a wall of text create 3 sentence paragraphs.
} //If still a wall of text create 3 sentence paragraphs. if ($(".comments p").length === 1) {
if( $( ".comments p" ).length === 1 ) { if (description.context != undefined) {
if ( description.context != undefined ) { newdesc = description.text()
newdesc = description.text() .replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "").split(/\n/);
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/); } else {
} newdesc = description.text();
else { }
newdesc = description.text(); doc = nlp(newdesc.toString());
} sentences = doc.map((m) => m.out("text"));
doc = nlp ( newdesc.toString() ); sentences[0] = sentences[0].replace(",", "");
sentences = doc.map((m)=> m.out( "text" )); $(".comments p").remove();
sentences[0] = sentences[0].replace(",",""); let size = 3;
$( ".comments p" ).remove(); let sentenceChunks = [];
let size = 3; let sentenceChunks = []; for (var i = 0; i < sentences.length; i += size) {
for (var i=0; i<sentences.length; i+=size) { sentenceChunks.push(sentences.slice(i, i + size));
sentenceChunks.push(sentences.slice(i,i+size)); }
} let output = '';
let output = ''; $.each(sentenceChunks, function (i, val) {
$.each(sentenceChunks, function(i, val) { let preOutput = '';
let preOutput = ''; $.each(val, function (i, val) {
$.each(val, function(i, val) { preOutput += val;
preOutput += val; });
}); output += "<p>" + preOutput + "</p>";
output += "<p>" + preOutput + "</p>"; });
}); $("div.comments").append(output);
$( "div.comments" ).append( output ); } else {
} $.each(description, function (i, val) {
else {
$.each(description, function(i, val) {
// $( description[i].outerHTML ).appendTo( ".comments" ); // $( description[i].outerHTML ).appendTo( ".comments" );
$( "div.comments :empty" ).remove(); $("div.comments :empty").remove();
$( "div.comments ").attr( "style", "" ); $("div.comments ").attr("style", "");
}); });
$( "div.comments" ).fadeIn( 100 ); $("div.comments").fadeIn(100);
} }
// Sexy blurred backgrounds // Sexy blurred backgrounds
cover = $( ".cover img" ).attr( "src" ); cover = $(".cover img").attr("src");
$( "#loader + .container-fluid" ) $("#loader + .container-fluid")
.prepend( "<div class='blur-wrapper'></div>" ); .prepend("<div class='blur-wrapper'></div>");
$( ".blur-wrapper" ) $(".blur-wrapper")
.prepend( '<div><img alt="Blurred cover" class="bg-blur" src="' + cover + '"></div>' ); .prepend('<div><img alt="Blurred cover" class="bg-blur" src="' + cover + '"></div>');
// Fix-up book detail headings // Fix-up book detail headings
publisher = $( ".publishers p span" ).text().split( ":" ); publisher = $(".publishers p span").text().split(":");
$( ".publishers p span" ).remove(); $(".publishers p span").remove();
$.each(publisher, function(i, val) { $.each(publisher, function (i, val) {
$( ".publishers" ).append( "<span>" + publisher[i] + "</span>" ); $(".publishers").append("<span>" + publisher[i] + "</span>");
});
$(".publishers span:nth-child(3)").text(function () {
return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
}); });
$( ".publishers span:nth-child(3)" ).text(function() {
return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
});
// Fix-up book custom colums headings // Fix-up book custom colums headings
// real_custom_column = $( '.real_custom_columns' ).text().split( ':' ); // real_custom_column = $( '.real_custom_columns' ).text().split( ':' );
real_custom_column = $( ".real_custom_columns" ); real_custom_column = $(".real_custom_columns");
// $( ".real_custom_columns" ).remove(); // $( ".real_custom_columns" ).remove();
$.each(real_custom_column, function(i, val) { $.each(real_custom_column, function (i, val) {
var split = $(this).text().split( ":" ); var split = $(this).text().split(":");
real_cc_key = split.shift(); real_cc_key = split.shift();
real_cc_value = split.join(":"); real_cc_value = split.join(":");
$( this ).text(""); $(this).text("");
if (real_cc_value != "") { if (real_cc_value != "") {
$( this ).append( "<span>" + real_cc_key + "</span><span>" + real_cc_value + "</span>" ); $(this).append("<span>" + real_cc_key + "</span><span>" + real_cc_value + "</span>");
} }
}); });
//$( '.real_custom_columns:nth-child(3)' ).text(function() { //$( '.real_custom_columns:nth-child(3)' ).text(function() {
//return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, ""); //return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, "");
//}); //});
published = $( ".publishing-date p" ) published = $(".publishing-date p")
.text().split(": "); .text().split(": ");
$( ".publishing-date p" ).remove(); $(".publishing-date p").remove();
$.each(published, function(i, val) { $.each(published, function (i, val) {
$( ".publishing-date" ).append( "<span>" + published[i] + "</span>" ); $(".publishing-date").append("<span>" + published[i] + "</span>");
}); });
languages = $( ".languages p span" ).text().split( ": " ); languages = $(".languages p span").text().split(": ");
$( ".languages p span" ).remove(); $(".languages p span").remove();
$.each(languages, function(i, val) { $.each(languages, function (i, val) {
$( ".languages" ).append( "<span>" + languages[i] + "</span>" ); $(".languages").append("<span>" + languages[i] + "</span>");
});
$( ".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 ) {
$( '<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) {
$( "<li>" + downloads[i].outerHTML + "</li>" ).appendTo( ".leramslist" );
}); });
$( ".leramslist" ).find( "span" ).remove();
$( ".leramslist a" ).removeClass( "btn btn-primary" ).removeAttr( "role" );
}
// Add classes to buttons
$( "#sendbtn" ).parent().addClass( "sendBtn" );
$( "[id*=btnGroupDrop]" ).parent().addClass( "downloadBtn" );
$( "read-in-browser" ).parent().addClass( "readBtn" );
$( ".downloadBtn button:first" ).addClass( "download-text" );
// Move all options in book details page to the same group
$( "[aria-label*='Delete book']" )
.prependTo( '[aria-label^="Download, send"]' )
.children().removeClass( "btn-sm" );
$( ".custom_columns" )
.addClass(" btn-group" )
.attr("role", "group" )
.removeClass( "custom_columns" )
.prependTo( '[aria-label^="Download, send"]' );
$( "#have_read_cb" )
.after( '<label class="block-label readLbl" for="#have_read_cb"></label>' );
$( "#archived_cb" )
.after( '<label class="block-label readLbl" for="#archived_cb"></label>' );
$( "#shelf-actions" ).prependTo( '[aria-label^="Download, send"]' );
// Move dropdown lists higher in dom, replace bootstrap toggle with own toggle.
$( '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();
});
$(".downloadBtn" ).click( function() {
$( ".leramslist" ).toggle();
});
$("#sendbtn2" ).click( function() {
$( ".sendtokindle-drop" ).toggle();
});
$('div[aria-label="Add to shelves"]' ).click( function() {
$( "#add-to-shelves" ).toggle();
});
// Fix formatting error on book detail languages
if ( !$( ".book-meta > .bookinfo > .languages > span:last-of-type" ).text().startsWith(" ") ) {
$( ".book-meta > .bookinfo > .languages > span:last-of-type" ).prepend(" ");
}
//Work to reposition dropdowns. Does not currently solve for
//screen resizing
function dropdownToggle() {
topPos = $( ".book-meta > .btn-toolbar:first" ).offset().top
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();
ribPosition = position - positionOff - 5
$( ".readinbrowser-drop" ).attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$( ".readinbrowser-drop" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
if ( $( "#sendbtn2" ).length > 0 ) { $(".book-meta h2:first").clone()
position = $( "#sendbtn2" ).offset().left .prependTo(".book-meta > .btn-toolbar:first");
if ( position + $( ".sendtokindle-drop" ).width() > $( window ).width() ) {
positionOff = position + $( ".sendtokindle-drop" ).width() - $( window ).width(); // If only one download type exists still put the items into a drop-drown list.
ribPosition = position - positionOff - 5 downloads = $("a[id^=btnGroupDrop]").get();
$( ".sendtokindle-drop" ).attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px"); if ($(downloads).length === 1) {
} else { $('<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]);
$( ".sendtokindle-drop" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px"); $(downloads).detach();
} $.each(downloads, function (i, val) {
$("<li>" + downloads[i].outerHTML + "</li>").appendTo(".leramslist");
});
$(".leramslist").find("span").remove();
$(".leramslist a").removeClass("btn btn-primary").removeAttr("role");
} }
if ( $( ".downloadBtn" ).length > 0 ) { // Add classes to buttons
$("#sendbtn").parent().addClass("sendBtn");
$("[id*=btnGroupDrop]").parent().addClass("downloadBtn");
$("read-in-browser").parent().addClass("readBtn");
$(".downloadBtn button:first").addClass("download-text");
// Move all options in book details page to the same group
$("[aria-label*='Delete book']")
.prependTo('[aria-label^="Download, send"]')
.children().removeClass("btn-sm");
$(".custom_columns")
.addClass(" btn-group")
.attr("role", "group")
.removeClass("custom_columns")
.prependTo('[aria-label^="Download, send"]');
$("#have_read_cb")
.after('<label class="block-label readLbl" for="#have_read_cb"></label>');
$("#archived_cb")
.after('<label class="block-label readLbl" for="#archived_cb"></label>');
$("#shelf-actions").prependTo('[aria-label^="Download, send"]');
// Move dropdown lists higher in dom, replace bootstrap toggle with own toggle.
$('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();
});
$(".downloadBtn").click(function () {
$(".leramslist").toggle();
});
$("#sendbtn2").click(function () {
$(".sendtokindle-drop").toggle();
});
position = $( "#btnGroupDrop1" ).offset().left
if ( position + $( ".leramslist" ).width() > $( window ).width() ) { $('div[aria-label="Add to shelves"]').click(function () {
positionOff = position + $( ".leramslist" ).width() - $( window ).width(); $("#add-to-shelves").toggle();
dlPosition = position - positionOff - 5 });
$( ".leramslist" ).attr("style", "left: " + dlPosition + "px !important; right: auto; top: " + topPos + "px");
} else { // Fix formatting error on book detail languages
$( ".leramslist" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px"); if (!$(".book-meta > .bookinfo > .languages > span:last-of-type").text().startsWith(" ")) {
} $(".book-meta > .bookinfo > .languages > span:last-of-type").prepend(" ");
} }
if ( $( 'div[aria-label="Add to shelves"]' ).length > 0 ) { //Work to reposition dropdowns. Does not currently solve for
//screen resizing
function dropdownToggle() {
topPos = $(".book-meta > .btn-toolbar:first").offset().top
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();
ribPosition = position - positionOff - 5
$(".readinbrowser-drop").attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$(".readinbrowser-drop").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
if ($("#sendbtn2").length > 0) {
position = $("#sendbtn2").offset().left
if (position + $(".sendtokindle-drop").width() > $(window).width()) {
positionOff = position + $(".sendtokindle-drop").width() - $(window).width();
ribPosition = position - positionOff - 5
$(".sendtokindle-drop").attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$(".sendtokindle-drop").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
position = $( 'div[aria-label="Add to shelves"]' ).offset().left if ($(".downloadBtn").length > 0) {
position = $("#btnGroupDrop1").offset().left
if (position + $(".leramslist").width() > $(window).width()) {
positionOff = position + $(".leramslist").width() - $(window).width();
dlPosition = position - positionOff - 5
$(".leramslist").attr("style", "left: " + dlPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$(".leramslist").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
if ( position + $( "#add-to-shelves" ).width() > $( window ).width() ) { if ($('div[aria-label="Add to shelves"]').length > 0) {
positionOff = position + $( "#add-to-shelves" ).width() - $( window ).width();
adsPosition = position - positionOff - 5 position = $('div[aria-label="Add to shelves"]').offset().left
$( "#add-to-shelves" ).attr("style", "left: " + adsPosition + "px !important; right: auto; top: " + topPos + "px");
} else { if (position + $("#add-to-shelves").width() > $(window).width()) {
$( "#add-to-shelves" ).attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px"); positionOff = position + $("#add-to-shelves").width() - $(window).width();
} adsPosition = position - positionOff - 5
$("#add-to-shelves").attr("style", "left: " + adsPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$("#add-to-shelves").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
} }
}
dropdownToggle();
$( window ).on( "resize", function() {
dropdownToggle(); dropdownToggle();
});
$(window).on("resize", function () {
dropdownToggle();
});
// Clone book rating for mobile view. // Clone book rating for mobile view.
$( ".book-meta > .bookinfo > .rating" ).clone().insertBefore( ".book-meta > .description" ).addClass("rating-mobile"); $(".book-meta > .bookinfo > .rating").clone().insertBefore(".book-meta > .description").addClass("rating-mobile");
} }
/////////////////////////////// ///////////////////////////////
...@@ -324,80 +326,77 @@ $( ".book-meta > .bookinfo > .rating" ).clone().insertBefore( ".book-meta > .des ...@@ -324,80 +326,77 @@ $( ".book-meta > .bookinfo > .rating" ).clone().insertBefore( ".book-meta > .des
// Hide dropdown and collapse menus on click-off // Hide dropdown and collapse menus on click-off
$(document).mouseup(function (e) { $(document).mouseup(function (e) {
var container = new Array(); var container = new Array();
container.push($('ul[aria-labelledby="read-in-browser"]')); container.push($('ul[aria-labelledby="read-in-browser"]'));
container.push($(".sendtokindle-drop")); container.push($(".sendtokindle-drop"));
container.push($(".leramslist")); container.push($(".leramslist"));
container.push($("#add-to-shelves")); container.push($("#add-to-shelves"));
container.push($(".navbar-collapse.collapse.in")); container.push($(".navbar-collapse.collapse.in"));
$.each(container, function(key, value) { $.each(container, function (key, value) {
if (!$(value).is(e.target) // if the target of the click isn't the container... 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 && $(value).has(e.target).length === 0) // ... nor a descendant of the container
{
if ( $(value).hasClass("dropdown-menu") )
{
$(value).hide();
} else
{
if ( $(value).hasClass("collapse") )
{ {
$(value).collapse("toggle"); if ($(value).hasClass("dropdown-menu")) {
$(value).hide();
} else {
if ($(value).hasClass("collapse")) {
$(value).collapse("toggle");
}
}
} }
} });
}
});
}); });
// Split path name to array and remove blanks // Split path name to array and remove blanks
url = window.location.pathname url = window.location.pathname
// Move create shelf // Move create shelf
$( "#nav_createshelf" ).prependTo( ".your-shelves" ); $("#nav_createshelf").prependTo(".your-shelves");
// Create drop-down for profile and move elements to it // Create drop-down for profile and move elements to it
$( "#main-nav" ) $("#main-nav")
.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>' ); .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>');
$( "#top_user" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" ); $("#top_user").parent().addClass("dropdown").appendTo(".profileDropli");
$( "#nav_about" ).addClass( "dropdown" ).appendTo( ".profileDropli" ); $("#nav_about").addClass("dropdown").appendTo(".profileDropli");
$( "#register" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" ); $("#register").parent().addClass("dropdown").appendTo(".profileDropli");
$( "#logout" ).parent().addClass( "dropdown" ).appendTo( ".profileDropli" ); $("#logout").parent().addClass("dropdown").appendTo(".profileDropli");
// Remove the modals except from some areas where they are needed // Remove the modals except from some areas where they are needed
bodyClass = $( "body" ).attr( "class" ).split(" "); bodyClass = $("body").attr("class").split(" ");
modalWanted = ["admin", "editbook", "config", "uiconfig", "me", "edituser"]; modalWanted = ["admin", "editbook", "config", "uiconfig", "me", "edituser"];
if ( $.inArray( bodyClass[0], modalWanted) != -1 ) { if ($.inArray(bodyClass[0], modalWanted) != -1) {
} else { } else {
$(" a:not(.dropdown-toggle) ") $(" a:not(.dropdown-toggle) ")
.removeAttr( "data-toggle", "data-target", "data-remote" ); .removeAttr("data-toggle", "data-target", "data-remote");
} }
// Add classes to global buttons // Add classes to global buttons
$( "#top_tasks" ).parent().addClass( "top_tasks" ); $("#top_tasks").parent().addClass("top_tasks");
$( "#top_admin" ).parent().addClass( "top_admin" ); $("#top_admin").parent().addClass("top_admin");
$( "#form-upload" ).parent().addClass( "form-upload" ); $("#form-upload").parent().addClass("form-upload");
// Search button work // Search button work
$( "input#query" ).focus(function() { $("input#query").focus(function () {
$( 'form[role="search"]' ).addClass( "search-focus" ); $('form[role="search"]').addClass("search-focus");
}); });
$( "input#query" ).focusout(function() { $("input#query").focusout(function () {
setTimeout(function() { setTimeout(function () {
$( 'form[role="search"]' ).removeClass( "search-focus" ); $('form[role="search"]').removeClass("search-focus");
}, 100); }, 100);
}); });
// 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 () {
// Add .offscreen if part of container not visible // Add .offscreen if part of container not visible
$(".dropdown-menu:visible").filter(function(){ $(".dropdown-menu:visible").filter(function () {
return $(this).visible() === false; return $(this).visible() === false;
}).each(function(){ }).each(function () {
$(this).addClass("offscreen"); $(this).addClass("offscreen");
}); });
}); });
// Fade out content on page unload // Fade out content on page unload
...@@ -426,324 +425,347 @@ $(document).on("click",".dropdown-toggle",function() { ...@@ -426,324 +425,347 @@ $(document).on("click",".dropdown-toggle",function() {
});*/ });*/
// Collapse long text into read-more // Collapse long text into read-more
$( "div.comments" ).readmore( { $("div.comments").readmore({
collapsedHeight: 134, collapsedHeight: 134,
heightMargin: 45, heightMargin: 45,
speed: 300, speed: 300,
moreLink: '<a href="#">READ MORE</a>', // ToDo: make translateable moreLink: '<a href="#">READ MORE</a>', // ToDo: make translateable
lessLink: '<a href="#">READ LESS</a>', // ToDo: make translateable lessLink: '<a href="#">READ LESS</a>', // ToDo: make translateable
}); });
///////////////////////////////// /////////////////////////////////
// End of Global Work // // End of Global Work //
/////////////////////////////// ///////////////////////////////
// Author Page Background Blur // Author Page Background Blur
if ( $( "body.author" ).length >0 ) { if ($("body.author").length > 0) {
cover = $( ".author-bio img" ).attr( "src" ); cover = $(".author-bio img").attr("src");
$( "#loader + .container-fluid" ) $("#loader + .container-fluid")
.prepend( '<div class="blur-wrapper"></div>' ); .prepend('<div class="blur-wrapper"></div>');
$( ".blur-wrapper" ).prepend( '<img alt="Blurred author bio" class="bg-blur" src="' + cover + '">' ); $(".blur-wrapper").prepend('<img alt="Blurred author bio" class="bg-blur" src="' + cover + '">');
// Place undefined cover images inside container // Place undefined cover images inside container
if ( $( '.bg-blur[src="undefined"]' ).length > 0 ) { if ($('.bg-blur[src="undefined"]').length > 0) {
$( ".bg-blur" ).before( '<div class="bg-blur undefined-img"></div>' ); $(".bg-blur").before('<div class="bg-blur undefined-img"></div>');
$( "img.bg-blur" ).appendTo( '.undefined-img' ); $("img.bg-blur").appendTo('.undefined-img');
} }
} }
// Ereader Page - add class to iframe body on ereader page after it loads. // Ereader Page - add class to iframe body on ereader page after it loads.
backurl = "../../book/" + url[2] backurl = "../../book/" + url[2]
$( "body.epub #title-controls" ) $("body.epub #title-controls")
.append('<div class="epub-back"><input action="action" onclick="location.href=backurl; return false;" type="button" value="Back" /></div>') .append('<div class="epub-back"><input action="action" onclick="location.href=backurl; return false;" type="button" value="Back" /></div>')
$( "body.stat .col-sm-10 p:first" ).insertAfter( "#libs" ); $("body.stat .col-sm-10 p:first").insertAfter("#libs");
// Check if link is external and force _blank attribute // Check if link is external and force _blank attribute
$(function(){ // document ready $(function () { // document ready
$( "a" ).filter(function () { $("a").filter(function () {
return this.hostname && this.hostname !== location.hostname; return this.hostname && this.hostname !== location.hostname;
}).each(function () { }).each(function () {
$(this).addClass("external").attr( "target", "_blank" ); $(this).addClass("external").attr("target", "_blank");
}); });
}); });
// Check if lists are empty and add class to buttons // Check if lists are empty and add class to buttons
if ( $.trim( $("#add-to-shelves").html() ).length === 0 ) { if ($.trim($("#add-to-shelves").html()).length === 0) {
$( "#add-to-shelf" ).addClass( "empty-ul" ); $("#add-to-shelf").addClass("empty-ul");
} }
shelfLength = $("#add-to-shelves li").length shelfLength = $("#add-to-shelves li").length
emptyLength = 0 emptyLength = 0
$("#add-to-shelves").on("click","li a",function(){ $("#add-to-shelves").on("click", "li a", function () {
console.log("#remove-from-shelves change registered" ); console.log("#remove-from-shelves change registered");
emptyLength++ emptyLength++
setTimeout(function() { setTimeout(function () {
if ( emptyLength >= shelfLength ) { if (emptyLength >= shelfLength) {
console.log("list is empty; adding empty-ul class" ); console.log("list is empty; adding empty-ul class");
$( "#add-to-shelf" ).addClass( "empty-ul" ); $("#add-to-shelf").addClass("empty-ul");
} else { } else {
console.log("list is not empty; removing empty-ul class" ); console.log("list is not empty; removing empty-ul class");
$( "#add-to-shelf" ).removeClass( "empty-ul" ); $("#add-to-shelf").removeClass("empty-ul");
} }
},100); }, 100);
}); });
if ( $.trim( $( 'ul[aria-labelledby="read-in-browser"] li' ).html() ).length === 0 ) { if ($.trim($('ul[aria-labelledby="read-in-browser"] li').html()).length === 0) {
$("#read-in-browser").addClass("empty-ul"); $("#read-in-browser").addClass("empty-ul");
} }
// Shelf Buttons and Tooltips // Shelf Buttons and Tooltips
if ( $( "body.shelf" ).length > 0 ) { if ($("body.shelf").length > 0) {
$( 'div[data-target="#DeleteShelfDialog"]' ) $('div[data-target="#DeleteShelfDialog"]')
.before( '<div class=".btn-group shelf-btn-group"></div>' ) .before('<div class=".btn-group shelf-btn-group"></div>')
.appendTo( ".shelf-btn-group" ) .appendTo(".shelf-btn-group")
.addClass( "delete-shelf-btn" ); .addClass("delete-shelf-btn");
$( 'a[href*="edit"]' ) $('a[href*="edit"]')
.appendTo( ".shelf-btn-group" ) .appendTo(".shelf-btn-group")
.addClass( "edit-shelf-btn" ); .addClass("edit-shelf-btn");
$( 'a[href*="order"]' ) $('a[href*="order"]')
.appendTo( ".shelf-btn-group" ) .appendTo(".shelf-btn-group")
.addClass( "order-shelf-btn" ); .addClass("order-shelf-btn");
$(".delete-shelf-btn").attr({ $(".delete-shelf-btn").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $( ".delete-shelf-btn" ).text(), // "Delete Shelf" "title": $(".delete-shelf-btn").text(), // "Delete Shelf"
"data-placement": "bottom" }) "data-placement": "bottom"
.addClass("delete-btn-tooltip"); })
.addClass("delete-btn-tooltip");
$(".edit-shelf-btn").attr({
"data-toggle-two": "tooltip", $(".edit-shelf-btn").attr({
"title": $(".edit-shelf-btn").text(), // "Edit Shelf" "data-toggle-two": "tooltip",
"data-placement": "bottom" }) "title": $(".edit-shelf-btn").text(), // "Edit Shelf"
.addClass("edit-btn-tooltip"); "data-placement": "bottom"
})
$(".order-shelf-btn").attr({ .addClass("edit-btn-tooltip");
"data-toggle-two": "tooltip",
"title": $(".order-shelf-btn").text(), //"Reorder Shelf" $(".order-shelf-btn").attr({
"data-placement": "bottom" }) "data-toggle-two": "tooltip",
.addClass("order-btn-tooltip"); "title": $(".order-shelf-btn").text(), //"Reorder Shelf"
"data-placement": "bottom"
})
.addClass("order-btn-tooltip");
} }
// Rest of Tooltips // Rest of Tooltips
$(".home-btn > a").attr({ $(".home-btn > a").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $(document.body).attr("data-text"), // Home "title": $(document.body).attr("data-text"), // Home
"data-placement": "bottom" }) "data-placement": "bottom"
})
.addClass("home-btn-tooltip"); .addClass("home-btn-tooltip");
$(".plexBack > a").attr({ $(".plexBack > a").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $(document.body).attr("data-textback"), // Back "title": $(document.body).attr("data-textback"), // Back
"data-placement": "bottom" }) "data-placement": "bottom"
.addClass("back-btn-tooltip"); })
.addClass("back-btn-tooltip");
$("#top_tasks").attr({ $("#top_tasks").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#top_tasks").text(), // "Tasks" "title": $("#top_tasks").text(), // "Tasks"
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": "#main-nav" }) "data-viewport": "#main-nav"
})
.addClass("tasks-btn-tooltip"); .addClass("tasks-btn-tooltip");
$( "#top_admin" ).attr({ $("#top_admin").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $( "#top_admin" ).attr("data-text"), // Settings "title": $("#top_admin").attr("data-text"), // Settings
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": "#main-nav" }) "data-viewport": "#main-nav"
.addClass("admin-btn-tooltip"); })
.addClass("admin-btn-tooltip");
$(".profileDrop").attr({ $(".profileDrop").attr({
"title": $("#top_user").attr("data-text"), //Account "title": $("#top_user").attr("data-text"), //Account
"data-placement": "bottom", "data-placement": "bottom",
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"data-viewport": "#main-nav" }) "data-viewport": "#main-nav"
.addClass("send-btn-tooltip dropdown"); })
.addClass("send-btn-tooltip dropdown");
$("#btn-upload").attr({ $("#btn-upload").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#btn-upload").parent().text() , // "Upload" "title": $("#btn-upload").parent().text(), // "Upload"
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": "#main-nav" }) "data-viewport": "#main-nav"
.addClass("upload-btn-tooltip"); })
.addClass("upload-btn-tooltip");
$("#add-to-shelf").attr({ $("#add-to-shelf").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $("#add-to-shelf").text() , // "Add to Shelf" "title": $("#add-to-shelf").text(), // "Add to Shelf"
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("addtoshelf-btn-tooltip"); })
.addClass("addtoshelf-btn-tooltip");
$("#have_read_cb").attr({ $("#have_read_cb").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#have_read_cb").attr("data-unchecked"), "title": $("#have_read_cb").attr("data-unchecked"),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("readunread-btn-tooltip"); })
.addClass("readunread-btn-tooltip");
$("#have_read_cb:checked").attr({ $("#have_read_cb:checked").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $( "#have_read_cb").attr("data-checked"), "title": $("#have_read_cb").attr("data-checked"),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("readunread-btn-tooltip"); })
.addClass("readunread-btn-tooltip");
$("#archived_cb").attr({ $("#archived_cb").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#archived_cb").attr("data-unchecked"), "title": $("#archived_cb").attr("data-unchecked"),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
})
.addClass("readunread-btn-tooltip"); .addClass("readunread-btn-tooltip");
$("#archived_cb:checked").attr({ $("#archived_cb:checked").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#archived_cb").attr("data-checked"), "title": $("#archived_cb").attr("data-checked"),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
})
.addClass("readunread-btn-tooltip"); .addClass("readunread-btn-tooltip");
$("button#delete").attr({ $("button#delete").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $( "button#delete" ).text(), //"Delete" "title": $("button#delete").text(), //"Delete"
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
})
.addClass("delete-book-btn-tooltip"); .addClass("delete-book-btn-tooltip");
$("#have_read_cb").click(function() { $("#have_read_cb").click(function () {
if ( $( "#have_read_cb:checked" ).length > 0 ) { if ($("#have_read_cb:checked").length > 0) {
$( this ).attr("data-original-title", $("#have_read_cb").attr("data-checked")); $(this).attr("data-original-title", $("#have_read_cb").attr("data-checked"));
} else { } else {
$( this).attr("data-original-title", $("#have_read_cb").attr("data-unchecked")); $(this).attr("data-original-title", $("#have_read_cb").attr("data-unchecked"));
} }
}); });
$("#archived_cb").click(function() { $("#archived_cb").click(function () {
if ( $( "#archived_cb:checked" ).length > 0 ) { if ($("#archived_cb:checked").length > 0) {
$( this ).attr("data-original-title", $("#archived_cb").attr("data-checked")); $(this).attr("data-original-title", $("#archived_cb").attr("data-checked"));
} else { } else {
$( this).attr("data-original-title", $("#archived_cb").attr("data-unchecked")); $(this).attr("data-original-title", $("#archived_cb").attr("data-unchecked"));
} }
}); });
$('.btn-group[aria-label="Edit/Delete book"] a').attr({ $('.btn-group[aria-label="Edit/Delete book"] a').attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $( "#edit_book" ).text(), // "Edit" "title": $("#edit_book").text(), // "Edit"
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("edit-btn-tooltip"); })
.addClass("edit-btn-tooltip");
$("#sendbtn").attr({ $("#sendbtn").attr({
"data-toggle": "tooltip", "data-toggle": "tooltip",
"title": $("#sendbtn").attr("data-text"), "title": $("#sendbtn").attr("data-text"),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("send-btn-tooltip"); })
.addClass("send-btn-tooltip");
$("#sendbtn2").attr({ $("#sendbtn2").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $( "#sendbtn2" ).text(), // "Send to Kindle", "title": $("#sendbtn2").text(), // "Send to Kindle",
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }) "data-viewport": ".btn-toolbar"
.addClass("send-btn-tooltip"); })
.addClass("send-btn-tooltip");
$("#read-in-browser").attr({ $("#read-in-browser").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $("#read-in-browser").text(), "title": $("#read-in-browser").text(),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar"}) "data-viewport": ".btn-toolbar"
.addClass("send-btn-tooltip"); })
.addClass("send-btn-tooltip");
$("#btnGroupDrop1").attr({ $("#btnGroupDrop1").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $( "#btnGroupDrop1" ).text(), "title": $("#btnGroupDrop1").text(),
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" }); "data-viewport": ".btn-toolbar"
});
if ( $( "body.epub").length === 0 ) {
$(document).ready(function(){ if ($("body.epub").length === 0) {
$("[data-toggle='tooltip']").tooltip({container: "body", trigger: "hover"}); $(document).ready(function () {
$("[data-toggle-two='tooltip']").tooltip({container: "body", trigger: "hover"}); $("[data-toggle='tooltip']").tooltip({container: "body", trigger: "hover"});
$( "#btn-upload" ).attr("title", " "); $("[data-toggle-two='tooltip']").tooltip({container: "body", trigger: "hover"});
}); $("#btn-upload").attr("title", " ");
});
$( '[data-toggle-two="tooltip"]' ).click(function(){
$('[data-toggle-two="tooltip"]').tooltip("hide"); $('[data-toggle-two="tooltip"]').click(function () {
}); $('[data-toggle-two="tooltip"]').tooltip("hide");
});
$( '[data-toggle="tooltip"]' ).click(function(){
$('[data-toggle="tooltip"]').tooltip("hide"); $('[data-toggle="tooltip"]').click(function () {
}); $('[data-toggle="tooltip"]').tooltip("hide");
});
} }
$("#read-in-browser a").attr("target",""); $("#read-in-browser a").attr("target", "");
if ( $(".edit-shelf-btn").length > 1 ) { if ($(".edit-shelf-btn").length > 1) {
$(".edit-shelf-btn:first").remove(); $(".edit-shelf-btn:first").remove();
} }
if ( $(".order-shelf-btn").length > 1 ) { if ($(".order-shelf-btn").length > 1) {
$(".order-shelf-btn:first").remove(); $(".order-shelf-btn:first").remove();
} }
$("#top_user > span.hidden-sm" ).clone().insertBefore(".profileDropli"); $("#top_user > span.hidden-sm").clone().insertBefore(".profileDropli");
$(".navbar-collapse.collapse.in").before('<div class="sidebar-backdrop"></div>'); $(".navbar-collapse.collapse.in").before('<div class="sidebar-backdrop"></div>');
// Get rid of leading white space // Get rid of leading white space
recentlyAdded = $("#nav_new a:contains('Recently')").text().trim(); recentlyAdded = $("#nav_new a:contains('Recently')").text().trim();
$("#nav_new a:contains('Recently')").contents().filter(function() { $("#nav_new a:contains('Recently')").contents().filter(function () {
return this.nodeType == 3 return this.nodeType == 3
}).each(function(){ }).each(function () {
this.textContent = this.textContent.replace(" Recently Added",recentlyAdded); this.textContent = this.textContent.replace(" Recently Added", recentlyAdded);
}); });
// Change shelf textValue // Change shelf textValue
shelfText = $( ".shelf .discover h2:first" ).text().replace(":"," —").replace(/\'/g,""); shelfText = $(".shelf .discover h2:first").text().replace(":", " —").replace(/\'/g, "");
$(".shelf .discover h2:first").text(shelfText); $(".shelf .discover h2:first").text(shelfText);
shelfText = $(".shelforder .col-sm-10 .col-sm-6.col-lg-6.col-xs-6 h2:first").text().replace(':',' —').replace(/\'/g,""); 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); $(".shelforder .col-sm-10 .col-sm-6.col-lg-6.col-xs-6 h2:first").text(shelfText);
function mobileSupport() { function mobileSupport() {
if ( $( window ).width() <= 768 ) { if ($(window).width() <= 768) {
//Move menu to collapse //Move menu to collapse
$(".row-fluid > .col-sm-2:first").appendTo(".navbar-collapse.collapse:first"); $(".row-fluid > .col-sm-2:first").appendTo(".navbar-collapse.collapse:first");
if ($( ".sidebar-backdrop").length < 1 ) { if ($(".sidebar-backdrop").length < 1) {
$(".navbar-collapse.collapse:first" ).after("<div class='sidebar-backdrop'></div>"); $(".navbar-collapse.collapse:first").after("<div class='sidebar-backdrop'></div>");
} }
} else { } else {
//Move menu out of collapse //Move menu out of collapse
$(".col-sm-2:first").insertBefore(".col-sm-10:first"); $(".col-sm-2:first").insertBefore(".col-sm-10:first");
$(".sidebar-backdrop").remove(); $(".sidebar-backdrop").remove();
} }
} }
// LayerCake plug // LayerCake plug
if ($(" body.stat p").length > 0 ) { 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>"); $(" 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>"); str = $(" body.stat p").html().replace("</a>.", "</a>");
$(" body.stat p").html(str); $(" body.stat p").html(str);
} }
// Collect delete buttons in editbook to single dropdown // Collect delete buttons in editbook to single dropdown
$(".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>' ); $(".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>');
deleteButtons = $(".editbook .text-center.more-stuff a").removeClass("btn btn-danger").attr("type", "").get(); deleteButtons = $(".editbook .text-center.more-stuff a").removeClass("btn btn-danger").attr("type", "").get();
$(deleteButtons).detach(); $(deleteButtons).detach();
$(".editbook .text-center.more-stuff h4").remove(); $(".editbook .text-center.more-stuff h4").remove();
$.each(deleteButtons, function(i, val) { $.each(deleteButtons, function (i, val) {
$("<li>" + deleteButtons[i].outerHTML + "</li>").appendTo(".delete-dropdown"); $("<li>" + deleteButtons[i].outerHTML + "</li>").appendTo(".delete-dropdown");
}); });
// Turn off bootstrap animations // Turn off bootstrap animations
$(function() { $.support.transition = false; }) $(function () {
$.support.transition = false;
})
mobileSupport(); mobileSupport();
// Only call function once resize is complete // Only call function once resize is complete
//var id; //var id;
$(window).on("resize",function() { $(window).on("resize", function () {
// clearTimeout(id); // clearTimeout(id);
// id = setTimeout(mobileSupport, 500); // id = setTimeout(mobileSupport, 500);
mobileSupport(); mobileSupport();
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment