Skip to content

Commit

Permalink
Merge remote-tracking branch 'theme/master'
Browse files Browse the repository at this point in the history
Added translations for some tooltips
Updated translations
  • Loading branch information
OzzieIsaacs committed Jan 12, 2019
2 parents f053508 + 4ace3a5 commit c527d1f
Show file tree
Hide file tree
Showing 28 changed files with 3,208 additions and 3,252 deletions.
100 changes: 1 addition & 99 deletions cps/static/css/caliBlur.min.css

Large diffs are not rendered by default.

151 changes: 25 additions & 126 deletions cps/static/js/caliBlur.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// 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.uiconfig' ).addClass( 'admin');
$( 'body.advsearch' ).addClass( 'advanced_search' );
$( 'body.newuser' ).addClass( 'admin' );
$( 'body.mailset' ).addClass( 'admin' );

// Back button
curHref = window.location.href.split('/');
Expand Down Expand Up @@ -34,99 +40,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( '<div class="bookinfo"></div>' );
$( 'h3:contains("Description:")' ).after( '<div class="description"></div>' );
$( '.languages' ).appendTo( '.bookinfo' );
$('.hr').detach();
if ( $( '.identifiers ').length > 0 ) {
console.log(".identifiers length " + $( '.identifiers ').length );
$( '.identifiers' ).before( '<div class="hr"></div>' );
} else {
if ( $( '.bookinfo > p:first-child' ).length > 0 ) {
console.log(".bookinfo > p:first-child length " + $( '.bookinfo > p' ).length );
$( '.bookinfo > p:first-child' ).first().after( '<div class="hr"></div>' );
} else{
if ( $( '.bookinfo a[href*="/series/"]' ).length > 0 ) {
console.log( 'series text found; placing hr below series' );
$( '.bookinfo a[href*="/series/"]' ).parent().after( '<div class="hr"></div>' );
} else {
console.log("prepending hr div to top of .bookinfo");
$( '.bookinfo' ).prepend( '<div class="hr"></div>' );
}
}
}
$( '.rating' ).insertBefore( '.hr' );
$( 'div.description' ).hide();
$( '#remove-from-shelves' ).insertAfter( '.hr' );
/* if book description is not in html format, Remove extra line breaks
Remove blank lines/unnecessary spaces, split by line break to array
Push array into .description div. If there is still a wall of text,
find sentences and split wall into groups of three sentence paragraphs.
If the book format is in html format, Keep html, but strip away inline
styles and empty elements */
/*
// If text is sitting in div as text node
if ( description[0] === undefined ) {
textValue = $( '.book-meta' )
.contents()
.filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).text();
description = $.makeArray(
textValue.replace(/(?:(?:\r\n|\r|\n)\s*){2}/gm, "")
);
$( '.book-meta' ).contents().filter(function() {
return this.nodeType === 3;
}).remove();
}
if ( description[1] === undefined ) {
newdesc = description.toString()
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
$.each(newdesc, function(i, val) {
$( 'div.description' ).append( '<p>' + newdesc[i] + '</p>' );
});
$( '.description' ).fadeIn(100);
//If still a wall of text create 3 sentence paragraphs.
if( $( '.description p' ).length === 1 ) {
if ( description.context != undefined ) {
newdesc = description.text()
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split(/\n/);
}
else {
newdesc = description.toString();
}
doc = nlp ( newdesc.toString() );
sentences = doc.map((m)=> m.out( 'text' ));
$( '.description p' ).remove();
let size = 3; let sentenceChunks = [];
for (var i=0; i<sentences.length; i+=size) {
sentenceChunks.push(sentences.slice(i,i+size));
}
let output = '';
$.each(sentenceChunks, function(i, val) {
let preOutput = '';
$.each(val, function(i, val) {
preOutput += val;
});
output += '<p>' + preOutput + '</p>';
});
$( 'div.description' ).append( output );
}
} else {
$.each(description, function(i, val) {
$( description[i].outerHTML ).appendTo( '.description' );
$( 'div.description :empty' ).remove();
$( 'div.description ').attr( 'style', '' );
});
$( 'div.description' ).fadeIn( 100 );
}*/


