2011-09-29 06:23:50 +00:00
{% extends "base.html" %}
2011-12-03 00:28:13 +00:00
{% block extra_css %}
2011-10-18 01:35:58 +00:00
< link rel = "stylesheet" href = "/static/css/book_list.css" >
2013-03-22 15:25:06 +00:00
< link rel = "stylesheet" href = "/static/css/book_panel2.css" >
2012-02-06 15:50:37 +00:00
< link rel = "stylesheet" href = "/static/css/search.css" >
2015-02-19 19:09:13 +00:00
< style type = "text/css" >
#scrolldown:last-child{ display:block}
#scrolldown{ display:none}
< / style >
2011-12-03 00:28:13 +00:00
{% endblock %}
{% block extra_head %}
2011-11-07 16:04:09 +00:00
< script type = "text/javascript" src = "/static/js/wishlist.js" > < / script >
2011-11-09 01:34:15 +00:00
< script type = "text/javascript" src = "/static/js/greenpanel.js" > < / script >
< script type = "text/javascript" src = "/static/js/toggle.js" > < / script >
2012-02-05 00:06:53 +00:00
< script type = "text/javascript" >
2015-03-06 21:59:20 +00:00
(function($){
$.fn.endlessScroll = function(options) {
var defaults = {
bottomPixels: 50,
fireOnce: true,
fireDelay: 150,
loader: "< br / > Loading...< br / > ",
data: "",
insertAfter: "div:last",
resetCounter: function() { return false; },
callback: function() { return true; },
ceaseFire: function() { return false; }
};
var options = $.extend({}, defaults, options);
var firing = true;
var fired = false;
var fireSequence = 0;
if (options.ceaseFire.apply(this) === true) {
firing = false;
}
if (firing === true) {
$(this).scroll(function() {
if (options.ceaseFire.apply(this) === true) {
firing = false;
return; // Scroll will still get called, but nothing will happen
}
if (this == document || this == window) {
var is_scrollable = $(document).height() - $(window).height() < = $(window).scrollTop() + options.bottomPixels;
} else {
// calculates the actual height of the scrolling container
var inner_wrap = $(".endless_scroll_inner_wrap", this);
if (inner_wrap.length == 0) {
inner_wrap = $(this).wrapInner("< div class = \"endless_scroll_inner_wrap\" / > ").find(".endless_scroll_inner_wrap");
}
var is_scrollable = inner_wrap.length > 0 & &
(inner_wrap.height() - $(this).height() < = $(this).scrollTop() + options.bottomPixels);
}
if (is_scrollable & & (options.fireOnce == false || (options.fireOnce == true & & fired != true))) {
if (options.resetCounter.apply(this) === true) fireSequence = 0;
fired = true;
fireSequence++;
$(options.insertAfter).after("< div id = \"endless_scroll_loader\" > " + options.loader + "< / div > ");
data = typeof options.data == 'function' ? options.data.apply(this, [fireSequence]) : options.data;
if (data !== false) {
$(options.insertAfter).after("< div id = \"endless_scroll_data\" > " + data + "< / div > ");
$("div#endless_scroll_data").hide().fadeIn();
$("div#endless_scroll_data").removeAttr("id");
options.callback.apply(this, [fireSequence]);
if (options.fireDelay !== false || options.fireDelay !== 0) {
$("body").after("< div id = \"endless_scroll_marker\" > < / div > ");
// slight delay for preventing event firing twice
$("div#endless_scroll_marker").fadeTo(options.fireDelay, 1, function() {
$(this).remove();
fired = false;
});
}
else {
fired = false;
}
}
$("div#endless_scroll_loader").remove();
}
});
}
};
})(jQuery);
2012-02-05 00:06:53 +00:00
var $j = jQuery.noConflict();
var page = 1;
$j(document).ready(function() {
$j(document).endlessScroll({
2012-02-05 16:56:41 +00:00
bottomPixels: 250,
2012-02-05 00:06:53 +00:00
fireOnce: false,
fireDelay: false,
insertAfter: "#results-bottom",
2012-03-10 03:16:07 +00:00
loader: '< img src = "/static/images/loading.gif" alt = "loading..." / > ',
2012-02-05 00:06:53 +00:00
callback: function(p) {
page += 1;
2016-06-20 17:08:23 +00:00
var url = "?q={{ q|urlencode }}& gbo={{ gbo }}& ty={{ ty }}& page=" + page;
2012-02-05 00:06:53 +00:00
$j.get(url, function(html) {
var view = $j(".listview").length > 0 ? "list" : "panel";
var results = $j(html).find(".book");
$j("#results").append(results);
2015-03-06 22:00:07 +00:00
if($j.cookie('view')=='panel') {togglePanel();}
2012-02-05 00:06:53 +00:00
});
}
});
});
< / script >
2011-09-29 06:23:50 +00:00
{% endblock %}
2011-12-13 16:55:34 +00:00
{% block title %}Google Books search results{% endblock %}
2011-09-29 06:23:50 +00:00
{% block content %}
< div id = "main-container" >
< div class = "js-main" >
2011-11-06 19:02:29 +00:00
< div id = "js-leftcol" >
2011-11-07 20:39:02 +00:00
{% include "explore.html" %}
< / div >
2011-09-29 06:23:50 +00:00
< div id = "js-maincol-fr" >
< div class = "js-maincol-inner" >
2012-02-06 18:53:25 +00:00
< div id = "content-block" >
2013-03-01 17:07:15 +00:00
{% if campaign_works %}
2011-09-29 06:23:50 +00:00
< div class = "content-block-heading" >
2016-06-20 17:08:23 +00:00
< h2 class = "content-heading" > These books are Free, or want to be!< / h2 >
2011-09-29 06:23:50 +00:00
< ul class = "book-list-view" >
< li > View As:< / li >
< li class = "view-list" >
2011-11-07 14:59:23 +00:00
< a href = "#" id = "toggle-list" >
2016-06-20 17:08:23 +00:00
< img src = "/static/images/booklist/view-list.png" title = "view list" height = "21" width = "24" alt = "use list view" / >
2011-09-29 06:23:50 +00:00
< / a >
< / li >
< li class = "view-list" >
2011-11-07 14:59:23 +00:00
< a href = "#" id = "toggle-panel" >
2016-06-20 17:08:23 +00:00
< img src = "/static/images/booklist/view-icon.png" title = "view icon" height = "22" width = "22" alt = "use panel view" / >
2011-09-29 06:23:50 +00:00
< / a >
< / li >
< / ul >
< / div >
2015-02-19 19:09:13 +00:00
< div id = "content-block-content-1" > < div id = "unglueit-results" style = "margin-bottom: 3em;" >
2013-03-01 17:07:15 +00:00
{% for work in campaign_works %}
2012-02-05 00:06:53 +00:00
< div class = "{% cycle 'row1' 'row2' %} book" >
2011-11-23 17:28:59 +00:00
{% with work.googlebooks_id as googlebooks_id %}
2012-01-03 00:07:12 +00:00
{% with work.last_campaign_status as status %}
{% with work.last_campaign.deadline as deadline %}
2013-03-01 17:07:15 +00:00
{% include "book_panel.html" %}
{% endwith %}{% endwith %}{% endwith %}
< / div >
{% endfor %}
< / div > < / div >
2015-06-07 22:55:49 +00:00
{% else %}
< div style = "margin: 20px; font-size:14px" > We couldn't find any matches in the Unglue.it database of free-licensed books.< / div >
2013-03-01 17:07:15 +00:00
{% endif %}
2015-06-07 22:55:49 +00:00
{% if not results and not campaign_works %}
< div style = "margin: 20px; font-size:14px" > Google Books couldn't find any matches either.< / div >
{% else %}
2013-03-01 17:07:15 +00:00
< div class = "content-block-heading" >
2015-06-07 22:55:49 +00:00
2016-06-20 17:08:23 +00:00
< h2 class = "content-heading" > < a href = "https://www.google.com/search?q={{q|urlencode }}&tbm=bks" > Google Books< / a > search results< / h2 >
2015-02-19 17:03:42 +00:00
2013-03-01 17:07:15 +00:00
{% if not campaign_works %}
< ul class = "book-list-view" >
< li > View As:< / li >
< li class = "view-list" >
< a href = "#" id = "toggle-list" >
< img src = "/static/images/booklist/view-list.png" align = "view list" title = "view list" height = "21" width = "24" alt = "use list view" / >
< / a >
< / li >
< li class = "view-list" >
< a href = "#" id = "toggle-panel" >
< img src = "/static/images/booklist/view-icon.png" align = "view icon" title = "view icon" height = "22" width = "22" alt = "use panel view" / >
< / a >
< / li >
< / ul >
{% endif %}
< / div >
2012-02-06 19:48:15 +00:00
< div id = "content-block-content" > < div id = "results" >
2015-03-06 22:28:21 +00:00
< div id = "scrolldown" style = " text-indent: 12em; margin-bottom: 1em;" > (scroll down or < a href = "javascript:$j(document).scroll()" > click< / a > to see Google Books results)< / div >
2011-11-23 17:28:59 +00:00
{% for work in results %}
2013-03-28 01:31:30 +00:00
{% if not work.last_campaign %}
2012-02-05 00:06:53 +00:00
< div class = "{% cycle 'row1' 'row2' %} book" >
2011-11-23 17:28:59 +00:00
{% with work.googlebooks_id as googlebooks_id %}
2012-05-12 01:28:25 +00:00
{% with 'yes' as on_search_page %}
2011-11-23 17:28:59 +00:00
{% include "book_panel.html" %}
2013-03-11 20:23:52 +00:00
{% endwith %}{% endwith %}
2011-11-07 20:11:52 +00:00
< / div >
2013-03-01 17:07:15 +00:00
{% endif %}
2011-09-29 06:23:50 +00:00
{% endfor %}
2012-02-06 19:48:15 +00:00
< / div > < / div >
2012-02-05 00:06:53 +00:00
< div id = "results-bottom" > < / div >
2015-06-07 22:55:49 +00:00
{% endif %}
2011-09-29 06:23:50 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
{% endblock %}