61 | bool get_checked( indentifier id, object& obj, Args... args ){
62 | obj.id = id;
63 | return booru.load( obj, args... );
64 | }
65 | };
66 |
67 | #endif
68 |
69 |
--------------------------------------------------------------------------------
/src/api/ShimmieApi.hpp:
--------------------------------------------------------------------------------
1 | /* This file is part of BooruSurfer2.
2 |
3 | BooruSurfer2 is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | BooruSurfer2 is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 |
13 | You should have received a copy of the GNU General Public License
14 | along with BooruSurfer2. If not, see .
15 | */
16 |
17 | #ifndef SHIMMIE_API_H
18 | #define SHIMMIE_API_H
19 |
20 | #include "Api.hpp"
21 | #include "../server/Server.hpp"
22 |
23 | class ShimmieApi : public Api{
24 | protected:
25 |
26 |
27 | public:
28 | ShimmieApi( std::string short_hand="shimmie" ) : Api( short_hand ) { }
29 |
30 | virtual std::string get_name() const{ return "Shimmie Testbed"; }
31 | virtual std::string get_url() const{ return "http://shimmie.shishnet.org/v2/"; }
32 |
33 |
34 | Post fetch_post( unsigned id, Image::Size level );
35 | Index get_index( std::string search, int page, int limit=-1 );
36 |
37 | virtual ThemeColor main_color() override{ return {0xFF,0xFF,0xFF}; }
38 | virtual ThemeColor secondary_color() override{ return {0xFF,0x76,0x1C}; }
39 |
40 | virtual std::string original_post_url( unsigned id ) override{
41 | return get_url() + "post/view/" + std::to_string( id );
42 | }
43 | virtual std::string original_index_url( std::string search ) override{
44 | return get_url() + "post/list/" + Server::remove_reserved( Server::encode_str( search ) );
45 | }
46 | };
47 |
48 | class Rule34Api : public ShimmieApi{
49 | public:
50 | Rule34Api() : ShimmieApi( "rule34" ) { }
51 |
52 | std::string get_name() const override{ return "Rule 34"; }
53 | std::string get_url() const override{ return "http://rule34.paheal.net/"; }
54 |
55 | ThemeColor main_color() override{ return {0x00,0x43,0x08}; }
56 | ThemeColor secondary_color() override{ return {0xAC,0xE4,0xA3}; }
57 | };
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/resources/infinity.js:
--------------------------------------------------------------------------------
1 | var items = window.location.pathname.split("/")
2 | items.shift()
3 |
4 | var strictParseInt = function( str ) {
5 | if( isNaN( String( str ) * 1 ) )
6 | return NaN
7 | return parseInt( str );
8 | }
9 |
10 | var site = items[1];
11 | var page_parsed = strictParseInt( items[2] );
12 | var page = isNaN(page_parsed) ? 1 : page_parsed;
13 | var limit = -1; //TODO: implement
14 | var search = isNaN(page_parsed) ? items[2] : items[3];
15 |
16 | var index_url = function() { return "/jsindex/" + site + "/" + (page+1) + "/" + search; }
17 |
18 | var load_next = function() {
19 | // alert( "loading next" );
20 | $.get( index_url(), function( response ){
21 | $( "#container .post_list" ).append( response );
22 | page += 1;
23 | });
24 | }
25 |
26 | window.onload = function() {
27 |
28 | $.get( index_url(), function( response ) {
29 | $( "nav.page_nav" ).remove();
30 | $( "#container .post_list" ).append( response );
31 | page += 1;
32 |
33 | $(window).scroll(function(){
34 | var current = $(window).scrollTop() + window.innerHeight;
35 | var total = $(document).height();
36 | if(Math.round(current) >= total) {
37 | load_next();
38 | }
39 | });
40 | } );
41 |
42 | $("#search").parent().append('');
43 | $("#search").attr("autocomplete", "off");
44 |
45 | $("#search").on("input", function(){
46 | var value = $("#search").val();
47 | $.getJSON( "/tags/" + site + "/" + value, function(data){
48 | var ul = $("