description = $( '.comments' );
bookInfo = $( '.author' ).nextUntil( 'h3:contains("Description")');
$( 'h3:contains("Description")' ).detach();
Expand Down Expand Up @@ -240,7 +154,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 ) {
Expand Down Expand Up @@ -385,18 +298,6 @@ $(document).mouseup(function (e) {

// Split path name to array and remove blanks
url = window.location.pathname
.split( "/" ).filter( function(v){return v!==''} );
// Add classes to some body elements that don't have it
if ( jQuery.inArray( 'epub', url ) != -1 ) {
$( 'body' ).addClass( url[3] );
} else {
$( 'body' ).addClass( url[1] );
}
if ( $( 'body.shelf' ).length > 0 ) {
$( 'a[href*= "'+url[1]+"/"+url[2]+'"]' )
.parent()
.addClass( 'active' );
}

// Move create shelf
$( '#nav_createshelf' ).prependTo( '.your-shelves' );
Expand Down Expand Up @@ -434,13 +335,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() {
Expand All @@ -454,7 +349,7 @@ $(document).on('click','.dropdown-toggle',function() {

// Fade out content on page unload
// delegate all clicks on "a" tag (links)
$(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.stats a )", function () {
/*$(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 () {
// get the href attribute
var newUrl = $(this).attr("href");
Expand All @@ -466,7 +361,7 @@ $(document).on("click", "a:not(.btn-toolbar a, a[href*='shelf/remove'], .identif
return;
}
// now, fadeout the html (whole page)
now, fadeout the html (whole page)
$( '.blur-wrapper' ).fadeOut(250);
$(".row-fluid .col-sm-10").fadeOut(500,function () {
// when the animation is complete, set the new location
Expand All @@ -475,7 +370,7 @@ $(document).on("click", "a:not(.btn-toolbar a, a[href*='shelf/remove'], .identif
// prevent the default browser behavior.
return false;
});
});*/

// Collapse long text into read-more
$( 'div.comments' ).readmore( {
Expand Down Expand Up @@ -507,7 +402,7 @@ backurl = '../../book/' + url[2]
$( 'body.epub #title-controls' )
.append('<div class="epub-back"><input action="action" onclick="location.href=backurl; return false;" type="button" value="Back" /></div>')

$( 'body.stats .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
$(function(){ // document ready
Expand Down Expand Up @@ -593,7 +488,7 @@ $( '.plexBack > a' ).attr({

$( '#top_tasks' ).attr({
'data-toggle': 'tooltip',
'title': 'Tasks',
'title': $( '#top_tasks' ).text(), //'Tasks',
'data-placement': 'bottom',
'data-viewport': '#main-nav' })
.addClass('tasks-btn-tooltip');
Expand All @@ -614,18 +509,20 @@ $( '.profileDrop' ).attr({

$( '#btn-upload' ).attr({
'data-toggle': 'tooltip',
'title': 'Upload',
'title': $( '#btn-upload' ).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',
'title': $( '#add-to-shelf' ).text() , // 'Add to Shelf',
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('addtoshelf-btn-tooltip');

var teetet = $( '#add-to-shelf' ).text()

$( '#have_read_cb' ).attr({
'data-toggle': 'tooltip',
'title': 'Mark As Read',
Expand All @@ -642,7 +539,7 @@ $( '#have_read_cb:checked' ).attr({

$( 'button#delete' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Delete',
'title': $( 'button#delete' ).text(), //'Delete',
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('delete-book-btn-tooltip');
Expand All @@ -657,11 +554,13 @@ $( '#have_read_cb' ).click(function() {

$( '.btn-group[aria-label="Edit/Delete book"] a' ).attr({
'data-toggle': 'tooltip',
'title': 'Edit',
'title': $( '#edit_book' ).text(), // 'Edit',
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('edit-btn-tooltip');

var teetet = $( '#edit_book' ).text()

$( '#sendbtn' ).attr({
'data-toggle': 'tooltip',
'title': 'Send to Kindle',
Expand Down Expand Up @@ -742,10 +641,10 @@ if ( $( window ).width() <= 768 ) {
}

// LayerCake plug
if ( $(' .stat.blur.stats p').length > 0 ) {
$(' .stat.blur.stats p').append(" and <a href='https://github.com/leram84/layer.Cake/tree/master/caliBlur' target='_blank'>layer.Cake</a>");
str = $(' .stat.blur.stats p').html().replace("</a>.","</a>");
$(' .stat.blur.stats p').html(str);
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);
}
// 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>' );
Expand Down
2 changes: 1 addition & 1 deletion cps/templates/config_view_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h4 class="panel-title">
<label for="config_theme">{{_('Theme')}}</label>
<select name="config_theme" id="config_theme" class="form-control">
<option value="0" {% if content.config_theme == 0 %}selected{% endif %}>{{ _("Standard Theme") }}</option>
<option value="1" {% if content.config_theme == 1 %}selected{% endif %}>{{ _("caliBlur! Dark Theme (Beta)") }}</option>
<option value="1" {% if content.config_theme == 1 %}selected{% endif %}>{{ _("caliBlur! Dark Theme") }}</option>
</select>
</div>
<div class="form-group">
Expand Down
Binary file modified cps/translations/de/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit c527d1f

Please sign in to comment.