ukko: mod support for ukko; fixes #23
This commit is contained in:
parent
400df0975f
commit
776bbeb73e
@ -1526,6 +1526,23 @@
|
|||||||
// // ...
|
// // ...
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
// You can also enable themes (like ukko) in mod panel like this:
|
||||||
|
// require_once("templates/themes/ukko/theme.php");
|
||||||
|
//
|
||||||
|
// $config['mod']['custom_pages']['/\*/'] = function() {
|
||||||
|
// global $mod;
|
||||||
|
//
|
||||||
|
// $ukko = new ukko();
|
||||||
|
// $ukko->settings = array();
|
||||||
|
// $ukko->settings['uri'] = '*';
|
||||||
|
// $ukko->settings['title'] = 'derp';
|
||||||
|
// $ukko->settings['subtitle'] = 'derpity';
|
||||||
|
// $ukko->settings['thread_limit'] = 15;
|
||||||
|
// $ukko->settings['exclude'] = '';
|
||||||
|
//
|
||||||
|
// echo $ukko->build($mod);
|
||||||
|
// };
|
||||||
|
|
||||||
// Example: Add links to dashboard (will all be in a new "Other" category).
|
// Example: Add links to dashboard (will all be in a new "Other" category).
|
||||||
// $config['mod']['dashboard_links']['Something'] = '?/something';
|
// $config['mod']['dashboard_links']['Something'] = '?/something';
|
||||||
|
|
||||||
|
@ -1,40 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
$theme = Array();
|
$theme = array();
|
||||||
|
|
||||||
// Theme name
|
// Theme name
|
||||||
$theme['name'] = 'Ukko';
|
$theme['name'] = 'Overboard (Ukko)';
|
||||||
// Description (you can use Tinyboard markup here)
|
// Description (you can use Tinyboard markup here)
|
||||||
$theme['description'] = 'Board with threads and messages from all boards';
|
$theme['description'] = 'Board with threads and messages from all boards';
|
||||||
$theme['version'] = 'v0.1';
|
$theme['version'] = 'v0.2';
|
||||||
|
|
||||||
// Theme configuration
|
// Theme configuration
|
||||||
$theme['config'] = Array();
|
$theme['config'] = array();
|
||||||
|
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = array(
|
||||||
'title' => 'Board name',
|
'title' => 'Board name',
|
||||||
'name' => 'title',
|
'name' => 'title',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'default' => 'Ukko'
|
'default' => 'Ukko'
|
||||||
);
|
);
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = array(
|
||||||
'title' => 'Board URI',
|
'title' => 'Board URI',
|
||||||
'name' => 'uri',
|
'name' => 'uri',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
'default' => '*',
|
||||||
'comment' => '(ukko for example)'
|
'comment' => '(ukko for example)'
|
||||||
);
|
);
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = array(
|
||||||
'title' => 'Subtitle',
|
'title' => 'Subtitle',
|
||||||
'name' => 'subtitle',
|
'name' => 'subtitle',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
|
'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
|
||||||
);
|
);
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = array(
|
||||||
'title' => 'Excluded boards',
|
'title' => 'Excluded boards',
|
||||||
'name' => 'exclude',
|
'name' => 'exclude',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'comment' => '(space seperated)'
|
'comment' => '(space seperated)'
|
||||||
);
|
);
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = array(
|
||||||
'title' => 'Number of threads',
|
'title' => 'Number of threads',
|
||||||
'name' => 'thread_limit',
|
'name' => 'thread_limit',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
function ukko_build($action, $settings) {
|
function ukko_build($action, $settings) {
|
||||||
$ukko = new ukko();
|
$ukko = new ukko();
|
||||||
$ukko->settings = $settings;
|
$ukko->settings = $settings;
|
||||||
$ukko->build();
|
|
||||||
|
file_write($settings['uri'] . '/index.html', $ukko->build());
|
||||||
|
file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class ukko {
|
class ukko {
|
||||||
@ -85,17 +87,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$body .= '<script> var overflow = ' . json_encode($overflow) . '</script>';
|
$body .= '<script> var overflow = ' . json_encode($overflow) . '</script>';
|
||||||
$body .= '<script type="text/javascript" src="ukko.js"></script>';
|
$body .= '<script type="text/javascript" src="/'.$this->settings['uri'].'/ukko.js"></script>';
|
||||||
|
|
||||||
file_write($this->settings['uri'] . '/index.html', Element('index.html', array(
|
return Element('index.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'board' => $board,
|
'board' => $board,
|
||||||
'no_post_form' => true,
|
'no_post_form' => true,
|
||||||
'body' => $body,
|
'body' => $body,
|
||||||
'boardlist' => createBoardlist($mod)
|
'mod' => $mod,
|
||||||
)));
|
'boardlist' => createBoardlist($mod),
|
||||||
|
'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index'])
|
||||||
file_write($this->settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ $(document).ready(function() {
|
|||||||
$('.pages').show().html(_("No more threads to display"));
|
$('.pages').show().html(_("No more threads to display"));
|
||||||
}
|
}
|
||||||
while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
|
while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
|
||||||
var page = '../' + overflow[0].board + '/' + overflow[0].page;
|
var page = modRoot + overflow[0].board + '/' + overflow[0].page;
|
||||||
thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
|
thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
|
||||||
if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
|
if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
|
||||||
overflow.shift();
|
overflow.shift();
|
||||||
|
Loading…
Reference in New Issue
Block a user