";
for ($i=0; $i<$upload_count; $i++) {
$upload_list .= "
";
}
} else {
$upload_list .= "
Files
Image-Specific Tags
";
for ($i=0; $i<$upload_count; $i++) {
$upload_list .= "
";
}
}
return $upload_list;
}
protected function h_bookmarklets(): string
{
global $config;
$link = make_http(make_link("upload"));
$main_page = make_http(make_link());
$title = $config->get_string(SetupConfig::TITLE);
$max_size = $config->get_int(UploadConfig::SIZE);
$max_kb = to_shorthand_int($max_size);
$delimiter = $config->get_bool('nice_urls') ? '?' : '&';
$html = '';
$js='javascript:(
function() {
if(typeof window=="undefined" || !window.location || window.location.href=="about:blank") {
window.location = "'. $main_page .'";
}
else if(typeof document=="undefined" || !document.body) {
window.location = "'. $main_page .'?url="+encodeURIComponent(window.location.href);
}
else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")) {
alert("You are already at '. $title .'!");
}
else {
var tags = prompt("Please enter tags", "tagme");
if(tags != "" && tags != null) {
var link = "'. $link . $delimiter .'url="+location.href+"&tags="+tags;
var w = window.open(link, "_blank");
}
}
}
)();';
$html .= 'Upload to '.$title.'';
$html .= ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)';
// Bookmarklet checks if shimmie supports ext. If not, won't upload to site/shows alert saying not supported.
$supported_ext = join(" ", DataHandlerExtension::get_all_supported_exts());
$title = "Booru to " . $config->get_string(SetupConfig::TITLE);
// CA=0: Ask to use current or new tags | CA=1: Always use current tags | CA=2: Always use new tags
$html .= '
'. $title . ' (Click when looking at an image page. Works on sites running Shimmie / Danbooru / Gelbooru. (This also grabs the tags / rating / source!))';
return $html;
}
/**
* Only allows 1 file to be uploaded - for replacing another image file.
*/
public function display_replace_page(Page $page, int $image_id)
{
global $config, $page;
$tl_enabled = ($config->get_string(UploadConfig::TRANSLOAD_ENGINE, "none") != "none");
$accept = $this->get_accept();
$upload_list = "